blob: 1f1fb0a2f7df8979d4cb200b77176a9f20393aad [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,
130 GlobalTfiOrTlli tfi_or_tlli
131 /* TODO */
132 } with {
133 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
134 };
135
136 /* 11.2.29 Packet Uplink Assignment */
137 type record O_Gtfi {
138 BIT1 presence ('0'B),
139 GlobalTfi global_tfi
140 } with { variant "" };
141 type record IO_Tlli {
142 BIT2 presence ('10'B),
143 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100144 } with { variant ""
145 variant (tlli) "BYTEORDER(first)"
146 };
Harald Welte484160b2017-07-28 13:30:24 +0200147 type record IIO_Tqi {
148 BIT3 presence ('110'B),
149 PacketRequestReference pkt_req_ref
150 } with { variant "" };
151 type union PktUlAssUnion {
152 O_Gtfi global_tfi,
153 IO_Tlli tlli,
154 IIO_Tqi tqi
155 } with {
156 variant "TAG(global_tfi, presence = '0'B;
157 tlli, presence = '10'B;
158 tqi, presence = '110'B)"
159 };
160 type record DynamicAllocation {
161 BIT1 extd_dyn_alloc,
162 BIT1 p0_present,
163 uint4_t p0 optional,
164 BIT1 pr_mode optional,
165 BIT1 usf_granularity,
166 BIT1 ul_tfi_ass_present,
167 uint5_t ul_tfi_assignment optional,
168 BIT1 reserved ('0'B),
169 BIT1 tbf_starting_time_present,
170 StartingFnDesc tbf_starting_time optional,
171 TsAllocationUnion ts_allocation
172 } with {
173 variant (p0) "PRESENCE(p0_present = '1'B)"
174 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
175 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
176 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
177 };
178 type record TsAllocationTs {
179 BIT1 presence,
180 uint3_t usf_tn optional
181 } with {
182 variant (usf_tn) "PRESENCE(presence = '1'B)"
183 };
184 type record length(8) of TsAllocationTs TsAllocationTsArr;
185 type record TnGamma {
186 BIT1 presence,
187 uint3_t usf_tn optional,
188 uint5_t gamma_tn optional
189 } with {
190 variant (usf_tn) "PRESENCE(presence = '1'B)"
191 variant (gamma_tn) "PRESENCE(presence = '1'B)"
192 };
193 type record length(8) of TnGamma TnGamma8;
194 type record TsAllocationPwr {
195 uint4_t alpha,
196 TnGamma tn_gamma
197 } with { variant "" };
198 type record TsAllocationUnion {
199 BIT1 presence,
200 TsAllocationTsArr ts optional,
201 TsAllocationPwr ts_with_pwr optional
202 } with {
203 variant (ts) "PRESENCE(presence = '0'B)"
204 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
205 };
206 type record SingleBlockAllocation {
207 uint3_t timeslot_nr,
208 BIT1 alpha_present,
209 uint4_t alpha optional,
210 uint5_t gamma_tn,
211 BIT1 p0_present,
212 uint4_t p0 optional,
213 BIT1 reserved ('0'B) optional,
214 BIT1 pr_mode optional,
215 StartingFnDesc tbf_starting_time
216 } with {
217 variant (alpha) "PRESENCE(alpha_present = '1'B)"
218 variant (p0) "PRESENCE(p0_present = '1'B)"
219 variant (reserved) "PRESENCE(p0_present = '1'B)"
220 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
221 };
222 type record PktUlAssGprs {
223 ChCodingCommand ch_coding_cmd,
224 BIT1 tlli_block_chan_coding,
225 PacketTimingAdvance pkt_ta,
226 BIT1 freq_par_present,
227 FrequencyParameters freq_par optional,
228 BIT2 alloc_present,
229 DynamicAllocation dyn_block_alloc optional,
230 SingleBlockAllocation sgl_block_alloc optional
231 } with {
232 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
233 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
234 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
235 };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200236 type record COMPACTreducedMA {
237 uint7_t ma_bitmap_length,
238 bitstring ma_bitmap,
239 BIT1 maio_2_present,
240 BIT6 maio_2
241 } with {
242 variant (ma_bitmap_length) "LENGTHTO (ma_bitmap)"
243 variant (ma_bitmap_length) "UNIT(bits)"
244 variant (maio_2) "PRESENCE(maio_2_present = '1'B)"
245 };
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +0200246 type record of AccessTechnologiesRequest AccessTechnologiesRequestRepetition
247 with { variant "EXTENSION_BIT(reverse)" };
248 type record AccessTechnologiesRequest
249 {
250 BIT4 accessTechnType,
251 BIT1 extensionBit
252 } with { variant "FIELDORDER(msb)" };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200253 type record MultiBlockAllocation {
254 uint3_t timeslot_nr,
255 BIT1 alpha_gamma_present,
256 uint4_t alpha optional,
257 uint5_t gamma_tn optional,
258 BIT1 p0_present,
259 uint4_t p0 optional,
260 BIT1 reserved ('0'B) optional,
261 BIT1 pr_mode optional,
262 StartingFnDesc tbf_starting_time,
263 uint2_t num_radio_blocks_alloc
264 } with {
265 variant (alpha) "PRESENCE(alpha_gamma_present = '1'B)"
266 variant (gamma_tn) "PRESENCE(alpha_gamma_present = '1'B)"
267 variant (p0) "PRESENCE(p0_present = '1'B)"
268 variant (reserved) "PRESENCE(p0_present = '1'B)"
269 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
270 };
271 type record PktUlAssEgprs {
272 BIT2 dual_carrier('00'B), /*TODO 01 -- Message escape for dual carrier, RTTI, BTTI with FANR activated, EGPRS2 */
273 BIT1 tlli_present,
274 GprsTlli tlli optional,
275 BIT1 compact_reduced_ma_present,
276 COMPACTreducedMA compact_reduced_ma optional,
277 EgprsChCodingCommand chan_coding_cmd,
278 BIT1 resegment,
279 EgprsWindowSize window_size,
280 BIT1 ats_present,
281 AccessTechnologiesRequestRepetition ats optional, /* ? */
282 BIT1 arac_retrans_req,
283 BIT1 tlli_block_chan_coding,
284 BIT1 bep_period2_present,
285 BIT4 bep_period2 optional,
286 PacketTimingAdvance pkt_ta,
287 BIT1 pkt_ext_ta_present,
288 BIT2 pkt_ext_ta optional,
289 BIT1 freq_par_present,
290 FrequencyParameters freq_par optional,
291 BIT2 alloc_present,
292 DynamicAllocation dyn_block_alloc optional,
293 MultiBlockAllocation multi_block_alloc optional
294 /* TODO: Additions for Rel-5 and more */
295 } with {
296 variant (tlli) "PRESENCE(tlli_present = '1'B)"
297 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
298 variant (ats) "PRESENCE(ats_present = '1'B)"
299 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
300 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
301 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
302 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
303 variant (multi_block_alloc) "PRESENCE(alloc_present = '10'B)"
304 };
Harald Welte484160b2017-07-28 13:30:24 +0200305 type record PacketUlAssignment {
306 PageMode page_mode,
307 BIT1 persistence_levels_present,
308 PersistenceLevels persistence_levels optional,
309 PktUlAssUnion identity,
310 BIT1 is_egprs, /* msg escape */
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200311 PktUlAssGprs gprs optional,
312 PktUlAssEgprs egprs optional
313 /* TODO: Table 11.2.29.1: PACKET UPLINK ASSIGNMENT information elements
314 https://www.etsi.org/deliver/etsi_ts/144000_144099/144060/09.03.00_60/ts_144060v090300p.pdf */
Harald Welte484160b2017-07-28 13:30:24 +0200315 } with {
316 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
317 variant (gprs) "PRESENCE(is_egprs = '0'B)"
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200318 variant (egprs) "PRESENCE(is_egprs = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200319 };
320
321 /* 11.2.10 Packet Paging Request */
Stefan Sperling59c15d62018-10-10 11:09:25 +0200322 type record MobileIdentityLV_Paging {
323 /* Note that the size of 'len' differs from that of the Mobile Identify IE
324 * as defined in 3GPP TS 24.008 10.5.1.4 "Mobile Identity"; Paging Requests
325 * use only 4 bit to encode the length of a mobile identity, whereas the IE
326 * uses a byte. */
Harald Welte484160b2017-07-28 13:30:24 +0200327 uint4_t len,
328 octetstring mobile_id
Vadim Yanitskiy322c7932020-01-01 23:03:47 +0100329 } with {
330 variant (len) "LENGTHTO(mobile_id)"
331 variant (mobile_id) "BYTEORDER(first)"
332 };
Harald Welte484160b2017-07-28 13:30:24 +0200333 type record PageInfoPs {
334 BIT1 presence ('0'B),
335 BIT1 ptmsi_or_mobile_id,
336 GsmTmsi ptmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200337 MobileIdentityLV_Paging mobile_identity optional
Harald Welte484160b2017-07-28 13:30:24 +0200338 } with {
339 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
340 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
341 };
342 type record PageInfoCs {
343 BIT1 presence ('1'B),
344 BIT1 tmsi_or_mobile_id,
345 GsmTmsi tmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200346 MobileIdentityLV_Paging mobile_identity optional,
Harald Welte484160b2017-07-28 13:30:24 +0200347 ChannelNeeded chan_needed,
348 BIT1 emlpp_prio_present,
349 uint3_t emlpp_prio optional
350 } with {
351 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
352 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
353 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
354 };
355 type union PageInfo {
356 PageInfoPs ps,
357 PageInfoCs cs
Vadim Yanitskiy5e518732020-01-01 21:27:18 +0100358 } with {
359 variant "TAG(ps, presence = '0'B; cs, presence = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200360 };
361 type record PacketPagingReq {
362 PageMode page_mode,
363 BIT1 persistence_levels_present,
364 PersistenceLevels persistence_levels optional,
365 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200366 uint2_t nln optional,
367 BIT1 repeated_pageinfo_present,
368 PageInfo repeated_pageinfo optional
Harald Welte484160b2017-07-28 13:30:24 +0200369 } with {
370 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
371 variant (nln) "PRESENCE(nln_present = '1'B)"
Oliver Smith8f9daab2019-10-09 09:27:19 +0200372 variant (repeated_pageinfo) "PRESENCE(repeated_pageinfo_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200373 };
374
375 /* 11.2.28 Uplink Ack/Nack */
376 type enumerated ChCodingCommand {
377 CH_CODING_CS1 ('00'B),
378 CH_CODING_CS2 ('01'B),
379 CH_CODING_CS3 ('10'B),
380 CH_CODING_CS4 ('11'B)
381 } with { variant "FIELDLENGTH(2)" };
382 type record UlAckNackGprs {
383 ChCodingCommand ch_coding_cmd,
384 AckNackDescription ack_nack_desc,
385 BIT1 cont_res_tlli_present,
386 GprsTlli cont_res_tlli optional,
387 BIT1 pkt_ta_present,
388 PacketTimingAdvance pkt_ta optional,
389 BIT1 pwr_ctrl_present,
390 PowerControlParameters pwr_ctrl optional
391 /* TODO: Extension Bits, Rel5 ,... */
392 } with {
393 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
394 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
395 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100396 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200397 };
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200398 type record UlAckNackEgprs {
399 EgprsChCodingCommand ch_coding_cmd,
400 BIT1 resegment,
401 BIT1 preemptive_tx,
402 BIT1 prr_retrans_req,
403 BIT1 arac_retrans_req,
404 BIT1 cont_res_tlli_present,
405 GprsTlli cont_res_tlli optional,
406 BIT1 tbf_est,
407 BIT1 pkt_ta_present,
408 PacketTimingAdvance pkt_ta optional,
409 BIT1 pkt_ext_ta_present,
410 BIT2 pkt_ext_ta optional,
411 BIT1 pwr_ctrl_present,
412 PowerControlParameters pwr_ctrl optional
413 /* TODO: TS 44.060 12.3.1 EGPRS Ack/Nack Description */
414 /* EgprsAckNackDescription ack_nack_desc, */
415 /* BIT1 not_used('0'B) */
416 /* TODO: Extension Bits, Rel5 ,... */
417 } with {
418 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
419 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
420 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
421 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
422 variant (cont_res_tlli) "BYTEORDER(first)"
423 };
Harald Welte484160b2017-07-28 13:30:24 +0200424 type record PacketUlAckNack {
425 PageMode page_mode,
426 BIT2 msg_excape ('00'B),
427 uint5_t uplink_tfi,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200428 BIT1 is_egprs,
429 UlAckNackGprs gprs optional,
430 UlAckNackEgprs egprs optional
Harald Welte484160b2017-07-28 13:30:24 +0200431 /* TODO: EGPRS */
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200432 } with {
433 variant (gprs) "PRESENCE(is_egprs = '0'B)"
434 variant (egprs) "PRESENCE(is_egprs = '1'B)"
435 };
Harald Welte484160b2017-07-28 13:30:24 +0200436
437 /* 11.2.8 Packet Downlink Dummy Control Block */
438 type record PacketDlDummy {
439 PageMode page_mode,
440 BIT1 persistence_levels_present,
441 PersistenceLevels persistence_levels optional
442 } with {
443 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
444 };
445
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700446 /* 11.9 Global Power Control Parameters */
447 type record GlobalPwrCtrlParams {
448 uint4_t alpha,
449 uint5_t t_avg_v,
450 uint5_t t_avg_t,
451 uint4_t pb,
452 BIT1 pc_meas_chan,
453 BIT1 spare ('0'B),
454 uint4_t n_avg_i
455 };
456
457 /* 12.12a Global Packet Timing Advance */
458 type record TimingAdvanceIdxTN {
459 uint4_t ta_idx,
460 uint3_t ts_num
461 };
462 type record GlobalPacketTA {
463 BIT1 ta_val_presence,
464 uint4_t ta_val optional,
465 BIT1 ul_presence,
466 TimingAdvanceIdxTN ul optional,
467 BIT1 dl_presence,
468 TimingAdvanceIdxTN dl optional
469 } with {
470 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
471 variant (ul) "PRESENCE(ul_presence = '1'B)"
472 variant (dl) "PRESENCE(dl_presence = '1'B)"
473 };
474
475 /* 11.2.13 Packet Power Control/Timing Advance */
476 type record PacketPwrControlTAMsg {
477 BIT1 g_pwr_ctrl_presence,
478 GlobalPwrCtrlParams g_pwr_ctrl optional,
479 BIT1 split,
480 BIT1 split_desc optional,
481 GlobalPacketTA g_pkt_ta optional,
482 PowerControlParameters pwr_ctrl optional
483 /* TODO: additions for R99, REL-7, REL-12 */
484 } with {
485 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
486 variant (split_desc) "PRESENCE(split = '1'B)"
487 /* FIXME: Fancy coding: either both IEs together, or one of them */
488 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
489 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
490 };
491 type record PacketPwrControlTA {
492 PageMode page_mode,
493 NullGlobalTfi global_tfi,
494 /* See 11.1.3.3 'Message escape' error label
495 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
496 BIT1 msg_escape,
497 PacketPwrControlTAMsg msg optional
498 } with {
499 variant (msg) "PRESENCE(msg_escape = '0'B)"
500 };
501
Harald Welte484160b2017-07-28 13:30:24 +0200502 /* 11.2.0.1 */
503 type union RlcmacDlCtrlUnion {
504 PacketDlAssignment dl_assignment,
505 PacketUlAssignment ul_assignment,
506 PacketPagingReq paging,
507 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200508 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700509 PacketPwrControlTA pwr_ta,
Harald Welte422f0722017-08-01 00:27:06 +0200510 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200511 } with { variant "" };
512
513 type record RlcmacDlCtrlMsg {
514 RlcmacDlCtrlMsgType msg_type,
515 RlcmacDlCtrlUnion u
516 } with {
517 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
518 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
519 paging, msg_type = PACKET_PAGING_REQUEST;
520 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200521 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700522 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Harald Welte422f0722017-08-01 00:27:06 +0200523 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200524 )"
525 };
526
527 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
528 with { extension "prototype(convert) encode(RAW)" };
529 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
530 with { extension "prototype(convert) decode(RAW)" };
531
532
533 /* 11.2.6 Packet Downlikn Ack/Nack */
534 type record ILevel {
535 BIT1 presence,
536 uint4_t i_level optional
537 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
538 type record length(8) of ILevel ILevels;
539 type record ChannelQualityReport {
540 uint6_t c_value,
541 uint3_t rxqual,
542 uint6_t sign_var,
543 ILevels i_levels
544 } with { variant "" };
545 type record PacketDlAckNack {
546 uint5_t dl_tfi,
547 AckNackDescription ack_nack_desc,
548 BIT1 chreq_desc_presence,
549 ChannelReqDescription chreq_desc optional,
550 ChannelQualityReport ch_qual_rep
551 } with { variant "" };
552
553 /* 11.2.2 Packet Control Acknowledgement */
554 type enumerated CtrlAck {
555 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
556 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
557 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
558 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
559 } with { variant "FIELDLENGTH(2)" };
560 type record PacketCtrlAck {
561 GprsTlli tlli,
562 CtrlAck ctrl_ack
563 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100564 } with { variant ""
565 variant (tlli) "BYTEORDER(first)"
566 };
Harald Welte484160b2017-07-28 13:30:24 +0200567
568 /* 1.2.8b Packet Uplink Dummy Control Block */
569 type record PacketUlDummy {
570 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100571 } with { variant ""
572 variant (tlli) "BYTEORDER(first)"
573 };
Harald Welte484160b2017-07-28 13:30:24 +0200574
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200575 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
576 * (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 +0200577 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100578 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200579 };
580
581 /* Table 11.2.16.2 Access Type */
582 type enumerated RlcAccessType {
583 RLC_ACC_TYPE_TWO_PHASE ('00'B),
584 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
585 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
586 RLC_ACC_TYPE_MM ('11'B)
587 } with { variant "FIELDLENGTH(2)" };
588
589 type union PacketResourceReqID {
590 GlobalTfi gtfi,
591 GprsTlli tlli
592 } with { variant (tlli) "BYTEORDER(first)" };
593
594 /* 11.2.16 Packet Resource Request */
595 type record PacketResourceReq {
596 BIT1 acc_type_presence,
597 RlcAccessType acc_type optional,
598 BIT1 id_type,
599 PacketResourceReqID id,
600 BIT1 ms_rac2_presence,
601 MSRadioAccCap2 ms_rac2 optional,
602 ChannelReqDescription ch_req_desc,
603 BIT1 change_mark_presence,
604 BIT2 change_mark optional,
605 BIT6 C_val,
606 BIT1 sign_var_presence,
607 BIT6 sign_var optional,
608 ILevels I_levels
609 /* TODO: additional contents for further Releases (starting from 1999) */
610 } with {
611 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
612 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
613 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
614 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
615 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
616 };
617
Harald Welte484160b2017-07-28 13:30:24 +0200618 /* 11.2.0.2 */
619 type union RlcmacUlCtrlUnion {
620 PacketCtrlAck ctrl_ack,
621 PacketDlAckNack dl_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200622 PacketUlDummy ul_dummy,
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200623 PacketResourceReq resource_req,
Harald Welte422f0722017-08-01 00:27:06 +0200624 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200625 } with { variant "" };
626
627 type record RlcmacUlCtrlMsg {
628 RlcmacUlCtrlMsgType msg_type,
629 RlcmacUlCtrlUnion u
630 } with {
631 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
632 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200633 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200634 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Harald Welte422f0722017-08-01 00:27:06 +0200635 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200636 )"
637 };
638
639 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
640 with { extension "prototype(convert) encode(RAW)" };
641 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
642 with { extension "prototype(convert) decode(RAW)" };
643
644 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
645
646 /* 12.3 Ack/Nack Description */
647 type record AckNackDescription {
648 BIT1 final_ack,
649 uint7_t starting_seq_nr,
650 ReceivedBlockBitmap receive_block_bitmap
651 } with { variant "" };
652
653 /* 12.7 Channel Request Description */
654 type enumerated RlcMode {
655 RLC_MODE_ACKNOWLEDGED (0),
656 RLC_MODE_UNACKNOWLEDGED (1)
657 } with { variant "FIELDLENGTH(1)" };
658 type enumerated LlcPduType {
659 LLC_PDU_IS_SACK_OR_ACK (0),
660 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
661 } with { variant "FIELDLENGTH(1)" };
662 type record ChannelReqDescription {
663 uint4_t peak_tput_class,
664 uint2_t priority,
665 RlcMode rlc_mode,
666 LlcPduType llc_pdu_type,
667 uint16_t RlcOctetCount
668 } with { variant "" };
669
670 /* 12.8 Frequency Parameters */
671 type record FreqIndirect {
672 uint6_t maio,
673 uint4_t ma_number,
674 BIT1 change_mark1_present,
675 uint2_t change_mark1 optional,
676 BIT1 change_mark2_present,
677 uint2_t change_mark2 optional
678 } with {
679 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
680 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
681 };
682 type record FreqDirect1 {
683 uint6_t maio,
684 GprsMobileAllication mobile_allocation
685 }
686 type record FreqDirect2 {
687 uint6_t maio,
688 uint6_t hsn,
689 uint4_t ma_freq_len,
690 octetstring m1_freq_list
691 } with {
692 /* FIXME: this can not be expressed in TTCN-3 ?!? */
693 //variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
694 variant (ma_freq_len) "LENGTHTO(m1_freq_list)"
695 };
696 type record FrequencyParameters {
697 uint3_t tsc,
698 BIT2 presence,
699 uint10_t arfcn optional,
700 FreqIndirect indirect optional,
701 FreqDirect1 direct1 optional,
702 FreqDirect2 direct2 optional
703 } with {
704 variant (arfcn) "PRESENCE(presence = '00'B)"
705 variant (indirect) "PRESENCE(presence = '01'B)"
706 variant (direct1) "PRESENCE(presence = '10'B)"
707 variant (direct2) "PRESENCE(presence = '11'B)"
708 };
709
710 /* 12.10 Global TFI */
711 type record GlobalTfi {
712 boolean is_dl_tfi,
713 uint5_t tfi
714 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
715
716 /* 12.10a GPRS Mobile Allocation */
717 type record RflNumberList {
718 uint4_t rfl_number,
719 BIT1 presence,
720 RflNumberList rfl_number_list optional
721 } with {
722 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
723 };
724 type record GprsMobileAllication {
725 uint6_t hsn,
726 BIT1 rfl_number_list_present,
727 RflNumberList rfl_number_list optional,
728 BIT1 ma_present,
729 uint6_t ma_length optional,
730 bitstring ma_bitmap optional
731 /* TODO: ARFCN index list */
732 } with {
733 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
734 variant (ma_length) "PRESENCE(ma_present = '0'B)"
735 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
736 /* FIXME: this can not be expressed in TTCN-3 ?!? */
737 //variant (ma_length) "LENGTHTO(ma_bitmap)+1"
738 variant (ma_length) "LENGTHTO(ma_bitmap)"
739 }
740
741 /* 12.11 Packet Request Reference */
742 type record PacketRequestReference {
743 uint11_t ra_info,
744 uint16_t frame_nr
745 } with { variant "" };
746
747 /* 12.12 Packet Timing Advance */
748 type record PacketTimingAdvance {
749 BIT1 val_present,
750 uint6_t val optional,
751 BIT1 idx_present,
752 uint4_t idx optional,
753 uint3_t timeslot_nr optional
754 } with {
755 variant (val) "PRESENCE(val_present = '1'B)"
756 variant (idx) "PRESENCE(idx_present = '1'B)"
757 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
758 };
759
760 /* 12.13 Power Control Parameters */
761 type record ZeroOneGamma {
762 BIT1 gamma_present,
763 uint5_t gamma
764 } with {
765 variant (gamma) "PRESENCE (gamma_present = '1'B)"
766 };
767 type record length(8) of ZeroOneGamma ZeroOneGammas;
768 type record PowerControlParameters {
769 uint4_t alpha,
770 ZeroOneGammas gamma
771 } with { variant "" };
772
773 /* 12.14 Persistence Level */
774 type record length(4) of uint4_t PersistenceLevels;
775
776 /* 12.20 Page Mode */
777 type enumerated PageMode {
778 PAGE_MODE_NORMAL ('00'B),
779 PAGE_MODE_EXTENDED ('01'B),
780 PAGE_MODE_REORG ('10'B),
781 PAGE_MODE_SAME ('11'B)
782 } with { variant "FIELDLENGTH(2)" };
783
784 /* 12.21 Starting Frame Number */
785 type record StartingFnDesc {
786 BIT1 presence,
787 uint16_t absolute_starting_time optional,
788 uint13_t relative_k optional
789 } with {
790 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
791 variant (relative_k) "PRESENCE(presence = '1'B)"
792 };
793
Vadim Yanitskiy3911d112020-04-01 22:31:30 +0700794 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
795 type union EGPRSPktChRequest {
796 EGPRSPktChRequest_MC5P2RB3 one_phase,
797 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
798 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
799 EGPRSPktChRequest_P2RB3 two_phase,
800 EGPRSPktChRequest_RB5 signalling,
801 EGPRSPktChRequest_RB5 one_phase_unack,
802 EGPRSPktChRequest_RB5 dedicated,
803 EGPRSPktChRequest_RB5 emergency,
804 EGPRSPktChRequest_P2RB3 two_phase_ipa,
805 EGPRSPktChRequest_RB5 signalling_ipa
806 } with {
807 variant "TAG (
808 one_phase, tag = '0'B;
809 short, tag = '100'B;
810 one_phase_red, tag = '101'B;
811 two_phase, tag = '110000'B;
812 signalling, tag = '110011'B;
813 one_phase_unack, tag = '110101'B;
814 dedicated, tag = '110110'B;
815 emergency, tag = '110111'B;
816 two_phase_ipa, tag = '111000'B;
817 signalling_ipa, tag = '111001'B;
818 )"
819 };
820
821 private type record EGPRSPktChRequest_MC5P2RB3 {
822 BIT1 tag,
823 BIT5 multislot_class,
824 BIT2 priority,
825 BIT3 random_bits
826 };
827
828 private type record EGPRSPktChRequest_NOB3P2RB3 {
829 BIT3 tag,
830 BIT3 nr_of_blocks,
831 BIT2 priority,
832 BIT3 random_bits
833 };
834
835 private type record EGPRSPktChRequest_MCG3P2RB3 {
836 BIT3 tag,
837 BIT3 multislot_class_group,
838 BIT2 priority,
839 BIT3 random_bits
840 };
841
842 private type record EGPRSPktChRequest_P2RB3 {
843 BIT6 tag,
844 BIT2 priority,
845 BIT3 random_bits
846 };
847
848 private type record EGPRSPktChRequest_RB5 {
849 BIT6 tag,
850 BIT5 random_bits
851 };
852
853 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
854 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
855 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
856 with { extension "prototype(convert) encode(RAW)" };
857
858 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
859 {
860 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
861 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
862 }
863
864 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
865 {
866 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
867 return bit2int(ra11);
868 }
869
Harald Welte7024baa2018-03-02 23:37:51 +0100870
Harald Welte484160b2017-07-28 13:30:24 +0200871} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };