blob: 1bb623296c4fb88d021932b5a1dbb8534ecf34bc [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
59 type record NullGlobalTfi {
60 BIT1 presence ('0'B),
61 GlobalTfi global_tfi
62 } with { variant "" };
63
64 type record TenTlli {
65 BIT2 presence ('10'B),
66 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +010067 } with { variant ""
68 variant (tlli) "BYTEORDER(first)"
69 };
Harald Welte484160b2017-07-28 13:30:24 +020070
71 type union GlobalTfiOrTlli {
72 NullGlobalTfi global_tfi,
73 TenTlli tlli
74 };
75
76 /* 11.2.7 Packet Downlink Assignment */
77 type record PacketDlAssignment {
78 PageMode page_mode,
79 BIT1 pres1,
80 PersistenceLevels persistence_levels optional,
81 GlobalTfiOrTlli tfi_or_tlli
82 /* TODO */
83 } with {
84 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
85 };
86
87 /* 11.2.29 Packet Uplink Assignment */
88 type record O_Gtfi {
89 BIT1 presence ('0'B),
90 GlobalTfi global_tfi
91 } with { variant "" };
92 type record IO_Tlli {
93 BIT2 presence ('10'B),
94 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +010095 } with { variant ""
96 variant (tlli) "BYTEORDER(first)"
97 };
Harald Welte484160b2017-07-28 13:30:24 +020098 type record IIO_Tqi {
99 BIT3 presence ('110'B),
100 PacketRequestReference pkt_req_ref
101 } with { variant "" };
102 type union PktUlAssUnion {
103 O_Gtfi global_tfi,
104 IO_Tlli tlli,
105 IIO_Tqi tqi
106 } with {
107 variant "TAG(global_tfi, presence = '0'B;
108 tlli, presence = '10'B;
109 tqi, presence = '110'B)"
110 };
111 type record DynamicAllocation {
112 BIT1 extd_dyn_alloc,
113 BIT1 p0_present,
114 uint4_t p0 optional,
115 BIT1 pr_mode optional,
116 BIT1 usf_granularity,
117 BIT1 ul_tfi_ass_present,
118 uint5_t ul_tfi_assignment optional,
119 BIT1 reserved ('0'B),
120 BIT1 tbf_starting_time_present,
121 StartingFnDesc tbf_starting_time optional,
122 TsAllocationUnion ts_allocation
123 } with {
124 variant (p0) "PRESENCE(p0_present = '1'B)"
125 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
126 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
127 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
128 };
129 type record TsAllocationTs {
130 BIT1 presence,
131 uint3_t usf_tn optional
132 } with {
133 variant (usf_tn) "PRESENCE(presence = '1'B)"
134 };
135 type record length(8) of TsAllocationTs TsAllocationTsArr;
136 type record TnGamma {
137 BIT1 presence,
138 uint3_t usf_tn optional,
139 uint5_t gamma_tn optional
140 } with {
141 variant (usf_tn) "PRESENCE(presence = '1'B)"
142 variant (gamma_tn) "PRESENCE(presence = '1'B)"
143 };
144 type record length(8) of TnGamma TnGamma8;
145 type record TsAllocationPwr {
146 uint4_t alpha,
147 TnGamma tn_gamma
148 } with { variant "" };
149 type record TsAllocationUnion {
150 BIT1 presence,
151 TsAllocationTsArr ts optional,
152 TsAllocationPwr ts_with_pwr optional
153 } with {
154 variant (ts) "PRESENCE(presence = '0'B)"
155 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
156 };
157 type record SingleBlockAllocation {
158 uint3_t timeslot_nr,
159 BIT1 alpha_present,
160 uint4_t alpha optional,
161 uint5_t gamma_tn,
162 BIT1 p0_present,
163 uint4_t p0 optional,
164 BIT1 reserved ('0'B) optional,
165 BIT1 pr_mode optional,
166 StartingFnDesc tbf_starting_time
167 } with {
168 variant (alpha) "PRESENCE(alpha_present = '1'B)"
169 variant (p0) "PRESENCE(p0_present = '1'B)"
170 variant (reserved) "PRESENCE(p0_present = '1'B)"
171 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
172 };
173 type record PktUlAssGprs {
174 ChCodingCommand ch_coding_cmd,
175 BIT1 tlli_block_chan_coding,
176 PacketTimingAdvance pkt_ta,
177 BIT1 freq_par_present,
178 FrequencyParameters freq_par optional,
179 BIT2 alloc_present,
180 DynamicAllocation dyn_block_alloc optional,
181 SingleBlockAllocation sgl_block_alloc optional
182 } with {
183 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
184 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
185 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
186 };
187 type record PacketUlAssignment {
188 PageMode page_mode,
189 BIT1 persistence_levels_present,
190 PersistenceLevels persistence_levels optional,
191 PktUlAssUnion identity,
192 BIT1 is_egprs, /* msg escape */
193 PktUlAssGprs gprs optional
194 } with {
195 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
196 variant (gprs) "PRESENCE(is_egprs = '0'B)"
197 };
198
199 /* 11.2.10 Packet Paging Request */
Stefan Sperling59c15d62018-10-10 11:09:25 +0200200 type record MobileIdentityLV_Paging {
201 /* Note that the size of 'len' differs from that of the Mobile Identify IE
202 * as defined in 3GPP TS 24.008 10.5.1.4 "Mobile Identity"; Paging Requests
203 * use only 4 bit to encode the length of a mobile identity, whereas the IE
204 * uses a byte. */
Harald Welte484160b2017-07-28 13:30:24 +0200205 uint4_t len,
206 octetstring mobile_id
Vadim Yanitskiy322c7932020-01-01 23:03:47 +0100207 } with {
208 variant (len) "LENGTHTO(mobile_id)"
209 variant (mobile_id) "BYTEORDER(first)"
210 };
Harald Welte484160b2017-07-28 13:30:24 +0200211 type record PageInfoPs {
212 BIT1 presence ('0'B),
213 BIT1 ptmsi_or_mobile_id,
214 GsmTmsi ptmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200215 MobileIdentityLV_Paging mobile_identity optional
Harald Welte484160b2017-07-28 13:30:24 +0200216 } with {
217 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
218 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
219 };
220 type record PageInfoCs {
221 BIT1 presence ('1'B),
222 BIT1 tmsi_or_mobile_id,
223 GsmTmsi tmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200224 MobileIdentityLV_Paging mobile_identity optional,
Harald Welte484160b2017-07-28 13:30:24 +0200225 ChannelNeeded chan_needed,
226 BIT1 emlpp_prio_present,
227 uint3_t emlpp_prio optional
228 } with {
229 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
230 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
231 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
232 };
233 type union PageInfo {
234 PageInfoPs ps,
235 PageInfoCs cs
Vadim Yanitskiy5e518732020-01-01 21:27:18 +0100236 } with {
237 variant "TAG(ps, presence = '0'B; cs, presence = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200238 };
239 type record PacketPagingReq {
240 PageMode page_mode,
241 BIT1 persistence_levels_present,
242 PersistenceLevels persistence_levels optional,
243 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200244 uint2_t nln optional,
245 BIT1 repeated_pageinfo_present,
246 PageInfo repeated_pageinfo optional
Harald Welte484160b2017-07-28 13:30:24 +0200247 } with {
248 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
249 variant (nln) "PRESENCE(nln_present = '1'B)"
Oliver Smith8f9daab2019-10-09 09:27:19 +0200250 variant (repeated_pageinfo) "PRESENCE(repeated_pageinfo_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200251 };
252
253 /* 11.2.28 Uplink Ack/Nack */
254 type enumerated ChCodingCommand {
255 CH_CODING_CS1 ('00'B),
256 CH_CODING_CS2 ('01'B),
257 CH_CODING_CS3 ('10'B),
258 CH_CODING_CS4 ('11'B)
259 } with { variant "FIELDLENGTH(2)" };
260 type record UlAckNackGprs {
261 ChCodingCommand ch_coding_cmd,
262 AckNackDescription ack_nack_desc,
263 BIT1 cont_res_tlli_present,
264 GprsTlli cont_res_tlli optional,
265 BIT1 pkt_ta_present,
266 PacketTimingAdvance pkt_ta optional,
267 BIT1 pwr_ctrl_present,
268 PowerControlParameters pwr_ctrl optional
269 /* TODO: Extension Bits, Rel5 ,... */
270 } with {
271 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
272 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
273 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100274 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200275 };
276 type record PacketUlAckNack {
277 PageMode page_mode,
278 BIT2 msg_excape ('00'B),
279 uint5_t uplink_tfi,
280 BIT1 is_egprs ('0'B), /* msg escape */
281 UlAckNackGprs gprs optional
282 /* TODO: EGPRS */
283 } with { variant (gprs) "PRESENCE(is_egprs = '0'B)" };
284
285 /* 11.2.8 Packet Downlink Dummy Control Block */
286 type record PacketDlDummy {
287 PageMode page_mode,
288 BIT1 persistence_levels_present,
289 PersistenceLevels persistence_levels optional
290 } with {
291 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
292 };
293
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700294 /* 11.9 Global Power Control Parameters */
295 type record GlobalPwrCtrlParams {
296 uint4_t alpha,
297 uint5_t t_avg_v,
298 uint5_t t_avg_t,
299 uint4_t pb,
300 BIT1 pc_meas_chan,
301 BIT1 spare ('0'B),
302 uint4_t n_avg_i
303 };
304
305 /* 12.12a Global Packet Timing Advance */
306 type record TimingAdvanceIdxTN {
307 uint4_t ta_idx,
308 uint3_t ts_num
309 };
310 type record GlobalPacketTA {
311 BIT1 ta_val_presence,
312 uint4_t ta_val optional,
313 BIT1 ul_presence,
314 TimingAdvanceIdxTN ul optional,
315 BIT1 dl_presence,
316 TimingAdvanceIdxTN dl optional
317 } with {
318 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
319 variant (ul) "PRESENCE(ul_presence = '1'B)"
320 variant (dl) "PRESENCE(dl_presence = '1'B)"
321 };
322
323 /* 11.2.13 Packet Power Control/Timing Advance */
324 type record PacketPwrControlTAMsg {
325 BIT1 g_pwr_ctrl_presence,
326 GlobalPwrCtrlParams g_pwr_ctrl optional,
327 BIT1 split,
328 BIT1 split_desc optional,
329 GlobalPacketTA g_pkt_ta optional,
330 PowerControlParameters pwr_ctrl optional
331 /* TODO: additions for R99, REL-7, REL-12 */
332 } with {
333 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
334 variant (split_desc) "PRESENCE(split = '1'B)"
335 /* FIXME: Fancy coding: either both IEs together, or one of them */
336 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
337 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
338 };
339 type record PacketPwrControlTA {
340 PageMode page_mode,
341 NullGlobalTfi global_tfi,
342 /* See 11.1.3.3 'Message escape' error label
343 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
344 BIT1 msg_escape,
345 PacketPwrControlTAMsg msg optional
346 } with {
347 variant (msg) "PRESENCE(msg_escape = '0'B)"
348 };
349
Harald Welte484160b2017-07-28 13:30:24 +0200350 /* 11.2.0.1 */
351 type union RlcmacDlCtrlUnion {
352 PacketDlAssignment dl_assignment,
353 PacketUlAssignment ul_assignment,
354 PacketPagingReq paging,
355 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200356 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700357 PacketPwrControlTA pwr_ta,
Harald Welte422f0722017-08-01 00:27:06 +0200358 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200359 } with { variant "" };
360
361 type record RlcmacDlCtrlMsg {
362 RlcmacDlCtrlMsgType msg_type,
363 RlcmacDlCtrlUnion u
364 } with {
365 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
366 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
367 paging, msg_type = PACKET_PAGING_REQUEST;
368 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200369 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700370 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Harald Welte422f0722017-08-01 00:27:06 +0200371 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200372 )"
373 };
374
375 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
376 with { extension "prototype(convert) encode(RAW)" };
377 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
378 with { extension "prototype(convert) decode(RAW)" };
379
380
381 /* 11.2.6 Packet Downlikn Ack/Nack */
382 type record ILevel {
383 BIT1 presence,
384 uint4_t i_level optional
385 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
386 type record length(8) of ILevel ILevels;
387 type record ChannelQualityReport {
388 uint6_t c_value,
389 uint3_t rxqual,
390 uint6_t sign_var,
391 ILevels i_levels
392 } with { variant "" };
393 type record PacketDlAckNack {
394 uint5_t dl_tfi,
395 AckNackDescription ack_nack_desc,
396 BIT1 chreq_desc_presence,
397 ChannelReqDescription chreq_desc optional,
398 ChannelQualityReport ch_qual_rep
399 } with { variant "" };
400
401 /* 11.2.2 Packet Control Acknowledgement */
402 type enumerated CtrlAck {
403 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
404 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
405 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
406 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
407 } with { variant "FIELDLENGTH(2)" };
408 type record PacketCtrlAck {
409 GprsTlli tlli,
410 CtrlAck ctrl_ack
411 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100412 } with { variant ""
413 variant (tlli) "BYTEORDER(first)"
414 };
Harald Welte484160b2017-07-28 13:30:24 +0200415
416 /* 1.2.8b Packet Uplink Dummy Control Block */
417 type record PacketUlDummy {
418 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100419 } with { variant ""
420 variant (tlli) "BYTEORDER(first)"
421 };
Harald Welte484160b2017-07-28 13:30:24 +0200422
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200423 /* 12.30 MS Radio Access Capability 2 (feature bitmask)
424 * (value part, see 3GPP TS 24.008, 10.5.5.12a) */
425 type union MSRadioAccCap2 {
426 /* TODO: see table 10.5.146/3GPP TS 24.008 */
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100427 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200428 };
429
430 /* Table 11.2.16.2 Access Type */
431 type enumerated RlcAccessType {
432 RLC_ACC_TYPE_TWO_PHASE ('00'B),
433 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
434 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
435 RLC_ACC_TYPE_MM ('11'B)
436 } with { variant "FIELDLENGTH(2)" };
437
438 type union PacketResourceReqID {
439 GlobalTfi gtfi,
440 GprsTlli tlli
441 } with { variant (tlli) "BYTEORDER(first)" };
442
443 /* 11.2.16 Packet Resource Request */
444 type record PacketResourceReq {
445 BIT1 acc_type_presence,
446 RlcAccessType acc_type optional,
447 BIT1 id_type,
448 PacketResourceReqID id,
449 BIT1 ms_rac2_presence,
450 MSRadioAccCap2 ms_rac2 optional,
451 ChannelReqDescription ch_req_desc,
452 BIT1 change_mark_presence,
453 BIT2 change_mark optional,
454 BIT6 C_val,
455 BIT1 sign_var_presence,
456 BIT6 sign_var optional,
457 ILevels I_levels
458 /* TODO: additional contents for further Releases (starting from 1999) */
459 } with {
460 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
461 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
462 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
463 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
464 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
465 };
466
Harald Welte484160b2017-07-28 13:30:24 +0200467 /* 11.2.0.2 */
468 type union RlcmacUlCtrlUnion {
469 PacketCtrlAck ctrl_ack,
470 PacketDlAckNack dl_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200471 PacketUlDummy ul_dummy,
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200472 PacketResourceReq resource_req,
Harald Welte422f0722017-08-01 00:27:06 +0200473 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200474 } with { variant "" };
475
476 type record RlcmacUlCtrlMsg {
477 RlcmacUlCtrlMsgType msg_type,
478 RlcmacUlCtrlUnion u
479 } with {
480 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
481 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200482 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200483 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Harald Welte422f0722017-08-01 00:27:06 +0200484 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200485 )"
486 };
487
488 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
489 with { extension "prototype(convert) encode(RAW)" };
490 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
491 with { extension "prototype(convert) decode(RAW)" };
492
493 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
494
495 /* 12.3 Ack/Nack Description */
496 type record AckNackDescription {
497 BIT1 final_ack,
498 uint7_t starting_seq_nr,
499 ReceivedBlockBitmap receive_block_bitmap
500 } with { variant "" };
501
502 /* 12.7 Channel Request Description */
503 type enumerated RlcMode {
504 RLC_MODE_ACKNOWLEDGED (0),
505 RLC_MODE_UNACKNOWLEDGED (1)
506 } with { variant "FIELDLENGTH(1)" };
507 type enumerated LlcPduType {
508 LLC_PDU_IS_SACK_OR_ACK (0),
509 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
510 } with { variant "FIELDLENGTH(1)" };
511 type record ChannelReqDescription {
512 uint4_t peak_tput_class,
513 uint2_t priority,
514 RlcMode rlc_mode,
515 LlcPduType llc_pdu_type,
516 uint16_t RlcOctetCount
517 } with { variant "" };
518
519 /* 12.8 Frequency Parameters */
520 type record FreqIndirect {
521 uint6_t maio,
522 uint4_t ma_number,
523 BIT1 change_mark1_present,
524 uint2_t change_mark1 optional,
525 BIT1 change_mark2_present,
526 uint2_t change_mark2 optional
527 } with {
528 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
529 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
530 };
531 type record FreqDirect1 {
532 uint6_t maio,
533 GprsMobileAllication mobile_allocation
534 }
535 type record FreqDirect2 {
536 uint6_t maio,
537 uint6_t hsn,
538 uint4_t ma_freq_len,
539 octetstring m1_freq_list
540 } with {
541 /* FIXME: this can not be expressed in TTCN-3 ?!? */
542 //variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
543 variant (ma_freq_len) "LENGTHTO(m1_freq_list)"
544 };
545 type record FrequencyParameters {
546 uint3_t tsc,
547 BIT2 presence,
548 uint10_t arfcn optional,
549 FreqIndirect indirect optional,
550 FreqDirect1 direct1 optional,
551 FreqDirect2 direct2 optional
552 } with {
553 variant (arfcn) "PRESENCE(presence = '00'B)"
554 variant (indirect) "PRESENCE(presence = '01'B)"
555 variant (direct1) "PRESENCE(presence = '10'B)"
556 variant (direct2) "PRESENCE(presence = '11'B)"
557 };
558
559 /* 12.10 Global TFI */
560 type record GlobalTfi {
561 boolean is_dl_tfi,
562 uint5_t tfi
563 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
564
565 /* 12.10a GPRS Mobile Allocation */
566 type record RflNumberList {
567 uint4_t rfl_number,
568 BIT1 presence,
569 RflNumberList rfl_number_list optional
570 } with {
571 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
572 };
573 type record GprsMobileAllication {
574 uint6_t hsn,
575 BIT1 rfl_number_list_present,
576 RflNumberList rfl_number_list optional,
577 BIT1 ma_present,
578 uint6_t ma_length optional,
579 bitstring ma_bitmap optional
580 /* TODO: ARFCN index list */
581 } with {
582 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
583 variant (ma_length) "PRESENCE(ma_present = '0'B)"
584 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
585 /* FIXME: this can not be expressed in TTCN-3 ?!? */
586 //variant (ma_length) "LENGTHTO(ma_bitmap)+1"
587 variant (ma_length) "LENGTHTO(ma_bitmap)"
588 }
589
590 /* 12.11 Packet Request Reference */
591 type record PacketRequestReference {
592 uint11_t ra_info,
593 uint16_t frame_nr
594 } with { variant "" };
595
596 /* 12.12 Packet Timing Advance */
597 type record PacketTimingAdvance {
598 BIT1 val_present,
599 uint6_t val optional,
600 BIT1 idx_present,
601 uint4_t idx optional,
602 uint3_t timeslot_nr optional
603 } with {
604 variant (val) "PRESENCE(val_present = '1'B)"
605 variant (idx) "PRESENCE(idx_present = '1'B)"
606 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
607 };
608
609 /* 12.13 Power Control Parameters */
610 type record ZeroOneGamma {
611 BIT1 gamma_present,
612 uint5_t gamma
613 } with {
614 variant (gamma) "PRESENCE (gamma_present = '1'B)"
615 };
616 type record length(8) of ZeroOneGamma ZeroOneGammas;
617 type record PowerControlParameters {
618 uint4_t alpha,
619 ZeroOneGammas gamma
620 } with { variant "" };
621
622 /* 12.14 Persistence Level */
623 type record length(4) of uint4_t PersistenceLevels;
624
625 /* 12.20 Page Mode */
626 type enumerated PageMode {
627 PAGE_MODE_NORMAL ('00'B),
628 PAGE_MODE_EXTENDED ('01'B),
629 PAGE_MODE_REORG ('10'B),
630 PAGE_MODE_SAME ('11'B)
631 } with { variant "FIELDLENGTH(2)" };
632
633 /* 12.21 Starting Frame Number */
634 type record StartingFnDesc {
635 BIT1 presence,
636 uint16_t absolute_starting_time optional,
637 uint13_t relative_k optional
638 } with {
639 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
640 variant (relative_k) "PRESENCE(presence = '1'B)"
641 };
642
Harald Welte7024baa2018-03-02 23:37:51 +0100643 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CTRL_ACK(GprsTlli tlli,
644 CtrlAck ack := MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN) := {
645 msg_type := PACKET_CONTROL_ACK,
646 u := {
647 ctrl_ack := {
648 tlli := tlli,
649 ctrl_ack := ack
650 }
651 }
652 }
653
Pau Espin Pedrola3f0a852019-12-02 19:16:26 +0100654 const ILevel iNone := {
Harald Welteb669ee02018-03-09 12:50:02 +0100655 presence := '0'B,
656 i_level := omit
657 }
Pau Espin Pedrola3f0a852019-12-02 19:16:26 +0100658 const ChannelQualityReport c_ChQualRep_default := {
Harald Welteb669ee02018-03-09 12:50:02 +0100659 c_value := 0,
660 rxqual := 0,
661 sign_var := 0,
662 i_levels := { iNone, iNone, iNone, iNone, iNone, iNone, iNone, iNone }
663 }
664 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_DL_ACK(uint5_t dl_tfi,
665 AckNackDescription andesc,
666 ChannelQualityReport qual_rep := c_ChQualRep_default) := {
667 msg_type := PACKET_DL_ACK_NACK,
668 u := {
669 dl_ack_nack := {
670 dl_tfi := dl_tfi,
671 ack_nack_desc := andesc,
672 chreq_desc_presence := '0'B,
673 chreq_desc := omit,
674 ch_qual_rep := qual_rep
675 }
676 }
677 }
678
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200679 template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_RES_REQ(
680 GprsTlli tlli, ChannelReqDescription ch_req_desc,
681 RlcAccessType acc_type := RLC_ACC_TYPE_TWO_PHASE
682 ) := {
683 msg_type := PACKET_RESOURCE_REQUEST,
684 u := {
685 resource_req := {
686 acc_type_presence := '1'B,
687 acc_type := acc_type,
688 id_type := '1'B,
689 id := { tlli := tlli },
690 ms_rac2_presence := '0'B,
691 ms_rac2 := omit,
692 ch_req_desc := ch_req_desc,
693 change_mark_presence := '0'B,
694 change_mark := omit,
695 C_val := '000000'B,
696 sign_var_presence := '0'B,
697 sign_var := omit,
698 I_levels := {
699 iNone, iNone, iNone, iNone,
700 iNone, iNone, iNone, iNone
701 }
702 }
703 }
704 }
Harald Welteb669ee02018-03-09 12:50:02 +0100705
Harald Welte7024baa2018-03-02 23:37:51 +0100706
Harald Welte484160b2017-07-28 13:30:24 +0200707} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };