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
This commit is contained in:
Vadim Yanitskiy 2019-09-09 01:07:37 +02:00
parent a4aacc2179
commit 7091e8de88
3 changed files with 120 additions and 64 deletions

View File

@ -445,13 +445,37 @@ module GSM_RR_Types {
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 @@ module GSM_RR_Types {
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 @@ module GSM_RR_Types {
}
};
/* 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 @@ module GSM_RR_Types {
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) := {

View File

@ -261,44 +261,13 @@ module LAPDm_RAW_PT {
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 @@ module LAPDm_RAW_PT {
//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 */

View File

@ -603,7 +603,7 @@ function f_wait_tbf_dl(TbfNr tbf_nr, GprsTlli tlli) runs on dummy_CT return Imme
var TbfPars tbf_pars := valueof(t_TbfParsInit);
log("Received IMM.ASS for our TLLI!");
tbf_pars.tfi[rr.payload.imm_ass.pkt_chan_desc.tn] :=
rr.payload.imm_ass.rest_octets.hh.dl.group1.tfi_assignment;
rr.payload.imm_ass.rest_octets.hh.pa.uldl.ass.dl.group1.tfi_assignment;
L1.send(TBF_DL_establish_req:{tbf_nr, tbf_pars});
} else {
repeat;