blob: d41f9e199fc32239b247233576cddf3f2fef8d4b [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
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200125 type record PacketDlAssignmentRel1999SubStruct {
126 EgprsWindowSize window_size,
127 BIT2 link_quality_meas_mode,
128 BIT1 bep_period2_present,
129 BIT4 bep_period2 optional
130 } with {
131 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
132 };
Harald Welte484160b2017-07-28 13:30:24 +0200133 /* 11.2.7 Packet Downlink Assignment */
134 type record PacketDlAssignment {
135 PageMode page_mode,
136 BIT1 pres1,
137 PersistenceLevels persistence_levels optional,
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200138 GlobalTfiOrTlli tfi_or_tlli,
139 BIT1 egprs2('0'B), /* TODO: implement union with egprs2 */
140 BIT2 mac_mode,
141 BIT2 rlc_mode,
142 BIT1 control_ack,
143 BIT8 timeslot_alloc,
144 PacketTimingAdvance pkt_ta,
145 BIT1 p0_present,
146 uint4_t p0 optional,
147 BIT1 reserved('0'B) optional,
148 BIT1 pr_mode optional,
149 BIT1 freq_par_present,
150 FrequencyParameters freq_par optional,
151 BIT1 dl_tfi_ass_present,
152 uint5_t dl_tfi_assignment optional,
153 BIT1 pwr_ctrl_present,
154 PowerControlParameters pwr_ctrl optional,
155 BIT1 tbf_starting_time_present,
156 StartingFnDesc tbf_starting_time optional,
157 BIT1 release1999('1'B),
158 BIT1 sub_present,
159 PacketDlAssignmentRel1999SubStruct sub optional,
160 BIT1 pkt_ext_ta_present,
161 BIT2 pkt_ext_ta optional,
162 BIT1 compact_reduced_ma_present,
163 COMPACTreducedMA compact_reduced_ma optional
164 /* TODO: Additions for REL-5 */
Harald Welte484160b2017-07-28 13:30:24 +0200165 } with {
166 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200167 variant (p0) "PRESENCE(p0_present = '1'B)"
168 variant (p0) "PRESENCE(p0_present = '1'B)"
169 variant (reserved) "PRESENCE(p0_present = '1'B)"
170 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
171 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
172 variant (dl_tfi_assignment) "PRESENCE(dl_tfi_ass_present = '1'B)"
173 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
174 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
175 variant (sub) "PRESENCE(sub_present = '1'B)"
176 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
177 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200178 };
179
180 /* 11.2.29 Packet Uplink Assignment */
181 type record O_Gtfi {
182 BIT1 presence ('0'B),
183 GlobalTfi global_tfi
184 } with { variant "" };
185 type record IO_Tlli {
186 BIT2 presence ('10'B),
187 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100188 } with { variant ""
189 variant (tlli) "BYTEORDER(first)"
190 };
Harald Welte484160b2017-07-28 13:30:24 +0200191 type record IIO_Tqi {
192 BIT3 presence ('110'B),
193 PacketRequestReference pkt_req_ref
194 } with { variant "" };
195 type union PktUlAssUnion {
196 O_Gtfi global_tfi,
197 IO_Tlli tlli,
198 IIO_Tqi tqi
199 } with {
200 variant "TAG(global_tfi, presence = '0'B;
201 tlli, presence = '10'B;
202 tqi, presence = '110'B)"
203 };
204 type record DynamicAllocation {
205 BIT1 extd_dyn_alloc,
206 BIT1 p0_present,
207 uint4_t p0 optional,
208 BIT1 pr_mode optional,
209 BIT1 usf_granularity,
210 BIT1 ul_tfi_ass_present,
211 uint5_t ul_tfi_assignment optional,
212 BIT1 reserved ('0'B),
213 BIT1 tbf_starting_time_present,
214 StartingFnDesc tbf_starting_time optional,
215 TsAllocationUnion ts_allocation
216 } with {
217 variant (p0) "PRESENCE(p0_present = '1'B)"
218 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
219 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
220 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
221 };
222 type record TsAllocationTs {
223 BIT1 presence,
224 uint3_t usf_tn optional
225 } with {
226 variant (usf_tn) "PRESENCE(presence = '1'B)"
227 };
228 type record length(8) of TsAllocationTs TsAllocationTsArr;
229 type record TnGamma {
230 BIT1 presence,
231 uint3_t usf_tn optional,
232 uint5_t gamma_tn optional
233 } with {
234 variant (usf_tn) "PRESENCE(presence = '1'B)"
235 variant (gamma_tn) "PRESENCE(presence = '1'B)"
236 };
237 type record length(8) of TnGamma TnGamma8;
238 type record TsAllocationPwr {
239 uint4_t alpha,
240 TnGamma tn_gamma
241 } with { variant "" };
242 type record TsAllocationUnion {
243 BIT1 presence,
244 TsAllocationTsArr ts optional,
245 TsAllocationPwr ts_with_pwr optional
246 } with {
247 variant (ts) "PRESENCE(presence = '0'B)"
248 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
249 };
250 type record SingleBlockAllocation {
251 uint3_t timeslot_nr,
252 BIT1 alpha_present,
253 uint4_t alpha optional,
254 uint5_t gamma_tn,
255 BIT1 p0_present,
256 uint4_t p0 optional,
257 BIT1 reserved ('0'B) optional,
258 BIT1 pr_mode optional,
259 StartingFnDesc tbf_starting_time
260 } with {
261 variant (alpha) "PRESENCE(alpha_present = '1'B)"
262 variant (p0) "PRESENCE(p0_present = '1'B)"
263 variant (reserved) "PRESENCE(p0_present = '1'B)"
264 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
265 };
266 type record PktUlAssGprs {
267 ChCodingCommand ch_coding_cmd,
268 BIT1 tlli_block_chan_coding,
269 PacketTimingAdvance pkt_ta,
270 BIT1 freq_par_present,
271 FrequencyParameters freq_par optional,
272 BIT2 alloc_present,
273 DynamicAllocation dyn_block_alloc optional,
274 SingleBlockAllocation sgl_block_alloc optional
275 } with {
276 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
277 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
278 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
279 };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200280 type record COMPACTreducedMA {
281 uint7_t ma_bitmap_length,
282 bitstring ma_bitmap,
283 BIT1 maio_2_present,
284 BIT6 maio_2
285 } with {
286 variant (ma_bitmap_length) "LENGTHTO (ma_bitmap)"
287 variant (ma_bitmap_length) "UNIT(bits)"
288 variant (maio_2) "PRESENCE(maio_2_present = '1'B)"
289 };
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +0200290 type record of AccessTechnologiesRequest AccessTechnologiesRequestRepetition
291 with { variant "EXTENSION_BIT(reverse)" };
292 type record AccessTechnologiesRequest
293 {
294 BIT4 accessTechnType,
295 BIT1 extensionBit
296 } with { variant "FIELDORDER(msb)" };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200297 type record MultiBlockAllocation {
298 uint3_t timeslot_nr,
299 BIT1 alpha_gamma_present,
300 uint4_t alpha optional,
301 uint5_t gamma_tn optional,
302 BIT1 p0_present,
303 uint4_t p0 optional,
304 BIT1 reserved ('0'B) optional,
305 BIT1 pr_mode optional,
306 StartingFnDesc tbf_starting_time,
307 uint2_t num_radio_blocks_alloc
308 } with {
309 variant (alpha) "PRESENCE(alpha_gamma_present = '1'B)"
310 variant (gamma_tn) "PRESENCE(alpha_gamma_present = '1'B)"
311 variant (p0) "PRESENCE(p0_present = '1'B)"
312 variant (reserved) "PRESENCE(p0_present = '1'B)"
313 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
314 };
315 type record PktUlAssEgprs {
316 BIT2 dual_carrier('00'B), /*TODO 01 -- Message escape for dual carrier, RTTI, BTTI with FANR activated, EGPRS2 */
317 BIT1 tlli_present,
318 GprsTlli tlli optional,
319 BIT1 compact_reduced_ma_present,
320 COMPACTreducedMA compact_reduced_ma optional,
321 EgprsChCodingCommand chan_coding_cmd,
322 BIT1 resegment,
323 EgprsWindowSize window_size,
324 BIT1 ats_present,
325 AccessTechnologiesRequestRepetition ats optional, /* ? */
326 BIT1 arac_retrans_req,
327 BIT1 tlli_block_chan_coding,
328 BIT1 bep_period2_present,
329 BIT4 bep_period2 optional,
330 PacketTimingAdvance pkt_ta,
331 BIT1 pkt_ext_ta_present,
332 BIT2 pkt_ext_ta optional,
333 BIT1 freq_par_present,
334 FrequencyParameters freq_par optional,
335 BIT2 alloc_present,
336 DynamicAllocation dyn_block_alloc optional,
337 MultiBlockAllocation multi_block_alloc optional
338 /* TODO: Additions for Rel-5 and more */
339 } with {
340 variant (tlli) "PRESENCE(tlli_present = '1'B)"
341 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
342 variant (ats) "PRESENCE(ats_present = '1'B)"
343 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
344 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
345 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
346 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
347 variant (multi_block_alloc) "PRESENCE(alloc_present = '10'B)"
348 };
Harald Welte484160b2017-07-28 13:30:24 +0200349 type record PacketUlAssignment {
350 PageMode page_mode,
351 BIT1 persistence_levels_present,
352 PersistenceLevels persistence_levels optional,
353 PktUlAssUnion identity,
354 BIT1 is_egprs, /* msg escape */
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200355 PktUlAssGprs gprs optional,
356 PktUlAssEgprs egprs optional
357 /* TODO: Table 11.2.29.1: PACKET UPLINK ASSIGNMENT information elements
358 https://www.etsi.org/deliver/etsi_ts/144000_144099/144060/09.03.00_60/ts_144060v090300p.pdf */
Harald Welte484160b2017-07-28 13:30:24 +0200359 } with {
360 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
361 variant (gprs) "PRESENCE(is_egprs = '0'B)"
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200362 variant (egprs) "PRESENCE(is_egprs = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200363 };
364
365 /* 11.2.10 Packet Paging Request */
Stefan Sperling59c15d62018-10-10 11:09:25 +0200366 type record MobileIdentityLV_Paging {
367 /* Note that the size of 'len' differs from that of the Mobile Identify IE
368 * as defined in 3GPP TS 24.008 10.5.1.4 "Mobile Identity"; Paging Requests
369 * use only 4 bit to encode the length of a mobile identity, whereas the IE
370 * uses a byte. */
Harald Welte484160b2017-07-28 13:30:24 +0200371 uint4_t len,
372 octetstring mobile_id
Vadim Yanitskiy322c7932020-01-01 23:03:47 +0100373 } with {
374 variant (len) "LENGTHTO(mobile_id)"
375 variant (mobile_id) "BYTEORDER(first)"
376 };
Harald Welte484160b2017-07-28 13:30:24 +0200377 type record PageInfoPs {
378 BIT1 presence ('0'B),
379 BIT1 ptmsi_or_mobile_id,
380 GsmTmsi ptmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200381 MobileIdentityLV_Paging mobile_identity optional
Harald Welte484160b2017-07-28 13:30:24 +0200382 } with {
383 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
384 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
385 };
386 type record PageInfoCs {
387 BIT1 presence ('1'B),
388 BIT1 tmsi_or_mobile_id,
389 GsmTmsi tmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200390 MobileIdentityLV_Paging mobile_identity optional,
Harald Welte484160b2017-07-28 13:30:24 +0200391 ChannelNeeded chan_needed,
392 BIT1 emlpp_prio_present,
393 uint3_t emlpp_prio optional
394 } with {
395 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
396 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
397 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
398 };
399 type union PageInfo {
400 PageInfoPs ps,
401 PageInfoCs cs
Vadim Yanitskiy5e518732020-01-01 21:27:18 +0100402 } with {
403 variant "TAG(ps, presence = '0'B; cs, presence = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200404 };
405 type record PacketPagingReq {
406 PageMode page_mode,
407 BIT1 persistence_levels_present,
408 PersistenceLevels persistence_levels optional,
409 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200410 uint2_t nln optional,
411 BIT1 repeated_pageinfo_present,
412 PageInfo repeated_pageinfo optional
Harald Welte484160b2017-07-28 13:30:24 +0200413 } with {
414 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
415 variant (nln) "PRESENCE(nln_present = '1'B)"
Oliver Smith8f9daab2019-10-09 09:27:19 +0200416 variant (repeated_pageinfo) "PRESENCE(repeated_pageinfo_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200417 };
418
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200419 /* 12.26 Extension Bits IE */
420 type record ExtensionBits {
421 uint6_t extension_length,
422 bitstring spare_bits
423 } with {
424 variant (extension_length) "LENGTHTO(spare_bits) - 1"
425 variant (extension_length) "UNIT(bits)"
426 };
427
Harald Welte484160b2017-07-28 13:30:24 +0200428 /* 11.2.28 Uplink Ack/Nack */
429 type enumerated ChCodingCommand {
430 CH_CODING_CS1 ('00'B),
431 CH_CODING_CS2 ('01'B),
432 CH_CODING_CS3 ('10'B),
433 CH_CODING_CS4 ('11'B)
434 } with { variant "FIELDLENGTH(2)" };
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200435 type record UlAckNackGprsAdditionsRel99 {
436 BIT1 ext_pkt_ta_present,
437 BIT2 ext_pkt_ta optional,
438 boolean tbf_est
439 /* TODO: Rel5 ,... */
440 } with {
441 variant (ext_pkt_ta) "PRESENCE(ext_pkt_ta_present = '1'B)"
442 variant (tbf_est) "FIELDLENGTH(1)"
443 };
Harald Welte484160b2017-07-28 13:30:24 +0200444 type record UlAckNackGprs {
445 ChCodingCommand ch_coding_cmd,
446 AckNackDescription ack_nack_desc,
447 BIT1 cont_res_tlli_present,
448 GprsTlli cont_res_tlli optional,
449 BIT1 pkt_ta_present,
450 PacketTimingAdvance pkt_ta optional,
451 BIT1 pwr_ctrl_present,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200452 PowerControlParameters pwr_ctrl optional,
453 BIT1 extension_bits_present,
454 ExtensionBits extension_bits optional,
455 BIT1 not_used ('0'B),
456 BIT1 rel99_present,
457 UlAckNackGprsAdditionsRel99 rel99 optional
Harald Welte484160b2017-07-28 13:30:24 +0200458 } with {
459 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
460 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
461 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200462 variant (extension_bits) "PRESENCE(extension_bits_present = '1'B)"
463 variant (rel99) "PRESENCE(rel99_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100464 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200465 };
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200466 type record UlAckNackEgprs {
467 EgprsChCodingCommand ch_coding_cmd,
468 BIT1 resegment,
469 BIT1 preemptive_tx,
470 BIT1 prr_retrans_req,
471 BIT1 arac_retrans_req,
472 BIT1 cont_res_tlli_present,
473 GprsTlli cont_res_tlli optional,
474 BIT1 tbf_est,
475 BIT1 pkt_ta_present,
476 PacketTimingAdvance pkt_ta optional,
477 BIT1 pkt_ext_ta_present,
478 BIT2 pkt_ext_ta optional,
479 BIT1 pwr_ctrl_present,
480 PowerControlParameters pwr_ctrl optional
481 /* TODO: TS 44.060 12.3.1 EGPRS Ack/Nack Description */
482 /* EgprsAckNackDescription ack_nack_desc, */
483 /* BIT1 not_used('0'B) */
484 /* TODO: Extension Bits, Rel5 ,... */
485 } with {
486 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
487 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
488 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
489 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
490 variant (cont_res_tlli) "BYTEORDER(first)"
491 };
Harald Welte484160b2017-07-28 13:30:24 +0200492 type record PacketUlAckNack {
493 PageMode page_mode,
494 BIT2 msg_excape ('00'B),
495 uint5_t uplink_tfi,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200496 BIT1 is_egprs,
497 UlAckNackGprs gprs optional,
498 UlAckNackEgprs egprs optional
Harald Welte484160b2017-07-28 13:30:24 +0200499 /* TODO: EGPRS */
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200500 } with {
501 variant (gprs) "PRESENCE(is_egprs = '0'B)"
502 variant (egprs) "PRESENCE(is_egprs = '1'B)"
503 };
Harald Welte484160b2017-07-28 13:30:24 +0200504
505 /* 11.2.8 Packet Downlink Dummy Control Block */
506 type record PacketDlDummy {
507 PageMode page_mode,
508 BIT1 persistence_levels_present,
509 PersistenceLevels persistence_levels optional
510 } with {
511 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
512 };
513
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700514 /* 11.9 Global Power Control Parameters */
515 type record GlobalPwrCtrlParams {
516 uint4_t alpha,
517 uint5_t t_avg_v,
518 uint5_t t_avg_t,
519 uint4_t pb,
520 BIT1 pc_meas_chan,
521 BIT1 spare ('0'B),
522 uint4_t n_avg_i
523 };
524
525 /* 12.12a Global Packet Timing Advance */
526 type record TimingAdvanceIdxTN {
527 uint4_t ta_idx,
528 uint3_t ts_num
529 };
530 type record GlobalPacketTA {
531 BIT1 ta_val_presence,
532 uint4_t ta_val optional,
533 BIT1 ul_presence,
534 TimingAdvanceIdxTN ul optional,
535 BIT1 dl_presence,
536 TimingAdvanceIdxTN dl optional
537 } with {
538 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
539 variant (ul) "PRESENCE(ul_presence = '1'B)"
540 variant (dl) "PRESENCE(dl_presence = '1'B)"
541 };
542
543 /* 11.2.13 Packet Power Control/Timing Advance */
544 type record PacketPwrControlTAMsg {
545 BIT1 g_pwr_ctrl_presence,
546 GlobalPwrCtrlParams g_pwr_ctrl optional,
547 BIT1 split,
548 BIT1 split_desc optional,
549 GlobalPacketTA g_pkt_ta optional,
550 PowerControlParameters pwr_ctrl optional
551 /* TODO: additions for R99, REL-7, REL-12 */
552 } with {
553 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
554 variant (split_desc) "PRESENCE(split = '1'B)"
555 /* FIXME: Fancy coding: either both IEs together, or one of them */
556 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
557 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
558 };
559 type record PacketPwrControlTA {
560 PageMode page_mode,
561 NullGlobalTfi global_tfi,
562 /* See 11.1.3.3 'Message escape' error label
563 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
564 BIT1 msg_escape,
565 PacketPwrControlTAMsg msg optional
566 } with {
567 variant (msg) "PRESENCE(msg_escape = '0'B)"
568 };
569
Harald Welte484160b2017-07-28 13:30:24 +0200570 /* 11.2.0.1 */
571 type union RlcmacDlCtrlUnion {
572 PacketDlAssignment dl_assignment,
573 PacketUlAssignment ul_assignment,
574 PacketPagingReq paging,
575 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200576 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700577 PacketPwrControlTA pwr_ta,
Harald Welte422f0722017-08-01 00:27:06 +0200578 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200579 } with { variant "" };
580
581 type record RlcmacDlCtrlMsg {
582 RlcmacDlCtrlMsgType msg_type,
583 RlcmacDlCtrlUnion u
584 } with {
585 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
586 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
587 paging, msg_type = PACKET_PAGING_REQUEST;
588 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200589 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700590 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Harald Welte422f0722017-08-01 00:27:06 +0200591 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200592 )"
593 };
594
595 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
596 with { extension "prototype(convert) encode(RAW)" };
597 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
598 with { extension "prototype(convert) decode(RAW)" };
599
600
601 /* 11.2.6 Packet Downlikn Ack/Nack */
602 type record ILevel {
603 BIT1 presence,
604 uint4_t i_level optional
605 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
606 type record length(8) of ILevel ILevels;
607 type record ChannelQualityReport {
608 uint6_t c_value,
609 uint3_t rxqual,
610 uint6_t sign_var,
611 ILevels i_levels
612 } with { variant "" };
613 type record PacketDlAckNack {
614 uint5_t dl_tfi,
615 AckNackDescription ack_nack_desc,
616 BIT1 chreq_desc_presence,
617 ChannelReqDescription chreq_desc optional,
618 ChannelQualityReport ch_qual_rep
619 } with { variant "" };
620
621 /* 11.2.2 Packet Control Acknowledgement */
622 type enumerated CtrlAck {
623 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
624 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
625 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
626 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
627 } with { variant "FIELDLENGTH(2)" };
628 type record PacketCtrlAck {
629 GprsTlli tlli,
630 CtrlAck ctrl_ack
631 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100632 } with { variant ""
633 variant (tlli) "BYTEORDER(first)"
634 };
Harald Welte484160b2017-07-28 13:30:24 +0200635
636 /* 1.2.8b Packet Uplink Dummy Control Block */
637 type record PacketUlDummy {
638 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100639 } with { variant ""
640 variant (tlli) "BYTEORDER(first)"
641 };
Harald Welte484160b2017-07-28 13:30:24 +0200642
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200643 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
644 * (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 +0200645 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100646 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200647 };
648
649 /* Table 11.2.16.2 Access Type */
650 type enumerated RlcAccessType {
651 RLC_ACC_TYPE_TWO_PHASE ('00'B),
652 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
653 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
654 RLC_ACC_TYPE_MM ('11'B)
655 } with { variant "FIELDLENGTH(2)" };
656
657 type union PacketResourceReqID {
658 GlobalTfi gtfi,
659 GprsTlli tlli
660 } with { variant (tlli) "BYTEORDER(first)" };
661
662 /* 11.2.16 Packet Resource Request */
663 type record PacketResourceReq {
664 BIT1 acc_type_presence,
665 RlcAccessType acc_type optional,
666 BIT1 id_type,
667 PacketResourceReqID id,
668 BIT1 ms_rac2_presence,
669 MSRadioAccCap2 ms_rac2 optional,
670 ChannelReqDescription ch_req_desc,
671 BIT1 change_mark_presence,
672 BIT2 change_mark optional,
673 BIT6 C_val,
674 BIT1 sign_var_presence,
675 BIT6 sign_var optional,
676 ILevels I_levels
677 /* TODO: additional contents for further Releases (starting from 1999) */
678 } with {
679 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
680 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
681 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
682 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
683 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
684 };
685
Harald Welte484160b2017-07-28 13:30:24 +0200686 /* 11.2.0.2 */
687 type union RlcmacUlCtrlUnion {
688 PacketCtrlAck ctrl_ack,
689 PacketDlAckNack dl_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200690 PacketUlDummy ul_dummy,
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200691 PacketResourceReq resource_req,
Harald Welte422f0722017-08-01 00:27:06 +0200692 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200693 } with { variant "" };
694
695 type record RlcmacUlCtrlMsg {
696 RlcmacUlCtrlMsgType msg_type,
697 RlcmacUlCtrlUnion u
698 } with {
699 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
700 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200701 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200702 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Harald Welte422f0722017-08-01 00:27:06 +0200703 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200704 )"
705 };
706
707 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
708 with { extension "prototype(convert) encode(RAW)" };
709 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
710 with { extension "prototype(convert) decode(RAW)" };
711
712 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
713
714 /* 12.3 Ack/Nack Description */
715 type record AckNackDescription {
716 BIT1 final_ack,
717 uint7_t starting_seq_nr,
718 ReceivedBlockBitmap receive_block_bitmap
719 } with { variant "" };
720
721 /* 12.7 Channel Request Description */
722 type enumerated RlcMode {
723 RLC_MODE_ACKNOWLEDGED (0),
724 RLC_MODE_UNACKNOWLEDGED (1)
725 } with { variant "FIELDLENGTH(1)" };
726 type enumerated LlcPduType {
727 LLC_PDU_IS_SACK_OR_ACK (0),
728 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
729 } with { variant "FIELDLENGTH(1)" };
730 type record ChannelReqDescription {
731 uint4_t peak_tput_class,
732 uint2_t priority,
733 RlcMode rlc_mode,
734 LlcPduType llc_pdu_type,
735 uint16_t RlcOctetCount
736 } with { variant "" };
737
738 /* 12.8 Frequency Parameters */
739 type record FreqIndirect {
740 uint6_t maio,
741 uint4_t ma_number,
742 BIT1 change_mark1_present,
743 uint2_t change_mark1 optional,
744 BIT1 change_mark2_present,
745 uint2_t change_mark2 optional
746 } with {
747 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
748 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
749 };
750 type record FreqDirect1 {
751 uint6_t maio,
752 GprsMobileAllication mobile_allocation
753 }
754 type record FreqDirect2 {
755 uint6_t maio,
756 uint6_t hsn,
757 uint4_t ma_freq_len,
758 octetstring m1_freq_list
759 } with {
Vadim Yanitskiycb33c742020-07-21 02:43:57 +0700760 variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
Harald Welte484160b2017-07-28 13:30:24 +0200761 };
762 type record FrequencyParameters {
763 uint3_t tsc,
764 BIT2 presence,
765 uint10_t arfcn optional,
766 FreqIndirect indirect optional,
767 FreqDirect1 direct1 optional,
768 FreqDirect2 direct2 optional
769 } with {
770 variant (arfcn) "PRESENCE(presence = '00'B)"
771 variant (indirect) "PRESENCE(presence = '01'B)"
772 variant (direct1) "PRESENCE(presence = '10'B)"
773 variant (direct2) "PRESENCE(presence = '11'B)"
774 };
775
776 /* 12.10 Global TFI */
777 type record GlobalTfi {
778 boolean is_dl_tfi,
779 uint5_t tfi
780 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
781
782 /* 12.10a GPRS Mobile Allocation */
783 type record RflNumberList {
784 uint4_t rfl_number,
785 BIT1 presence,
786 RflNumberList rfl_number_list optional
787 } with {
788 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
789 };
790 type record GprsMobileAllication {
791 uint6_t hsn,
792 BIT1 rfl_number_list_present,
793 RflNumberList rfl_number_list optional,
794 BIT1 ma_present,
795 uint6_t ma_length optional,
796 bitstring ma_bitmap optional
797 /* TODO: ARFCN index list */
798 } with {
799 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
800 variant (ma_length) "PRESENCE(ma_present = '0'B)"
801 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
Vadim Yanitskiycb33c742020-07-21 02:43:57 +0700802 variant (ma_length) "LENGTHTO(ma_bitmap)+1"
Harald Welte484160b2017-07-28 13:30:24 +0200803 }
804
805 /* 12.11 Packet Request Reference */
806 type record PacketRequestReference {
807 uint11_t ra_info,
808 uint16_t frame_nr
809 } with { variant "" };
810
811 /* 12.12 Packet Timing Advance */
812 type record PacketTimingAdvance {
813 BIT1 val_present,
814 uint6_t val optional,
815 BIT1 idx_present,
816 uint4_t idx optional,
817 uint3_t timeslot_nr optional
818 } with {
819 variant (val) "PRESENCE(val_present = '1'B)"
820 variant (idx) "PRESENCE(idx_present = '1'B)"
821 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
822 };
823
824 /* 12.13 Power Control Parameters */
825 type record ZeroOneGamma {
826 BIT1 gamma_present,
Vadim Yanitskiy4728e092020-07-22 14:10:45 +0700827 uint5_t gamma optional
Harald Welte484160b2017-07-28 13:30:24 +0200828 } with {
829 variant (gamma) "PRESENCE (gamma_present = '1'B)"
830 };
831 type record length(8) of ZeroOneGamma ZeroOneGammas;
832 type record PowerControlParameters {
833 uint4_t alpha,
834 ZeroOneGammas gamma
835 } with { variant "" };
836
837 /* 12.14 Persistence Level */
838 type record length(4) of uint4_t PersistenceLevels;
839
840 /* 12.20 Page Mode */
841 type enumerated PageMode {
842 PAGE_MODE_NORMAL ('00'B),
843 PAGE_MODE_EXTENDED ('01'B),
844 PAGE_MODE_REORG ('10'B),
845 PAGE_MODE_SAME ('11'B)
846 } with { variant "FIELDLENGTH(2)" };
847
848 /* 12.21 Starting Frame Number */
849 type record StartingFnDesc {
850 BIT1 presence,
851 uint16_t absolute_starting_time optional,
852 uint13_t relative_k optional
853 } with {
854 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
855 variant (relative_k) "PRESENCE(presence = '1'B)"
856 };
857
Vadim Yanitskiy3911d112020-04-01 22:31:30 +0700858 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
859 type union EGPRSPktChRequest {
860 EGPRSPktChRequest_MC5P2RB3 one_phase,
861 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
862 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
863 EGPRSPktChRequest_P2RB3 two_phase,
864 EGPRSPktChRequest_RB5 signalling,
865 EGPRSPktChRequest_RB5 one_phase_unack,
866 EGPRSPktChRequest_RB5 dedicated,
867 EGPRSPktChRequest_RB5 emergency,
868 EGPRSPktChRequest_P2RB3 two_phase_ipa,
869 EGPRSPktChRequest_RB5 signalling_ipa
870 } with {
871 variant "TAG (
872 one_phase, tag = '0'B;
873 short, tag = '100'B;
874 one_phase_red, tag = '101'B;
875 two_phase, tag = '110000'B;
876 signalling, tag = '110011'B;
877 one_phase_unack, tag = '110101'B;
878 dedicated, tag = '110110'B;
879 emergency, tag = '110111'B;
880 two_phase_ipa, tag = '111000'B;
881 signalling_ipa, tag = '111001'B;
882 )"
883 };
884
885 private type record EGPRSPktChRequest_MC5P2RB3 {
886 BIT1 tag,
887 BIT5 multislot_class,
888 BIT2 priority,
889 BIT3 random_bits
890 };
891
892 private type record EGPRSPktChRequest_NOB3P2RB3 {
893 BIT3 tag,
894 BIT3 nr_of_blocks,
895 BIT2 priority,
896 BIT3 random_bits
897 };
898
899 private type record EGPRSPktChRequest_MCG3P2RB3 {
900 BIT3 tag,
901 BIT3 multislot_class_group,
902 BIT2 priority,
903 BIT3 random_bits
904 };
905
906 private type record EGPRSPktChRequest_P2RB3 {
907 BIT6 tag,
908 BIT2 priority,
909 BIT3 random_bits
910 };
911
912 private type record EGPRSPktChRequest_RB5 {
913 BIT6 tag,
914 BIT5 random_bits
915 };
916
917 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
918 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
919 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
920 with { extension "prototype(convert) encode(RAW)" };
921
922 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
923 {
924 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
925 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
926 }
927
928 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
929 {
930 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
931 return bit2int(ra11);
932 }
933
Harald Welte7024baa2018-03-02 23:37:51 +0100934
Harald Welte484160b2017-07-28 13:30:24 +0200935} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };