Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 1 | /* Data Types / Encoding / Decoding for OsmocomBB L1CTL interface */ |
| 2 | /* (C) 2017 by Harald Welte <laforge@gnumonks.org>, derived from l1ctl_proto.h |
| 3 | * (C) 2010 by Harald Welte + Holger Hans Peter Freyther */ |
| 4 | module L1CTL_Types { |
| 5 | |
| 6 | import from General_Types all; |
| 7 | import from GSM_Types all; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 8 | import from GSM_RR_Types all; |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 9 | import from Osmocom_Types all; |
| 10 | |
| 11 | type enumerated L1ctlMsgType { |
| 12 | L1CTL_NONE, |
| 13 | L1CTL_FBSB_REQ, |
| 14 | L1CTL_FBSB_CONF, |
| 15 | L1CTL_DATA_IND, |
| 16 | L1CTL_RACH_REQ, |
| 17 | L1CTL_DM_EST_REQ, |
| 18 | L1CTL_DATA_REQ, |
| 19 | L1CTL_RESET_IND, |
| 20 | L1CTL_PM_REQ, /* power measurement */ |
| 21 | L1CTL_PM_CONF, /* power measurement */ |
| 22 | L1CTL_ECHO_REQ, |
| 23 | L1CTL_ECHO_CONF, |
| 24 | L1CTL_RACH_CONF, |
| 25 | L1CTL_RESET_REQ, |
| 26 | L1CTL_RESET_CONF, |
| 27 | L1CTL_DATA_CONF, |
| 28 | L1CTL_CCCH_MODE_REQ, |
| 29 | L1CTL_CCCH_MODE_CONF, |
| 30 | L1CTL_DM_REL_REQ, |
| 31 | L1CTL_PARAM_REQ, |
| 32 | L1CTL_DM_FREQ_REQ, |
| 33 | L1CTL_CRYPTO_REQ, |
| 34 | L1CTL_SIM_REQ, |
| 35 | L1CTL_SIM_CONF, |
| 36 | L1CTL_TCH_MODE_REQ, |
| 37 | L1CTL_TCH_MODE_CONF, |
| 38 | L1CTL_NEIGH_PM_REQ, |
| 39 | L1CTL_NEIGH_PM_IND, |
| 40 | L1CTL_TRAFFIC_REQ, |
| 41 | L1CTL_TRAFFIC_CONF, |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 42 | L1CTL_TRAFFIC_IND, |
| 43 | L1CTL_TBF_CFG_REQ, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 44 | L1CTL_TBF_CFG_CONF, |
| 45 | L1CTL_DATA_TBF_REQ, |
| 46 | L1CTL_DATA_TBF_CONF |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 47 | } with { variant "FIELDLENGTH(8)" }; |
| 48 | |
| 49 | type enumerated L1ctlCcchMode { |
| 50 | CCCH_MODE_NONE (0), |
| 51 | CCCH_MODE_NON_COMBINED, |
| 52 | CCCH_MODE_COMBINED |
| 53 | } with { variant "FIELDLENGTH(8)" }; |
| 54 | |
| 55 | type enumerated L1ctlNeighMode { |
| 56 | NEIGH_MODE_NONE (0), |
| 57 | NEIGH_MODE_PM, |
| 58 | NEIGH_MODE_SB |
| 59 | } with { variant "FIELDLENGTH(8)" }; |
| 60 | |
Harald Welte | 1dcc371 | 2017-08-01 00:05:52 +0200 | [diff] [blame] | 61 | type enumerated L1ctlGprsCs { |
| 62 | L1CTL_CS1 (1), |
| 63 | L1CTL_CS2, |
| 64 | L1CTL_CS3, |
| 65 | L1CTL_CS4, |
| 66 | L1CTL_MCS1, |
| 67 | L1CTL_MCS2, |
| 68 | L1CTL_MCS3, |
| 69 | L1CTL_MCS4, |
| 70 | L1CTL_MCS5, |
| 71 | L1CTL_MCS6, |
| 72 | L1CTL_MCS7, |
| 73 | L1CTL_MCS8, |
| 74 | L1CTL_MCS9 |
| 75 | } with { variant "FIELDLENGTH(8)" }; |
| 76 | |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 77 | type enumerated L1ctlResetType { |
| 78 | L1CTL_RES_T_BOOT (0), |
| 79 | L1CTL_RES_T_FULL, |
| 80 | L1CTL_RES_T_SCHED |
| 81 | } with { variant "FIELDLENGTH(8)" }; |
| 82 | |
| 83 | const integer TRAFFIC_DATA_LEN := 40; |
| 84 | |
| 85 | type record L1ctlHdrFlags { |
| 86 | BIT7 padding, |
| 87 | boolean f_done |
| 88 | } with { variant "" }; |
| 89 | |
| 90 | type record L1ctlHeader { |
| 91 | L1ctlMsgType msg_type, |
| 92 | L1ctlHdrFlags flags, |
| 93 | OCT2 padding |
| 94 | } with { variant "" }; |
| 95 | |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 96 | template L1ctlHeader t_L1ctlHeader(template L1ctlMsgType msg_type) := { |
| 97 | msg_type := msg_type, |
| 98 | flags := { padding := '0000000'B, f_done := false }, |
| 99 | padding := '0000'O |
| 100 | }; |
| 101 | |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 102 | type record L1ctlDlInfo { |
Harald Welte | 8e4db2c | 2017-07-16 18:54:55 +0200 | [diff] [blame] | 103 | RslChannelNr chan_nr, |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 104 | RslLinkId link_id, |
| 105 | Arfcn arfcn, |
Harald Welte | 5f0d5c8 | 2017-07-16 18:56:01 +0200 | [diff] [blame] | 106 | uint32_t frame_nr, |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 107 | GsmRxLev rx_level, |
| 108 | uint8_t snr, |
| 109 | uint8_t num_biterr, |
| 110 | uint8_t fire_crc |
| 111 | } with { variant "" }; |
| 112 | |
| 113 | type record L1ctlFbsbConf { |
| 114 | int16_t initial_freq_err, |
| 115 | uint8_t result, |
| 116 | uint8_t bsic |
| 117 | } with { variant "" }; |
| 118 | |
| 119 | type record L1ctlCcchModeConf { |
| 120 | L1ctlCcchMode ccch_mode, |
| 121 | OCT3 padding |
| 122 | } with { variant "" }; |
| 123 | |
| 124 | /* gsm48_chan_mode */ |
| 125 | type uint8_t L1ctlTchMode; |
| 126 | |
| 127 | type record L1ctlAudioMode { |
| 128 | BIT4 padding, |
| 129 | boolean tx_microphone, |
| 130 | boolean tx_traffic_req, |
| 131 | boolean rx_speaker, |
| 132 | boolean rx_traffic_ind |
| 133 | } with { variant "" }; |
| 134 | |
Harald Welte | 66110f0 | 2017-07-16 21:05:18 +0200 | [diff] [blame] | 135 | template L1ctlAudioMode t_L1CTL_AudioModeNone := { '0000'B, false, false, false, false }; |
| 136 | |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 137 | type record L1ctlTchModeConf { |
| 138 | L1ctlTchMode tch_mode, |
| 139 | L1ctlAudioMode audio_mode, |
| 140 | OCT2 padding |
| 141 | } with { variant "" }; |
| 142 | |
| 143 | type record L1ctlDataInd { |
| 144 | octetstring payload length(23) |
| 145 | } with { variant "" }; |
| 146 | |
| 147 | type union L1ctlDlPayload { |
| 148 | L1ctlFbsbConf fbsb_conf, |
| 149 | L1ctlCcchModeConf ccch_mode_conf, |
| 150 | L1ctlTchModeConf tch_mode_conf, |
| 151 | L1ctlDataInd data_ind, |
| 152 | L1ctlTrafficReq traffic_ind, |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 153 | L1ctlTbfCfgReq tbf_cfg_conf, |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 154 | octetstring other |
| 155 | } with { variant "" }; |
| 156 | |
| 157 | type record L1ctlDlMessage { |
| 158 | L1ctlHeader header, |
| 159 | L1ctlDlInfo dl_info optional, |
| 160 | L1ctlDlPayload payload |
| 161 | } with { variant (dl_info) "PRESENCE(header.msg_type = L1CTL_FBSB_CONF, |
| 162 | header.msg_type = L1CTL_RACH_CONF, |
| 163 | header.msg_type = L1CTL_DATA_IND, |
| 164 | header.msg_type = L1CTL_DATA_CONF, |
| 165 | header.msg_type = L1CTL_TRAFFIC_IND)" |
| 166 | variant (payload) "CROSSTAG(fbsb_conf, header.msg_type = L1CTL_FBSB_CONF; |
| 167 | ccch_mode_conf, header.msg_type = L1CTL_CCCH_MODE_CONF; |
| 168 | tch_mode_conf, header.msg_type = L1CTL_TCH_MODE_CONF; |
| 169 | data_ind, header.msg_type = L1CTL_DATA_IND; |
| 170 | traffic_ind, header.msg_type = L1CTL_TRAFFIC_IND; |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 171 | tbf_cfg_conf, header.msg_type = L1CTL_TBF_CFG_CONF; |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 172 | other, OTHERWISE; |
| 173 | )" }; |
| 174 | |
| 175 | external function enc_L1ctlDlMessage(in L1ctlDlMessage msg) return octetstring |
| 176 | with { extension "prototype(convert) encode(RAW)" }; |
| 177 | external function dec_L1ctlDlMessage(in octetstring stream) return L1ctlDlMessage |
| 178 | with { extension "prototype(convert) decode(RAW)" }; |
| 179 | |
| 180 | |
| 181 | type record L1ctlUlInfo { |
Harald Welte | 8e4db2c | 2017-07-16 18:54:55 +0200 | [diff] [blame] | 182 | RslChannelNr chan_nr, |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 183 | RslLinkId link_id, |
| 184 | OCT2 padding |
| 185 | } with { variant "" }; |
| 186 | |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 187 | type record L1ctlUlTbfInfo { |
| 188 | uint8_t tbf_nr, |
Harald Welte | 1dcc371 | 2017-08-01 00:05:52 +0200 | [diff] [blame] | 189 | L1ctlGprsCs cs, |
| 190 | OCT2 padding |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 191 | } with { variant "" }; |
| 192 | |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 193 | type record L1ctlFbsbFlags { |
| 194 | BIT5 padding, |
| 195 | boolean sb, |
| 196 | boolean fb1, |
| 197 | boolean fb0 |
| 198 | } with { variant "" }; |
| 199 | |
Harald Welte | 66110f0 | 2017-07-16 21:05:18 +0200 | [diff] [blame] | 200 | template L1ctlFbsbFlags t_L1CTL_FBSB_F_ALL := { |
| 201 | padding := '00000'B, |
| 202 | sb := true, |
| 203 | fb1 := true, |
| 204 | fb0 := true |
| 205 | }; |
| 206 | |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 207 | type record L1ctlFbsbReq { |
| 208 | Arfcn arfcn, |
| 209 | uint16_t timeout_tdma_frames, |
| 210 | uint16_t freq_err_thresh1, |
| 211 | uint16_t freq_err_thresh2, |
| 212 | uint8_t num_freqerr_avg, |
| 213 | L1ctlFbsbFlags flags, |
| 214 | uint8_t sync_info_idx, |
| 215 | L1ctlCcchMode ccch_mode, |
| 216 | GsmRxLev rxlev_exp |
| 217 | } with { variant "" }; |
| 218 | |
| 219 | type record L1ctlCcchModeReq { |
| 220 | L1ctlTchMode tch_mode, |
| 221 | L1ctlAudioMode audio_mode, |
| 222 | OCT2 padding |
| 223 | } with { variant "" }; |
| 224 | |
| 225 | type record L1ctlTchModeReq { |
| 226 | L1ctlTchMode tch_mode, |
| 227 | L1ctlAudioMode audio_mode, |
| 228 | OCT2 padding |
| 229 | } with { variant "" }; |
| 230 | |
| 231 | type record L1ctlRachReq { |
| 232 | uint8_t ra, |
| 233 | uint8_t combined, |
| 234 | uint16_t offset |
| 235 | } with { variant "" }; |
| 236 | |
| 237 | type record L1ctlParReq { |
| 238 | int8_t ta, |
| 239 | uint8_t tx_power, |
| 240 | OCT2 padding |
| 241 | } with { variant "" }; |
| 242 | |
| 243 | type record L1ctlH1 { |
| 244 | uint8_t hsn, |
| 245 | uint8_t maio, |
| 246 | uint8_t n, |
| 247 | OCT1 padding, |
| 248 | bitstring ma length(64) |
| 249 | } with { variant "" }; |
| 250 | |
| 251 | type record L1ctlDmEstReq { |
| 252 | GsmTsc tsc, |
| 253 | uint8_t h, |
| 254 | Arfcn arfcn optional, |
| 255 | L1ctlH1 hopping optional, |
| 256 | L1ctlTchMode tch_mode, |
| 257 | L1ctlAudioMode audio_mode |
| 258 | } with { variant (arfcn) "PRESENCE(h = 0)" |
| 259 | variant (hopping) "PRESENCE(h = 1)" }; |
| 260 | |
| 261 | type record L1ctlReset { |
| 262 | L1ctlResetType reset_type, |
| 263 | OCT3 padding |
| 264 | } with { variant "" }; |
| 265 | |
| 266 | |
| 267 | type record L1ctlTrafficReq { |
| 268 | octetstring data length(TRAFFIC_DATA_LEN) |
| 269 | } with { variant "" }; |
| 270 | |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 271 | type record length(8) of uint8_t TfiUsfArr; |
| 272 | |
| 273 | type record L1ctlTbfCfgReq { |
| 274 | uint8_t tbf_nr, |
| 275 | boolean is_uplink, |
| 276 | OCT2 padding, |
| 277 | TfiUsfArr tfi_usf |
| 278 | } with { variant (is_uplink) "FIELDLENGTH(8)" }; |
| 279 | |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 280 | type union L1ctlUlPayload { |
| 281 | L1ctlFbsbReq fbsb_req, |
| 282 | L1ctlCcchModeReq ccch_mode_req, |
| 283 | L1ctlTchModeReq tch_mode_req, |
| 284 | L1ctlRachReq rach_req, |
| 285 | L1ctlParReq par_req, |
| 286 | L1ctlDmEstReq dm_est_req, |
| 287 | L1ctlReset reset_req, |
| 288 | //L1ctlNeighPmReq neigh_pm_req, |
| 289 | L1ctlTrafficReq traffic_req, |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 290 | L1ctlTbfCfgReq tbf_cfg_req, |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 291 | octetstring other |
| 292 | } with { variant "" }; |
| 293 | |
| 294 | type record L1ctlUlMessage { |
| 295 | L1ctlHeader header, |
| 296 | L1ctlUlInfo ul_info optional, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 297 | L1ctlUlTbfInfo ul_info_tbf optional, |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 298 | L1ctlUlPayload payload |
| 299 | } with { variant (ul_info) "PRESENCE(header.msg_type = L1CTL_RACH_REQ, |
| 300 | header.msg_type = L1CTL_PARAM_REQ, |
| 301 | header.msg_type = L1CTL_CRYPTO_REQ, |
| 302 | header.msg_type = L1CTL_DATA_REQ, |
| 303 | header.msg_type = L1CTL_DM_EST_REQ, |
| 304 | header.msg_type = L1CTL_DM_FREQ_REQ, |
| 305 | header.msg_type = L1CTL_DM_REL_REQ, |
| 306 | header.msg_type = L1CTL_TRAFFIC_REQ)" |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 307 | variant (ul_info_tbf) "PRESENCE(header.msg_type = L1CTL_DATA_TBF_REQ)" |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 308 | variant (payload) "CROSSTAG(fbsb_req, header.msg_type = L1CTL_FBSB_REQ; |
| 309 | ccch_mode_req, header.msg_type = L1CTL_CCCH_MODE_REQ; |
| 310 | tch_mode_req, header.msg_type = L1CTL_TCH_MODE_REQ; |
| 311 | rach_req, header.msg_type = L1CTL_RACH_REQ; |
| 312 | par_req, header.msg_type = L1CTL_PARAM_REQ; |
| 313 | dm_est_req, header.msg_type = L1CTL_DM_EST_REQ; |
| 314 | reset_req, header.msg_type = L1CTL_RESET_REQ; |
| 315 | traffic_req, header.msg_type = L1CTL_TRAFFIC_REQ; |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 316 | tbf_cfg_req, header.msg_type = L1CTL_TBF_CFG_REQ; |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 317 | other, OTHERWISE; |
| 318 | )" }; |
| 319 | |
| 320 | external function enc_L1ctlUlMessage(in L1ctlUlMessage msg) return octetstring |
| 321 | with { extension "prototype(convert) encode(RAW)" }; |
| 322 | external function dec_L1ctlUlMessage(in octetstring stream) return L1ctlUlMessage |
| 323 | with { extension "prototype(convert) decode(RAW)" }; |
| 324 | |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 325 | type record L1ctlUlMessageLV { |
| 326 | uint16_t len, |
| 327 | L1ctlUlMessage msg |
| 328 | } with { variant (len) "LENGTHTO(msg)" }; |
| 329 | |
| 330 | external function enc_L1ctlUlMessageLV(in L1ctlUlMessageLV msg) return octetstring |
| 331 | with { extension "prototype(convert) encode(RAW)" }; |
| 332 | external function dec_L1ctlUlMessageLV(in octetstring stream) return L1ctlUlMessageLV |
| 333 | with { extension "prototype(convert) decode(RAW)" }; |
| 334 | |
| 335 | type record L1ctlDlMessageLV { |
| 336 | uint16_t len, |
| 337 | L1ctlDlMessage msg |
| 338 | } with { variant (len) "LENGTHTO(msg)" }; |
| 339 | |
| 340 | external function enc_L1ctlDlMessageLV(in L1ctlDlMessageLV msg) return octetstring |
| 341 | with { extension "prototype(convert) encode(RAW)" }; |
| 342 | external function dec_L1ctlDlMessageLV(in octetstring stream) return L1ctlDlMessageLV |
| 343 | with { extension "prototype(convert) decode(RAW)" }; |
| 344 | |
| 345 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 346 | |
| 347 | |
| 348 | /* for generating RESET_REQ */ |
| 349 | template L1ctlUlMessage t_L1ctlResetReq(template L1ctlResetType rst_type) := { |
| 350 | header := t_L1ctlHeader(L1CTL_RESET_REQ), |
| 351 | ul_info := omit, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 352 | ul_info_tbf := omit, |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 353 | payload := { |
| 354 | reset_req := { |
| 355 | reset_type := rst_type, |
| 356 | padding := '000000'O |
| 357 | } |
| 358 | } |
| 359 | }; |
| 360 | |
| 361 | /* for generating FBSB_REQ */ |
| 362 | template L1ctlUlMessage t_L1CTL_FBSB_REQ(template Arfcn arfcn, template L1ctlFbsbFlags flags, uint8_t sync_info_idx, L1ctlCcchMode ccch_mode, GsmRxLev rxlev_exp) := { |
| 363 | header := t_L1ctlHeader(L1CTL_FBSB_REQ), |
| 364 | ul_info := omit, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 365 | ul_info_tbf := omit, |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 366 | payload := { |
| 367 | fbsb_req := { |
| 368 | arfcn := arfcn, |
Harald Welte | a82f7e6 | 2018-02-22 18:51:33 +0100 | [diff] [blame] | 369 | timeout_tdma_frames := 250, /* about 1s */ |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 370 | freq_err_thresh1 := 10000, |
| 371 | freq_err_thresh2 := 800, |
| 372 | num_freqerr_avg := 3, |
| 373 | flags := flags, |
| 374 | sync_info_idx := sync_info_idx, |
| 375 | ccch_mode := ccch_mode, |
| 376 | rxlev_exp := rxlev_exp |
| 377 | } |
| 378 | } |
| 379 | }; |
| 380 | |
| 381 | /* for matching against incoming FBSB_CONF */ |
| 382 | template L1ctlDlMessage t_L1CTL_FBSB_CONF(template uint8_t result) := { |
| 383 | header := t_L1ctlHeader(L1CTL_FBSB_CONF), |
| 384 | dl_info := ?, |
| 385 | payload := { |
| 386 | fbsb_conf := { |
| 387 | initial_freq_err := ?, |
| 388 | result := result, |
| 389 | bsic := ? |
| 390 | } |
| 391 | } |
| 392 | }; |
| 393 | |
| 394 | template L1ctlUlMessage t_L1CTL_RACH_REQ(uint8_t ra, uint8_t combined, uint16_t offset) := { |
| 395 | header := t_L1ctlHeader(L1CTL_RACH_REQ), |
| 396 | ul_info := { |
| 397 | chan_nr := t_RslChanNr_RACH(0), |
| 398 | link_id := ts_RslLinkID_DCCH(0), |
| 399 | padding := '0000'O |
| 400 | }, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 401 | ul_info_tbf := omit, |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 402 | payload := { |
| 403 | rach_req := { |
| 404 | ra := ra, |
| 405 | combined := combined, |
| 406 | offset := offset |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | template L1ctlUlMessage t_L1CTL_DM_EST_REQ(Arfcn arfcn, RslChannelNr chan_nr, GsmTsc tsc) := { |
| 412 | header := t_L1ctlHeader(L1CTL_DM_EST_REQ), |
| 413 | ul_info := { |
| 414 | chan_nr := chan_nr, |
| 415 | link_id := ts_RslLinkID_DCCH(0), |
| 416 | padding := '0000'O |
| 417 | }, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 418 | ul_info_tbf := omit, |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 419 | payload := { |
| 420 | dm_est_req := { |
| 421 | tsc := tsc, |
| 422 | h := 0, |
| 423 | arfcn := arfcn, |
| 424 | hopping := omit, |
| 425 | tch_mode := 0, |
| 426 | audio_mode := t_L1CTL_AudioModeNone |
| 427 | } |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | template L1ctlUlMessage t_L1CTL_DM_REL_REQ(RslChannelNr chan_nr) := { |
Harald Welte | 143edbd | 2017-07-17 20:55:42 +0200 | [diff] [blame] | 432 | header := t_L1ctlHeader(L1CTL_DM_REL_REQ), |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 433 | ul_info := { |
| 434 | chan_nr := chan_nr, |
| 435 | link_id := ts_RslLinkID_DCCH(0), |
| 436 | padding := '0000'O |
| 437 | }, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 438 | ul_info_tbf := omit, |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 439 | payload := { |
| 440 | other := ''O |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | template L1ctlUlMessage t_L1CTL_DATA_REQ(template RslChannelNr chan_nr, template RslLinkId link_id, octetstring l2_data) := { |
| 445 | header := t_L1ctlHeader(L1CTL_DATA_REQ), |
| 446 | ul_info := { |
| 447 | chan_nr := chan_nr, |
| 448 | link_id := link_id, |
| 449 | padding := '0000'O |
| 450 | }, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 451 | ul_info_tbf := omit, |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 452 | payload := { |
| 453 | other := l2_data |
| 454 | } |
| 455 | } |
| 456 | |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 457 | template L1ctlUlMessage t_L1CTL_TBF_CFG_REQ(boolean is_uplink, TfiUsfArr tfi_usf) := { |
| 458 | header := t_L1ctlHeader(L1CTL_TBF_CFG_REQ), |
| 459 | ul_info := omit, |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 460 | ul_info_tbf := omit, |
Harald Welte | 00d4dac | 2017-07-30 00:50:32 +0200 | [diff] [blame] | 461 | payload := { |
| 462 | tbf_cfg_req := { |
| 463 | tbf_nr := 0, |
| 464 | is_uplink := is_uplink, |
| 465 | padding := '0000'O, |
| 466 | tfi_usf := tfi_usf |
| 467 | } |
| 468 | } |
| 469 | }; |
| 470 | |
| 471 | template L1ctlDlMessage t_L1CTL_TBF_CFG_CONF(template boolean is_uplink) := { |
| 472 | header := t_L1ctlHeader(L1CTL_TBF_CFG_CONF), |
| 473 | dl_info := omit, |
| 474 | payload := { |
| 475 | tbf_cfg_conf := { |
| 476 | tbf_nr := 0, |
| 477 | is_uplink := is_uplink, |
| 478 | padding := ?, |
| 479 | tfi_usf := ? |
| 480 | } |
| 481 | } |
| 482 | }; |
| 483 | |
Harald Welte | 1dcc371 | 2017-08-01 00:05:52 +0200 | [diff] [blame] | 484 | template L1ctlUlMessage t_L1CTL_DATA_TBF_REQ(octetstring l2_data, L1ctlGprsCs cs := L1CTL_CS1, uint8_t tbf_nr := 0) := { |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 485 | header := t_L1ctlHeader(L1CTL_DATA_TBF_REQ), |
| 486 | ul_info := omit, |
| 487 | ul_info_tbf := { |
| 488 | tbf_nr := tbf_nr, |
Harald Welte | 1dcc371 | 2017-08-01 00:05:52 +0200 | [diff] [blame] | 489 | cs := cs, |
| 490 | padding := '0000'O |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 491 | }, |
| 492 | payload := { |
| 493 | other := l2_data |
| 494 | } |
| 495 | } |
| 496 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 497 | /* for matching against incoming RACH_CONF */ |
| 498 | template L1ctlDlMessage t_L1CTL_RACH_CONF := { |
| 499 | header := t_L1ctlHeader(L1CTL_RACH_CONF), |
| 500 | dl_info := ?, |
| 501 | payload := ? |
| 502 | }; |
| 503 | |
Harald Welte | ce6dc44 | 2018-02-21 22:00:21 +0100 | [diff] [blame] | 504 | /* for matching against incoming DATA_IND */ |
| 505 | template L1ctlDlMessage t_L1CTL_DATA_IND(template RslChannelNr chan_nr, |
| 506 | template RslLinkId link_id := ?) := { |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 507 | header := t_L1ctlHeader(L1CTL_DATA_IND), |
| 508 | dl_info := { |
| 509 | chan_nr := chan_nr, |
Harald Welte | ce6dc44 | 2018-02-21 22:00:21 +0100 | [diff] [blame] | 510 | link_id := link_id, |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 511 | arfcn := ?, |
| 512 | frame_nr := ?, |
| 513 | rx_level := ?, |
| 514 | snr := ?, |
| 515 | num_biterr := ?, |
| 516 | fire_crc := ? |
| 517 | }, |
| 518 | payload := { |
| 519 | data_ind := ? |
| 520 | } |
| 521 | }; |
| 522 | |
Harald Welte | 88849c6 | 2017-07-30 17:19:41 +0200 | [diff] [blame] | 523 | template ImmediateAssignment t_IMM_ASS(uint8_t ra, GsmFrameNumber fn) := { |
| 524 | ded_or_tbf := ?, |
| 525 | page_mode := ?, |
| 526 | chan_desc := *, |
| 527 | pkt_chan_desc := *, |
| 528 | req_ref := f_compute_ReqRef(ra, fn), |
| 529 | timing_advance := ?, |
| 530 | mobile_allocation := ?, |
| 531 | rest_octets:= ? |
| 532 | }; |
| 533 | |
| 534 | template GsmRrMessage t_RR_IMM_ASS(uint8_t ra, GsmFrameNumber fn) := { |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 535 | header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?), |
| 536 | payload := { |
Harald Welte | 88849c6 | 2017-07-30 17:19:41 +0200 | [diff] [blame] | 537 | imm_ass := t_IMM_ASS(ra, fn) |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 538 | } |
| 539 | }; |
| 540 | |
Harald Welte | f654332 | 2017-07-16 07:35:10 +0200 | [diff] [blame] | 541 | } with { encode "RAW" }; |