library/RLCMAC_CSN1_Types.ttcn: implement Packet Power Control/Timing Advance

This message is sent on PACCH by the network to the mobile station
in order to update the mobile station timing advance or power
control parameters. See 3GPP TS 44.060, section 11.2.13.

Change-Id: Ie07000b08918501a99962ad760932a27eacae678
diff --git a/library/RLCMAC_CSN1_Types.ttcn b/library/RLCMAC_CSN1_Types.ttcn
index 918cbff..29ec07b 100644
--- a/library/RLCMAC_CSN1_Types.ttcn
+++ b/library/RLCMAC_CSN1_Types.ttcn
@@ -26,6 +26,7 @@
 		PACKET_PAGING_REQUEST		('100010'B),
 		PACKET_PDCH_RELEASE		('100011'B),
 		PACKET_POLLING_REQUEST		('000100'B),
+		PACKET_PWR_CONTROL_TA		('000101'B),
 		/* TODO */
 		PACKET_TBF_RELEASE		('001000'B),
 		PACKET_UL_ACK_NACK		('001001'B),
@@ -282,6 +283,62 @@
 		variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
 	};
 
+	/* 11.9 Global Power Control Parameters */
+	type record GlobalPwrCtrlParams {
+		uint4_t			alpha,
+		uint5_t			t_avg_v,
+		uint5_t			t_avg_t,
+		uint4_t			pb,
+		BIT1			pc_meas_chan,
+		BIT1			spare ('0'B),
+		uint4_t			n_avg_i
+	};
+
+	/* 12.12a Global Packet Timing Advance */
+	type record TimingAdvanceIdxTN {
+		uint4_t			ta_idx,
+		uint3_t			ts_num
+	};
+	type record GlobalPacketTA {
+		BIT1			ta_val_presence,
+		uint4_t			ta_val optional,
+		BIT1			ul_presence,
+		TimingAdvanceIdxTN	ul optional,
+		BIT1			dl_presence,
+		TimingAdvanceIdxTN	dl optional
+	} with {
+		variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
+		variant (ul) "PRESENCE(ul_presence = '1'B)"
+		variant (dl) "PRESENCE(dl_presence = '1'B)"
+	};
+
+	/* 11.2.13 Packet Power Control/Timing Advance */
+	type record PacketPwrControlTAMsg {
+		BIT1			g_pwr_ctrl_presence,
+		GlobalPwrCtrlParams	g_pwr_ctrl optional,
+		BIT1			split,
+		BIT1			split_desc optional,
+		GlobalPacketTA		g_pkt_ta optional,
+		PowerControlParameters	pwr_ctrl optional
+		/* TODO: additions for R99, REL-7, REL-12 */
+	} with {
+		variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
+		variant (split_desc) "PRESENCE(split = '1'B)"
+		/* FIXME: Fancy coding: either both IEs together, or one of them */
+		variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
+		variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
+	};
+	type record PacketPwrControlTA {
+		PageMode		page_mode,
+		NullGlobalTfi		global_tfi,
+		/* See 11.1.3.3 'Message escape' error label
+		 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
+		BIT1			msg_escape,
+		PacketPwrControlTAMsg	msg optional
+	} with {
+		variant (msg) "PRESENCE(msg_escape = '0'B)"
+	};
+
 	/* 11.2.0.1 */
 	type union RlcmacDlCtrlUnion {
 		PacketDlAssignment	dl_assignment,
@@ -289,6 +346,7 @@
 		PacketPagingReq		paging,
 		PacketUlAckNack		ul_ack_nack,
 		PacketDlDummy		dl_dummy,
+		PacketPwrControlTA	pwr_ta,
 		octetstring		other
 	} with { variant "" };
 
@@ -301,6 +359,7 @@
 				      paging,		msg_type = PACKET_PAGING_REQUEST;
 				      ul_ack_nack,	msg_type = PACKET_UL_ACK_NACK;
 				      dl_dummy,		msg_type = PACKET_DL_DUMMY_CTRL;
+				      pwr_ta,		msg_type = PACKET_PWR_CONTROL_TA;
 				      other,		OTHERWISE
 			)"
 	};