blob: ee02a8a826961e986d5cda9804832459360bfe35 [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
419 /* 11.2.28 Uplink Ack/Nack */
420 type enumerated ChCodingCommand {
421 CH_CODING_CS1 ('00'B),
422 CH_CODING_CS2 ('01'B),
423 CH_CODING_CS3 ('10'B),
424 CH_CODING_CS4 ('11'B)
425 } with { variant "FIELDLENGTH(2)" };
426 type record UlAckNackGprs {
427 ChCodingCommand ch_coding_cmd,
428 AckNackDescription ack_nack_desc,
429 BIT1 cont_res_tlli_present,
430 GprsTlli cont_res_tlli optional,
431 BIT1 pkt_ta_present,
432 PacketTimingAdvance pkt_ta optional,
433 BIT1 pwr_ctrl_present,
434 PowerControlParameters pwr_ctrl optional
435 /* TODO: Extension Bits, Rel5 ,... */
436 } with {
437 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
438 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
439 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100440 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200441 };
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200442 type record UlAckNackEgprs {
443 EgprsChCodingCommand ch_coding_cmd,
444 BIT1 resegment,
445 BIT1 preemptive_tx,
446 BIT1 prr_retrans_req,
447 BIT1 arac_retrans_req,
448 BIT1 cont_res_tlli_present,
449 GprsTlli cont_res_tlli optional,
450 BIT1 tbf_est,
451 BIT1 pkt_ta_present,
452 PacketTimingAdvance pkt_ta optional,
453 BIT1 pkt_ext_ta_present,
454 BIT2 pkt_ext_ta optional,
455 BIT1 pwr_ctrl_present,
456 PowerControlParameters pwr_ctrl optional
457 /* TODO: TS 44.060 12.3.1 EGPRS Ack/Nack Description */
458 /* EgprsAckNackDescription ack_nack_desc, */
459 /* BIT1 not_used('0'B) */
460 /* TODO: Extension Bits, Rel5 ,... */
461 } with {
462 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
463 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
464 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
465 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
466 variant (cont_res_tlli) "BYTEORDER(first)"
467 };
Harald Welte484160b2017-07-28 13:30:24 +0200468 type record PacketUlAckNack {
469 PageMode page_mode,
470 BIT2 msg_excape ('00'B),
471 uint5_t uplink_tfi,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200472 BIT1 is_egprs,
473 UlAckNackGprs gprs optional,
474 UlAckNackEgprs egprs optional
Harald Welte484160b2017-07-28 13:30:24 +0200475 /* TODO: EGPRS */
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200476 } with {
477 variant (gprs) "PRESENCE(is_egprs = '0'B)"
478 variant (egprs) "PRESENCE(is_egprs = '1'B)"
479 };
Harald Welte484160b2017-07-28 13:30:24 +0200480
481 /* 11.2.8 Packet Downlink Dummy Control Block */
482 type record PacketDlDummy {
483 PageMode page_mode,
484 BIT1 persistence_levels_present,
485 PersistenceLevels persistence_levels optional
486 } with {
487 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
488 };
489
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700490 /* 11.9 Global Power Control Parameters */
491 type record GlobalPwrCtrlParams {
492 uint4_t alpha,
493 uint5_t t_avg_v,
494 uint5_t t_avg_t,
495 uint4_t pb,
496 BIT1 pc_meas_chan,
497 BIT1 spare ('0'B),
498 uint4_t n_avg_i
499 };
500
501 /* 12.12a Global Packet Timing Advance */
502 type record TimingAdvanceIdxTN {
503 uint4_t ta_idx,
504 uint3_t ts_num
505 };
506 type record GlobalPacketTA {
507 BIT1 ta_val_presence,
508 uint4_t ta_val optional,
509 BIT1 ul_presence,
510 TimingAdvanceIdxTN ul optional,
511 BIT1 dl_presence,
512 TimingAdvanceIdxTN dl optional
513 } with {
514 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
515 variant (ul) "PRESENCE(ul_presence = '1'B)"
516 variant (dl) "PRESENCE(dl_presence = '1'B)"
517 };
518
519 /* 11.2.13 Packet Power Control/Timing Advance */
520 type record PacketPwrControlTAMsg {
521 BIT1 g_pwr_ctrl_presence,
522 GlobalPwrCtrlParams g_pwr_ctrl optional,
523 BIT1 split,
524 BIT1 split_desc optional,
525 GlobalPacketTA g_pkt_ta optional,
526 PowerControlParameters pwr_ctrl optional
527 /* TODO: additions for R99, REL-7, REL-12 */
528 } with {
529 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
530 variant (split_desc) "PRESENCE(split = '1'B)"
531 /* FIXME: Fancy coding: either both IEs together, or one of them */
532 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
533 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
534 };
535 type record PacketPwrControlTA {
536 PageMode page_mode,
537 NullGlobalTfi global_tfi,
538 /* See 11.1.3.3 'Message escape' error label
539 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
540 BIT1 msg_escape,
541 PacketPwrControlTAMsg msg optional
542 } with {
543 variant (msg) "PRESENCE(msg_escape = '0'B)"
544 };
545
Harald Welte484160b2017-07-28 13:30:24 +0200546 /* 11.2.0.1 */
547 type union RlcmacDlCtrlUnion {
548 PacketDlAssignment dl_assignment,
549 PacketUlAssignment ul_assignment,
550 PacketPagingReq paging,
551 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200552 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700553 PacketPwrControlTA pwr_ta,
Harald Welte422f0722017-08-01 00:27:06 +0200554 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200555 } with { variant "" };
556
557 type record RlcmacDlCtrlMsg {
558 RlcmacDlCtrlMsgType msg_type,
559 RlcmacDlCtrlUnion u
560 } with {
561 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
562 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
563 paging, msg_type = PACKET_PAGING_REQUEST;
564 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200565 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700566 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Harald Welte422f0722017-08-01 00:27:06 +0200567 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200568 )"
569 };
570
571 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
572 with { extension "prototype(convert) encode(RAW)" };
573 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
574 with { extension "prototype(convert) decode(RAW)" };
575
576
577 /* 11.2.6 Packet Downlikn Ack/Nack */
578 type record ILevel {
579 BIT1 presence,
580 uint4_t i_level optional
581 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
582 type record length(8) of ILevel ILevels;
583 type record ChannelQualityReport {
584 uint6_t c_value,
585 uint3_t rxqual,
586 uint6_t sign_var,
587 ILevels i_levels
588 } with { variant "" };
589 type record PacketDlAckNack {
590 uint5_t dl_tfi,
591 AckNackDescription ack_nack_desc,
592 BIT1 chreq_desc_presence,
593 ChannelReqDescription chreq_desc optional,
594 ChannelQualityReport ch_qual_rep
595 } with { variant "" };
596
597 /* 11.2.2 Packet Control Acknowledgement */
598 type enumerated CtrlAck {
599 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
600 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
601 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
602 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
603 } with { variant "FIELDLENGTH(2)" };
604 type record PacketCtrlAck {
605 GprsTlli tlli,
606 CtrlAck ctrl_ack
607 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100608 } with { variant ""
609 variant (tlli) "BYTEORDER(first)"
610 };
Harald Welte484160b2017-07-28 13:30:24 +0200611
612 /* 1.2.8b Packet Uplink Dummy Control Block */
613 type record PacketUlDummy {
614 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100615 } with { variant ""
616 variant (tlli) "BYTEORDER(first)"
617 };
Harald Welte484160b2017-07-28 13:30:24 +0200618
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200619 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
620 * (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 +0200621 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100622 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200623 };
624
625 /* Table 11.2.16.2 Access Type */
626 type enumerated RlcAccessType {
627 RLC_ACC_TYPE_TWO_PHASE ('00'B),
628 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
629 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
630 RLC_ACC_TYPE_MM ('11'B)
631 } with { variant "FIELDLENGTH(2)" };
632
633 type union PacketResourceReqID {
634 GlobalTfi gtfi,
635 GprsTlli tlli
636 } with { variant (tlli) "BYTEORDER(first)" };
637
638 /* 11.2.16 Packet Resource Request */
639 type record PacketResourceReq {
640 BIT1 acc_type_presence,
641 RlcAccessType acc_type optional,
642 BIT1 id_type,
643 PacketResourceReqID id,
644 BIT1 ms_rac2_presence,
645 MSRadioAccCap2 ms_rac2 optional,
646 ChannelReqDescription ch_req_desc,
647 BIT1 change_mark_presence,
648 BIT2 change_mark optional,
649 BIT6 C_val,
650 BIT1 sign_var_presence,
651 BIT6 sign_var optional,
652 ILevels I_levels
653 /* TODO: additional contents for further Releases (starting from 1999) */
654 } with {
655 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
656 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
657 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
658 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
659 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
660 };
661
Harald Welte484160b2017-07-28 13:30:24 +0200662 /* 11.2.0.2 */
663 type union RlcmacUlCtrlUnion {
664 PacketCtrlAck ctrl_ack,
665 PacketDlAckNack dl_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200666 PacketUlDummy ul_dummy,
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200667 PacketResourceReq resource_req,
Harald Welte422f0722017-08-01 00:27:06 +0200668 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200669 } with { variant "" };
670
671 type record RlcmacUlCtrlMsg {
672 RlcmacUlCtrlMsgType msg_type,
673 RlcmacUlCtrlUnion u
674 } with {
675 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
676 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200677 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200678 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Harald Welte422f0722017-08-01 00:27:06 +0200679 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200680 )"
681 };
682
683 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
684 with { extension "prototype(convert) encode(RAW)" };
685 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
686 with { extension "prototype(convert) decode(RAW)" };
687
688 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
689
690 /* 12.3 Ack/Nack Description */
691 type record AckNackDescription {
692 BIT1 final_ack,
693 uint7_t starting_seq_nr,
694 ReceivedBlockBitmap receive_block_bitmap
695 } with { variant "" };
696
697 /* 12.7 Channel Request Description */
698 type enumerated RlcMode {
699 RLC_MODE_ACKNOWLEDGED (0),
700 RLC_MODE_UNACKNOWLEDGED (1)
701 } with { variant "FIELDLENGTH(1)" };
702 type enumerated LlcPduType {
703 LLC_PDU_IS_SACK_OR_ACK (0),
704 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
705 } with { variant "FIELDLENGTH(1)" };
706 type record ChannelReqDescription {
707 uint4_t peak_tput_class,
708 uint2_t priority,
709 RlcMode rlc_mode,
710 LlcPduType llc_pdu_type,
711 uint16_t RlcOctetCount
712 } with { variant "" };
713
714 /* 12.8 Frequency Parameters */
715 type record FreqIndirect {
716 uint6_t maio,
717 uint4_t ma_number,
718 BIT1 change_mark1_present,
719 uint2_t change_mark1 optional,
720 BIT1 change_mark2_present,
721 uint2_t change_mark2 optional
722 } with {
723 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
724 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
725 };
726 type record FreqDirect1 {
727 uint6_t maio,
728 GprsMobileAllication mobile_allocation
729 }
730 type record FreqDirect2 {
731 uint6_t maio,
732 uint6_t hsn,
733 uint4_t ma_freq_len,
734 octetstring m1_freq_list
735 } with {
736 /* FIXME: this can not be expressed in TTCN-3 ?!? */
737 //variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
738 variant (ma_freq_len) "LENGTHTO(m1_freq_list)"
739 };
740 type record FrequencyParameters {
741 uint3_t tsc,
742 BIT2 presence,
743 uint10_t arfcn optional,
744 FreqIndirect indirect optional,
745 FreqDirect1 direct1 optional,
746 FreqDirect2 direct2 optional
747 } with {
748 variant (arfcn) "PRESENCE(presence = '00'B)"
749 variant (indirect) "PRESENCE(presence = '01'B)"
750 variant (direct1) "PRESENCE(presence = '10'B)"
751 variant (direct2) "PRESENCE(presence = '11'B)"
752 };
753
754 /* 12.10 Global TFI */
755 type record GlobalTfi {
756 boolean is_dl_tfi,
757 uint5_t tfi
758 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
759
760 /* 12.10a GPRS Mobile Allocation */
761 type record RflNumberList {
762 uint4_t rfl_number,
763 BIT1 presence,
764 RflNumberList rfl_number_list optional
765 } with {
766 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
767 };
768 type record GprsMobileAllication {
769 uint6_t hsn,
770 BIT1 rfl_number_list_present,
771 RflNumberList rfl_number_list optional,
772 BIT1 ma_present,
773 uint6_t ma_length optional,
774 bitstring ma_bitmap optional
775 /* TODO: ARFCN index list */
776 } with {
777 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
778 variant (ma_length) "PRESENCE(ma_present = '0'B)"
779 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
780 /* FIXME: this can not be expressed in TTCN-3 ?!? */
781 //variant (ma_length) "LENGTHTO(ma_bitmap)+1"
782 variant (ma_length) "LENGTHTO(ma_bitmap)"
783 }
784
785 /* 12.11 Packet Request Reference */
786 type record PacketRequestReference {
787 uint11_t ra_info,
788 uint16_t frame_nr
789 } with { variant "" };
790
791 /* 12.12 Packet Timing Advance */
792 type record PacketTimingAdvance {
793 BIT1 val_present,
794 uint6_t val optional,
795 BIT1 idx_present,
796 uint4_t idx optional,
797 uint3_t timeslot_nr optional
798 } with {
799 variant (val) "PRESENCE(val_present = '1'B)"
800 variant (idx) "PRESENCE(idx_present = '1'B)"
801 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
802 };
803
804 /* 12.13 Power Control Parameters */
805 type record ZeroOneGamma {
806 BIT1 gamma_present,
807 uint5_t gamma
808 } with {
809 variant (gamma) "PRESENCE (gamma_present = '1'B)"
810 };
811 type record length(8) of ZeroOneGamma ZeroOneGammas;
812 type record PowerControlParameters {
813 uint4_t alpha,
814 ZeroOneGammas gamma
815 } with { variant "" };
816
817 /* 12.14 Persistence Level */
818 type record length(4) of uint4_t PersistenceLevels;
819
820 /* 12.20 Page Mode */
821 type enumerated PageMode {
822 PAGE_MODE_NORMAL ('00'B),
823 PAGE_MODE_EXTENDED ('01'B),
824 PAGE_MODE_REORG ('10'B),
825 PAGE_MODE_SAME ('11'B)
826 } with { variant "FIELDLENGTH(2)" };
827
828 /* 12.21 Starting Frame Number */
829 type record StartingFnDesc {
830 BIT1 presence,
831 uint16_t absolute_starting_time optional,
832 uint13_t relative_k optional
833 } with {
834 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
835 variant (relative_k) "PRESENCE(presence = '1'B)"
836 };
837
Vadim Yanitskiy3911d112020-04-01 22:31:30 +0700838 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
839 type union EGPRSPktChRequest {
840 EGPRSPktChRequest_MC5P2RB3 one_phase,
841 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
842 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
843 EGPRSPktChRequest_P2RB3 two_phase,
844 EGPRSPktChRequest_RB5 signalling,
845 EGPRSPktChRequest_RB5 one_phase_unack,
846 EGPRSPktChRequest_RB5 dedicated,
847 EGPRSPktChRequest_RB5 emergency,
848 EGPRSPktChRequest_P2RB3 two_phase_ipa,
849 EGPRSPktChRequest_RB5 signalling_ipa
850 } with {
851 variant "TAG (
852 one_phase, tag = '0'B;
853 short, tag = '100'B;
854 one_phase_red, tag = '101'B;
855 two_phase, tag = '110000'B;
856 signalling, tag = '110011'B;
857 one_phase_unack, tag = '110101'B;
858 dedicated, tag = '110110'B;
859 emergency, tag = '110111'B;
860 two_phase_ipa, tag = '111000'B;
861 signalling_ipa, tag = '111001'B;
862 )"
863 };
864
865 private type record EGPRSPktChRequest_MC5P2RB3 {
866 BIT1 tag,
867 BIT5 multislot_class,
868 BIT2 priority,
869 BIT3 random_bits
870 };
871
872 private type record EGPRSPktChRequest_NOB3P2RB3 {
873 BIT3 tag,
874 BIT3 nr_of_blocks,
875 BIT2 priority,
876 BIT3 random_bits
877 };
878
879 private type record EGPRSPktChRequest_MCG3P2RB3 {
880 BIT3 tag,
881 BIT3 multislot_class_group,
882 BIT2 priority,
883 BIT3 random_bits
884 };
885
886 private type record EGPRSPktChRequest_P2RB3 {
887 BIT6 tag,
888 BIT2 priority,
889 BIT3 random_bits
890 };
891
892 private type record EGPRSPktChRequest_RB5 {
893 BIT6 tag,
894 BIT5 random_bits
895 };
896
897 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
898 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
899 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
900 with { extension "prototype(convert) encode(RAW)" };
901
902 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
903 {
904 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
905 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
906 }
907
908 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
909 {
910 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
911 return bit2int(ra11);
912 }
913
Harald Welte7024baa2018-03-02 23:37:51 +0100914
Harald Welte484160b2017-07-28 13:30:24 +0200915} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };