blob: 6bdca40741ee047c80a6a280f1a093a58d63503c [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),
35 PACKET_DL_DUMMY_CTRL ('100101'B)
36 } with { variant "FIELDLENGTH(6)" };
37
38 /* TS 44.060 11.2.0.2 */
39 type enumerated RlcmacUlCtrlMsgType {
40 PACKET_CELL_CHANGE_FEATURE ('000000'B),
41 PACKET_CONTROL_ACK ('000001'B),
42 PACKET_DL_ACK_NACK ('000010'B),
43 PACKET_UL_DUMMY_CTRL ('000011'B),
44 PACKET_MEASUREMENT_REPORT ('000100'B),
45 PACKET_ENH_MEASUREMENT_REPORT ('001010'B),
46 PACKET_RESOURCE_REQUEST ('000101'B),
47 PACKET_MOBILE_TBF_STATUS ('000110'B),
48 PACKET_PSI_STATUS ('000111'B),
49 PACKET_EGPRS_DL_ACK_NACK ('001000'B),
50 PACKET_PAUSE ('001001'B),
51 ADDITIONAL_MS_RA_CAPABILITIES ('001011'B),
52 PACKET_CELL_CANGE_NOTIFICATION ('001100'B),
53 PACKET_SI_STATUS ('001101'B),
54 PACKET_CS_REQUEST ('001110'B),
55 MBMS_SERVICE_REQUEST ('001111'B),
56 MBMS_DL_ACK_NACK ('010000'B)
57 } with { variant "FIELDLENGTH(6)" };
58
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +020059 type enumerated EgprsChCodingCommand {
60 CH_CODING_MCS1 ('0000'B),
61 CH_CODING_MCS2 ('0001'B),
62 CH_CODING_MCS3 ('0010'B),
63 CH_CODING_MCS4 ('0011'B),
64 CH_CODING_MCS5 ('0100'B),
65 CH_CODING_MCS6 ('0101'B),
66 CH_CODING_MCS7 ('0110'B),
67 CH_CODING_MCS8 ('0111'B),
68 CH_CODING_MCS9 ('1000'B),
69 CH_CODING_MCS5_7 ('1001'B),
70 CH_CODING_MCS6_9 ('1010'B)
71 } with { variant "FIELDLENGTH(4)" };
72
73 /* TS 44.060 Table 12.5.2.1 */
74 type enumerated EgprsWindowSize { /* This probably needs to be moved to RLCMAC_CSN1_Types.ttcn */
75 EGPRS_WS_64 ('00000'B),
76 EGPRS_WS_96 ('00001'B),
77 EGPRS_WS_128 ('00010'B),
78 EGPRS_WS_160 ('00011'B),
79 EGPRS_WS_192 ('00100'B),
80 EGPRS_WS_224 ('00101'B),
81 EGPRS_WS_256 ('00110'B),
82 EGPRS_WS_288 ('00111'B),
83 EGPRS_WS_320 ('01000'B),
84 EGPRS_WS_352 ('01001'B),
85 EGPRS_WS_384 ('01010'B),
86 EGPRS_WS_416 ('01011'B),
87 EGPRS_WS_448 ('01100'B),
88 EGPRS_WS_480 ('01101'B),
89 EGPRS_WS_512 ('01110'B),
90 EGPRS_WS_544 ('01111'B),
91 EGPRS_WS_576 ('10000'B),
92 EGPRS_WS_608 ('10001'B),
93 EGPRS_WS_640 ('10010'B),
94 EGPRS_WS_672 ('10011'B),
95 EGPRS_WS_704 ('10100'B),
96 EGPRS_WS_736 ('10101'B),
97 EGPRS_WS_768 ('10110'B),
98 EGPRS_WS_800 ('10111'B),
99 EGPRS_WS_832 ('11000'B),
100 EGPRS_WS_864 ('11001'B),
101 EGPRS_WS_896 ('11010'B),
102 EGPRS_WS_928 ('11011'B),
103 EGPRS_WS_960 ('11100'B),
104 EGPRS_WS_992 ('11101'B),
105 EGPRS_WS_1024 ('11110'B)
106 } with { variant "FIELDLENGTH(5)" };
107
Harald Welte484160b2017-07-28 13:30:24 +0200108 type record NullGlobalTfi {
109 BIT1 presence ('0'B),
110 GlobalTfi global_tfi
111 } with { variant "" };
112
113 type record TenTlli {
114 BIT2 presence ('10'B),
115 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100116 } with { variant ""
117 variant (tlli) "BYTEORDER(first)"
118 };
Harald Welte484160b2017-07-28 13:30:24 +0200119
120 type union GlobalTfiOrTlli {
121 NullGlobalTfi global_tfi,
122 TenTlli tlli
123 };
124
125 /* 11.2.7 Packet Downlink Assignment */
126 type record PacketDlAssignment {
127 PageMode page_mode,
128 BIT1 pres1,
129 PersistenceLevels persistence_levels optional,
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200130 GlobalTfiOrTlli tfi_or_tlli,
131 BIT1 egprs2('0'B), /* TODO: implement union with egprs2 */
132 BIT2 mac_mode,
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700133 BIT1 rlc_mode,
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200134 BIT1 control_ack,
135 BIT8 timeslot_alloc,
136 PacketTimingAdvance pkt_ta,
137 BIT1 p0_present,
138 uint4_t p0 optional,
139 BIT1 reserved('0'B) optional,
140 BIT1 pr_mode optional,
141 BIT1 freq_par_present,
142 FrequencyParameters freq_par optional,
143 BIT1 dl_tfi_ass_present,
144 uint5_t dl_tfi_assignment optional,
145 BIT1 pwr_ctrl_present,
146 PowerControlParameters pwr_ctrl optional,
147 BIT1 tbf_starting_time_present,
148 StartingFnDesc tbf_starting_time optional,
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700149 /* The value '1' was allocated in an earlier version of the protocol */
150 BIT1 spare ('0'B),
151 /* Rel-{99,5,6,7,9,10,12,14} Additions (Matrioshka) */
152 PktDlAssRelAdditions rel_additions optional
Harald Welte484160b2017-07-28 13:30:24 +0200153 } with {
154 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200155 variant (p0) "PRESENCE(p0_present = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200156 variant (reserved) "PRESENCE(p0_present = '1'B)"
157 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
158 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
159 variant (dl_tfi_assignment) "PRESENCE(dl_tfi_ass_present = '1'B)"
160 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
161 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700162 };
163
164 private type record PktDlAssRelAdditions {
165 BIT1 rel99_presence, // 0/1
166 PktDlAssR99Additions rel99 optional
167 } with {
168 variant (rel99) "PRESENCE(rel99_presence = '1'B)"
169 };
170
171 private type record PktDlAssR99Additions {
172 BIT1 egprs_present,
173 PktDlAssR99EGPRS egprs optional,
174 BIT1 pkt_ext_ta_present,
175 BIT2 pkt_ext_ta optional,
176 BIT1 compact_reduced_ma_present,
177 COMPACTreducedMA compact_reduced_ma optional
178 /* TODO: Additions for REL-5 */
179 } with {
180 variant (egprs) "PRESENCE(egprs_present = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200181 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
182 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200183 };
184
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700185 private type record PktDlAssR99EGPRS {
186 EgprsWindowSize window_size,
187 BIT2 link_quality_meas_mode,
188 BIT1 bep_period2_present,
189 BIT4 bep_period2 optional
190 } with {
191 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
192 };
193
Harald Welte484160b2017-07-28 13:30:24 +0200194 /* 11.2.29 Packet Uplink Assignment */
195 type record O_Gtfi {
196 BIT1 presence ('0'B),
197 GlobalTfi global_tfi
198 } with { variant "" };
199 type record IO_Tlli {
200 BIT2 presence ('10'B),
201 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100202 } with { variant ""
203 variant (tlli) "BYTEORDER(first)"
204 };
Harald Welte484160b2017-07-28 13:30:24 +0200205 type record IIO_Tqi {
206 BIT3 presence ('110'B),
207 PacketRequestReference pkt_req_ref
208 } with { variant "" };
209 type union PktUlAssUnion {
210 O_Gtfi global_tfi,
211 IO_Tlli tlli,
212 IIO_Tqi tqi
213 } with {
214 variant "TAG(global_tfi, presence = '0'B;
215 tlli, presence = '10'B;
216 tqi, presence = '110'B)"
217 };
218 type record DynamicAllocation {
219 BIT1 extd_dyn_alloc,
220 BIT1 p0_present,
221 uint4_t p0 optional,
222 BIT1 pr_mode optional,
223 BIT1 usf_granularity,
224 BIT1 ul_tfi_ass_present,
225 uint5_t ul_tfi_assignment optional,
226 BIT1 reserved ('0'B),
227 BIT1 tbf_starting_time_present,
228 StartingFnDesc tbf_starting_time optional,
229 TsAllocationUnion ts_allocation
230 } with {
231 variant (p0) "PRESENCE(p0_present = '1'B)"
232 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
233 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
234 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
235 };
236 type record TsAllocationTs {
237 BIT1 presence,
238 uint3_t usf_tn optional
239 } with {
240 variant (usf_tn) "PRESENCE(presence = '1'B)"
241 };
242 type record length(8) of TsAllocationTs TsAllocationTsArr;
243 type record TnGamma {
244 BIT1 presence,
245 uint3_t usf_tn optional,
246 uint5_t gamma_tn optional
247 } with {
248 variant (usf_tn) "PRESENCE(presence = '1'B)"
249 variant (gamma_tn) "PRESENCE(presence = '1'B)"
250 };
251 type record length(8) of TnGamma TnGamma8;
252 type record TsAllocationPwr {
253 uint4_t alpha,
254 TnGamma tn_gamma
255 } with { variant "" };
256 type record TsAllocationUnion {
257 BIT1 presence,
258 TsAllocationTsArr ts optional,
259 TsAllocationPwr ts_with_pwr optional
260 } with {
261 variant (ts) "PRESENCE(presence = '0'B)"
262 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
263 };
264 type record SingleBlockAllocation {
265 uint3_t timeslot_nr,
266 BIT1 alpha_present,
267 uint4_t alpha optional,
268 uint5_t gamma_tn,
269 BIT1 p0_present,
270 uint4_t p0 optional,
271 BIT1 reserved ('0'B) optional,
272 BIT1 pr_mode optional,
273 StartingFnDesc tbf_starting_time
274 } with {
275 variant (alpha) "PRESENCE(alpha_present = '1'B)"
276 variant (p0) "PRESENCE(p0_present = '1'B)"
277 variant (reserved) "PRESENCE(p0_present = '1'B)"
278 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
279 };
280 type record PktUlAssGprs {
281 ChCodingCommand ch_coding_cmd,
282 BIT1 tlli_block_chan_coding,
283 PacketTimingAdvance pkt_ta,
284 BIT1 freq_par_present,
285 FrequencyParameters freq_par optional,
286 BIT2 alloc_present,
287 DynamicAllocation dyn_block_alloc optional,
288 SingleBlockAllocation sgl_block_alloc optional
289 } with {
290 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
291 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
292 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
293 };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200294 type record COMPACTreducedMA {
295 uint7_t ma_bitmap_length,
296 bitstring ma_bitmap,
297 BIT1 maio_2_present,
Vadim Yanitskiyfdbfd6e2020-07-22 14:38:20 +0700298 BIT6 maio_2 optional
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200299 } with {
300 variant (ma_bitmap_length) "LENGTHTO (ma_bitmap)"
301 variant (ma_bitmap_length) "UNIT(bits)"
302 variant (maio_2) "PRESENCE(maio_2_present = '1'B)"
303 };
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +0200304 type record of AccessTechnologiesRequest AccessTechnologiesRequestRepetition
305 with { variant "EXTENSION_BIT(reverse)" };
306 type record AccessTechnologiesRequest
307 {
308 BIT4 accessTechnType,
309 BIT1 extensionBit
310 } with { variant "FIELDORDER(msb)" };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200311 type record MultiBlockAllocation {
312 uint3_t timeslot_nr,
313 BIT1 alpha_gamma_present,
314 uint4_t alpha optional,
315 uint5_t gamma_tn optional,
316 BIT1 p0_present,
317 uint4_t p0 optional,
318 BIT1 reserved ('0'B) optional,
319 BIT1 pr_mode optional,
320 StartingFnDesc tbf_starting_time,
321 uint2_t num_radio_blocks_alloc
322 } with {
323 variant (alpha) "PRESENCE(alpha_gamma_present = '1'B)"
324 variant (gamma_tn) "PRESENCE(alpha_gamma_present = '1'B)"
325 variant (p0) "PRESENCE(p0_present = '1'B)"
326 variant (reserved) "PRESENCE(p0_present = '1'B)"
327 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
328 };
329 type record PktUlAssEgprs {
330 BIT2 dual_carrier('00'B), /*TODO 01 -- Message escape for dual carrier, RTTI, BTTI with FANR activated, EGPRS2 */
331 BIT1 tlli_present,
332 GprsTlli tlli optional,
333 BIT1 compact_reduced_ma_present,
334 COMPACTreducedMA compact_reduced_ma optional,
335 EgprsChCodingCommand chan_coding_cmd,
336 BIT1 resegment,
337 EgprsWindowSize window_size,
338 BIT1 ats_present,
339 AccessTechnologiesRequestRepetition ats optional, /* ? */
340 BIT1 arac_retrans_req,
341 BIT1 tlli_block_chan_coding,
342 BIT1 bep_period2_present,
343 BIT4 bep_period2 optional,
344 PacketTimingAdvance pkt_ta,
345 BIT1 pkt_ext_ta_present,
346 BIT2 pkt_ext_ta optional,
347 BIT1 freq_par_present,
348 FrequencyParameters freq_par optional,
349 BIT2 alloc_present,
350 DynamicAllocation dyn_block_alloc optional,
351 MultiBlockAllocation multi_block_alloc optional
352 /* TODO: Additions for Rel-5 and more */
353 } with {
354 variant (tlli) "PRESENCE(tlli_present = '1'B)"
355 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
356 variant (ats) "PRESENCE(ats_present = '1'B)"
357 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
358 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
359 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
360 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
361 variant (multi_block_alloc) "PRESENCE(alloc_present = '10'B)"
362 };
Harald Welte484160b2017-07-28 13:30:24 +0200363 type record PacketUlAssignment {
364 PageMode page_mode,
365 BIT1 persistence_levels_present,
366 PersistenceLevels persistence_levels optional,
367 PktUlAssUnion identity,
368 BIT1 is_egprs, /* msg escape */
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200369 PktUlAssGprs gprs optional,
370 PktUlAssEgprs egprs optional
371 /* TODO: Table 11.2.29.1: PACKET UPLINK ASSIGNMENT information elements
372 https://www.etsi.org/deliver/etsi_ts/144000_144099/144060/09.03.00_60/ts_144060v090300p.pdf */
Harald Welte484160b2017-07-28 13:30:24 +0200373 } with {
374 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
375 variant (gprs) "PRESENCE(is_egprs = '0'B)"
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200376 variant (egprs) "PRESENCE(is_egprs = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200377 };
378
379 /* 11.2.10 Packet Paging Request */
Stefan Sperling59c15d62018-10-10 11:09:25 +0200380 type record MobileIdentityLV_Paging {
381 /* Note that the size of 'len' differs from that of the Mobile Identify IE
382 * as defined in 3GPP TS 24.008 10.5.1.4 "Mobile Identity"; Paging Requests
383 * use only 4 bit to encode the length of a mobile identity, whereas the IE
384 * uses a byte. */
Harald Welte484160b2017-07-28 13:30:24 +0200385 uint4_t len,
386 octetstring mobile_id
Vadim Yanitskiy322c7932020-01-01 23:03:47 +0100387 } with {
388 variant (len) "LENGTHTO(mobile_id)"
389 variant (mobile_id) "BYTEORDER(first)"
390 };
Harald Welte484160b2017-07-28 13:30:24 +0200391 type record PageInfoPs {
392 BIT1 presence ('0'B),
393 BIT1 ptmsi_or_mobile_id,
394 GsmTmsi ptmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200395 MobileIdentityLV_Paging mobile_identity optional
Harald Welte484160b2017-07-28 13:30:24 +0200396 } with {
397 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
398 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
399 };
400 type record PageInfoCs {
401 BIT1 presence ('1'B),
402 BIT1 tmsi_or_mobile_id,
403 GsmTmsi tmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200404 MobileIdentityLV_Paging mobile_identity optional,
Harald Welte484160b2017-07-28 13:30:24 +0200405 ChannelNeeded chan_needed,
406 BIT1 emlpp_prio_present,
407 uint3_t emlpp_prio optional
408 } with {
409 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
410 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
411 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
412 };
413 type union PageInfo {
414 PageInfoPs ps,
415 PageInfoCs cs
Vadim Yanitskiy5e518732020-01-01 21:27:18 +0100416 } with {
417 variant "TAG(ps, presence = '0'B; cs, presence = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200418 };
419 type record PacketPagingReq {
420 PageMode page_mode,
421 BIT1 persistence_levels_present,
422 PersistenceLevels persistence_levels optional,
423 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200424 uint2_t nln optional,
425 BIT1 repeated_pageinfo_present,
426 PageInfo repeated_pageinfo optional
Harald Welte484160b2017-07-28 13:30:24 +0200427 } with {
428 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
429 variant (nln) "PRESENCE(nln_present = '1'B)"
Oliver Smith8f9daab2019-10-09 09:27:19 +0200430 variant (repeated_pageinfo) "PRESENCE(repeated_pageinfo_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200431 };
432
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200433 /* 12.26 Extension Bits IE */
434 type record ExtensionBits {
435 uint6_t extension_length,
436 bitstring spare_bits
437 } with {
438 variant (extension_length) "LENGTHTO(spare_bits) - 1"
439 variant (extension_length) "UNIT(bits)"
440 };
441
Harald Welte484160b2017-07-28 13:30:24 +0200442 /* 11.2.28 Uplink Ack/Nack */
443 type enumerated ChCodingCommand {
444 CH_CODING_CS1 ('00'B),
445 CH_CODING_CS2 ('01'B),
446 CH_CODING_CS3 ('10'B),
447 CH_CODING_CS4 ('11'B)
448 } with { variant "FIELDLENGTH(2)" };
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200449 type record UlAckNackGprsAdditionsRel99 {
450 BIT1 ext_pkt_ta_present,
451 BIT2 ext_pkt_ta optional,
452 boolean tbf_est
453 /* TODO: Rel5 ,... */
454 } with {
455 variant (ext_pkt_ta) "PRESENCE(ext_pkt_ta_present = '1'B)"
456 variant (tbf_est) "FIELDLENGTH(1)"
457 };
Harald Welte484160b2017-07-28 13:30:24 +0200458 type record UlAckNackGprs {
459 ChCodingCommand ch_coding_cmd,
460 AckNackDescription ack_nack_desc,
461 BIT1 cont_res_tlli_present,
462 GprsTlli cont_res_tlli optional,
463 BIT1 pkt_ta_present,
464 PacketTimingAdvance pkt_ta optional,
465 BIT1 pwr_ctrl_present,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200466 PowerControlParameters pwr_ctrl optional,
467 BIT1 extension_bits_present,
468 ExtensionBits extension_bits optional,
469 BIT1 not_used ('0'B),
470 BIT1 rel99_present,
471 UlAckNackGprsAdditionsRel99 rel99 optional
Harald Welte484160b2017-07-28 13:30:24 +0200472 } with {
473 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
474 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
475 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200476 variant (extension_bits) "PRESENCE(extension_bits_present = '1'B)"
477 variant (rel99) "PRESENCE(rel99_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100478 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200479 };
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200480 type record UlAckNackEgprs {
481 EgprsChCodingCommand ch_coding_cmd,
482 BIT1 resegment,
483 BIT1 preemptive_tx,
484 BIT1 prr_retrans_req,
485 BIT1 arac_retrans_req,
486 BIT1 cont_res_tlli_present,
487 GprsTlli cont_res_tlli optional,
488 BIT1 tbf_est,
489 BIT1 pkt_ta_present,
490 PacketTimingAdvance pkt_ta optional,
491 BIT1 pkt_ext_ta_present,
492 BIT2 pkt_ext_ta optional,
493 BIT1 pwr_ctrl_present,
494 PowerControlParameters pwr_ctrl optional
495 /* TODO: TS 44.060 12.3.1 EGPRS Ack/Nack Description */
496 /* EgprsAckNackDescription ack_nack_desc, */
497 /* BIT1 not_used('0'B) */
498 /* TODO: Extension Bits, Rel5 ,... */
499 } with {
500 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
501 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
502 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
503 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
504 variant (cont_res_tlli) "BYTEORDER(first)"
505 };
Harald Welte484160b2017-07-28 13:30:24 +0200506 type record PacketUlAckNack {
507 PageMode page_mode,
508 BIT2 msg_excape ('00'B),
509 uint5_t uplink_tfi,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200510 BIT1 is_egprs,
511 UlAckNackGprs gprs optional,
512 UlAckNackEgprs egprs optional
Harald Welte484160b2017-07-28 13:30:24 +0200513 /* TODO: EGPRS */
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200514 } with {
515 variant (gprs) "PRESENCE(is_egprs = '0'B)"
516 variant (egprs) "PRESENCE(is_egprs = '1'B)"
517 };
Harald Welte484160b2017-07-28 13:30:24 +0200518
519 /* 11.2.8 Packet Downlink Dummy Control Block */
520 type record PacketDlDummy {
521 PageMode page_mode,
522 BIT1 persistence_levels_present,
523 PersistenceLevels persistence_levels optional
524 } with {
525 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
526 };
527
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700528 /* 11.9 Global Power Control Parameters */
529 type record GlobalPwrCtrlParams {
530 uint4_t alpha,
531 uint5_t t_avg_v,
532 uint5_t t_avg_t,
533 uint4_t pb,
534 BIT1 pc_meas_chan,
535 BIT1 spare ('0'B),
536 uint4_t n_avg_i
537 };
538
539 /* 12.12a Global Packet Timing Advance */
540 type record TimingAdvanceIdxTN {
541 uint4_t ta_idx,
542 uint3_t ts_num
543 };
544 type record GlobalPacketTA {
545 BIT1 ta_val_presence,
546 uint4_t ta_val optional,
547 BIT1 ul_presence,
548 TimingAdvanceIdxTN ul optional,
549 BIT1 dl_presence,
550 TimingAdvanceIdxTN dl optional
551 } with {
552 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
553 variant (ul) "PRESENCE(ul_presence = '1'B)"
554 variant (dl) "PRESENCE(dl_presence = '1'B)"
555 };
556
557 /* 11.2.13 Packet Power Control/Timing Advance */
558 type record PacketPwrControlTAMsg {
559 BIT1 g_pwr_ctrl_presence,
560 GlobalPwrCtrlParams g_pwr_ctrl optional,
561 BIT1 split,
562 BIT1 split_desc optional,
563 GlobalPacketTA g_pkt_ta optional,
564 PowerControlParameters pwr_ctrl optional
565 /* TODO: additions for R99, REL-7, REL-12 */
566 } with {
567 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
568 variant (split_desc) "PRESENCE(split = '1'B)"
569 /* FIXME: Fancy coding: either both IEs together, or one of them */
570 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
571 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
572 };
573 type record PacketPwrControlTA {
574 PageMode page_mode,
575 NullGlobalTfi global_tfi,
576 /* See 11.1.3.3 'Message escape' error label
577 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
578 BIT1 msg_escape,
579 PacketPwrControlTAMsg msg optional
580 } with {
581 variant (msg) "PRESENCE(msg_escape = '0'B)"
582 };
583
Harald Welte484160b2017-07-28 13:30:24 +0200584 /* 11.2.0.1 */
585 type union RlcmacDlCtrlUnion {
586 PacketDlAssignment dl_assignment,
587 PacketUlAssignment ul_assignment,
588 PacketPagingReq paging,
589 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200590 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700591 PacketPwrControlTA pwr_ta,
Harald Welte422f0722017-08-01 00:27:06 +0200592 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200593 } with { variant "" };
594
595 type record RlcmacDlCtrlMsg {
596 RlcmacDlCtrlMsgType msg_type,
597 RlcmacDlCtrlUnion u
598 } with {
599 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
600 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
601 paging, msg_type = PACKET_PAGING_REQUEST;
602 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200603 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700604 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Harald Welte422f0722017-08-01 00:27:06 +0200605 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200606 )"
607 };
608
609 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
610 with { extension "prototype(convert) encode(RAW)" };
611 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
612 with { extension "prototype(convert) decode(RAW)" };
613
614
615 /* 11.2.6 Packet Downlikn Ack/Nack */
616 type record ILevel {
617 BIT1 presence,
618 uint4_t i_level optional
619 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
620 type record length(8) of ILevel ILevels;
621 type record ChannelQualityReport {
622 uint6_t c_value,
623 uint3_t rxqual,
624 uint6_t sign_var,
625 ILevels i_levels
626 } with { variant "" };
627 type record PacketDlAckNack {
628 uint5_t dl_tfi,
629 AckNackDescription ack_nack_desc,
630 BIT1 chreq_desc_presence,
631 ChannelReqDescription chreq_desc optional,
632 ChannelQualityReport ch_qual_rep
633 } with { variant "" };
634
635 /* 11.2.2 Packet Control Acknowledgement */
636 type enumerated CtrlAck {
637 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
638 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
639 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
640 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
641 } with { variant "FIELDLENGTH(2)" };
642 type record PacketCtrlAck {
643 GprsTlli tlli,
644 CtrlAck ctrl_ack
645 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100646 } with { variant ""
647 variant (tlli) "BYTEORDER(first)"
648 };
Harald Welte484160b2017-07-28 13:30:24 +0200649
650 /* 1.2.8b Packet Uplink Dummy Control Block */
651 type record PacketUlDummy {
652 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100653 } with { variant ""
654 variant (tlli) "BYTEORDER(first)"
655 };
Harald Welte484160b2017-07-28 13:30:24 +0200656
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200657 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
658 * (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 +0200659 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100660 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200661 };
662
663 /* Table 11.2.16.2 Access Type */
664 type enumerated RlcAccessType {
665 RLC_ACC_TYPE_TWO_PHASE ('00'B),
666 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
667 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
668 RLC_ACC_TYPE_MM ('11'B)
669 } with { variant "FIELDLENGTH(2)" };
670
671 type union PacketResourceReqID {
672 GlobalTfi gtfi,
673 GprsTlli tlli
674 } with { variant (tlli) "BYTEORDER(first)" };
675
676 /* 11.2.16 Packet Resource Request */
677 type record PacketResourceReq {
678 BIT1 acc_type_presence,
679 RlcAccessType acc_type optional,
680 BIT1 id_type,
681 PacketResourceReqID id,
682 BIT1 ms_rac2_presence,
683 MSRadioAccCap2 ms_rac2 optional,
684 ChannelReqDescription ch_req_desc,
685 BIT1 change_mark_presence,
686 BIT2 change_mark optional,
687 BIT6 C_val,
688 BIT1 sign_var_presence,
689 BIT6 sign_var optional,
690 ILevels I_levels
691 /* TODO: additional contents for further Releases (starting from 1999) */
692 } with {
693 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
694 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
695 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
696 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
697 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
698 };
699
Harald Welte484160b2017-07-28 13:30:24 +0200700 /* 11.2.0.2 */
701 type union RlcmacUlCtrlUnion {
702 PacketCtrlAck ctrl_ack,
703 PacketDlAckNack dl_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200704 PacketUlDummy ul_dummy,
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200705 PacketResourceReq resource_req,
Harald Welte422f0722017-08-01 00:27:06 +0200706 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200707 } with { variant "" };
708
709 type record RlcmacUlCtrlMsg {
710 RlcmacUlCtrlMsgType msg_type,
711 RlcmacUlCtrlUnion u
712 } with {
713 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
714 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200715 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200716 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Harald Welte422f0722017-08-01 00:27:06 +0200717 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200718 )"
719 };
720
721 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
722 with { extension "prototype(convert) encode(RAW)" };
723 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
724 with { extension "prototype(convert) decode(RAW)" };
725
726 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
727
728 /* 12.3 Ack/Nack Description */
729 type record AckNackDescription {
730 BIT1 final_ack,
731 uint7_t starting_seq_nr,
732 ReceivedBlockBitmap receive_block_bitmap
733 } with { variant "" };
734
735 /* 12.7 Channel Request Description */
736 type enumerated RlcMode {
737 RLC_MODE_ACKNOWLEDGED (0),
738 RLC_MODE_UNACKNOWLEDGED (1)
739 } with { variant "FIELDLENGTH(1)" };
740 type enumerated LlcPduType {
741 LLC_PDU_IS_SACK_OR_ACK (0),
742 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
743 } with { variant "FIELDLENGTH(1)" };
744 type record ChannelReqDescription {
745 uint4_t peak_tput_class,
746 uint2_t priority,
747 RlcMode rlc_mode,
748 LlcPduType llc_pdu_type,
749 uint16_t RlcOctetCount
750 } with { variant "" };
751
752 /* 12.8 Frequency Parameters */
753 type record FreqIndirect {
754 uint6_t maio,
755 uint4_t ma_number,
756 BIT1 change_mark1_present,
757 uint2_t change_mark1 optional,
758 BIT1 change_mark2_present,
759 uint2_t change_mark2 optional
760 } with {
761 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
762 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
763 };
764 type record FreqDirect1 {
765 uint6_t maio,
766 GprsMobileAllication mobile_allocation
767 }
768 type record FreqDirect2 {
769 uint6_t maio,
770 uint6_t hsn,
771 uint4_t ma_freq_len,
772 octetstring m1_freq_list
773 } with {
Vadim Yanitskiycb33c742020-07-21 02:43:57 +0700774 variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
Harald Welte484160b2017-07-28 13:30:24 +0200775 };
776 type record FrequencyParameters {
777 uint3_t tsc,
778 BIT2 presence,
779 uint10_t arfcn optional,
780 FreqIndirect indirect optional,
781 FreqDirect1 direct1 optional,
782 FreqDirect2 direct2 optional
783 } with {
784 variant (arfcn) "PRESENCE(presence = '00'B)"
785 variant (indirect) "PRESENCE(presence = '01'B)"
786 variant (direct1) "PRESENCE(presence = '10'B)"
787 variant (direct2) "PRESENCE(presence = '11'B)"
788 };
789
790 /* 12.10 Global TFI */
791 type record GlobalTfi {
792 boolean is_dl_tfi,
793 uint5_t tfi
794 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
795
796 /* 12.10a GPRS Mobile Allocation */
797 type record RflNumberList {
798 uint4_t rfl_number,
799 BIT1 presence,
800 RflNumberList rfl_number_list optional
801 } with {
802 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
803 };
804 type record GprsMobileAllication {
805 uint6_t hsn,
806 BIT1 rfl_number_list_present,
807 RflNumberList rfl_number_list optional,
808 BIT1 ma_present,
809 uint6_t ma_length optional,
810 bitstring ma_bitmap optional
811 /* TODO: ARFCN index list */
812 } with {
813 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
814 variant (ma_length) "PRESENCE(ma_present = '0'B)"
815 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
Vadim Yanitskiycb33c742020-07-21 02:43:57 +0700816 variant (ma_length) "LENGTHTO(ma_bitmap)+1"
Vadim Yanitskiy9fa1db52020-07-21 03:14:51 +0700817 variant (ma_bitmap) "BYTEORDER(first), BITORDER(msb)"
818 };
Harald Welte484160b2017-07-28 13:30:24 +0200819
820 /* 12.11 Packet Request Reference */
821 type record PacketRequestReference {
822 uint11_t ra_info,
823 uint16_t frame_nr
824 } with { variant "" };
825
826 /* 12.12 Packet Timing Advance */
827 type record PacketTimingAdvance {
828 BIT1 val_present,
829 uint6_t val optional,
830 BIT1 idx_present,
831 uint4_t idx optional,
832 uint3_t timeslot_nr optional
833 } with {
834 variant (val) "PRESENCE(val_present = '1'B)"
835 variant (idx) "PRESENCE(idx_present = '1'B)"
836 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
837 };
838
839 /* 12.13 Power Control Parameters */
840 type record ZeroOneGamma {
841 BIT1 gamma_present,
Vadim Yanitskiy4728e092020-07-22 14:10:45 +0700842 uint5_t gamma optional
Harald Welte484160b2017-07-28 13:30:24 +0200843 } with {
844 variant (gamma) "PRESENCE (gamma_present = '1'B)"
845 };
846 type record length(8) of ZeroOneGamma ZeroOneGammas;
847 type record PowerControlParameters {
848 uint4_t alpha,
849 ZeroOneGammas gamma
850 } with { variant "" };
851
852 /* 12.14 Persistence Level */
853 type record length(4) of uint4_t PersistenceLevels;
854
855 /* 12.20 Page Mode */
856 type enumerated PageMode {
857 PAGE_MODE_NORMAL ('00'B),
858 PAGE_MODE_EXTENDED ('01'B),
859 PAGE_MODE_REORG ('10'B),
860 PAGE_MODE_SAME ('11'B)
861 } with { variant "FIELDLENGTH(2)" };
862
863 /* 12.21 Starting Frame Number */
864 type record StartingFnDesc {
865 BIT1 presence,
866 uint16_t absolute_starting_time optional,
867 uint13_t relative_k optional
868 } with {
869 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
870 variant (relative_k) "PRESENCE(presence = '1'B)"
871 };
872
Vadim Yanitskiy3911d112020-04-01 22:31:30 +0700873 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
874 type union EGPRSPktChRequest {
875 EGPRSPktChRequest_MC5P2RB3 one_phase,
876 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
877 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
878 EGPRSPktChRequest_P2RB3 two_phase,
879 EGPRSPktChRequest_RB5 signalling,
880 EGPRSPktChRequest_RB5 one_phase_unack,
881 EGPRSPktChRequest_RB5 dedicated,
882 EGPRSPktChRequest_RB5 emergency,
883 EGPRSPktChRequest_P2RB3 two_phase_ipa,
884 EGPRSPktChRequest_RB5 signalling_ipa
885 } with {
886 variant "TAG (
887 one_phase, tag = '0'B;
888 short, tag = '100'B;
889 one_phase_red, tag = '101'B;
890 two_phase, tag = '110000'B;
891 signalling, tag = '110011'B;
892 one_phase_unack, tag = '110101'B;
893 dedicated, tag = '110110'B;
894 emergency, tag = '110111'B;
895 two_phase_ipa, tag = '111000'B;
896 signalling_ipa, tag = '111001'B;
897 )"
898 };
899
900 private type record EGPRSPktChRequest_MC5P2RB3 {
901 BIT1 tag,
902 BIT5 multislot_class,
903 BIT2 priority,
904 BIT3 random_bits
905 };
906
907 private type record EGPRSPktChRequest_NOB3P2RB3 {
908 BIT3 tag,
909 BIT3 nr_of_blocks,
910 BIT2 priority,
911 BIT3 random_bits
912 };
913
914 private type record EGPRSPktChRequest_MCG3P2RB3 {
915 BIT3 tag,
916 BIT3 multislot_class_group,
917 BIT2 priority,
918 BIT3 random_bits
919 };
920
921 private type record EGPRSPktChRequest_P2RB3 {
922 BIT6 tag,
923 BIT2 priority,
924 BIT3 random_bits
925 };
926
927 private type record EGPRSPktChRequest_RB5 {
928 BIT6 tag,
929 BIT5 random_bits
930 };
931
932 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
933 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
934 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
935 with { extension "prototype(convert) encode(RAW)" };
936
937 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
938 {
939 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
940 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
941 }
942
943 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
944 {
945 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
946 return bit2int(ra11);
947 }
948
Harald Welte7024baa2018-03-02 23:37:51 +0100949
Harald Welte484160b2017-07-28 13:30:24 +0200950} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };