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