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
This commit is contained in:
Vadim Yanitskiy 2020-11-14 04:24:57 +07:00
parent 0e18824f3b
commit 1acc7bb184
8 changed files with 50 additions and 22 deletions

View File

@ -585,7 +585,7 @@ friend function f_resolve_fh_params(inout FreqHopPars fhp, uint8_t tn,
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 @@ private altstep as_Tguard() runs on ConnHdlr {
}
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 {

View File

@ -43,7 +43,8 @@ function f_lapdm_exit() runs on lapdm_test_CT {
/* 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) */

View File

@ -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,

View File

@ -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
};

View File

@ -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;

View File

@ -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,

View File

@ -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,

View File

@ -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),