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; |
Pau Espin Pedrol | 8690408 | 2019-12-30 20:21:00 +0100 | [diff] [blame] | 19 | import from MobileL3_GMM_SM_Types all; |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 20 | |
| 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 Yanitskiy | 759cb29 | 2019-09-30 20:08:11 +0700 | [diff] [blame] | 30 | PACKET_PWR_CONTROL_TA ('000101'B), |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 31 | /* 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 Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 67 | } with { variant "" |
| 68 | variant (tlli) "BYTEORDER(first)" |
| 69 | }; |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 70 | |
| 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 Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 95 | } with { variant "" |
| 96 | variant (tlli) "BYTEORDER(first)" |
| 97 | }; |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 98 | 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 Sperling | 59c15d6 | 2018-10-10 11:09:25 +0200 | [diff] [blame] | 200 | 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 Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 205 | uint4_t len, |
| 206 | octetstring mobile_id |
| 207 | } with { variant (len) "LENGTHTO(mobile_id)" }; |
| 208 | type record PageInfoPs { |
| 209 | BIT1 presence ('0'B), |
| 210 | BIT1 ptmsi_or_mobile_id, |
| 211 | GsmTmsi ptmsi optional, |
Stefan Sperling | 59c15d6 | 2018-10-10 11:09:25 +0200 | [diff] [blame] | 212 | MobileIdentityLV_Paging mobile_identity optional |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 213 | } with { |
| 214 | variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)" |
| 215 | variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)" |
| 216 | }; |
| 217 | type record PageInfoCs { |
| 218 | BIT1 presence ('1'B), |
| 219 | BIT1 tmsi_or_mobile_id, |
| 220 | GsmTmsi tmsi optional, |
Stefan Sperling | 59c15d6 | 2018-10-10 11:09:25 +0200 | [diff] [blame] | 221 | MobileIdentityLV_Paging mobile_identity optional, |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 222 | ChannelNeeded chan_needed, |
| 223 | BIT1 emlpp_prio_present, |
| 224 | uint3_t emlpp_prio optional |
| 225 | } with { |
| 226 | variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)" |
| 227 | variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)" |
| 228 | variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)" |
| 229 | }; |
| 230 | type union PageInfo { |
| 231 | PageInfoPs ps, |
| 232 | PageInfoCs cs |
| 233 | }; |
| 234 | type record PacketPagingReq { |
| 235 | PageMode page_mode, |
| 236 | BIT1 persistence_levels_present, |
| 237 | PersistenceLevels persistence_levels optional, |
| 238 | BIT1 nln_present, |
Oliver Smith | 8f9daab | 2019-10-09 09:27:19 +0200 | [diff] [blame] | 239 | uint2_t nln optional, |
| 240 | BIT1 repeated_pageinfo_present, |
| 241 | PageInfo repeated_pageinfo optional |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 242 | } with { |
| 243 | variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)" |
| 244 | variant (nln) "PRESENCE(nln_present = '1'B)" |
Oliver Smith | 8f9daab | 2019-10-09 09:27:19 +0200 | [diff] [blame] | 245 | variant (repeated_pageinfo) "PRESENCE(repeated_pageinfo_present = '1'B)" |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 246 | }; |
| 247 | |
| 248 | /* 11.2.28 Uplink Ack/Nack */ |
| 249 | type enumerated ChCodingCommand { |
| 250 | CH_CODING_CS1 ('00'B), |
| 251 | CH_CODING_CS2 ('01'B), |
| 252 | CH_CODING_CS3 ('10'B), |
| 253 | CH_CODING_CS4 ('11'B) |
| 254 | } with { variant "FIELDLENGTH(2)" }; |
| 255 | type record UlAckNackGprs { |
| 256 | ChCodingCommand ch_coding_cmd, |
| 257 | AckNackDescription ack_nack_desc, |
| 258 | BIT1 cont_res_tlli_present, |
| 259 | GprsTlli cont_res_tlli optional, |
| 260 | BIT1 pkt_ta_present, |
| 261 | PacketTimingAdvance pkt_ta optional, |
| 262 | BIT1 pwr_ctrl_present, |
| 263 | PowerControlParameters pwr_ctrl optional |
| 264 | /* TODO: Extension Bits, Rel5 ,... */ |
| 265 | } with { |
| 266 | variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)" |
| 267 | variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)" |
| 268 | variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)" |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 269 | variant (cont_res_tlli) "BYTEORDER(first)" |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 270 | }; |
| 271 | type record PacketUlAckNack { |
| 272 | PageMode page_mode, |
| 273 | BIT2 msg_excape ('00'B), |
| 274 | uint5_t uplink_tfi, |
| 275 | BIT1 is_egprs ('0'B), /* msg escape */ |
| 276 | UlAckNackGprs gprs optional |
| 277 | /* TODO: EGPRS */ |
| 278 | } with { variant (gprs) "PRESENCE(is_egprs = '0'B)" }; |
| 279 | |
| 280 | /* 11.2.8 Packet Downlink Dummy Control Block */ |
| 281 | type record PacketDlDummy { |
| 282 | PageMode page_mode, |
| 283 | BIT1 persistence_levels_present, |
| 284 | PersistenceLevels persistence_levels optional |
| 285 | } with { |
| 286 | variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)" |
| 287 | }; |
| 288 | |
Vadim Yanitskiy | 759cb29 | 2019-09-30 20:08:11 +0700 | [diff] [blame] | 289 | /* 11.9 Global Power Control Parameters */ |
| 290 | type record GlobalPwrCtrlParams { |
| 291 | uint4_t alpha, |
| 292 | uint5_t t_avg_v, |
| 293 | uint5_t t_avg_t, |
| 294 | uint4_t pb, |
| 295 | BIT1 pc_meas_chan, |
| 296 | BIT1 spare ('0'B), |
| 297 | uint4_t n_avg_i |
| 298 | }; |
| 299 | |
| 300 | /* 12.12a Global Packet Timing Advance */ |
| 301 | type record TimingAdvanceIdxTN { |
| 302 | uint4_t ta_idx, |
| 303 | uint3_t ts_num |
| 304 | }; |
| 305 | type record GlobalPacketTA { |
| 306 | BIT1 ta_val_presence, |
| 307 | uint4_t ta_val optional, |
| 308 | BIT1 ul_presence, |
| 309 | TimingAdvanceIdxTN ul optional, |
| 310 | BIT1 dl_presence, |
| 311 | TimingAdvanceIdxTN dl optional |
| 312 | } with { |
| 313 | variant (ta_val) "PRESENCE(ta_val_presence = '1'B)" |
| 314 | variant (ul) "PRESENCE(ul_presence = '1'B)" |
| 315 | variant (dl) "PRESENCE(dl_presence = '1'B)" |
| 316 | }; |
| 317 | |
| 318 | /* 11.2.13 Packet Power Control/Timing Advance */ |
| 319 | type record PacketPwrControlTAMsg { |
| 320 | BIT1 g_pwr_ctrl_presence, |
| 321 | GlobalPwrCtrlParams g_pwr_ctrl optional, |
| 322 | BIT1 split, |
| 323 | BIT1 split_desc optional, |
| 324 | GlobalPacketTA g_pkt_ta optional, |
| 325 | PowerControlParameters pwr_ctrl optional |
| 326 | /* TODO: additions for R99, REL-7, REL-12 */ |
| 327 | } with { |
| 328 | variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)" |
| 329 | variant (split_desc) "PRESENCE(split = '1'B)" |
| 330 | /* FIXME: Fancy coding: either both IEs together, or one of them */ |
| 331 | variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)" |
| 332 | variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)" |
| 333 | }; |
| 334 | type record PacketPwrControlTA { |
| 335 | PageMode page_mode, |
| 336 | NullGlobalTfi global_tfi, |
| 337 | /* See 11.1.3.3 'Message escape' error label |
| 338 | * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */ |
| 339 | BIT1 msg_escape, |
| 340 | PacketPwrControlTAMsg msg optional |
| 341 | } with { |
| 342 | variant (msg) "PRESENCE(msg_escape = '0'B)" |
| 343 | }; |
| 344 | |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 345 | /* 11.2.0.1 */ |
| 346 | type union RlcmacDlCtrlUnion { |
| 347 | PacketDlAssignment dl_assignment, |
| 348 | PacketUlAssignment ul_assignment, |
| 349 | PacketPagingReq paging, |
| 350 | PacketUlAckNack ul_ack_nack, |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 351 | PacketDlDummy dl_dummy, |
Vadim Yanitskiy | 759cb29 | 2019-09-30 20:08:11 +0700 | [diff] [blame] | 352 | PacketPwrControlTA pwr_ta, |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 353 | octetstring other |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 354 | } with { variant "" }; |
| 355 | |
| 356 | type record RlcmacDlCtrlMsg { |
| 357 | RlcmacDlCtrlMsgType msg_type, |
| 358 | RlcmacDlCtrlUnion u |
| 359 | } with { |
| 360 | variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT; |
| 361 | ul_assignment, msg_type = PACKET_UL_ASSIGNMENT; |
| 362 | paging, msg_type = PACKET_PAGING_REQUEST; |
| 363 | ul_ack_nack, msg_type = PACKET_UL_ACK_NACK; |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 364 | dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL; |
Vadim Yanitskiy | 759cb29 | 2019-09-30 20:08:11 +0700 | [diff] [blame] | 365 | pwr_ta, msg_type = PACKET_PWR_CONTROL_TA; |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 366 | other, OTHERWISE |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 367 | )" |
| 368 | }; |
| 369 | |
| 370 | external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring |
| 371 | with { extension "prototype(convert) encode(RAW)" }; |
| 372 | external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg |
| 373 | with { extension "prototype(convert) decode(RAW)" }; |
| 374 | |
| 375 | |
| 376 | /* 11.2.6 Packet Downlikn Ack/Nack */ |
| 377 | type record ILevel { |
| 378 | BIT1 presence, |
| 379 | uint4_t i_level optional |
| 380 | } with { variant (i_level) "PRESENCE(presence = '1'B)" }; |
| 381 | type record length(8) of ILevel ILevels; |
| 382 | type record ChannelQualityReport { |
| 383 | uint6_t c_value, |
| 384 | uint3_t rxqual, |
| 385 | uint6_t sign_var, |
| 386 | ILevels i_levels |
| 387 | } with { variant "" }; |
| 388 | type record PacketDlAckNack { |
| 389 | uint5_t dl_tfi, |
| 390 | AckNackDescription ack_nack_desc, |
| 391 | BIT1 chreq_desc_presence, |
| 392 | ChannelReqDescription chreq_desc optional, |
| 393 | ChannelQualityReport ch_qual_rep |
| 394 | } with { variant "" }; |
| 395 | |
| 396 | /* 11.2.2 Packet Control Acknowledgement */ |
| 397 | type enumerated CtrlAck { |
| 398 | MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B), |
| 399 | MS_RCVD_RBSN1_NO_RBSN0 ('01'B), |
| 400 | MS_RCVD_RBSN0_NO_RBSN1 ('10'B), |
| 401 | MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B) |
| 402 | } with { variant "FIELDLENGTH(2)" }; |
| 403 | type record PacketCtrlAck { |
| 404 | GprsTlli tlli, |
| 405 | CtrlAck ctrl_ack |
| 406 | /* TODO: Rel5 additions */ |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 407 | } with { variant "" |
| 408 | variant (tlli) "BYTEORDER(first)" |
| 409 | }; |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 410 | |
| 411 | /* 1.2.8b Packet Uplink Dummy Control Block */ |
| 412 | type record PacketUlDummy { |
| 413 | GprsTlli tlli |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 414 | } with { variant "" |
| 415 | variant (tlli) "BYTEORDER(first)" |
| 416 | }; |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 417 | |
Vadim Yanitskiy | c524849 | 2019-09-14 16:11:33 +0200 | [diff] [blame] | 418 | /* 12.30 MS Radio Access Capability 2 (feature bitmask) |
| 419 | * (value part, see 3GPP TS 24.008, 10.5.5.12a) */ |
| 420 | type union MSRadioAccCap2 { |
| 421 | /* TODO: see table 10.5.146/3GPP TS 24.008 */ |
Pau Espin Pedrol | 8690408 | 2019-12-30 20:21:00 +0100 | [diff] [blame] | 422 | MSRadioAccessCapabilityV msRadioAccessCapabilityV |
Vadim Yanitskiy | c524849 | 2019-09-14 16:11:33 +0200 | [diff] [blame] | 423 | }; |
| 424 | |
| 425 | /* Table 11.2.16.2 Access Type */ |
| 426 | type enumerated RlcAccessType { |
| 427 | RLC_ACC_TYPE_TWO_PHASE ('00'B), |
| 428 | RLC_ACC_TYPE_PAG_RESPONSE ('01'B), |
| 429 | RLC_ACC_TYPE_CELL_UPDATE ('10'B), |
| 430 | RLC_ACC_TYPE_MM ('11'B) |
| 431 | } with { variant "FIELDLENGTH(2)" }; |
| 432 | |
| 433 | type union PacketResourceReqID { |
| 434 | GlobalTfi gtfi, |
| 435 | GprsTlli tlli |
| 436 | } with { variant (tlli) "BYTEORDER(first)" }; |
| 437 | |
| 438 | /* 11.2.16 Packet Resource Request */ |
| 439 | type record PacketResourceReq { |
| 440 | BIT1 acc_type_presence, |
| 441 | RlcAccessType acc_type optional, |
| 442 | BIT1 id_type, |
| 443 | PacketResourceReqID id, |
| 444 | BIT1 ms_rac2_presence, |
| 445 | MSRadioAccCap2 ms_rac2 optional, |
| 446 | ChannelReqDescription ch_req_desc, |
| 447 | BIT1 change_mark_presence, |
| 448 | BIT2 change_mark optional, |
| 449 | BIT6 C_val, |
| 450 | BIT1 sign_var_presence, |
| 451 | BIT6 sign_var optional, |
| 452 | ILevels I_levels |
| 453 | /* TODO: additional contents for further Releases (starting from 1999) */ |
| 454 | } with { |
| 455 | variant (acc_type) "PRESENCE(acc_type_presence = '1'B)" |
| 456 | variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)" |
| 457 | variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)" |
| 458 | variant (change_mark) "PRESENCE(change_mark_presence = '1'B)" |
| 459 | variant (sign_var) "PRESENCE(sign_var_presence = '1'B)" |
| 460 | }; |
| 461 | |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 462 | /* 11.2.0.2 */ |
| 463 | type union RlcmacUlCtrlUnion { |
| 464 | PacketCtrlAck ctrl_ack, |
| 465 | PacketDlAckNack dl_ack_nack, |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 466 | PacketUlDummy ul_dummy, |
Vadim Yanitskiy | c524849 | 2019-09-14 16:11:33 +0200 | [diff] [blame] | 467 | PacketResourceReq resource_req, |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 468 | octetstring other |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 469 | } with { variant "" }; |
| 470 | |
| 471 | type record RlcmacUlCtrlMsg { |
| 472 | RlcmacUlCtrlMsgType msg_type, |
| 473 | RlcmacUlCtrlUnion u |
| 474 | } with { |
| 475 | variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK; |
| 476 | dl_ack_nack, msg_type = PACKET_DL_ACK_NACK; |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 477 | ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL; |
Vadim Yanitskiy | c524849 | 2019-09-14 16:11:33 +0200 | [diff] [blame] | 478 | resource_req, msg_type = PACKET_RESOURCE_REQUEST; |
Harald Welte | 422f072 | 2017-08-01 00:27:06 +0200 | [diff] [blame] | 479 | other, OTHERWISE |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 480 | )" |
| 481 | }; |
| 482 | |
| 483 | external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring |
| 484 | with { extension "prototype(convert) encode(RAW)" }; |
| 485 | external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg |
| 486 | with { extension "prototype(convert) decode(RAW)" }; |
| 487 | |
| 488 | type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" }; |
| 489 | |
| 490 | /* 12.3 Ack/Nack Description */ |
| 491 | type record AckNackDescription { |
| 492 | BIT1 final_ack, |
| 493 | uint7_t starting_seq_nr, |
| 494 | ReceivedBlockBitmap receive_block_bitmap |
| 495 | } with { variant "" }; |
| 496 | |
| 497 | /* 12.7 Channel Request Description */ |
| 498 | type enumerated RlcMode { |
| 499 | RLC_MODE_ACKNOWLEDGED (0), |
| 500 | RLC_MODE_UNACKNOWLEDGED (1) |
| 501 | } with { variant "FIELDLENGTH(1)" }; |
| 502 | type enumerated LlcPduType { |
| 503 | LLC_PDU_IS_SACK_OR_ACK (0), |
| 504 | LLC_PDU_IS_NOT_SACK_OR_ACK (1) |
| 505 | } with { variant "FIELDLENGTH(1)" }; |
| 506 | type record ChannelReqDescription { |
| 507 | uint4_t peak_tput_class, |
| 508 | uint2_t priority, |
| 509 | RlcMode rlc_mode, |
| 510 | LlcPduType llc_pdu_type, |
| 511 | uint16_t RlcOctetCount |
| 512 | } with { variant "" }; |
| 513 | |
| 514 | /* 12.8 Frequency Parameters */ |
| 515 | type record FreqIndirect { |
| 516 | uint6_t maio, |
| 517 | uint4_t ma_number, |
| 518 | BIT1 change_mark1_present, |
| 519 | uint2_t change_mark1 optional, |
| 520 | BIT1 change_mark2_present, |
| 521 | uint2_t change_mark2 optional |
| 522 | } with { |
| 523 | variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)" |
| 524 | variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)" |
| 525 | }; |
| 526 | type record FreqDirect1 { |
| 527 | uint6_t maio, |
| 528 | GprsMobileAllication mobile_allocation |
| 529 | } |
| 530 | type record FreqDirect2 { |
| 531 | uint6_t maio, |
| 532 | uint6_t hsn, |
| 533 | uint4_t ma_freq_len, |
| 534 | octetstring m1_freq_list |
| 535 | } with { |
| 536 | /* FIXME: this can not be expressed in TTCN-3 ?!? */ |
| 537 | //variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3" |
| 538 | variant (ma_freq_len) "LENGTHTO(m1_freq_list)" |
| 539 | }; |
| 540 | type record FrequencyParameters { |
| 541 | uint3_t tsc, |
| 542 | BIT2 presence, |
| 543 | uint10_t arfcn optional, |
| 544 | FreqIndirect indirect optional, |
| 545 | FreqDirect1 direct1 optional, |
| 546 | FreqDirect2 direct2 optional |
| 547 | } with { |
| 548 | variant (arfcn) "PRESENCE(presence = '00'B)" |
| 549 | variant (indirect) "PRESENCE(presence = '01'B)" |
| 550 | variant (direct1) "PRESENCE(presence = '10'B)" |
| 551 | variant (direct2) "PRESENCE(presence = '11'B)" |
| 552 | }; |
| 553 | |
| 554 | /* 12.10 Global TFI */ |
| 555 | type record GlobalTfi { |
| 556 | boolean is_dl_tfi, |
| 557 | uint5_t tfi |
| 558 | } with { variant (is_dl_tfi) "FIELDLENGTH(1)" }; |
| 559 | |
| 560 | /* 12.10a GPRS Mobile Allocation */ |
| 561 | type record RflNumberList { |
| 562 | uint4_t rfl_number, |
| 563 | BIT1 presence, |
| 564 | RflNumberList rfl_number_list optional |
| 565 | } with { |
| 566 | variant (rfl_number_list) "PRESENCE(presence = '1'B)" |
| 567 | }; |
| 568 | type record GprsMobileAllication { |
| 569 | uint6_t hsn, |
| 570 | BIT1 rfl_number_list_present, |
| 571 | RflNumberList rfl_number_list optional, |
| 572 | BIT1 ma_present, |
| 573 | uint6_t ma_length optional, |
| 574 | bitstring ma_bitmap optional |
| 575 | /* TODO: ARFCN index list */ |
| 576 | } with { |
| 577 | variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)" |
| 578 | variant (ma_length) "PRESENCE(ma_present = '0'B)" |
| 579 | variant (ma_bitmap) "PRESENCE(ma_present = '0'B)" |
| 580 | /* FIXME: this can not be expressed in TTCN-3 ?!? */ |
| 581 | //variant (ma_length) "LENGTHTO(ma_bitmap)+1" |
| 582 | variant (ma_length) "LENGTHTO(ma_bitmap)" |
| 583 | } |
| 584 | |
| 585 | /* 12.11 Packet Request Reference */ |
| 586 | type record PacketRequestReference { |
| 587 | uint11_t ra_info, |
| 588 | uint16_t frame_nr |
| 589 | } with { variant "" }; |
| 590 | |
| 591 | /* 12.12 Packet Timing Advance */ |
| 592 | type record PacketTimingAdvance { |
| 593 | BIT1 val_present, |
| 594 | uint6_t val optional, |
| 595 | BIT1 idx_present, |
| 596 | uint4_t idx optional, |
| 597 | uint3_t timeslot_nr optional |
| 598 | } with { |
| 599 | variant (val) "PRESENCE(val_present = '1'B)" |
| 600 | variant (idx) "PRESENCE(idx_present = '1'B)" |
| 601 | variant (timeslot_nr) "PRESENCE(idx_present = '1'B)" |
| 602 | }; |
| 603 | |
| 604 | /* 12.13 Power Control Parameters */ |
| 605 | type record ZeroOneGamma { |
| 606 | BIT1 gamma_present, |
| 607 | uint5_t gamma |
| 608 | } with { |
| 609 | variant (gamma) "PRESENCE (gamma_present = '1'B)" |
| 610 | }; |
| 611 | type record length(8) of ZeroOneGamma ZeroOneGammas; |
| 612 | type record PowerControlParameters { |
| 613 | uint4_t alpha, |
| 614 | ZeroOneGammas gamma |
| 615 | } with { variant "" }; |
| 616 | |
| 617 | /* 12.14 Persistence Level */ |
| 618 | type record length(4) of uint4_t PersistenceLevels; |
| 619 | |
| 620 | /* 12.20 Page Mode */ |
| 621 | type enumerated PageMode { |
| 622 | PAGE_MODE_NORMAL ('00'B), |
| 623 | PAGE_MODE_EXTENDED ('01'B), |
| 624 | PAGE_MODE_REORG ('10'B), |
| 625 | PAGE_MODE_SAME ('11'B) |
| 626 | } with { variant "FIELDLENGTH(2)" }; |
| 627 | |
| 628 | /* 12.21 Starting Frame Number */ |
| 629 | type record StartingFnDesc { |
| 630 | BIT1 presence, |
| 631 | uint16_t absolute_starting_time optional, |
| 632 | uint13_t relative_k optional |
| 633 | } with { |
| 634 | variant (absolute_starting_time) "PRESENCE(presence = '0'B)" |
| 635 | variant (relative_k) "PRESENCE(presence = '1'B)" |
| 636 | }; |
| 637 | |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 638 | template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_CTRL_ACK(GprsTlli tlli, |
| 639 | CtrlAck ack := MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN) := { |
| 640 | msg_type := PACKET_CONTROL_ACK, |
| 641 | u := { |
| 642 | ctrl_ack := { |
| 643 | tlli := tlli, |
| 644 | ctrl_ack := ack |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | |
Pau Espin Pedrol | a3f0a85 | 2019-12-02 19:16:26 +0100 | [diff] [blame] | 649 | const ILevel iNone := { |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 650 | presence := '0'B, |
| 651 | i_level := omit |
| 652 | } |
Pau Espin Pedrol | a3f0a85 | 2019-12-02 19:16:26 +0100 | [diff] [blame] | 653 | const ChannelQualityReport c_ChQualRep_default := { |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 654 | c_value := 0, |
| 655 | rxqual := 0, |
| 656 | sign_var := 0, |
| 657 | i_levels := { iNone, iNone, iNone, iNone, iNone, iNone, iNone, iNone } |
| 658 | } |
| 659 | template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_DL_ACK(uint5_t dl_tfi, |
| 660 | AckNackDescription andesc, |
| 661 | ChannelQualityReport qual_rep := c_ChQualRep_default) := { |
| 662 | msg_type := PACKET_DL_ACK_NACK, |
| 663 | u := { |
| 664 | dl_ack_nack := { |
| 665 | dl_tfi := dl_tfi, |
| 666 | ack_nack_desc := andesc, |
| 667 | chreq_desc_presence := '0'B, |
| 668 | chreq_desc := omit, |
| 669 | ch_qual_rep := qual_rep |
| 670 | } |
| 671 | } |
| 672 | } |
| 673 | |
Vadim Yanitskiy | c524849 | 2019-09-14 16:11:33 +0200 | [diff] [blame] | 674 | template (value) RlcmacUlCtrlMsg ts_RlcMacUlCtrl_PKT_RES_REQ( |
| 675 | GprsTlli tlli, ChannelReqDescription ch_req_desc, |
| 676 | RlcAccessType acc_type := RLC_ACC_TYPE_TWO_PHASE |
| 677 | ) := { |
| 678 | msg_type := PACKET_RESOURCE_REQUEST, |
| 679 | u := { |
| 680 | resource_req := { |
| 681 | acc_type_presence := '1'B, |
| 682 | acc_type := acc_type, |
| 683 | id_type := '1'B, |
| 684 | id := { tlli := tlli }, |
| 685 | ms_rac2_presence := '0'B, |
| 686 | ms_rac2 := omit, |
| 687 | ch_req_desc := ch_req_desc, |
| 688 | change_mark_presence := '0'B, |
| 689 | change_mark := omit, |
| 690 | C_val := '000000'B, |
| 691 | sign_var_presence := '0'B, |
| 692 | sign_var := omit, |
| 693 | I_levels := { |
| 694 | iNone, iNone, iNone, iNone, |
| 695 | iNone, iNone, iNone, iNone |
| 696 | } |
| 697 | } |
| 698 | } |
| 699 | } |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 700 | |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 701 | |
Harald Welte | 484160b | 2017-07-28 13:30:24 +0200 | [diff] [blame] | 702 | } with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" }; |