RLCMAC: Implement type+template for EGPRS Dl Pkt ACK/NACK

Change-Id: I0d6555f8644e39da6124be2e861d57fda3b3d8a1
diff --git a/library/RLCMAC_CSN1_Types.ttcn b/library/RLCMAC_CSN1_Types.ttcn
index 1ffb85b..14570bf 100644
--- a/library/RLCMAC_CSN1_Types.ttcn
+++ b/library/RLCMAC_CSN1_Types.ttcn
@@ -617,7 +617,7 @@
 		with { extension "prototype(convert) decode(RAW)" };
 
 
-	/* 11.2.6 Packet Downlikn Ack/Nack */
+	/* 11.2.6 Packet Downlink Ack/Nack */
 	type record ILevel {
 		BIT1	presence,
 		uint4_t	i_level optional
@@ -635,7 +635,60 @@
 		BIT1			chreq_desc_presence,
 		ChannelReqDescription	chreq_desc optional,
 		ChannelQualityReport	ch_qual_rep
+	} with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)" };
+
+	/* 11.2.6a Egprs Packet Downlink Ack/Nack */
+	type record EgprsBEPLinkQualityMeasurements {
+		BIT1	gmsk_presence,
+		BIT5	gmsk_mean_bep optional,
+		BIT3	gmsk_cv_bep optional,
+		BIT1	psk8_presence,
+		BIT5	psk8_mean_bep optional,
+		BIT3	psk8_cv_bep optional
+	} with { variant (gmsk_mean_bep) "PRESENCE(gmsk_presence = '1'B)"
+ 		 variant (gmsk_cv_bep) "PRESENCE(gmsk_presence = '1'B)"
+		 variant (psk8_mean_bep) "PRESENCE(psk8_presence = '1'B)"
+		 variant (psk8_cv_bep) "PRESENCE(psk8_presence = '1'B)"
+	};
+	/* 12.5.4 EGPRS Timeslot Link Quality Measurements IE */
+	type record BEPMeas {
+		BIT1	presence,
+		BIT1	is_8psk optional,
+		uint4_t	bep_meas optional
+	} with { variant (is_8psk) "PRESENCE(presence = '1'B)"
+		 variant (bep_meas) "PRESENCE(presence = '1'B)"
+	};
+	type record length(8) of BEPMeas BEPMeasLi;
+	type record EgprsTimeslotLinkQualityMeasurements {
+		BIT1	bep_measurements_presence,
+		BEPMeasLi bep_meas optional,
+		BIT1	i_measurements_presence,
+		ILevels i_meas optional
+	} with { variant (bep_meas) "PRESENCE(bep_measurements_presence = '1'B)"
+ 		 variant (i_meas) "PRESENCE(i_measurements_presence = '1'B)"
+	};
+	/* Table 12.5.1.1 : EGPRS Channel Quality Report Information elements */
+	type record EgprsChannelQualityReport {
+		EgprsBEPLinkQualityMeasurements bep_link_qual_meas,
+		uint6_t			c_value,
+		EgprsTimeslotLinkQualityMeasurements ts_link_qual_meas
 	} with { variant "" };
+	type record EgprsPacketDlAckNack {
+		uint5_t				dl_tfi,
+		BIT1				ms_oom,
+		BIT1				egprs_ch_qual_rep_presence,
+		EgprsChannelQualityReport 	egprs_ch_qual_rep optional,
+		BIT1				chreq_desc_presence,
+		ChannelReqDescription		chreq_desc optional,
+		BIT1				pfi_presence,
+		BIT7				pfi optional,
+		BIT1				epdan_presence('0'B),
+		/* TODO: Implement EPD A/N */
+		EgprsAckNackDescriptionIE ack_nack_desc_ie
+	} with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)"
+ 		 variant (egprs_ch_qual_rep) "PRESENCE(egprs_ch_qual_rep_presence = '1'B)"
+		 variant (pfi) "PRESENCE(pfi_presence = '1'B)"
+	};
 
 	/* 11.2.2 Packet Control Acknowledgement */
 	type enumerated CtrlAck {
@@ -706,6 +759,7 @@
 	type union RlcmacUlCtrlUnion {
 		PacketCtrlAck		ctrl_ack,
 		PacketDlAckNack		dl_ack_nack,
+		EgprsPacketDlAckNack	dl_ack_nack_egprs,
 		PacketUlDummy		ul_dummy,
 		PacketResourceReq	resource_req,
 		octetstring		other
@@ -717,6 +771,7 @@
 	} with {
 		variant (u) "CROSSTAG(ctrl_ack,		msg_type = PACKET_CONTROL_ACK;
 				      dl_ack_nack,	msg_type = PACKET_DL_ACK_NACK;
+				      dl_ack_nack_egprs, msg_type = PACKET_EGPRS_DL_ACK_NACK;
 				      ul_dummy,		msg_type = PACKET_UL_DUMMY_CTRL;
 				      resource_req,	msg_type = PACKET_RESOURCE_REQUEST;
 				      other,		OTHERWISE
@@ -737,6 +792,27 @@
 		ReceivedBlockBitmap	receive_block_bitmap
 	} with { variant "" };
 
+	/* 12.3.1 Egprs Ack/Nack Description */
+	type bitstring UncompressedReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
+	type record EgprsAckNackDescription {
+		BIT1			final_ack,
+		BIT1			begin_window,
+		BIT1			end_window,
+		uint11_t		starting_seq_nr,
+		BIT1			compressed,
+		/* TODO: CompressedReceivedBlockBitmap	urbb optional, */
+		UncompressedReceivedBlockBitmap	urbb optional
+	} with {  variant (urbb) "PRESENCE(compressed = '0'B)" };
+	type record EgprsAckNackDescriptionIE {
+		BIT1			len_present,
+		uint8_t			len optional,
+		EgprsAckNackDescription	acknack_desc
+	} with { variant (len) "PRESENCE(len_present = '1'B)"
+		 variant (len) "LENGTHTO(acknack_desc)"
+		 variant (len) "UNIT(bits)"
+	};
+
+
 	/* 12.7 Channel Request Description */
 	type enumerated RlcMode {
 		RLC_MODE_ACKNOWLEDGED	(0),