blob: af8b8d67b8fc311d233a6f2970530141a91ec22a [file] [log] [blame]
Harald Welte484160b2017-07-28 13:30:24 +02001/* GPRS RLC/MAC Control Messages as per 3GPP TS 44.060 manually transcribed from the CSN.1 syntax, as no CSN.1
2 * tool for Eclipse TITAN could be found. Implements only the minimum necessary messages for Osmocom teseting
Harald Welte34b5a952019-05-27 11:54:11 +02003 * purposes. */
4
5/* (C) 2017-2018 Harald Welte <laforge@gnumonks.org>
6 * contributions by sysmocom - s.f.m.c. GmbH
7 * All rights reserved.
8 *
9 * Released under the terms of GNU General Public License, Version 2 or
10 * (at your option) any later version.
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 */
14
Harald Welte484160b2017-07-28 13:30:24 +020015module RLCMAC_CSN1_Types {
16 import from General_Types all;
17 import from Osmocom_Types all;
18 import from GSM_Types all;
Pau Espin Pedrol86904082019-12-30 20:21:00 +010019 import from MobileL3_GMM_SM_Types all;
Harald Welte484160b2017-07-28 13:30:24 +020020
21 /* TS 44.060 11.2.0.1 */
22 type enumerated RlcmacDlCtrlMsgType {
23 PACKET_ACCESS_REJECT ('100001'B),
24 PACKET_CELL_CHANGE_ORDER ('000001'B),
25 PACKET_DL_ASSIGNMENT ('000010'B),
26 PACKET_MEASUREMENT_ORDER ('000011'B),
27 PACKET_PAGING_REQUEST ('100010'B),
28 PACKET_PDCH_RELEASE ('100011'B),
29 PACKET_POLLING_REQUEST ('000100'B),
Vadim Yanitskiy759cb292019-09-30 20:08:11 +070030 PACKET_PWR_CONTROL_TA ('000101'B),
Harald Welte484160b2017-07-28 13:30:24 +020031 /* TODO */
32 PACKET_TBF_RELEASE ('001000'B),
33 PACKET_UL_ACK_NACK ('001001'B),
34 PACKET_UL_ASSIGNMENT ('001010'B),
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +010035 PACKET_CELL_CHANGE_CONTINUE ('001011'B),
36 PACKET_NEIGHBOUR_CELL_DATA ('001100'B),
Harald Welte484160b2017-07-28 13:30:24 +020037 PACKET_DL_DUMMY_CTRL ('100101'B)
38 } with { variant "FIELDLENGTH(6)" };
39
40 /* TS 44.060 11.2.0.2 */
41 type enumerated RlcmacUlCtrlMsgType {
42 PACKET_CELL_CHANGE_FEATURE ('000000'B),
43 PACKET_CONTROL_ACK ('000001'B),
44 PACKET_DL_ACK_NACK ('000010'B),
45 PACKET_UL_DUMMY_CTRL ('000011'B),
46 PACKET_MEASUREMENT_REPORT ('000100'B),
47 PACKET_ENH_MEASUREMENT_REPORT ('001010'B),
48 PACKET_RESOURCE_REQUEST ('000101'B),
49 PACKET_MOBILE_TBF_STATUS ('000110'B),
50 PACKET_PSI_STATUS ('000111'B),
51 PACKET_EGPRS_DL_ACK_NACK ('001000'B),
52 PACKET_PAUSE ('001001'B),
53 ADDITIONAL_MS_RA_CAPABILITIES ('001011'B),
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +010054 PACKET_CELL_CHANGE_NOTIFICATION ('001100'B),
Harald Welte484160b2017-07-28 13:30:24 +020055 PACKET_SI_STATUS ('001101'B),
56 PACKET_CS_REQUEST ('001110'B),
57 MBMS_SERVICE_REQUEST ('001111'B),
58 MBMS_DL_ACK_NACK ('010000'B)
59 } with { variant "FIELDLENGTH(6)" };
60
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +020061 type enumerated EgprsChCodingCommand {
62 CH_CODING_MCS1 ('0000'B),
63 CH_CODING_MCS2 ('0001'B),
64 CH_CODING_MCS3 ('0010'B),
65 CH_CODING_MCS4 ('0011'B),
66 CH_CODING_MCS5 ('0100'B),
67 CH_CODING_MCS6 ('0101'B),
68 CH_CODING_MCS7 ('0110'B),
69 CH_CODING_MCS8 ('0111'B),
70 CH_CODING_MCS9 ('1000'B),
71 CH_CODING_MCS5_7 ('1001'B),
72 CH_CODING_MCS6_9 ('1010'B)
73 } with { variant "FIELDLENGTH(4)" };
74
75 /* TS 44.060 Table 12.5.2.1 */
76 type enumerated EgprsWindowSize { /* This probably needs to be moved to RLCMAC_CSN1_Types.ttcn */
77 EGPRS_WS_64 ('00000'B),
78 EGPRS_WS_96 ('00001'B),
79 EGPRS_WS_128 ('00010'B),
80 EGPRS_WS_160 ('00011'B),
81 EGPRS_WS_192 ('00100'B),
82 EGPRS_WS_224 ('00101'B),
83 EGPRS_WS_256 ('00110'B),
84 EGPRS_WS_288 ('00111'B),
85 EGPRS_WS_320 ('01000'B),
86 EGPRS_WS_352 ('01001'B),
87 EGPRS_WS_384 ('01010'B),
88 EGPRS_WS_416 ('01011'B),
89 EGPRS_WS_448 ('01100'B),
90 EGPRS_WS_480 ('01101'B),
91 EGPRS_WS_512 ('01110'B),
92 EGPRS_WS_544 ('01111'B),
93 EGPRS_WS_576 ('10000'B),
94 EGPRS_WS_608 ('10001'B),
95 EGPRS_WS_640 ('10010'B),
96 EGPRS_WS_672 ('10011'B),
97 EGPRS_WS_704 ('10100'B),
98 EGPRS_WS_736 ('10101'B),
99 EGPRS_WS_768 ('10110'B),
100 EGPRS_WS_800 ('10111'B),
101 EGPRS_WS_832 ('11000'B),
102 EGPRS_WS_864 ('11001'B),
103 EGPRS_WS_896 ('11010'B),
104 EGPRS_WS_928 ('11011'B),
105 EGPRS_WS_960 ('11100'B),
106 EGPRS_WS_992 ('11101'B),
107 EGPRS_WS_1024 ('11110'B)
108 } with { variant "FIELDLENGTH(5)" };
109
Harald Welte484160b2017-07-28 13:30:24 +0200110 type record NullGlobalTfi {
111 BIT1 presence ('0'B),
112 GlobalTfi global_tfi
113 } with { variant "" };
114
115 type record TenTlli {
116 BIT2 presence ('10'B),
117 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100118 } with { variant ""
119 variant (tlli) "BYTEORDER(first)"
120 };
Harald Welte484160b2017-07-28 13:30:24 +0200121
122 type union GlobalTfiOrTlli {
123 NullGlobalTfi global_tfi,
124 TenTlli tlli
125 };
126
127 /* 11.2.7 Packet Downlink Assignment */
128 type record PacketDlAssignment {
129 PageMode page_mode,
130 BIT1 pres1,
131 PersistenceLevels persistence_levels optional,
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200132 GlobalTfiOrTlli tfi_or_tlli,
133 BIT1 egprs2('0'B), /* TODO: implement union with egprs2 */
134 BIT2 mac_mode,
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700135 BIT1 rlc_mode,
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200136 BIT1 control_ack,
137 BIT8 timeslot_alloc,
138 PacketTimingAdvance pkt_ta,
139 BIT1 p0_present,
140 uint4_t p0 optional,
141 BIT1 reserved('0'B) optional,
142 BIT1 pr_mode optional,
143 BIT1 freq_par_present,
144 FrequencyParameters freq_par optional,
145 BIT1 dl_tfi_ass_present,
146 uint5_t dl_tfi_assignment optional,
147 BIT1 pwr_ctrl_present,
148 PowerControlParameters pwr_ctrl optional,
149 BIT1 tbf_starting_time_present,
150 StartingFnDesc tbf_starting_time optional,
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700151 /* The value '1' was allocated in an earlier version of the protocol */
152 BIT1 spare ('0'B),
153 /* Rel-{99,5,6,7,9,10,12,14} Additions (Matrioshka) */
154 PktDlAssRelAdditions rel_additions optional
Harald Welte484160b2017-07-28 13:30:24 +0200155 } with {
156 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200157 variant (p0) "PRESENCE(p0_present = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200158 variant (reserved) "PRESENCE(p0_present = '1'B)"
159 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
160 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
161 variant (dl_tfi_assignment) "PRESENCE(dl_tfi_ass_present = '1'B)"
162 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
163 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700164 };
165
166 private type record PktDlAssRelAdditions {
167 BIT1 rel99_presence, // 0/1
168 PktDlAssR99Additions rel99 optional
169 } with {
170 variant (rel99) "PRESENCE(rel99_presence = '1'B)"
171 };
172
173 private type record PktDlAssR99Additions {
174 BIT1 egprs_present,
175 PktDlAssR99EGPRS egprs optional,
176 BIT1 pkt_ext_ta_present,
177 BIT2 pkt_ext_ta optional,
178 BIT1 compact_reduced_ma_present,
179 COMPACTreducedMA compact_reduced_ma optional
180 /* TODO: Additions for REL-5 */
181 } with {
182 variant (egprs) "PRESENCE(egprs_present = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200183 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
184 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200185 };
186
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700187 private type record PktDlAssR99EGPRS {
188 EgprsWindowSize window_size,
189 BIT2 link_quality_meas_mode,
190 BIT1 bep_period2_present,
191 BIT4 bep_period2 optional
192 } with {
193 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
194 };
195
Harald Welte484160b2017-07-28 13:30:24 +0200196 /* 11.2.29 Packet Uplink Assignment */
197 type record O_Gtfi {
198 BIT1 presence ('0'B),
199 GlobalTfi global_tfi
200 } with { variant "" };
201 type record IO_Tlli {
202 BIT2 presence ('10'B),
203 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100204 } with { variant ""
205 variant (tlli) "BYTEORDER(first)"
206 };
Harald Welte484160b2017-07-28 13:30:24 +0200207 type record IIO_Tqi {
208 BIT3 presence ('110'B),
209 PacketRequestReference pkt_req_ref
210 } with { variant "" };
211 type union PktUlAssUnion {
212 O_Gtfi global_tfi,
213 IO_Tlli tlli,
214 IIO_Tqi tqi
215 } with {
216 variant "TAG(global_tfi, presence = '0'B;
217 tlli, presence = '10'B;
218 tqi, presence = '110'B)"
219 };
220 type record DynamicAllocation {
221 BIT1 extd_dyn_alloc,
222 BIT1 p0_present,
223 uint4_t p0 optional,
224 BIT1 pr_mode optional,
225 BIT1 usf_granularity,
226 BIT1 ul_tfi_ass_present,
227 uint5_t ul_tfi_assignment optional,
228 BIT1 reserved ('0'B),
229 BIT1 tbf_starting_time_present,
230 StartingFnDesc tbf_starting_time optional,
231 TsAllocationUnion ts_allocation
232 } with {
233 variant (p0) "PRESENCE(p0_present = '1'B)"
234 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
235 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
236 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
237 };
238 type record TsAllocationTs {
239 BIT1 presence,
240 uint3_t usf_tn optional
241 } with {
242 variant (usf_tn) "PRESENCE(presence = '1'B)"
243 };
244 type record length(8) of TsAllocationTs TsAllocationTsArr;
245 type record TnGamma {
246 BIT1 presence,
247 uint3_t usf_tn optional,
248 uint5_t gamma_tn optional
249 } with {
250 variant (usf_tn) "PRESENCE(presence = '1'B)"
251 variant (gamma_tn) "PRESENCE(presence = '1'B)"
252 };
253 type record length(8) of TnGamma TnGamma8;
254 type record TsAllocationPwr {
255 uint4_t alpha,
256 TnGamma tn_gamma
257 } with { variant "" };
258 type record TsAllocationUnion {
259 BIT1 presence,
260 TsAllocationTsArr ts optional,
261 TsAllocationPwr ts_with_pwr optional
262 } with {
263 variant (ts) "PRESENCE(presence = '0'B)"
264 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
265 };
266 type record SingleBlockAllocation {
267 uint3_t timeslot_nr,
268 BIT1 alpha_present,
269 uint4_t alpha optional,
270 uint5_t gamma_tn,
271 BIT1 p0_present,
272 uint4_t p0 optional,
273 BIT1 reserved ('0'B) optional,
274 BIT1 pr_mode optional,
275 StartingFnDesc tbf_starting_time
276 } with {
277 variant (alpha) "PRESENCE(alpha_present = '1'B)"
278 variant (p0) "PRESENCE(p0_present = '1'B)"
279 variant (reserved) "PRESENCE(p0_present = '1'B)"
280 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
281 };
282 type record PktUlAssGprs {
283 ChCodingCommand ch_coding_cmd,
284 BIT1 tlli_block_chan_coding,
285 PacketTimingAdvance pkt_ta,
286 BIT1 freq_par_present,
287 FrequencyParameters freq_par optional,
288 BIT2 alloc_present,
289 DynamicAllocation dyn_block_alloc optional,
290 SingleBlockAllocation sgl_block_alloc optional
291 } with {
292 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
293 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
294 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
295 };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200296 type record COMPACTreducedMA {
297 uint7_t ma_bitmap_length,
298 bitstring ma_bitmap,
299 BIT1 maio_2_present,
Vadim Yanitskiyfdbfd6e2020-07-22 14:38:20 +0700300 BIT6 maio_2 optional
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200301 } with {
302 variant (ma_bitmap_length) "LENGTHTO (ma_bitmap)"
303 variant (ma_bitmap_length) "UNIT(bits)"
304 variant (maio_2) "PRESENCE(maio_2_present = '1'B)"
305 };
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +0200306 type record of AccessTechnologiesRequest AccessTechnologiesRequestRepetition
307 with { variant "EXTENSION_BIT(reverse)" };
308 type record AccessTechnologiesRequest
309 {
310 BIT4 accessTechnType,
311 BIT1 extensionBit
312 } with { variant "FIELDORDER(msb)" };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200313 type record MultiBlockAllocation {
314 uint3_t timeslot_nr,
315 BIT1 alpha_gamma_present,
316 uint4_t alpha optional,
317 uint5_t gamma_tn optional,
318 BIT1 p0_present,
319 uint4_t p0 optional,
320 BIT1 reserved ('0'B) optional,
321 BIT1 pr_mode optional,
322 StartingFnDesc tbf_starting_time,
323 uint2_t num_radio_blocks_alloc
324 } with {
325 variant (alpha) "PRESENCE(alpha_gamma_present = '1'B)"
326 variant (gamma_tn) "PRESENCE(alpha_gamma_present = '1'B)"
327 variant (p0) "PRESENCE(p0_present = '1'B)"
328 variant (reserved) "PRESENCE(p0_present = '1'B)"
329 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
330 };
331 type record PktUlAssEgprs {
332 BIT2 dual_carrier('00'B), /*TODO 01 -- Message escape for dual carrier, RTTI, BTTI with FANR activated, EGPRS2 */
333 BIT1 tlli_present,
334 GprsTlli tlli optional,
335 BIT1 compact_reduced_ma_present,
336 COMPACTreducedMA compact_reduced_ma optional,
337 EgprsChCodingCommand chan_coding_cmd,
338 BIT1 resegment,
339 EgprsWindowSize window_size,
340 BIT1 ats_present,
341 AccessTechnologiesRequestRepetition ats optional, /* ? */
342 BIT1 arac_retrans_req,
343 BIT1 tlli_block_chan_coding,
344 BIT1 bep_period2_present,
345 BIT4 bep_period2 optional,
346 PacketTimingAdvance pkt_ta,
347 BIT1 pkt_ext_ta_present,
348 BIT2 pkt_ext_ta optional,
349 BIT1 freq_par_present,
350 FrequencyParameters freq_par optional,
351 BIT2 alloc_present,
352 DynamicAllocation dyn_block_alloc optional,
353 MultiBlockAllocation multi_block_alloc optional
354 /* TODO: Additions for Rel-5 and more */
355 } with {
356 variant (tlli) "PRESENCE(tlli_present = '1'B)"
357 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
358 variant (ats) "PRESENCE(ats_present = '1'B)"
359 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
360 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
361 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
362 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
363 variant (multi_block_alloc) "PRESENCE(alloc_present = '10'B)"
364 };
Harald Welte484160b2017-07-28 13:30:24 +0200365 type record PacketUlAssignment {
366 PageMode page_mode,
367 BIT1 persistence_levels_present,
368 PersistenceLevels persistence_levels optional,
369 PktUlAssUnion identity,
370 BIT1 is_egprs, /* msg escape */
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200371 PktUlAssGprs gprs optional,
372 PktUlAssEgprs egprs optional
373 /* TODO: Table 11.2.29.1: PACKET UPLINK ASSIGNMENT information elements
374 https://www.etsi.org/deliver/etsi_ts/144000_144099/144060/09.03.00_60/ts_144060v090300p.pdf */
Harald Welte484160b2017-07-28 13:30:24 +0200375 } with {
376 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
377 variant (gprs) "PRESENCE(is_egprs = '0'B)"
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200378 variant (egprs) "PRESENCE(is_egprs = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200379 };
380
381 /* 11.2.10 Packet Paging Request */
Stefan Sperling59c15d62018-10-10 11:09:25 +0200382 type record MobileIdentityLV_Paging {
383 /* Note that the size of 'len' differs from that of the Mobile Identify IE
384 * as defined in 3GPP TS 24.008 10.5.1.4 "Mobile Identity"; Paging Requests
385 * use only 4 bit to encode the length of a mobile identity, whereas the IE
386 * uses a byte. */
Harald Welte484160b2017-07-28 13:30:24 +0200387 uint4_t len,
388 octetstring mobile_id
Vadim Yanitskiy322c7932020-01-01 23:03:47 +0100389 } with {
390 variant (len) "LENGTHTO(mobile_id)"
391 variant (mobile_id) "BYTEORDER(first)"
392 };
Harald Welte484160b2017-07-28 13:30:24 +0200393 type record PageInfoPs {
394 BIT1 presence ('0'B),
395 BIT1 ptmsi_or_mobile_id,
396 GsmTmsi ptmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200397 MobileIdentityLV_Paging mobile_identity optional
Harald Welte484160b2017-07-28 13:30:24 +0200398 } with {
399 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
400 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
401 };
402 type record PageInfoCs {
403 BIT1 presence ('1'B),
404 BIT1 tmsi_or_mobile_id,
405 GsmTmsi tmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200406 MobileIdentityLV_Paging mobile_identity optional,
Harald Welte484160b2017-07-28 13:30:24 +0200407 ChannelNeeded chan_needed,
408 BIT1 emlpp_prio_present,
409 uint3_t emlpp_prio optional
410 } with {
411 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
412 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
413 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
414 };
415 type union PageInfo {
416 PageInfoPs ps,
417 PageInfoCs cs
Vadim Yanitskiy5e518732020-01-01 21:27:18 +0100418 } with {
419 variant "TAG(ps, presence = '0'B; cs, presence = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200420 };
Vadim Yanitskiye94164d2020-10-31 05:46:03 +0700421 type record RepeatedPageInfoItem {
422 BIT1 presence,
423 PageInfo item
424 } with { variant "PRESENCE(presence = '1'B)" };
425 type record of RepeatedPageInfoItem RepeatedPageInfo;
Harald Welte484160b2017-07-28 13:30:24 +0200426 type record PacketPagingReq {
427 PageMode page_mode,
428 BIT1 persistence_levels_present,
429 PersistenceLevels persistence_levels optional,
430 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200431 uint2_t nln optional,
Vadim Yanitskiye94164d2020-10-31 05:46:03 +0700432 RepeatedPageInfo repeated_pageinfo optional,
433 BIT1 repeated_pageinfo_term ('0'B)
Harald Welte484160b2017-07-28 13:30:24 +0200434 } with {
435 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
436 variant (nln) "PRESENCE(nln_present = '1'B)"
437 };
438
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200439 /* 12.26 Extension Bits IE */
440 type record ExtensionBits {
441 uint6_t extension_length,
442 bitstring spare_bits
443 } with {
444 variant (extension_length) "LENGTHTO(spare_bits) - 1"
445 variant (extension_length) "UNIT(bits)"
446 };
447
Harald Welte484160b2017-07-28 13:30:24 +0200448 /* 11.2.28 Uplink Ack/Nack */
449 type enumerated ChCodingCommand {
450 CH_CODING_CS1 ('00'B),
451 CH_CODING_CS2 ('01'B),
452 CH_CODING_CS3 ('10'B),
453 CH_CODING_CS4 ('11'B)
454 } with { variant "FIELDLENGTH(2)" };
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200455 type record UlAckNackGprsAdditionsRel99 {
456 BIT1 ext_pkt_ta_present,
457 BIT2 ext_pkt_ta optional,
458 boolean tbf_est
459 /* TODO: Rel5 ,... */
460 } with {
461 variant (ext_pkt_ta) "PRESENCE(ext_pkt_ta_present = '1'B)"
462 variant (tbf_est) "FIELDLENGTH(1)"
463 };
Harald Welte484160b2017-07-28 13:30:24 +0200464 type record UlAckNackGprs {
465 ChCodingCommand ch_coding_cmd,
466 AckNackDescription ack_nack_desc,
467 BIT1 cont_res_tlli_present,
468 GprsTlli cont_res_tlli optional,
469 BIT1 pkt_ta_present,
470 PacketTimingAdvance pkt_ta optional,
471 BIT1 pwr_ctrl_present,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200472 PowerControlParameters pwr_ctrl optional,
473 BIT1 extension_bits_present,
474 ExtensionBits extension_bits optional,
475 BIT1 not_used ('0'B),
476 BIT1 rel99_present,
477 UlAckNackGprsAdditionsRel99 rel99 optional
Harald Welte484160b2017-07-28 13:30:24 +0200478 } with {
479 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
480 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
481 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200482 variant (extension_bits) "PRESENCE(extension_bits_present = '1'B)"
483 variant (rel99) "PRESENCE(rel99_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100484 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200485 };
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200486 type record UlAckNackEgprs {
Pau Espin Pedrolf8fe2d22020-11-10 18:39:25 +0100487 BIT2 msg_excape ('00'B),
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200488 EgprsChCodingCommand ch_coding_cmd,
489 BIT1 resegment,
490 BIT1 preemptive_tx,
491 BIT1 prr_retrans_req,
492 BIT1 arac_retrans_req,
493 BIT1 cont_res_tlli_present,
494 GprsTlli cont_res_tlli optional,
495 BIT1 tbf_est,
496 BIT1 pkt_ta_present,
497 PacketTimingAdvance pkt_ta optional,
498 BIT1 pkt_ext_ta_present,
499 BIT2 pkt_ext_ta optional,
500 BIT1 pwr_ctrl_present,
501 PowerControlParameters pwr_ctrl optional
502 /* TODO: TS 44.060 12.3.1 EGPRS Ack/Nack Description */
503 /* EgprsAckNackDescription ack_nack_desc, */
504 /* BIT1 not_used('0'B) */
505 /* TODO: Extension Bits, Rel5 ,... */
506 } with {
507 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
508 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
509 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
510 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
511 variant (cont_res_tlli) "BYTEORDER(first)"
512 };
Harald Welte484160b2017-07-28 13:30:24 +0200513 type record PacketUlAckNack {
514 PageMode page_mode,
515 BIT2 msg_excape ('00'B),
516 uint5_t uplink_tfi,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200517 BIT1 is_egprs,
518 UlAckNackGprs gprs optional,
519 UlAckNackEgprs egprs optional
Harald Welte484160b2017-07-28 13:30:24 +0200520 /* TODO: EGPRS */
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200521 } with {
522 variant (gprs) "PRESENCE(is_egprs = '0'B)"
523 variant (egprs) "PRESENCE(is_egprs = '1'B)"
524 };
Harald Welte484160b2017-07-28 13:30:24 +0200525
526 /* 11.2.8 Packet Downlink Dummy Control Block */
527 type record PacketDlDummy {
528 PageMode page_mode,
529 BIT1 persistence_levels_present,
530 PersistenceLevels persistence_levels optional
531 } with {
532 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
533 };
534
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700535 /* 11.9 Global Power Control Parameters */
536 type record GlobalPwrCtrlParams {
537 uint4_t alpha,
538 uint5_t t_avg_v,
539 uint5_t t_avg_t,
540 uint4_t pb,
541 BIT1 pc_meas_chan,
542 BIT1 spare ('0'B),
543 uint4_t n_avg_i
544 };
545
546 /* 12.12a Global Packet Timing Advance */
547 type record TimingAdvanceIdxTN {
548 uint4_t ta_idx,
549 uint3_t ts_num
550 };
551 type record GlobalPacketTA {
552 BIT1 ta_val_presence,
553 uint4_t ta_val optional,
554 BIT1 ul_presence,
555 TimingAdvanceIdxTN ul optional,
556 BIT1 dl_presence,
557 TimingAdvanceIdxTN dl optional
558 } with {
559 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
560 variant (ul) "PRESENCE(ul_presence = '1'B)"
561 variant (dl) "PRESENCE(dl_presence = '1'B)"
562 };
563
564 /* 11.2.13 Packet Power Control/Timing Advance */
565 type record PacketPwrControlTAMsg {
566 BIT1 g_pwr_ctrl_presence,
567 GlobalPwrCtrlParams g_pwr_ctrl optional,
568 BIT1 split,
569 BIT1 split_desc optional,
570 GlobalPacketTA g_pkt_ta optional,
571 PowerControlParameters pwr_ctrl optional
572 /* TODO: additions for R99, REL-7, REL-12 */
573 } with {
574 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
575 variant (split_desc) "PRESENCE(split = '1'B)"
576 /* FIXME: Fancy coding: either both IEs together, or one of them */
577 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
578 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
579 };
580 type record PacketPwrControlTA {
581 PageMode page_mode,
582 NullGlobalTfi global_tfi,
583 /* See 11.1.3.3 'Message escape' error label
584 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
585 BIT1 msg_escape,
586 PacketPwrControlTAMsg msg optional
587 } with {
588 variant (msg) "PRESENCE(msg_escape = '0'B)"
589 };
590
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100591 /* 11.2.2a Packet Cell Change Continue */
592 type record PacketCellChangeContinue {
593 PageMode page_mode,
594 BIT1 zero ('0'B),
595 GlobalTfi gtfi,
596 BIT1 arfcn_bsic_presence,
597 uint10_t arfcn optional,
598 uint6_t bsic optional,
599 uint2_t container_id optional
600 } with {
601 variant (arfcn) "PRESENCE(arfcn_bsic_presence = '1'B)"
602 variant (bsic) "PRESENCE(arfcn_bsic_presence = '1'B)"
603 variant (container_id) "PRESENCE(arfcn_bsic_presence = '1'B)"
604 };
605
606 /* 11.2.9e Packet Neighbour Cell Data */
607 type record PacketNeighbourCellDataContainer {
608 BIT3 pd,
609 uint5_t cd_length,
610 octetstring container_data
611 } with {
612 variant (cd_length) "LENGTHTO (container_data)"
613 variant (container_data) "BYTEORDER(first)"
614 };
615 type record of PacketNeighbourCellDataContainer PacketNeighbourCellDataContainerList
616 type record PacketNeighbourCellData {
617 PageMode page_mode,
618 BIT1 zero ('0'B),
619 GlobalTfi gtfi,
620 uint2_t container_id,
621 BIT1 spare ('0'B),
622 uint5_t container_index,
623 BIT1 arfcn_bsic_presence,
624 uint10_t arfcn optional,
625 uint6_t bsic optional,
626 PacketNeighbourCellDataContainerList container_list
627 } with {
628 variant (arfcn) "PRESENCE(arfcn_bsic_presence = '1'B)"
629 variant (bsic) "PRESENCE(arfcn_bsic_presence = '1'B)"
630 };
631
Harald Welte484160b2017-07-28 13:30:24 +0200632 /* 11.2.0.1 */
633 type union RlcmacDlCtrlUnion {
634 PacketDlAssignment dl_assignment,
635 PacketUlAssignment ul_assignment,
636 PacketPagingReq paging,
637 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200638 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700639 PacketPwrControlTA pwr_ta,
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100640 PacketCellChangeContinue cell_chg_continue,
641 PacketNeighbourCellData neighbour_cell_data,
Harald Welte422f0722017-08-01 00:27:06 +0200642 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200643 } with { variant "" };
644
645 type record RlcmacDlCtrlMsg {
646 RlcmacDlCtrlMsgType msg_type,
647 RlcmacDlCtrlUnion u
648 } with {
649 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
650 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
651 paging, msg_type = PACKET_PAGING_REQUEST;
652 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200653 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700654 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100655 cell_chg_continue,msg_type = PACKET_CELL_CHANGE_CONTINUE;
656 neighbour_cell_data,msg_type = PACKET_NEIGHBOUR_CELL_DATA;
Harald Welte422f0722017-08-01 00:27:06 +0200657 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200658 )"
659 };
660
661 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
662 with { extension "prototype(convert) encode(RAW)" };
663 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
664 with { extension "prototype(convert) decode(RAW)" };
665
666
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100667 /* 11.2.6 Packet Downlink Ack/Nack */
Harald Welte484160b2017-07-28 13:30:24 +0200668 type record ILevel {
669 BIT1 presence,
670 uint4_t i_level optional
671 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
672 type record length(8) of ILevel ILevels;
673 type record ChannelQualityReport {
674 uint6_t c_value,
675 uint3_t rxqual,
676 uint6_t sign_var,
677 ILevels i_levels
678 } with { variant "" };
679 type record PacketDlAckNack {
680 uint5_t dl_tfi,
681 AckNackDescription ack_nack_desc,
682 BIT1 chreq_desc_presence,
683 ChannelReqDescription chreq_desc optional,
684 ChannelQualityReport ch_qual_rep
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100685 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)" };
686
687 /* 11.2.6a Egprs Packet Downlink Ack/Nack */
688 type record EgprsBEPLinkQualityMeasurements {
689 BIT1 gmsk_presence,
690 BIT5 gmsk_mean_bep optional,
691 BIT3 gmsk_cv_bep optional,
692 BIT1 psk8_presence,
693 BIT5 psk8_mean_bep optional,
694 BIT3 psk8_cv_bep optional
695 } with { variant (gmsk_mean_bep) "PRESENCE(gmsk_presence = '1'B)"
696 variant (gmsk_cv_bep) "PRESENCE(gmsk_presence = '1'B)"
697 variant (psk8_mean_bep) "PRESENCE(psk8_presence = '1'B)"
698 variant (psk8_cv_bep) "PRESENCE(psk8_presence = '1'B)"
699 };
700 /* 12.5.4 EGPRS Timeslot Link Quality Measurements IE */
701 type record BEPMeas {
702 BIT1 presence,
703 BIT1 is_8psk optional,
704 uint4_t bep_meas optional
705 } with { variant (is_8psk) "PRESENCE(presence = '1'B)"
706 variant (bep_meas) "PRESENCE(presence = '1'B)"
707 };
708 type record length(8) of BEPMeas BEPMeasLi;
709 type record EgprsTimeslotLinkQualityMeasurements {
710 BIT1 bep_measurements_presence,
711 BEPMeasLi bep_meas optional,
712 BIT1 i_measurements_presence,
713 ILevels i_meas optional
714 } with { variant (bep_meas) "PRESENCE(bep_measurements_presence = '1'B)"
715 variant (i_meas) "PRESENCE(i_measurements_presence = '1'B)"
716 };
717 /* Table 12.5.1.1 : EGPRS Channel Quality Report Information elements */
718 type record EgprsChannelQualityReport {
719 EgprsBEPLinkQualityMeasurements bep_link_qual_meas,
720 uint6_t c_value,
721 EgprsTimeslotLinkQualityMeasurements ts_link_qual_meas
Harald Welte484160b2017-07-28 13:30:24 +0200722 } with { variant "" };
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100723 type record EgprsPacketDlAckNack {
724 uint5_t dl_tfi,
725 BIT1 ms_oom,
726 BIT1 egprs_ch_qual_rep_presence,
727 EgprsChannelQualityReport egprs_ch_qual_rep optional,
728 BIT1 chreq_desc_presence,
729 ChannelReqDescription chreq_desc optional,
730 BIT1 pfi_presence,
731 BIT7 pfi optional,
732 BIT1 epdan_presence('0'B),
733 /* TODO: Implement EPD A/N */
734 EgprsAckNackDescriptionIE ack_nack_desc_ie
735 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)"
736 variant (egprs_ch_qual_rep) "PRESENCE(egprs_ch_qual_rep_presence = '1'B)"
737 variant (pfi) "PRESENCE(pfi_presence = '1'B)"
738 };
Harald Welte484160b2017-07-28 13:30:24 +0200739
740 /* 11.2.2 Packet Control Acknowledgement */
741 type enumerated CtrlAck {
742 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
743 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
744 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
745 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
746 } with { variant "FIELDLENGTH(2)" };
747 type record PacketCtrlAck {
748 GprsTlli tlli,
749 CtrlAck ctrl_ack
750 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100751 } with { variant ""
752 variant (tlli) "BYTEORDER(first)"
753 };
Harald Welte484160b2017-07-28 13:30:24 +0200754
755 /* 1.2.8b Packet Uplink Dummy Control Block */
756 type record PacketUlDummy {
757 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100758 } with { variant ""
759 variant (tlli) "BYTEORDER(first)"
760 };
Harald Welte484160b2017-07-28 13:30:24 +0200761
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200762 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
763 * (for value part, see 3GPP TS 24.008 sec 10.5.5.12a and table 10.5.146) */
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200764 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100765 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200766 };
767
768 /* Table 11.2.16.2 Access Type */
769 type enumerated RlcAccessType {
770 RLC_ACC_TYPE_TWO_PHASE ('00'B),
771 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
772 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
773 RLC_ACC_TYPE_MM ('11'B)
774 } with { variant "FIELDLENGTH(2)" };
775
776 type union PacketResourceReqID {
777 GlobalTfi gtfi,
778 GprsTlli tlli
779 } with { variant (tlli) "BYTEORDER(first)" };
780
781 /* 11.2.16 Packet Resource Request */
782 type record PacketResourceReq {
783 BIT1 acc_type_presence,
784 RlcAccessType acc_type optional,
785 BIT1 id_type,
786 PacketResourceReqID id,
787 BIT1 ms_rac2_presence,
788 MSRadioAccCap2 ms_rac2 optional,
789 ChannelReqDescription ch_req_desc,
790 BIT1 change_mark_presence,
791 BIT2 change_mark optional,
792 BIT6 C_val,
793 BIT1 sign_var_presence,
794 BIT6 sign_var optional,
795 ILevels I_levels
796 /* TODO: additional contents for further Releases (starting from 1999) */
797 } with {
798 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
799 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
800 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
801 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
802 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
803 };
804
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100805 /* 11.2.3a Packet Cell Change Notification */
806 type record NCMeasurementItem {
807 uint6_t freq,
808 BIT1 bsic_presence,
809 uint6_t bsic optional,
810 uint6_t rxlev
811 } with {
812 variant (bsic) "PRESENCE(bsic_presence = '1'B)"
813 };
814 type record of NCMeasurementItem NCMeasurements;
815 type record CCNMesurementReport {
816 uint6_t rxlev_servig_cell,
817 BIT1 zero ('0'B),
818 uint3_t num_meas,
819 NCMeasurements meas
820 } with { variant "" };
821 type record PacketCellChangeNotification {
822 GlobalTfi gtfi,
823 /* TODO: support 3g/4g in these bits */
824 BIT1 arfcn_bsic_presence,
825 uint10_t arfcn optional,
826 uint6_t bsic optional,
827 BIT1 ba_psi3_presence,
828 BIT1 ba_used optional,
829 BIT2 psi3_change_mark optional,
830 BIT1 pmo_used,
831 BIT1 pccn_sending,
832 CCNMesurementReport ccn_meas_rep
833 /* TODO: Rel6 additions for 3G support */
834 } with {
835 variant (arfcn) "PRESENCE(arfcn_bsic_presence = '0'B)"
836 variant (bsic) "PRESENCE(arfcn_bsic_presence = '0'B)"
837 variant (ba_used) "PRESENCE(ba_psi3_presence = '0'B)"
838 variant (psi3_change_mark) "PRESENCE(ba_psi3_presence = '1'B)"
839 };
840
Harald Welte484160b2017-07-28 13:30:24 +0200841 /* 11.2.0.2 */
842 type union RlcmacUlCtrlUnion {
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100843 PacketCtrlAck ctrl_ack,
844 PacketDlAckNack dl_ack_nack,
845 EgprsPacketDlAckNack dl_ack_nack_egprs,
846 PacketUlDummy ul_dummy,
847 PacketResourceReq resource_req,
848 PacketCellChangeNotification cell_chg_notif,
849 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200850 } with { variant "" };
851
852 type record RlcmacUlCtrlMsg {
853 RlcmacUlCtrlMsgType msg_type,
854 RlcmacUlCtrlUnion u
855 } with {
856 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
857 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100858 dl_ack_nack_egprs, msg_type = PACKET_EGPRS_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200859 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200860 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100861 cell_chg_notif, msg_type = PACKET_CELL_CHANGE_NOTIFICATION;
Harald Welte422f0722017-08-01 00:27:06 +0200862 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200863 )"
864 };
865
866 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
867 with { extension "prototype(convert) encode(RAW)" };
868 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
869 with { extension "prototype(convert) decode(RAW)" };
870
871 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
872
873 /* 12.3 Ack/Nack Description */
874 type record AckNackDescription {
875 BIT1 final_ack,
876 uint7_t starting_seq_nr,
877 ReceivedBlockBitmap receive_block_bitmap
878 } with { variant "" };
879
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100880 /* 12.3.1 Egprs Ack/Nack Description */
881 type bitstring UncompressedReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
882 type record EgprsAckNackDescription {
883 BIT1 final_ack,
884 BIT1 begin_window,
885 BIT1 end_window,
886 uint11_t starting_seq_nr,
887 BIT1 compressed,
888 /* TODO: CompressedReceivedBlockBitmap urbb optional, */
889 UncompressedReceivedBlockBitmap urbb optional
890 } with { variant (urbb) "PRESENCE(compressed = '0'B)" };
891 type record EgprsAckNackDescriptionIE {
892 BIT1 len_present,
893 uint8_t len optional,
894 EgprsAckNackDescription acknack_desc
895 } with { variant (len) "PRESENCE(len_present = '1'B)"
896 variant (len) "LENGTHTO(acknack_desc)"
897 variant (len) "UNIT(bits)"
898 };
899
900
Harald Welte484160b2017-07-28 13:30:24 +0200901 /* 12.7 Channel Request Description */
902 type enumerated RlcMode {
903 RLC_MODE_ACKNOWLEDGED (0),
904 RLC_MODE_UNACKNOWLEDGED (1)
905 } with { variant "FIELDLENGTH(1)" };
906 type enumerated LlcPduType {
907 LLC_PDU_IS_SACK_OR_ACK (0),
908 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
909 } with { variant "FIELDLENGTH(1)" };
910 type record ChannelReqDescription {
911 uint4_t peak_tput_class,
912 uint2_t priority,
913 RlcMode rlc_mode,
914 LlcPduType llc_pdu_type,
915 uint16_t RlcOctetCount
916 } with { variant "" };
917
918 /* 12.8 Frequency Parameters */
919 type record FreqIndirect {
920 uint6_t maio,
921 uint4_t ma_number,
922 BIT1 change_mark1_present,
923 uint2_t change_mark1 optional,
924 BIT1 change_mark2_present,
925 uint2_t change_mark2 optional
926 } with {
927 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
928 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
929 };
930 type record FreqDirect1 {
931 uint6_t maio,
932 GprsMobileAllication mobile_allocation
933 }
934 type record FreqDirect2 {
935 uint6_t maio,
936 uint6_t hsn,
937 uint4_t ma_freq_len,
938 octetstring m1_freq_list
939 } with {
Vadim Yanitskiycb33c742020-07-21 02:43:57 +0700940 variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
Harald Welte484160b2017-07-28 13:30:24 +0200941 };
942 type record FrequencyParameters {
943 uint3_t tsc,
944 BIT2 presence,
945 uint10_t arfcn optional,
946 FreqIndirect indirect optional,
947 FreqDirect1 direct1 optional,
948 FreqDirect2 direct2 optional
949 } with {
950 variant (arfcn) "PRESENCE(presence = '00'B)"
951 variant (indirect) "PRESENCE(presence = '01'B)"
952 variant (direct1) "PRESENCE(presence = '10'B)"
953 variant (direct2) "PRESENCE(presence = '11'B)"
954 };
955
956 /* 12.10 Global TFI */
957 type record GlobalTfi {
958 boolean is_dl_tfi,
959 uint5_t tfi
960 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
961
962 /* 12.10a GPRS Mobile Allocation */
963 type record RflNumberList {
964 uint4_t rfl_number,
965 BIT1 presence,
966 RflNumberList rfl_number_list optional
967 } with {
968 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
969 };
970 type record GprsMobileAllication {
971 uint6_t hsn,
972 BIT1 rfl_number_list_present,
973 RflNumberList rfl_number_list optional,
974 BIT1 ma_present,
975 uint6_t ma_length optional,
Vadim Yanitskiy06c41612020-07-23 04:45:37 +0700976 bitstring ma_bitmap length(1..64) optional
Harald Welte484160b2017-07-28 13:30:24 +0200977 /* TODO: ARFCN index list */
978 } with {
979 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
980 variant (ma_length) "PRESENCE(ma_present = '0'B)"
981 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
Vadim Yanitskiy06c41612020-07-23 04:45:37 +0700982 variant (ma_length) "LENGTHTO(ma_bitmap)-1, UNIT(bits)"
Vadim Yanitskiy9fa1db52020-07-21 03:14:51 +0700983 variant (ma_bitmap) "BYTEORDER(first), BITORDER(msb)"
984 };
Harald Welte484160b2017-07-28 13:30:24 +0200985
986 /* 12.11 Packet Request Reference */
987 type record PacketRequestReference {
988 uint11_t ra_info,
989 uint16_t frame_nr
990 } with { variant "" };
991
992 /* 12.12 Packet Timing Advance */
993 type record PacketTimingAdvance {
994 BIT1 val_present,
995 uint6_t val optional,
996 BIT1 idx_present,
997 uint4_t idx optional,
998 uint3_t timeslot_nr optional
999 } with {
1000 variant (val) "PRESENCE(val_present = '1'B)"
1001 variant (idx) "PRESENCE(idx_present = '1'B)"
1002 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
1003 };
1004
1005 /* 12.13 Power Control Parameters */
1006 type record ZeroOneGamma {
1007 BIT1 gamma_present,
Vadim Yanitskiy4728e092020-07-22 14:10:45 +07001008 uint5_t gamma optional
Harald Welte484160b2017-07-28 13:30:24 +02001009 } with {
1010 variant (gamma) "PRESENCE (gamma_present = '1'B)"
1011 };
1012 type record length(8) of ZeroOneGamma ZeroOneGammas;
1013 type record PowerControlParameters {
1014 uint4_t alpha,
1015 ZeroOneGammas gamma
1016 } with { variant "" };
1017
1018 /* 12.14 Persistence Level */
1019 type record length(4) of uint4_t PersistenceLevels;
1020
1021 /* 12.20 Page Mode */
1022 type enumerated PageMode {
1023 PAGE_MODE_NORMAL ('00'B),
1024 PAGE_MODE_EXTENDED ('01'B),
1025 PAGE_MODE_REORG ('10'B),
1026 PAGE_MODE_SAME ('11'B)
1027 } with { variant "FIELDLENGTH(2)" };
1028
1029 /* 12.21 Starting Frame Number */
1030 type record StartingFnDesc {
1031 BIT1 presence,
1032 uint16_t absolute_starting_time optional,
1033 uint13_t relative_k optional
1034 } with {
1035 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
1036 variant (relative_k) "PRESENCE(presence = '1'B)"
1037 };
1038
Vadim Yanitskiy3911d112020-04-01 22:31:30 +07001039 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
1040 type union EGPRSPktChRequest {
1041 EGPRSPktChRequest_MC5P2RB3 one_phase,
1042 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
1043 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
1044 EGPRSPktChRequest_P2RB3 two_phase,
1045 EGPRSPktChRequest_RB5 signalling,
1046 EGPRSPktChRequest_RB5 one_phase_unack,
1047 EGPRSPktChRequest_RB5 dedicated,
1048 EGPRSPktChRequest_RB5 emergency,
1049 EGPRSPktChRequest_P2RB3 two_phase_ipa,
1050 EGPRSPktChRequest_RB5 signalling_ipa
1051 } with {
1052 variant "TAG (
1053 one_phase, tag = '0'B;
1054 short, tag = '100'B;
1055 one_phase_red, tag = '101'B;
1056 two_phase, tag = '110000'B;
1057 signalling, tag = '110011'B;
1058 one_phase_unack, tag = '110101'B;
1059 dedicated, tag = '110110'B;
1060 emergency, tag = '110111'B;
1061 two_phase_ipa, tag = '111000'B;
1062 signalling_ipa, tag = '111001'B;
1063 )"
1064 };
1065
1066 private type record EGPRSPktChRequest_MC5P2RB3 {
1067 BIT1 tag,
1068 BIT5 multislot_class,
1069 BIT2 priority,
1070 BIT3 random_bits
1071 };
1072
1073 private type record EGPRSPktChRequest_NOB3P2RB3 {
1074 BIT3 tag,
1075 BIT3 nr_of_blocks,
1076 BIT2 priority,
1077 BIT3 random_bits
1078 };
1079
1080 private type record EGPRSPktChRequest_MCG3P2RB3 {
1081 BIT3 tag,
1082 BIT3 multislot_class_group,
1083 BIT2 priority,
1084 BIT3 random_bits
1085 };
1086
1087 private type record EGPRSPktChRequest_P2RB3 {
1088 BIT6 tag,
1089 BIT2 priority,
1090 BIT3 random_bits
1091 };
1092
1093 private type record EGPRSPktChRequest_RB5 {
1094 BIT6 tag,
1095 BIT5 random_bits
1096 };
1097
1098 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
1099 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
1100 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
1101 with { extension "prototype(convert) encode(RAW)" };
1102
1103 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
1104 {
1105 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
1106 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
1107 }
1108
1109 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
1110 {
1111 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
1112 return bit2int(ra11);
1113 }
1114
Harald Welte7024baa2018-03-02 23:37:51 +01001115
Harald Welte484160b2017-07-28 13:30:24 +02001116} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };