From 1acc7bb1840582a351888bba9f98644b9435f5a1 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 14 Nov 2020 04:24:57 +0700 Subject: 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 --- library/GSMTAP_Types.ttcn | 3 ++- library/GSM_Types.ttcn | 25 +++++++++++++++++++++++++ library/L1CTL_PortType.ttcn | 5 ++++- library/L1CTL_Types.ttcn | 16 ++++++++-------- library/LAPDm_RAW_PT.ttcn | 10 ++++++---- library/Osmocom_Types.ttcn | 5 ----- 6 files changed, 45 insertions(+), 19 deletions(-) (limited to 'library') diff --git a/library/GSMTAP_Types.ttcn b/library/GSMTAP_Types.ttcn index 32882844..76e6ea3c 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 @@ module GSMTAP_Types { 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 bcf2794e..d954962a 100644 --- a/library/GSM_Types.ttcn +++ b/library/GSM_Types.ttcn @@ -29,6 +29,31 @@ type hexstring GsmMnc length(2 .. 3); 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 19b3ee39..5c554c2b 100644 --- a/library/L1CTL_PortType.ttcn +++ b/library/L1CTL_PortType.ttcn @@ -42,7 +42,10 @@ module L1CTL_PortType { 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 fe375eff..220a2cdd 100644 --- a/library/L1CTL_Types.ttcn +++ b/library/L1CTL_Types.ttcn @@ -122,7 +122,7 @@ module L1CTL_Types { 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 @@ module L1CTL_Types { uint8_t ts_nr, OCT1 padding, uint32_le fn, - Arfcn arfcn, + GsmBandArfcn arfcn, OCT2 padding2 } with { variant "" }; @@ -264,7 +264,7 @@ module L1CTL_Types { }; 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 @@ module L1CTL_Types { 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 @@ module L1CTL_Types { /* 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 @@ module L1CTL_Types { h0h1 := { h0 := { h := 0, - arfcn := { false, arfcn }, + arfcn := ts_GsmBandArfcn(arfcn), padding := f_pad_oct(''O, 130, '00'O) } } @@ -813,7 +813,7 @@ module L1CTL_Types { 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 d0ad24b9..3e2fba2b 100644 --- a/library/LAPDm_RAW_PT.ttcn +++ b/library/LAPDm_RAW_PT.ttcn @@ -22,7 +22,7 @@ module LAPDm_RAW_PT { /* 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 @@ module LAPDm_RAW_PT { GprsCodingScheme cs, uint8_t ts_nr, GsmFrameNumber fn, - Arfcn arfcn, + GsmBandArfcn arfcn, RlcmacUlBlock block } type union RLCMAC_ph_data_req { @@ -198,7 +198,8 @@ module LAPDm_RAW_PT { } /* 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 @@ module LAPDm_RAW_PT { } 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 4012f6d8..862509bb 100644 --- a/library/Osmocom_Types.ttcn +++ b/library/Osmocom_Types.ttcn @@ -44,11 +44,6 @@ const uint32_t c_UINT32_MAX := 4294967295; 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), -- cgit v1.2.3