Change in osmo-ttcn3-hacks[master]: library: move Osmocom_Types.Arfcn to GSM_Types.GsmBandArfcn

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Nov 25 16:05:16 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21148 )

Change subject: library: move Osmocom_Types.Arfcn to GSM_Types.GsmBandArfcn
......................................................................

library: move Osmocom_Types.Arfcn to GSM_Types.GsmBandArfcn

In some cases GsmArfcn itself is not enough.  It case of L1CTL
and GSMTAP, it needs to be equipped with a band discriminator:

  - DCS / PCS (as the numbers may overlap),
  - Downlink / Uplink (not yet there).

Let's rename this record and move it to GSM_Types.  Also, add
send / receive tamplates, so we can add new fields later.

Change-Id: I7a63f03bbd15a06caafb786122dc12991d115771
---
M bts/BTS_Tests.ttcn
M bts/BTS_Tests_LAPDm.ttcn
M library/GSMTAP_Types.ttcn
M library/GSM_Types.ttcn
M library/L1CTL_PortType.ttcn
M library/L1CTL_Types.ttcn
M library/LAPDm_RAW_PT.ttcn
M library/Osmocom_Types.ttcn
8 files changed, 50 insertions(+), 22 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 462e2d5..4be8d2b 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -585,7 +585,7 @@
 			for (j := 0; j < lengthof(g.trx_maio); j := j + 1) {
 				var FreqHopGroupItem gi := g.trx_maio[j];
 				var GsmArfcn arfcn := c_arfcn_list[gi.trx_nr];
-				fhp.ma := fhp.ma & { { false, arfcn } };
+				fhp.ma := fhp.ma & { valueof(ts_GsmBandArfcn(arfcn)) };
 				fhp.ma_map.ma[gi.trx_nr] := '1'B;
 			}
 
@@ -636,7 +636,8 @@
 }
 
 friend function f_l1_tune(L1CTL_PT L1CTL, L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED) {
-	f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, ccch_mode, mp_rxlev_exp);
+	var GsmBandArfcn arfcn := valueof(ts_GsmBandArfcn(mp_trx0_arfcn));
+	f_L1CTL_FBSB(L1CTL, arfcn, ccch_mode, mp_rxlev_exp);
 }
 
 private function f_trxc_fake_rssi(TRXC_RSSI rssi) runs on ConnHdlr {
diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index d961adb..0c032bb 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -43,7 +43,8 @@
 
 /* master function switching to a dedicated radio channel */
 function f_switch_dcch() runs on ConnHdlr {
-	var BCCH_tune_req tune_req := { arfcn := { false, mp_trx0_arfcn }, combined_ccch := true };
+	var GsmBandArfcn arfcn := valueof(ts_GsmBandArfcn(mp_trx0_arfcn));
+	var BCCH_tune_req tune_req := { arfcn := arfcn, combined_ccch := true };
 	var DCCH_switch_req sw_req;
 
 	/* Craft channel description (with or without frequency hopping parameters) */
diff --git a/library/GSMTAP_Types.ttcn b/library/GSMTAP_Types.ttcn
index 3288284..76e6ea3 100644
--- a/library/GSMTAP_Types.ttcn
+++ b/library/GSMTAP_Types.ttcn
@@ -1,5 +1,6 @@
 module GSMTAP_Types {
 	import from Osmocom_Types all;
+	import from GSM_Types all;
 
 	const uint8_t GSMTAP_VERSION	:= 2;
 
@@ -49,7 +50,7 @@
 		uint8_t		hdr_len,
 		GsmtapMsgType	msg_type,
 		uint8_t		timeslot,
-		Arfcn		arfcn,
+		GsmBandArfcn	arfcn,
 		int8_t		signal_dbm,
 		int8_t		snr_db,
 		uint32_t	frame_number,
diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index bcf2794..d954962 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -29,6 +29,31 @@
 type uint16_t GsmLac;
 type uint16_t GsmCellId;
 
+/* ARFCN with explicit band discrimination */
+type record GsmBandArfcn {
+	boolean		pcs,
+	BIT5		spare,
+	GsmArfcn	arfcn
+} with {
+	variant (arfcn) "BYTEORDER(last)"
+	variant (arfcn) "FIELDLENGTH(10)"
+};
+
+template (value) GsmBandArfcn
+ts_GsmBandArfcn(template (value) GsmArfcn arfcn,
+		template (value) boolean pcs := false) := {
+	pcs := pcs,
+	spare := '00000'B,
+	arfcn := arfcn
+};
+template GsmBandArfcn
+tr_GsmBandArfcn(template (present) GsmArfcn arfcn,
+		template (present) boolean pcs := ?) := {
+	pcs := pcs,
+	spare := ?,
+	arfcn := arfcn
+};
+
 type enumerated GprsCodingScheme {
 	CS1, CS2, CS3, CS4
 };
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index 19b3ee3..5c554c2 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -42,7 +42,10 @@
 		return len;
 	}
 
-	function f_L1CTL_FBSB(L1CTL_PT pt, Arfcn arfcn, L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED, integer rxlev_exp := 57) {
+	function f_L1CTL_FBSB(L1CTL_PT pt, GsmBandArfcn arfcn,
+			      L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED,
+			      integer rxlev_exp := 57)
+	{
 		timer T := 15.0;
 		for (var integer i := 0; i < 10; i := i+1) {
 			var L1ctlDlMessage dl;
diff --git a/library/L1CTL_Types.ttcn b/library/L1CTL_Types.ttcn
index fe375ef..220a2cd 100644
--- a/library/L1CTL_Types.ttcn
+++ b/library/L1CTL_Types.ttcn
@@ -122,7 +122,7 @@
 	type record L1ctlDlInfo {
 		RslChannelNr	chan_nr,
 		RslLinkId	link_id,
-		Arfcn		arfcn,
+		GsmBandArfcn	arfcn,
 		uint32_t	frame_nr,
 		GsmRxLev	rx_level,
 		uint8_t		snr,
@@ -245,7 +245,7 @@
 		uint8_t		ts_nr,
 		OCT1		padding,
 		uint32_le	fn,
-		Arfcn		arfcn,
+		GsmBandArfcn	arfcn,
 		OCT2		padding2
 	} with { variant "" };
 
@@ -264,7 +264,7 @@
 	};
 
 	type record L1ctlFbsbReq {
-		Arfcn		arfcn,
+		GsmBandArfcn	arfcn,
 		uint16_t	timeout_tdma_frames,
 		uint16_t	freq_err_thresh1,
 		uint16_t	freq_err_thresh2,
@@ -319,11 +319,11 @@
 
 	type record L1ctlH0 {
 		uint8_t		h,
-		Arfcn		arfcn,
+		GsmBandArfcn	arfcn,
 		octetstring	padding length(130)
 	} with { variant "" };
 
-	type record length(0..64) of Arfcn L1ctlMA;
+	type record length(0..64) of GsmBandArfcn L1ctlMA;
 	type record L1ctlH1 {
 		uint8_t		h,
 		uint8_t		hsn,
@@ -477,7 +477,7 @@
 
 	/* for generating FBSB_REQ */
 	template (value) L1ctlUlMessage
-	ts_L1CTL_FBSB_REQ(template (value) Arfcn arfcn,
+	ts_L1CTL_FBSB_REQ(template (value) GsmBandArfcn arfcn,
 			  template (value) L1ctlFbsbFlags flags,
 			  template (value) uint8_t sync_info_idx,
 			  template (value) L1ctlCcchMode ccch_mode,
@@ -655,7 +655,7 @@
 				h0h1 := {
 					h0 := {
 						h := 0,
-						arfcn := { false, arfcn },
+						arfcn := ts_GsmBandArfcn(arfcn),
 						padding := f_pad_oct(''O, 130, '00'O)
 					}
 				}
@@ -813,7 +813,7 @@
 
 	template (value) L1ctlUlMessage
 	ts_L1CTL_DATA_ABS_REQ(octetstring l2_data,
-			      template (value) Arfcn arfcn,
+			      template (value) GsmBandArfcn arfcn,
 			      template (value) uint8_t ts,
 			      template (value) GsmFrameNumber fn,
 			      template (value) L1ctlGprsCs cs := L1CTL_CS1,
diff --git a/library/LAPDm_RAW_PT.ttcn b/library/LAPDm_RAW_PT.ttcn
index d0ad24b..3e2fba2 100644
--- a/library/LAPDm_RAW_PT.ttcn
+++ b/library/LAPDm_RAW_PT.ttcn
@@ -22,7 +22,7 @@
 
 	/* request to tune to a given ARFCN and start BCCH decoding */
 	type record BCCH_tune_req {
-		Arfcn arfcn,
+		GsmBandArfcn arfcn,
 		boolean combined_ccch
 	}
 
@@ -102,7 +102,7 @@
 		GprsCodingScheme cs,
 		uint8_t ts_nr,
 		GsmFrameNumber fn,
-		Arfcn arfcn,
+		GsmBandArfcn arfcn,
 		RlcmacUlBlock block
 	}
 	type union RLCMAC_ph_data_req {
@@ -198,7 +198,8 @@
 	}
 
 	/* tune to given ARFCN and start BCCH/CCCH decoding */
-	private function f_tune_bcch(Arfcn arfcn, boolean combined) runs on lapdm_CT {
+	private function f_tune_bcch(GsmBandArfcn arfcn, boolean combined)
+	runs on lapdm_CT {
 		var L1ctlCcchMode mode := CCCH_MODE_NON_COMBINED;
 		if (combined) {
 			mode := CCCH_MODE_COMBINED;
@@ -274,7 +275,8 @@
 	}
 
 	template (value) RLCMAC_ph_data_req ts_PH_DATA_ABS(uint8_t tbf_id, GprsCodingScheme cs,
-							   uint8_t ts, uint32_t fn, Arfcn arfcn,
+							   uint8_t ts, uint32_t fn,
+							   GsmBandArfcn arfcn,
 							   RlcmacUlBlock block) := {
 		abs := {
 			tbf_id := tbf_id,
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index 4012f6d..862509b 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -44,11 +44,6 @@
 const BIT1 CSN1_L := '0'B;
 const BIT1 CSN1_H := '1'B;
 
-type record Arfcn {
-	boolean		pcs,
-	uint15_t	arfcn
-} with { variant "" };
-
 /* based on Linux */
 type enumerated AddressFamily {
 	AF_UNSPEC	('00'O),

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21148
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7a63f03bbd15a06caafb786122dc12991d115771
Gerrit-Change-Number: 21148
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201125/ce938d4b/attachment.htm>


More information about the gerrit-log mailing list