blob: 14570bf4c563306ed0f0bf94cca3abe44f3a3a6f [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 };
Vadim Yanitskiye94164d2020-10-31 05:46:03 +0700419 type record RepeatedPageInfoItem {
420 BIT1 presence,
421 PageInfo item
422 } with { variant "PRESENCE(presence = '1'B)" };
423 type record of RepeatedPageInfoItem RepeatedPageInfo;
Harald Welte484160b2017-07-28 13:30:24 +0200424 type record PacketPagingReq {
425 PageMode page_mode,
426 BIT1 persistence_levels_present,
427 PersistenceLevels persistence_levels optional,
428 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200429 uint2_t nln optional,
Vadim Yanitskiye94164d2020-10-31 05:46:03 +0700430 RepeatedPageInfo repeated_pageinfo optional,
431 BIT1 repeated_pageinfo_term ('0'B)
Harald Welte484160b2017-07-28 13:30:24 +0200432 } with {
433 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
434 variant (nln) "PRESENCE(nln_present = '1'B)"
435 };
436
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200437 /* 12.26 Extension Bits IE */
438 type record ExtensionBits {
439 uint6_t extension_length,
440 bitstring spare_bits
441 } with {
442 variant (extension_length) "LENGTHTO(spare_bits) - 1"
443 variant (extension_length) "UNIT(bits)"
444 };
445
Harald Welte484160b2017-07-28 13:30:24 +0200446 /* 11.2.28 Uplink Ack/Nack */
447 type enumerated ChCodingCommand {
448 CH_CODING_CS1 ('00'B),
449 CH_CODING_CS2 ('01'B),
450 CH_CODING_CS3 ('10'B),
451 CH_CODING_CS4 ('11'B)
452 } with { variant "FIELDLENGTH(2)" };
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200453 type record UlAckNackGprsAdditionsRel99 {
454 BIT1 ext_pkt_ta_present,
455 BIT2 ext_pkt_ta optional,
456 boolean tbf_est
457 /* TODO: Rel5 ,... */
458 } with {
459 variant (ext_pkt_ta) "PRESENCE(ext_pkt_ta_present = '1'B)"
460 variant (tbf_est) "FIELDLENGTH(1)"
461 };
Harald Welte484160b2017-07-28 13:30:24 +0200462 type record UlAckNackGprs {
463 ChCodingCommand ch_coding_cmd,
464 AckNackDescription ack_nack_desc,
465 BIT1 cont_res_tlli_present,
466 GprsTlli cont_res_tlli optional,
467 BIT1 pkt_ta_present,
468 PacketTimingAdvance pkt_ta optional,
469 BIT1 pwr_ctrl_present,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200470 PowerControlParameters pwr_ctrl optional,
471 BIT1 extension_bits_present,
472 ExtensionBits extension_bits optional,
473 BIT1 not_used ('0'B),
474 BIT1 rel99_present,
475 UlAckNackGprsAdditionsRel99 rel99 optional
Harald Welte484160b2017-07-28 13:30:24 +0200476 } with {
477 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
478 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
479 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200480 variant (extension_bits) "PRESENCE(extension_bits_present = '1'B)"
481 variant (rel99) "PRESENCE(rel99_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100482 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200483 };
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200484 type record UlAckNackEgprs {
Pau Espin Pedrolf8fe2d22020-11-10 18:39:25 +0100485 BIT2 msg_excape ('00'B),
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200486 EgprsChCodingCommand ch_coding_cmd,
487 BIT1 resegment,
488 BIT1 preemptive_tx,
489 BIT1 prr_retrans_req,
490 BIT1 arac_retrans_req,
491 BIT1 cont_res_tlli_present,
492 GprsTlli cont_res_tlli optional,
493 BIT1 tbf_est,
494 BIT1 pkt_ta_present,
495 PacketTimingAdvance pkt_ta optional,
496 BIT1 pkt_ext_ta_present,
497 BIT2 pkt_ext_ta optional,
498 BIT1 pwr_ctrl_present,
499 PowerControlParameters pwr_ctrl optional
500 /* TODO: TS 44.060 12.3.1 EGPRS Ack/Nack Description */
501 /* EgprsAckNackDescription ack_nack_desc, */
502 /* BIT1 not_used('0'B) */
503 /* TODO: Extension Bits, Rel5 ,... */
504 } with {
505 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
506 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
507 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
508 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
509 variant (cont_res_tlli) "BYTEORDER(first)"
510 };
Harald Welte484160b2017-07-28 13:30:24 +0200511 type record PacketUlAckNack {
512 PageMode page_mode,
513 BIT2 msg_excape ('00'B),
514 uint5_t uplink_tfi,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200515 BIT1 is_egprs,
516 UlAckNackGprs gprs optional,
517 UlAckNackEgprs egprs optional
Harald Welte484160b2017-07-28 13:30:24 +0200518 /* TODO: EGPRS */
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200519 } with {
520 variant (gprs) "PRESENCE(is_egprs = '0'B)"
521 variant (egprs) "PRESENCE(is_egprs = '1'B)"
522 };
Harald Welte484160b2017-07-28 13:30:24 +0200523
524 /* 11.2.8 Packet Downlink Dummy Control Block */
525 type record PacketDlDummy {
526 PageMode page_mode,
527 BIT1 persistence_levels_present,
528 PersistenceLevels persistence_levels optional
529 } with {
530 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
531 };
532
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700533 /* 11.9 Global Power Control Parameters */
534 type record GlobalPwrCtrlParams {
535 uint4_t alpha,
536 uint5_t t_avg_v,
537 uint5_t t_avg_t,
538 uint4_t pb,
539 BIT1 pc_meas_chan,
540 BIT1 spare ('0'B),
541 uint4_t n_avg_i
542 };
543
544 /* 12.12a Global Packet Timing Advance */
545 type record TimingAdvanceIdxTN {
546 uint4_t ta_idx,
547 uint3_t ts_num
548 };
549 type record GlobalPacketTA {
550 BIT1 ta_val_presence,
551 uint4_t ta_val optional,
552 BIT1 ul_presence,
553 TimingAdvanceIdxTN ul optional,
554 BIT1 dl_presence,
555 TimingAdvanceIdxTN dl optional
556 } with {
557 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
558 variant (ul) "PRESENCE(ul_presence = '1'B)"
559 variant (dl) "PRESENCE(dl_presence = '1'B)"
560 };
561
562 /* 11.2.13 Packet Power Control/Timing Advance */
563 type record PacketPwrControlTAMsg {
564 BIT1 g_pwr_ctrl_presence,
565 GlobalPwrCtrlParams g_pwr_ctrl optional,
566 BIT1 split,
567 BIT1 split_desc optional,
568 GlobalPacketTA g_pkt_ta optional,
569 PowerControlParameters pwr_ctrl optional
570 /* TODO: additions for R99, REL-7, REL-12 */
571 } with {
572 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
573 variant (split_desc) "PRESENCE(split = '1'B)"
574 /* FIXME: Fancy coding: either both IEs together, or one of them */
575 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
576 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
577 };
578 type record PacketPwrControlTA {
579 PageMode page_mode,
580 NullGlobalTfi global_tfi,
581 /* See 11.1.3.3 'Message escape' error label
582 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
583 BIT1 msg_escape,
584 PacketPwrControlTAMsg msg optional
585 } with {
586 variant (msg) "PRESENCE(msg_escape = '0'B)"
587 };
588
Harald Welte484160b2017-07-28 13:30:24 +0200589 /* 11.2.0.1 */
590 type union RlcmacDlCtrlUnion {
591 PacketDlAssignment dl_assignment,
592 PacketUlAssignment ul_assignment,
593 PacketPagingReq paging,
594 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200595 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700596 PacketPwrControlTA pwr_ta,
Harald Welte422f0722017-08-01 00:27:06 +0200597 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200598 } with { variant "" };
599
600 type record RlcmacDlCtrlMsg {
601 RlcmacDlCtrlMsgType msg_type,
602 RlcmacDlCtrlUnion u
603 } with {
604 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
605 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
606 paging, msg_type = PACKET_PAGING_REQUEST;
607 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200608 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700609 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Harald Welte422f0722017-08-01 00:27:06 +0200610 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200611 )"
612 };
613
614 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
615 with { extension "prototype(convert) encode(RAW)" };
616 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
617 with { extension "prototype(convert) decode(RAW)" };
618
619
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100620 /* 11.2.6 Packet Downlink Ack/Nack */
Harald Welte484160b2017-07-28 13:30:24 +0200621 type record ILevel {
622 BIT1 presence,
623 uint4_t i_level optional
624 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
625 type record length(8) of ILevel ILevels;
626 type record ChannelQualityReport {
627 uint6_t c_value,
628 uint3_t rxqual,
629 uint6_t sign_var,
630 ILevels i_levels
631 } with { variant "" };
632 type record PacketDlAckNack {
633 uint5_t dl_tfi,
634 AckNackDescription ack_nack_desc,
635 BIT1 chreq_desc_presence,
636 ChannelReqDescription chreq_desc optional,
637 ChannelQualityReport ch_qual_rep
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100638 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)" };
639
640 /* 11.2.6a Egprs Packet Downlink Ack/Nack */
641 type record EgprsBEPLinkQualityMeasurements {
642 BIT1 gmsk_presence,
643 BIT5 gmsk_mean_bep optional,
644 BIT3 gmsk_cv_bep optional,
645 BIT1 psk8_presence,
646 BIT5 psk8_mean_bep optional,
647 BIT3 psk8_cv_bep optional
648 } with { variant (gmsk_mean_bep) "PRESENCE(gmsk_presence = '1'B)"
649 variant (gmsk_cv_bep) "PRESENCE(gmsk_presence = '1'B)"
650 variant (psk8_mean_bep) "PRESENCE(psk8_presence = '1'B)"
651 variant (psk8_cv_bep) "PRESENCE(psk8_presence = '1'B)"
652 };
653 /* 12.5.4 EGPRS Timeslot Link Quality Measurements IE */
654 type record BEPMeas {
655 BIT1 presence,
656 BIT1 is_8psk optional,
657 uint4_t bep_meas optional
658 } with { variant (is_8psk) "PRESENCE(presence = '1'B)"
659 variant (bep_meas) "PRESENCE(presence = '1'B)"
660 };
661 type record length(8) of BEPMeas BEPMeasLi;
662 type record EgprsTimeslotLinkQualityMeasurements {
663 BIT1 bep_measurements_presence,
664 BEPMeasLi bep_meas optional,
665 BIT1 i_measurements_presence,
666 ILevels i_meas optional
667 } with { variant (bep_meas) "PRESENCE(bep_measurements_presence = '1'B)"
668 variant (i_meas) "PRESENCE(i_measurements_presence = '1'B)"
669 };
670 /* Table 12.5.1.1 : EGPRS Channel Quality Report Information elements */
671 type record EgprsChannelQualityReport {
672 EgprsBEPLinkQualityMeasurements bep_link_qual_meas,
673 uint6_t c_value,
674 EgprsTimeslotLinkQualityMeasurements ts_link_qual_meas
Harald Welte484160b2017-07-28 13:30:24 +0200675 } with { variant "" };
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100676 type record EgprsPacketDlAckNack {
677 uint5_t dl_tfi,
678 BIT1 ms_oom,
679 BIT1 egprs_ch_qual_rep_presence,
680 EgprsChannelQualityReport egprs_ch_qual_rep optional,
681 BIT1 chreq_desc_presence,
682 ChannelReqDescription chreq_desc optional,
683 BIT1 pfi_presence,
684 BIT7 pfi optional,
685 BIT1 epdan_presence('0'B),
686 /* TODO: Implement EPD A/N */
687 EgprsAckNackDescriptionIE ack_nack_desc_ie
688 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)"
689 variant (egprs_ch_qual_rep) "PRESENCE(egprs_ch_qual_rep_presence = '1'B)"
690 variant (pfi) "PRESENCE(pfi_presence = '1'B)"
691 };
Harald Welte484160b2017-07-28 13:30:24 +0200692
693 /* 11.2.2 Packet Control Acknowledgement */
694 type enumerated CtrlAck {
695 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
696 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
697 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
698 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
699 } with { variant "FIELDLENGTH(2)" };
700 type record PacketCtrlAck {
701 GprsTlli tlli,
702 CtrlAck ctrl_ack
703 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100704 } with { variant ""
705 variant (tlli) "BYTEORDER(first)"
706 };
Harald Welte484160b2017-07-28 13:30:24 +0200707
708 /* 1.2.8b Packet Uplink Dummy Control Block */
709 type record PacketUlDummy {
710 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100711 } with { variant ""
712 variant (tlli) "BYTEORDER(first)"
713 };
Harald Welte484160b2017-07-28 13:30:24 +0200714
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200715 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
716 * (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 +0200717 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100718 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200719 };
720
721 /* Table 11.2.16.2 Access Type */
722 type enumerated RlcAccessType {
723 RLC_ACC_TYPE_TWO_PHASE ('00'B),
724 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
725 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
726 RLC_ACC_TYPE_MM ('11'B)
727 } with { variant "FIELDLENGTH(2)" };
728
729 type union PacketResourceReqID {
730 GlobalTfi gtfi,
731 GprsTlli tlli
732 } with { variant (tlli) "BYTEORDER(first)" };
733
734 /* 11.2.16 Packet Resource Request */
735 type record PacketResourceReq {
736 BIT1 acc_type_presence,
737 RlcAccessType acc_type optional,
738 BIT1 id_type,
739 PacketResourceReqID id,
740 BIT1 ms_rac2_presence,
741 MSRadioAccCap2 ms_rac2 optional,
742 ChannelReqDescription ch_req_desc,
743 BIT1 change_mark_presence,
744 BIT2 change_mark optional,
745 BIT6 C_val,
746 BIT1 sign_var_presence,
747 BIT6 sign_var optional,
748 ILevels I_levels
749 /* TODO: additional contents for further Releases (starting from 1999) */
750 } with {
751 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
752 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
753 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
754 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
755 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
756 };
757
Harald Welte484160b2017-07-28 13:30:24 +0200758 /* 11.2.0.2 */
759 type union RlcmacUlCtrlUnion {
760 PacketCtrlAck ctrl_ack,
761 PacketDlAckNack dl_ack_nack,
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100762 EgprsPacketDlAckNack dl_ack_nack_egprs,
Harald Welte422f0722017-08-01 00:27:06 +0200763 PacketUlDummy ul_dummy,
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200764 PacketResourceReq resource_req,
Harald Welte422f0722017-08-01 00:27:06 +0200765 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200766 } with { variant "" };
767
768 type record RlcmacUlCtrlMsg {
769 RlcmacUlCtrlMsgType msg_type,
770 RlcmacUlCtrlUnion u
771 } with {
772 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
773 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100774 dl_ack_nack_egprs, msg_type = PACKET_EGPRS_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200775 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200776 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Harald Welte422f0722017-08-01 00:27:06 +0200777 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200778 )"
779 };
780
781 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
782 with { extension "prototype(convert) encode(RAW)" };
783 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
784 with { extension "prototype(convert) decode(RAW)" };
785
786 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
787
788 /* 12.3 Ack/Nack Description */
789 type record AckNackDescription {
790 BIT1 final_ack,
791 uint7_t starting_seq_nr,
792 ReceivedBlockBitmap receive_block_bitmap
793 } with { variant "" };
794
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100795 /* 12.3.1 Egprs Ack/Nack Description */
796 type bitstring UncompressedReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
797 type record EgprsAckNackDescription {
798 BIT1 final_ack,
799 BIT1 begin_window,
800 BIT1 end_window,
801 uint11_t starting_seq_nr,
802 BIT1 compressed,
803 /* TODO: CompressedReceivedBlockBitmap urbb optional, */
804 UncompressedReceivedBlockBitmap urbb optional
805 } with { variant (urbb) "PRESENCE(compressed = '0'B)" };
806 type record EgprsAckNackDescriptionIE {
807 BIT1 len_present,
808 uint8_t len optional,
809 EgprsAckNackDescription acknack_desc
810 } with { variant (len) "PRESENCE(len_present = '1'B)"
811 variant (len) "LENGTHTO(acknack_desc)"
812 variant (len) "UNIT(bits)"
813 };
814
815
Harald Welte484160b2017-07-28 13:30:24 +0200816 /* 12.7 Channel Request Description */
817 type enumerated RlcMode {
818 RLC_MODE_ACKNOWLEDGED (0),
819 RLC_MODE_UNACKNOWLEDGED (1)
820 } with { variant "FIELDLENGTH(1)" };
821 type enumerated LlcPduType {
822 LLC_PDU_IS_SACK_OR_ACK (0),
823 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
824 } with { variant "FIELDLENGTH(1)" };
825 type record ChannelReqDescription {
826 uint4_t peak_tput_class,
827 uint2_t priority,
828 RlcMode rlc_mode,
829 LlcPduType llc_pdu_type,
830 uint16_t RlcOctetCount
831 } with { variant "" };
832
833 /* 12.8 Frequency Parameters */
834 type record FreqIndirect {
835 uint6_t maio,
836 uint4_t ma_number,
837 BIT1 change_mark1_present,
838 uint2_t change_mark1 optional,
839 BIT1 change_mark2_present,
840 uint2_t change_mark2 optional
841 } with {
842 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
843 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
844 };
845 type record FreqDirect1 {
846 uint6_t maio,
847 GprsMobileAllication mobile_allocation
848 }
849 type record FreqDirect2 {
850 uint6_t maio,
851 uint6_t hsn,
852 uint4_t ma_freq_len,
853 octetstring m1_freq_list
854 } with {
Vadim Yanitskiycb33c742020-07-21 02:43:57 +0700855 variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
Harald Welte484160b2017-07-28 13:30:24 +0200856 };
857 type record FrequencyParameters {
858 uint3_t tsc,
859 BIT2 presence,
860 uint10_t arfcn optional,
861 FreqIndirect indirect optional,
862 FreqDirect1 direct1 optional,
863 FreqDirect2 direct2 optional
864 } with {
865 variant (arfcn) "PRESENCE(presence = '00'B)"
866 variant (indirect) "PRESENCE(presence = '01'B)"
867 variant (direct1) "PRESENCE(presence = '10'B)"
868 variant (direct2) "PRESENCE(presence = '11'B)"
869 };
870
871 /* 12.10 Global TFI */
872 type record GlobalTfi {
873 boolean is_dl_tfi,
874 uint5_t tfi
875 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
876
877 /* 12.10a GPRS Mobile Allocation */
878 type record RflNumberList {
879 uint4_t rfl_number,
880 BIT1 presence,
881 RflNumberList rfl_number_list optional
882 } with {
883 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
884 };
885 type record GprsMobileAllication {
886 uint6_t hsn,
887 BIT1 rfl_number_list_present,
888 RflNumberList rfl_number_list optional,
889 BIT1 ma_present,
890 uint6_t ma_length optional,
Vadim Yanitskiy06c41612020-07-23 04:45:37 +0700891 bitstring ma_bitmap length(1..64) optional
Harald Welte484160b2017-07-28 13:30:24 +0200892 /* TODO: ARFCN index list */
893 } with {
894 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
895 variant (ma_length) "PRESENCE(ma_present = '0'B)"
896 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
Vadim Yanitskiy06c41612020-07-23 04:45:37 +0700897 variant (ma_length) "LENGTHTO(ma_bitmap)-1, UNIT(bits)"
Vadim Yanitskiy9fa1db52020-07-21 03:14:51 +0700898 variant (ma_bitmap) "BYTEORDER(first), BITORDER(msb)"
899 };
Harald Welte484160b2017-07-28 13:30:24 +0200900
901 /* 12.11 Packet Request Reference */
902 type record PacketRequestReference {
903 uint11_t ra_info,
904 uint16_t frame_nr
905 } with { variant "" };
906
907 /* 12.12 Packet Timing Advance */
908 type record PacketTimingAdvance {
909 BIT1 val_present,
910 uint6_t val optional,
911 BIT1 idx_present,
912 uint4_t idx optional,
913 uint3_t timeslot_nr optional
914 } with {
915 variant (val) "PRESENCE(val_present = '1'B)"
916 variant (idx) "PRESENCE(idx_present = '1'B)"
917 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
918 };
919
920 /* 12.13 Power Control Parameters */
921 type record ZeroOneGamma {
922 BIT1 gamma_present,
Vadim Yanitskiy4728e092020-07-22 14:10:45 +0700923 uint5_t gamma optional
Harald Welte484160b2017-07-28 13:30:24 +0200924 } with {
925 variant (gamma) "PRESENCE (gamma_present = '1'B)"
926 };
927 type record length(8) of ZeroOneGamma ZeroOneGammas;
928 type record PowerControlParameters {
929 uint4_t alpha,
930 ZeroOneGammas gamma
931 } with { variant "" };
932
933 /* 12.14 Persistence Level */
934 type record length(4) of uint4_t PersistenceLevels;
935
936 /* 12.20 Page Mode */
937 type enumerated PageMode {
938 PAGE_MODE_NORMAL ('00'B),
939 PAGE_MODE_EXTENDED ('01'B),
940 PAGE_MODE_REORG ('10'B),
941 PAGE_MODE_SAME ('11'B)
942 } with { variant "FIELDLENGTH(2)" };
943
944 /* 12.21 Starting Frame Number */
945 type record StartingFnDesc {
946 BIT1 presence,
947 uint16_t absolute_starting_time optional,
948 uint13_t relative_k optional
949 } with {
950 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
951 variant (relative_k) "PRESENCE(presence = '1'B)"
952 };
953
Vadim Yanitskiy3911d112020-04-01 22:31:30 +0700954 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
955 type union EGPRSPktChRequest {
956 EGPRSPktChRequest_MC5P2RB3 one_phase,
957 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
958 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
959 EGPRSPktChRequest_P2RB3 two_phase,
960 EGPRSPktChRequest_RB5 signalling,
961 EGPRSPktChRequest_RB5 one_phase_unack,
962 EGPRSPktChRequest_RB5 dedicated,
963 EGPRSPktChRequest_RB5 emergency,
964 EGPRSPktChRequest_P2RB3 two_phase_ipa,
965 EGPRSPktChRequest_RB5 signalling_ipa
966 } with {
967 variant "TAG (
968 one_phase, tag = '0'B;
969 short, tag = '100'B;
970 one_phase_red, tag = '101'B;
971 two_phase, tag = '110000'B;
972 signalling, tag = '110011'B;
973 one_phase_unack, tag = '110101'B;
974 dedicated, tag = '110110'B;
975 emergency, tag = '110111'B;
976 two_phase_ipa, tag = '111000'B;
977 signalling_ipa, tag = '111001'B;
978 )"
979 };
980
981 private type record EGPRSPktChRequest_MC5P2RB3 {
982 BIT1 tag,
983 BIT5 multislot_class,
984 BIT2 priority,
985 BIT3 random_bits
986 };
987
988 private type record EGPRSPktChRequest_NOB3P2RB3 {
989 BIT3 tag,
990 BIT3 nr_of_blocks,
991 BIT2 priority,
992 BIT3 random_bits
993 };
994
995 private type record EGPRSPktChRequest_MCG3P2RB3 {
996 BIT3 tag,
997 BIT3 multislot_class_group,
998 BIT2 priority,
999 BIT3 random_bits
1000 };
1001
1002 private type record EGPRSPktChRequest_P2RB3 {
1003 BIT6 tag,
1004 BIT2 priority,
1005 BIT3 random_bits
1006 };
1007
1008 private type record EGPRSPktChRequest_RB5 {
1009 BIT6 tag,
1010 BIT5 random_bits
1011 };
1012
1013 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
1014 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
1015 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
1016 with { extension "prototype(convert) encode(RAW)" };
1017
1018 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
1019 {
1020 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
1021 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
1022 }
1023
1024 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
1025 {
1026 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
1027 return bit2int(ra11);
1028 }
1029
Harald Welte7024baa2018-03-02 23:37:51 +01001030
Harald Welte484160b2017-07-28 13:30:24 +02001031} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };