library/GSM_RR_Types.ttcn: refactor IaRestOctHH coding
According to 3GPP TS 44.018, section 10.5.2.16, IA Rest Octets IE
starting with 'HH' bits may contain one of the following CSN.1
encoded components:
7 6 5 4 3 2 1 0 Bit Numbers
H H 0 0 . . . . Packet Uplink Assignment
H H 0 1 . . . . Packet Downlink Assignment
H H 1 . . . . . Second Part Packet Assignment
We already have (partial) support for the first two, while the
last type has not been supported so far. Let's add it.
Also, this change introduces several templates for IA Rest Octets
IE and some of its components mentioned above. This would allow
us to abstract the API users from dealing with further changes,
e.g. adding a coding attribute 'CSN.1 L/H' and missing fields.
Change-Id: Ib3a21e7c5fa1cad4466e3a09fa70540de7f6ecc5
diff --git a/library/GSM_RR_Types.ttcn b/library/GSM_RR_Types.ttcn
index b090d25..3d2f76a 100644
--- a/library/GSM_RR_Types.ttcn
+++ b/library/GSM_RR_Types.ttcn
@@ -445,13 +445,37 @@
variant (mobile_allocation) "PRESENCE(freq_par_len != 0)"
*/
};
- type record IaRestOctHH {
- BIT2 presence,
- PacketUlAssign ul optional,
- PacketDlAssign dl optional
+ type record SecondPartAssign {
+ BIT1 r99, /* H / L */
+ BIT1 presence optional,
+ BIT5 ext_ra optional
} with {
- variant (ul) "PRESENCE(presence = '00'B)"
- variant (dl) "PRESENCE(presence = '01'B)"
+ /* TODO: use 'CSN.1 L/H' attribute here */
+ variant (presence) "PRESENCE(r99 = '1'B)" /* H */
+ variant (ext_ra) "PRESENCE(presence = '1'B)"
+ };
+ type union PacketUlDlAssignUnion {
+ PacketUlAssign ul,
+ PacketDlAssign dl
+ };
+ type record PacketUlDlAssign {
+ BIT1 ass_disc,
+ PacketUlDlAssignUnion ass
+ } with {
+ variant (ass) "CROSSTAG(dl, ass_disc = '1'B; ul, ass_disc = '0'B)"
+ };
+ type union PacketAssignUnion {
+ SecondPartAssign spa,
+ PacketUlDlAssign uldl
+ };
+ type record IaRestOctHH {
+ /* Packet Assignment discriminator:
+ * Packet Uplink / Downlink Assignment (0)
+ * Second Part Packet Assignment (1) */
+ BIT1 pa_disc,
+ PacketAssignUnion pa
+ } with {
+ variant (pa) "CROSSTAG(spa, pa_disc = '1'B; uldl, pa_disc = '0'B)"
};
type record PacketUlAssignDyn {
uint5_t tfi_assignment,
@@ -724,6 +748,88 @@
with { extension "prototype(convert) decode(RAW)" };
+ template PacketDlAssign tr_PacketDlAssign(template GprsTlli tlli) := {
+ tlli := tlli,
+ group1_present := ?,
+ group1 := *,
+ ta_index_present := ?,
+ ta_index := *,
+ tbf_starting_time_present := ?,
+ tbf_starting_time := *,
+ p0_present := ?,
+ p0 := *,
+ pr_mode := *
+ };
+
+ template IaRestOctets tr_IaRestOctets_DLAss(template PacketDlAssign dl_ass) := {
+ presence := '11'B, /* HH */
+ ll := omit, lh := omit, hl := omit,
+ hh := {
+ pa_disc := '0'B, /* Packet Assignment (0) */
+ pa := {
+ uldl := {
+ ass_disc := '1'B, /* Downlink Assignment (1) */
+ ass := { dl := dl_ass }
+ }
+ }
+ }
+ };
+
+ template PacketUlAssign tr_PacketUlDynAssign(template uint5_t tfi := ?,
+ template BIT1 polling := ?,
+ template uint3_t usf := ?,
+ template BIT1 usf_granularity := ?,
+ template ChCodingCommand cs := ?) := {
+ presence := '1'B, /* Dynamic Assignment */
+ dynamic := {
+ tfi_assignment := tfi,
+ polling := polling,
+ spare := '0'B, /* Dynamic Assignment (mandatory after Rel-4) */
+ usf := usf,
+ usf_granularity := usf_granularity,
+ p0_present := ?,
+ p0 := *,
+ pr_mode := *,
+ ch_coding_cmd := cs,
+ tlli_block_chan_coding := ?,
+ alpha_present := ?,
+ alpha := *,
+ gamma := ?,
+ /* TODO: add to parameters */
+ ta_index_present := ?,
+ ta_index := *,
+ tbf_starting_time_present := ?,
+ tbf_starting_time := *
+ },
+ single := omit
+ };
+
+ template PacketUlAssign tr_PacketUlSglAssign := {
+ presence := '1'B, /* Single Block Assignment */
+ dynamic := omit,
+ single := {
+ alpha_present := ?,
+ alpha := *,
+ gamma := ?,
+ padding := '01'B,
+ tbf_starting_time := ?
+ }
+ };
+
+ template IaRestOctets tr_IaRestOctets_ULAss(template PacketUlAssign ul_ass) := {
+ presence := '11'B, /* HH */
+ ll := omit, lh := omit, hl := omit,
+ hh := {
+ pa_disc := '0'B, /* Packet Assignment (0) */
+ pa := {
+ uldl := {
+ ass_disc := '0'B, /* Uplink Assignment (0) */
+ ass := { ul := ul_ass }
+ }
+ }
+ }
+ };
+
template (value) GsmRrMessage ts_IMM_ASS(uint8_t ra, GsmFrameNumber fn, TimingAdvance ta,
ChannelDescription ch_desc, MobileAllocation ma) := {
header := t_RrHeader(IMMEDIATE_ASSIGNMENT, 0),
@@ -802,6 +908,7 @@
}
};
+ /* TODO: introduce generic TBF Assignment template for DL and UL */
template ImmediateAssignment t_IMM_ASS_TBF_DL(template GprsTlli tlli) := {
ded_or_tbf := {
spare := ?,
@@ -822,28 +929,7 @@
req_ref := ?,
timing_advance := ?,
mobile_allocation := ?,
- rest_octets := {
- presence := '11'B,
- ll := omit,
- lh := omit,
- hl := omit,
- hh := {
- presence := '01'B,
- ul := omit,
- dl := {
- tlli := tlli,
- group1_present := ?,
- group1 := *,
- ta_index_present := ?,
- ta_index := *,
- tbf_starting_time_present := ?,
- tbf_starting_time := *,
- p0_present := ?,
- p0 := *,
- pr_mode := *
- }
- }
- }
+ rest_octets := tr_IaRestOctets_DLAss(tr_PacketDlAssign(tlli))
};
template GsmRrMessage t_RR_IMM_ASS_TBF_DL(template GprsTlli tlli) := {
diff --git a/library/LAPDm_RAW_PT.ttcn b/library/LAPDm_RAW_PT.ttcn
index 2ede566..5a8d9ea 100644
--- a/library/LAPDm_RAW_PT.ttcn
+++ b/library/LAPDm_RAW_PT.ttcn
@@ -261,44 +261,13 @@
a[idx] := tfi_usf;
}
- /* Match an IMM.ASS for an Uplink TBF with a dynamic allocation */
+ /* Match an IMM.ASS for an Uplink TBF with a dynamic allocation
+ * FIXME: this template has nothing to do with LAPDm, move to GSM_RR_Types.ttcn */
template ImmediateAssignment t_IMM_ASS_TBF_UL_DYN(uint8_t ra, GsmFrameNumber fn) modifies t_IMM_ASS := {
ded_or_tbf := { spare := ?, tma := ?, downlink := false, tbf := true},
chan_desc := omit,
pkt_chan_desc := ?,
- rest_octets := {
- presence := '11'B,
- ll := omit,
- lh := omit,
- hl := omit,
- hh := {
- presence := '00'B,
- ul := {
- presence := '1'B,
- dynamic := {
- tfi_assignment := ?,
- polling := ?,
- spare := '0'B,
- usf := ?,
- usf_granularity := ?,
- p0_present := ?,
- p0 := *,
- pr_mode := *,
- ch_coding_cmd := ?,
- tlli_block_chan_coding:= ?,
- alpha_present := ?,
- alpha := *,
- gamma := ?,
- ta_index_present := ?,
- ta_index := *,
- tbf_starting_time_present := ?,
- tbf_starting_time := *
- },
- single := omit
- },
- dl := omit
- }
- }
+ rest_octets := tr_IaRestOctets_ULAss(tr_PacketUlDynAssign())
};
template (value) RLCMAC_ph_data_req ts_PH_DATA_ABS(uint8_t tbf_id, GprsCodingScheme cs,
@@ -332,7 +301,8 @@
//chan_desc := imm_ass.chan_desc;
/* Important: ARFCN, TN, TSC, USF, USF_GRANULARITY, CH_CODING_CMD */
- f_TfiUsfArrSet(tua, imm_ass.pkt_chan_desc.tn, imm_ass.rest_octets.hh.ul.dynamic.usf);
+ f_TfiUsfArrSet(tua, imm_ass.pkt_chan_desc.tn,
+ imm_ass.rest_octets.hh.pa.uldl.ass.ul.dynamic.usf);
f_L1CTL_TBF_CFG(L1CTL, true, tua);
} else {
/* FIXME: single block uplink allocation */