library: L1CTL: rework GPRS related message definitions

The old GPRS related messages are no longer valid.  Use the new message
definitions supported by both trxcon and virtphy since recently.

Comment out lines referencing the old definitions in LAPDm_RAW_PT.ttcn.
This module contains an implementation of the RLC/MAC abstraction
layer, which is currently not used anywhere.

Change-Id: Ib8f4459480bbe12584a6fa71882f745f03c5055d
Related: osmocom-bb.git I9567d64f9d00262e36147e8d7e541e5e246bda5f
Related: OS#5500
diff --git a/library/L1CTL_Types.ttcn b/library/L1CTL_Types.ttcn
index 9162eea..192091e 100644
--- a/library/L1CTL_Types.ttcn
+++ b/library/L1CTL_Types.ttcn
@@ -16,8 +16,6 @@
 	import from GSM_RR_Types all;
 	import from Osmocom_Types all;
 
-	type uint32_t uint32_le with { variant "BYTEORDER(first)" };
-
 	type enumerated L1ctlMsgType {
 		L1CTL_NONE,
 		L1CTL_FBSB_REQ,
@@ -51,12 +49,11 @@
 		L1CTL_TRAFFIC_CONF,
 		L1CTL_TRAFFIC_IND,
 		L1CTL_BURST_IND,
-		L1CTL_TBF_CFG_REQ,
-		L1CTL_TBF_CFG_CONF,
-		L1CTL_DATA_TBF_REQ,
-		L1CTL_DATA_TBF_CONF,
-		L1CTL_EXT_RACH_REQ,
-		L1CTL_DATA_ABS_REQ /*!< FIXME: no such message in OsmocomBB */
+		L1CTL_GPRS_UL_TBF_CFG_REQ,
+		L1CTL_GPRS_DL_TBF_CFG_REQ,
+		L1CTL_GPRS_UL_BLOCK_REQ,
+		L1CTL_GPRS_DL_BLOCK_IND,
+		L1CTL_EXT_RACH_REQ
 	} with { variant "FIELDLENGTH(8)" };
 
 	type enumerated L1ctlCcchMode {
@@ -72,22 +69,6 @@
 		NEIGH_MODE_SB
 	} with { variant "FIELDLENGTH(8)" };
 
-	type enumerated L1ctlGprsCs {
-		L1CTL_CS1 	(1),
-		L1CTL_CS2,
-		L1CTL_CS3,
-		L1CTL_CS4,
-		L1CTL_MCS1,
-		L1CTL_MCS2,
-		L1CTL_MCS3,
-		L1CTL_MCS4,
-		L1CTL_MCS5,
-		L1CTL_MCS6,
-		L1CTL_MCS7,
-		L1CTL_MCS8,
-		L1CTL_MCS9
-	} with { variant "FIELDLENGTH(8)" };
-
 	type enumerated L1ctlResetType {
 		L1CTL_RES_T_BOOT (0),
 		L1CTL_RES_T_FULL,
@@ -200,22 +181,6 @@
 		OCT2		padding
 	} with { variant "" };
 
-	type record L1ctlUlTbfInfo {
-		uint8_t		tbf_nr,
-		L1ctlGprsCs	cs,
-		OCT2		padding
-	} with { variant "" };
-
-	type record L1ctlUlAbsInfo {
-		uint8_t		tbf_nr,
-		L1ctlGprsCs	cs,
-		uint8_t		ts_nr,
-		OCT1		padding,
-		uint32_le	fn,
-		GsmBandArfcn	arfcn,
-		OCT2		padding2
-	} with { variant "" };
-
 	type record L1ctlFbsbFlags {
 		BIT5		padding,
 		boolean		sb,
@@ -342,14 +307,47 @@
 		variant (data) "BYTEORDER(first)"
 	}
 
-	type record length(8) of uint8_t TfiUsfArr;
 
-	type record L1ctlTbfCfgReq {
-		uint8_t		tbf_nr,
-		boolean		is_uplink,
-		OCT2		padding,
-		TfiUsfArr	tfi_usf
-	} with { variant (is_uplink) "FIELDLENGTH(8)" };
+	/* payload of L1CTL_GPRS_UL_TBF_CFG_REQ */
+	type record L1ctlGprsUlTbfCfgReq {
+		uint8_t			tbf_ref,
+		BIT8			slotmask,
+		OCT2			pad ('0000'O)
+	} with { variant (slotmask) "BITORDER(msb)" };
+
+	/* payload of L1CTL_GPRS_DL_TBF_CFG_REQ */
+	type record L1ctlGprsDlTbfCfgReq {
+		uint8_t			tbf_ref,
+		BIT8			slotmask,
+		uint8_t			dl_tfi,
+		OCT1			pad ('00'O)
+	} with { variant (slotmask) "BITORDER(msb)" };
+
+	/* part of L1CTL_GPRS_{UL,DL}_BLOCK_{REQ,IND} */
+	type record L1ctlGprsBlockHdr {
+		uint32_t		fn,
+		uint8_t			tn,
+		OCT3			pad ('000000'O)
+	} with { variant "" };
+
+	/* payload of L1CTL_GPRS_UL_BLOCK_REQ */
+	type record L1ctlGprsUlBlockReq {
+		L1ctlGprsBlockHdr	hdr,
+		octetstring		data
+	} with { variant (data) "BYTEORDER(first)" };
+
+	/* payload of L1CTL_GPRS_DL_BLOCK_IND */
+	type record L1ctlGprsDlBlockInd {
+		L1ctlGprsBlockHdr	hdr,
+		record {
+			uint16_t	ber10k,		/* Bit Error Rate */
+			int16_t		ci_cb,		/* C/I in centiBels */
+			uint8_t		rx_level	/* RxLev 0..63 */
+		} meas,
+		uint8_t			usf,
+		octetstring		data
+	} with { variant (data) "BYTEORDER(first)" };
+
 
 	type union L1ctlMsgPayload {
 		L1ctlFbsbReq		fbsb_req,
@@ -376,8 +374,10 @@
 		L1ctlTrafficReq		traffic_req,
 		L1ctlTrafficReq		traffic_ind,
 		/* TODO: L1CTL_BURST_IND */
-		L1ctlTbfCfgReq		tbf_cfg_req,
-		L1ctlTbfCfgReq		tbf_cfg_conf,
+		L1ctlGprsUlTbfCfgReq	ul_tbf_cfg_req,
+		L1ctlGprsDlTbfCfgReq	dl_tbf_cfg_req,
+		L1ctlGprsUlBlockReq	ul_block_req,
+		L1ctlGprsDlBlockInd	dl_block_ind,
 		L1ctlExtRachReq		ext_rach_req,
 		octetstring		other
 	} with {
@@ -388,8 +388,6 @@
 		L1ctlHeader	header,
 		L1ctlUlInfo	ul_info optional,
 		L1ctlDlInfo	dl_info optional,
-		L1ctlUlTbfInfo	ul_info_tbf optional,
-		L1ctlUlAbsInfo	ul_info_abs optional,
 		L1ctlMsgPayload	payload optional
 	} with { variant (ul_info) "PRESENCE(header.msg_type = L1CTL_RACH_REQ,
 					     header.msg_type = L1CTL_EXT_RACH_REQ,
@@ -406,8 +404,6 @@
 					     header.msg_type = L1CTL_DATA_CONF,
 					     header.msg_type = L1CTL_TRAFFIC_IND,
 					     header.msg_type = L1CTL_TRAFFIC_CONF)"
-		 variant (ul_info_tbf) "PRESENCE(header.msg_type = L1CTL_DATA_TBF_REQ)"
-		 variant (ul_info_abs) "PRESENCE(header.msg_type = L1CTL_DATA_ABS_REQ)"
 		 variant (payload) "CROSSTAG(fbsb_req, header.msg_type = L1CTL_FBSB_REQ;
 					     fbsb_conf, header.msg_type = L1CTL_FBSB_CONF;
 					     data_ind, header.msg_type = L1CTL_DATA_IND;
@@ -432,8 +428,10 @@
 					     traffic_req, header.msg_type = L1CTL_TRAFFIC_REQ;
 					     traffic_ind, header.msg_type = L1CTL_TRAFFIC_IND;
 					     /* TODO: burst_ind, header.msg_type = L1CTL_BURST_IND */
-					     tbf_cfg_req, header.msg_type = L1CTL_TBF_CFG_REQ;
-					     tbf_cfg_conf, header.msg_type = L1CTL_TBF_CFG_CONF;
+					     ul_tbf_cfg_req, header.msg_type = L1CTL_GPRS_UL_TBF_CFG_REQ;
+					     dl_tbf_cfg_req, header.msg_type = L1CTL_GPRS_DL_TBF_CFG_REQ;
+					     ul_block_req, header.msg_type = L1CTL_GPRS_UL_BLOCK_REQ;
+					     dl_block_ind, header.msg_type = L1CTL_GPRS_DL_BLOCK_IND;
 					     ext_rach_req, header.msg_type = L1CTL_EXT_RACH_REQ;
 					     other, OTHERWISE;
 				)" };
@@ -455,15 +453,12 @@
 
 
 
-
 	/* for generating RESET_REQ */
 	template (value) L1ctlMessage
 	t_L1ctlResetReq(template (value) L1ctlResetType rst_type) := {
 		header := ts_L1ctlHeader(L1CTL_RESET_REQ),
 		ul_info := omit,
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			reset_req := {
 				reset_type := rst_type,
@@ -482,8 +477,6 @@
 		header := ts_L1ctlHeader(L1CTL_FBSB_REQ),
 		ul_info := omit,
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			fbsb_req := {
 				arfcn := arfcn,
@@ -505,8 +498,6 @@
 		header := tr_L1ctlHeader(L1CTL_FBSB_CONF),
 		ul_info := omit,
 		dl_info := ?,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			fbsb_conf := {
 				initial_freq_err := ?,
@@ -521,8 +512,6 @@
 		header := ts_L1ctlHeader(L1CTL_CCCH_MODE_REQ),
 		ul_info := omit,
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			ccch_mode_req := {
 				ccch_mode := ccch_mode,
@@ -540,8 +529,6 @@
 		header := ts_L1ctlHeader(L1CTL_TCH_MODE_REQ),
 		ul_info := omit,
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			tch_mode_req := {
 				tch_mode := tch_mode,
@@ -561,8 +548,6 @@
 		header := tr_L1ctlHeader(msg_type),
 		ul_info := *,
 		dl_info := *,
-		ul_info_tbf := *,
-		ul_info_abs := *,
 		payload := *
 	}
 
@@ -581,8 +566,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			rach_req := {
 				ra := ra,
@@ -605,8 +588,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			ext_rach_req := {
 				ra11 := ra11,
@@ -627,8 +608,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			par_req := {
 				ta := ta,
@@ -649,8 +628,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			dm_est_req := {
 				tsc := tsc,
@@ -713,8 +690,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := omit
 	}
 
@@ -729,8 +704,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			data_req := {
 				l1header := omit,
@@ -751,8 +724,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			data_req := {
 				l1header := l1h,
@@ -772,8 +743,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			traffic_req := {
 				data := frame
@@ -781,92 +750,11 @@
 		}
 	};
 
-	template (value) L1ctlMessage
-	ts_L1CTL_TBF_CFG_REQ(template (value) boolean is_uplink,
-			     template (value) TfiUsfArr tfi_usf) := {
-		header := ts_L1ctlHeader(L1CTL_TBF_CFG_REQ),
-		ul_info := omit,
-		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
-		payload := {
-			tbf_cfg_req := {
-				tbf_nr := 0,
-				is_uplink := is_uplink,
-				padding := '0000'O,
-				tfi_usf := tfi_usf
-			}
-		}
-	};
-
-	template L1ctlMessage
-	tr_L1CTL_TBF_CFG_CONF(template (present) boolean is_uplink) := {
-		header := tr_L1ctlHeader(L1CTL_TBF_CFG_CONF),
-		ul_info := omit,
-		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
-		payload := {
-			tbf_cfg_conf := {
-				tbf_nr := 0,
-				is_uplink := is_uplink,
-				padding := ?,
-				tfi_usf := ?
-			}
-		}
-	};
-
-	template (value) L1ctlMessage
-	ts_L1CTL_DATA_TBF_REQ(octetstring l2_data,
-			      template (value) L1ctlGprsCs cs := L1CTL_CS1,
-			      template (value) uint8_t tbf_nr := 0) := {
-		header := ts_L1ctlHeader(L1CTL_DATA_TBF_REQ),
-		ul_info := omit,
-		dl_info := omit,
-		ul_info_tbf := {
-			tbf_nr := tbf_nr,
-			cs := cs,
-			padding := '0000'O
-		},
-		ul_info_abs := omit,
-		payload := {
-			other := l2_data
-		}
-	}
-
-	template (value) L1ctlMessage
-	ts_L1CTL_DATA_ABS_REQ(octetstring l2_data,
-			      template (value) GsmBandArfcn arfcn,
-			      template (value) uint8_t ts,
-			      template (value) GsmFrameNumber fn,
-			      template (value) L1ctlGprsCs cs := L1CTL_CS1,
-			      template (value) uint8_t tbf_nr := 0) := {
-		header := ts_L1ctlHeader(L1CTL_DATA_ABS_REQ),
-		ul_info := omit,
-		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := {
-			tbf_nr := tbf_nr,
-			cs := cs,
-			ts_nr := ts,
-			padding := '00'O,
-			fn := fn,
-			arfcn := arfcn,
-			padding2 := '0000'O
-		},
-		payload := {
-			other := l2_data
-		}
-	}
-
-
 	/* for matching against incoming RACH_CONF */
 	template L1ctlMessage tr_L1CTL_RACH_CONF := {
 		header := tr_L1ctlHeader(L1CTL_RACH_CONF),
 		ul_info := omit,
 		dl_info := ?,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := *
 	};
 
@@ -892,8 +780,6 @@
 			num_biterr := num_biterr,
 			fire_crc := fire_crc
 		},
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			data_ind := {
 				payload := l2_data
@@ -918,8 +804,6 @@
 			num_biterr := num_biterr,
 			fire_crc := fire_crc
 		},
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			data_ind := {
 				payload := l2_data
@@ -946,8 +830,6 @@
 			num_biterr := num_biterr,
 			fire_crc := fire_crc
 		},
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			traffic_ind := {
 				data := frame
@@ -966,8 +848,6 @@
 			padding := '0000'O
 		},
 		dl_info := omit,
-		ul_info_tbf := omit,
-		ul_info_abs := omit,
 		payload := {
 			crypto_req := {
 				algo := algo,
@@ -977,6 +857,163 @@
 		}
 	};
 
+
+	template (value) L1ctlMessage
+	ts_L1CTL_GPRS_UL_TBF_CFG_REQ(template (value) uint8_t tbf_ref,
+				     template (value) BIT8 slotmask := '00000000'B) := {
+		header := ts_L1ctlHeader(L1CTL_GPRS_UL_TBF_CFG_REQ),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			ul_tbf_cfg_req := {
+				tbf_ref := tbf_ref,
+				slotmask := slotmask,
+				pad := '0000'O
+			}
+		}
+	};
+	template L1ctlMessage
+	tr_L1CTL_GPRS_UL_TBF_CFG_REQ(template (present) uint8_t tbf_ref := ?,
+				     template (present) BIT8 slotmask := ?) := {
+		header := tr_L1ctlHeader(L1CTL_GPRS_UL_TBF_CFG_REQ),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			ul_tbf_cfg_req := {
+				tbf_ref := tbf_ref,
+				slotmask := slotmask,
+				pad := ?
+			}
+		}
+	};
+
+	template (value) L1ctlMessage
+	ts_L1CTL_GPRS_DL_TBF_CFG_REQ(template (value) uint8_t tbf_ref,
+				     template (value) BIT8 slotmask := '00000000'B,
+				     template (value) uint5_t dl_tfi := 0) := {
+		header := ts_L1ctlHeader(L1CTL_GPRS_DL_TBF_CFG_REQ),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			dl_tbf_cfg_req := {
+				tbf_ref := tbf_ref,
+				slotmask := slotmask,
+				dl_tfi := dl_tfi,
+				pad := '00'O
+			}
+		}
+	};
+	template L1ctlMessage
+	tr_L1CTL_GPRS_DL_TBF_CFG_REQ(template (present) uint8_t tbf_ref := ?,
+				     template (present) BIT8 slotmask := ?,
+				     template (present) uint5_t dl_tfi := ?) := {
+		header := tr_L1ctlHeader(L1CTL_GPRS_DL_TBF_CFG_REQ),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			dl_tbf_cfg_req := {
+				tbf_ref := tbf_ref,
+				slotmask := slotmask,
+				dl_tfi := dl_tfi,
+				pad := ?
+			}
+		}
+	};
+
+	template (value) L1ctlMessage
+	ts_L1CTL_GPRS_UL_BLOCK_REQ(template (value) GsmFrameNumber fn,
+				   template (value) uint3_t tn,
+				   template (value) octetstring data) := {
+		header := ts_L1ctlHeader(L1CTL_GPRS_UL_BLOCK_REQ),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			ul_block_req := {
+				hdr := {
+					fn := fn,
+					tn := tn,
+					pad := '000000'O
+				},
+				data := data
+			}
+		}
+	};
+	template L1ctlMessage
+	tr_L1CTL_GPRS_UL_BLOCK_REQ(template (present) GsmFrameNumber fn := ?,
+				   template (present) uint3_t tn := ?,
+				   template (present) octetstring data := ?) := {
+		header := tr_L1ctlHeader(L1CTL_GPRS_UL_BLOCK_REQ),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			ul_block_req := {
+				hdr := {
+					fn := fn,
+					tn := tn,
+					pad := ?
+				},
+				data := data
+			}
+		}
+	};
+
+	template (value) L1ctlMessage
+	ts_L1CTL_GPRS_DL_BLOCK_IND(template (value) GsmFrameNumber fn,
+				   template (value) uint3_t tn,
+				   template (value) uint3_t usf,
+				   template (value) octetstring data,
+				   template (value) uint16_t ber10k := 0,
+				   template (value) int16_t ci_cb := 180 /* 18 dB */,
+				   template (value) GsmRxLev rx_level := 63) := {
+		header := ts_L1ctlHeader(L1CTL_GPRS_DL_BLOCK_IND),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			dl_block_ind := {
+				hdr := {
+					fn := fn,
+					tn := tn,
+					pad := '000000'O
+				},
+				meas := {
+					ber10k := ber10k,
+					ci_cb := ci_cb,
+					rx_level := rx_level
+				},
+				usf := usf,
+				data := data
+			}
+		}
+	};
+	template L1ctlMessage
+	tr_L1CTL_GPRS_DL_BLOCK_IND(template (present) GsmFrameNumber fn := ?,
+				   template (present) uint3_t tn := ?,
+				   template (present) uint3_t usf := ?,
+				   template (present) octetstring data := ?,
+				   template (present) uint16_t ber10k := ?,
+				   template (present) int16_t ci_cb := ?,
+				   template (present) GsmRxLev rx_level := ?) := {
+		header := tr_L1ctlHeader(L1CTL_GPRS_DL_BLOCK_IND),
+		ul_info := omit,
+		dl_info := omit,
+		payload := {
+			dl_block_ind := {
+				hdr := {
+					fn := fn,
+					tn := tn,
+					pad := ?
+				},
+				meas := {
+					ber10k := ber10k,
+					ci_cb := ci_cb,
+					rx_level := rx_level
+				},
+				usf := usf,
+				data := data
+			}
+		}
+	};
+
 	const octetstring c_DummyUI := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O;
 
 /* We use "BYTEORDER(last)" so we get little-endian integers.  Unfortuantely, this also