Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* Osmocom PCU Interface Types, as per osmo-pcu/include/osmocom/pcu/pcuif_proto.h |
| 2 | * (C) 2018-2019 Harald Welte <laforge@gnumonks.org> |
| 3 | * contributions by Vadim Yanitskiy <axilirator@gmail.com> |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Released under the terms of GNU General Public License, Version 2 or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 12 | module PCUIF_Types { |
| 13 | |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 16 | import from Native_Functions all; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 17 | |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 18 | modulepar { |
| 19 | /* PCUIF version supported by the IUT */ |
Vadim Yanitskiy | befa21c | 2020-09-22 00:53:16 +0700 | [diff] [blame] | 20 | PCUIF_Version mp_pcuif_version := 10; |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 21 | }; |
| 22 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 23 | const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts"; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 24 | type integer PCUIF_Version (9..10); /* supported versions */ |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 25 | |
| 26 | type enumerated PCUIF_MsgType { |
| 27 | PCU_IF_MSG_DATA_REQ ('00'O), |
| 28 | PCU_IF_MSG_DATA_CNF ('01'O), |
| 29 | PCU_IF_MSG_DATA_IND ('02'O), |
| 30 | PCU_IF_MSG_SUSP_REQ ('03'O), |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 31 | PCU_IF_MSG_APP_INFO_REQ ('04'O), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 32 | PCU_IF_MSG_RTS_REQ ('10'O), |
| 33 | PCU_IF_MSG_DATA_CNF_DT ('11'O), |
| 34 | PCU_IF_MSG_RACH_IND ('22'O), |
| 35 | PCU_IF_MSG_INFO_IND ('32'O), |
| 36 | PCU_IF_MSG_ACT_REQ ('40'O), |
| 37 | PCU_IF_MSG_TIME_IND ('52'O), |
| 38 | PCU_IF_MSG_PAG_REQ ('60'O), |
| 39 | PCU_IF_MSG_TXT_IND ('70'O) |
| 40 | } with { variant "FIELDLENGTH(8)" }; |
| 41 | |
| 42 | type enumerated PCUIF_Sapi { |
| 43 | PCU_IF_SAPI_UNKNOWN ('00'O), |
| 44 | PCU_IF_SAPI_RACH ('01'O), |
| 45 | PCU_IF_SAPI_AGCH ('02'O), |
| 46 | PCU_IF_SAPI_PCH ('03'O), |
| 47 | PCU_IF_SAPI_BCCH ('04'O), |
| 48 | PCU_IF_SAPI_PDTCH ('05'O), |
| 49 | PCU_IF_SAPI_PRACH ('06'O), |
| 50 | PCU_IF_SAPI_PTCCH ('07'O), |
| 51 | PCU_IF_SAPI_AGCH_DT ('08'O) |
| 52 | } with { variant "FIELDLENGTH(8)" }; |
| 53 | |
| 54 | type record PCUIF_Flags { |
| 55 | boolean bts_active, |
| 56 | boolean sysmo_direct_dsp, |
| 57 | BIT14 spare, |
| 58 | boolean cs1, |
| 59 | boolean cs2, |
| 60 | boolean cs3, |
| 61 | boolean cs4, |
| 62 | boolean mcs1, |
| 63 | boolean mcs2, |
| 64 | boolean mcs3, |
| 65 | boolean mcs4, |
| 66 | boolean mcs5, |
| 67 | boolean mcs6, |
| 68 | boolean mcs7, |
| 69 | boolean mcs8, |
| 70 | boolean mcs9, |
| 71 | BIT3 spare2 |
| 72 | } with { variant "" }; |
| 73 | |
| 74 | type enumerated PCUIF_TextType { |
| 75 | PCU_VERSION (0), |
| 76 | PCU_OML_ALERT (1) |
| 77 | } with { variant "FIELDLENGTH(8)" }; |
| 78 | |
Vadim Yanitskiy | e1527f7 | 2019-09-09 02:15:33 +0200 | [diff] [blame] | 79 | type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 80 | |
| 81 | type record PCUIF_txt_ind { |
| 82 | PCUIF_TextType txt_type, |
| 83 | PCUIF_Text text |
| 84 | } with { variant "" }; |
| 85 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 86 | type record PCUIF_data { |
| 87 | PCUIF_Sapi sapi, |
| 88 | uint8_t len, |
Vadim Yanitskiy | d8f28e6 | 2019-09-10 18:11:52 +0200 | [diff] [blame] | 89 | octetstring data length(162), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 90 | uint32_t fn, |
| 91 | uint16_t arfcn, |
| 92 | uint8_t trx_nr, |
| 93 | uint8_t ts_nr, |
| 94 | uint8_t block_nr, |
| 95 | int8_t rssi, |
| 96 | uint16_t ber10k, |
| 97 | int16_t ta_offs_qbits, |
| 98 | int16_t lqual_cb |
Vadim Yanitskiy | d8f28e6 | 2019-09-10 18:11:52 +0200 | [diff] [blame] | 99 | } with { variant (data) "FIELDLENGTH(162), ALIGN(left)" }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 100 | |
| 101 | type record PCUIF_data_cnf_dt { |
| 102 | PCUIF_Sapi sapi, |
| 103 | OCT4 tlli, |
| 104 | uint32_t fn, |
| 105 | uint16_t arfcn, |
| 106 | uint8_t trx_nr, |
| 107 | uint8_t ts_nr, |
| 108 | uint8_t block_nr, |
| 109 | int8_t rssi, |
| 110 | uint16_t ber10k, |
| 111 | int16_t ta_offs_qbits, |
| 112 | int16_t lqual_cb |
| 113 | } with { variant "" }; |
| 114 | |
| 115 | type record PCUIF_rts_req { |
| 116 | PCUIF_Sapi sapi, |
| 117 | OCT3 spare, |
| 118 | uint32_t fn, |
| 119 | uint16_t arfcn, |
| 120 | uint8_t trx_nr, |
| 121 | uint8_t ts_nr, |
| 122 | uint8_t block_nr |
| 123 | } with { variant "" }; |
| 124 | |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 125 | type enumerated PCUIF_BurstType { |
| 126 | BURST_TYPE_NONE (0), |
| 127 | BURST_TYPE_0 (1), |
| 128 | BURST_TYPE_1 (2), |
| 129 | BURST_TYPE_2 (3) |
| 130 | } with { variant "FIELDLENGTH(8)" }; |
| 131 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 132 | type record PCUIF_rach_ind { |
| 133 | PCUIF_Sapi sapi, |
| 134 | uint16_t ra, |
| 135 | int16_t qta, |
| 136 | uint32_t fn, |
| 137 | uint16_t arfcn, |
| 138 | uint8_t is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 139 | PCUIF_BurstType burst_type, |
| 140 | uint8_t trx_nr, |
| 141 | uint8_t ts_nr |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 142 | } with { variant "" }; |
| 143 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 144 | type record PCUIF_InfoTrxTs { |
| 145 | uint8_t tsc, |
| 146 | uint8_t hopping, |
| 147 | uint8_t hsn, |
| 148 | uint8_t maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 149 | uint8_t ma_bit_len, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 150 | bitstring ma length(64) |
| 151 | } with { variant (ma) "BYTEORDER(first), BITORDER(msb)" }; |
| 152 | private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList; |
| 153 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 154 | private type record PCUIF_InfoTrx { |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 155 | uint16_t arfcn, |
| 156 | BIT8 pdch_mask, |
Vadim Yanitskiy | d805172 | 2020-08-22 02:33:17 +0700 | [diff] [blame] | 157 | OCT1 spare, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 158 | uint32_t hLayer1, |
| 159 | PCUIF_InfoTrxTsList ts |
| 160 | } with { variant (pdch_mask) "BITORDER(msb)" }; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 161 | type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 162 | |
| 163 | type record PCUIF_info_ind { |
| 164 | uint32_t version, |
| 165 | PCUIF_Flags flags, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 166 | PCUIF_InfoTrxs trx, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 167 | uint8_t bsic, |
| 168 | |
| 169 | uint16_t mcc, |
| 170 | uint16_t mnc, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 171 | uint8_t mnc_3_digits, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 172 | uint16_t lac, |
| 173 | uint16_t rac, |
| 174 | |
| 175 | uint16_t nsei, |
| 176 | record length(7) of uint8_t nse_timer, |
| 177 | record length(11) of uint8_t cell_timer, |
| 178 | |
| 179 | uint16_t cell_id, |
| 180 | uint16_t repeat_time, |
| 181 | uint8_t repeat_count, |
| 182 | uint16_t bvci, |
| 183 | uint8_t t3142, |
| 184 | uint8_t t3169, |
| 185 | uint8_t t3191, |
| 186 | uint8_t t3193_10ms, |
| 187 | uint8_t t3195, |
Pau Espin Pedrol | 76de166 | 2021-03-01 17:40:58 +0100 | [diff] [blame] | 188 | uint8_t n3101, |
| 189 | uint8_t n3103, |
| 190 | uint8_t n3105, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 191 | uint8_t cv_countdown, |
| 192 | uint16_t dl_tbf_ext, |
| 193 | uint16_t ul_tbf_ext, |
| 194 | uint8_t initial_cs, |
| 195 | uint8_t initial_mcs, |
| 196 | |
| 197 | record length(2) of uint16_t nsvci, |
Vadim Yanitskiy | 0d59080 | 2020-08-21 00:14:22 +0700 | [diff] [blame] | 198 | record length(2) of uint16_t local_port, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 199 | record length(2) of uint16_t remote_port, |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 200 | PCUIF_RemoteAddr remote_addr |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 201 | } with { variant "" }; |
| 202 | |
| 203 | type enumerated PCUIF_AddrType { |
| 204 | PCUIF_ADDR_TYPE_UNSPEC ('00'O), |
| 205 | PCUIF_ADDR_TYPE_IPV4 ('04'O), |
| 206 | PCUIF_ADDR_TYPE_IPV6 ('29'O) |
| 207 | } with { variant "FIELDLENGTH(8)" }; |
| 208 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 209 | type record PCUIF_RemoteAddr { |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 210 | record length(2) of PCUIF_AddrType addr_type, |
| 211 | record length(2) of octetstring addr length(16) |
| 212 | } with { variant "" }; |
| 213 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 214 | type record PCUIF_act_req { |
| 215 | uint8_t is_activate, |
| 216 | uint8_t trx_nr, |
| 217 | uint8_t ts_nr, |
| 218 | OCT1 spare |
| 219 | } with { variant "" }; |
| 220 | |
| 221 | type record PCUIF_time_ind { |
| 222 | uint32_t fn |
| 223 | } with { variant "" }; |
| 224 | |
| 225 | type record PCUIF_pag_req { |
| 226 | PCUIF_Sapi sapi, |
| 227 | uint8_t chan_needed, |
| 228 | OCT9 identity_lv |
| 229 | } with { variant "" }; |
| 230 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 231 | type record PCUIF_app_info_req { |
| 232 | uint8_t application_type, |
| 233 | uint8_t len, |
| 234 | octetstring data |
| 235 | } with { |
| 236 | variant (len) "LENGTHTO(data)" |
| 237 | } |
| 238 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 239 | type record PCUIF_susp_req { |
| 240 | OCT4 tlli, |
| 241 | OCT6 ra_id, |
| 242 | uint8_t cause |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 243 | } with { |
| 244 | variant (tlli) "BYTEORDER(last)" |
| 245 | }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 246 | |
| 247 | |
| 248 | type union PCUIF_MsgUnion { |
| 249 | PCUIF_data data_req, |
| 250 | PCUIF_data data_cnf, |
| 251 | PCUIF_data_cnf_dt data_cnf_dt, |
| 252 | PCUIF_data data_ind, |
| 253 | PCUIF_susp_req susp_req, |
| 254 | PCUIF_rts_req rts_req, |
| 255 | PCUIF_rach_ind rach_ind, |
| 256 | PCUIF_txt_ind txt_ind, |
| 257 | PCUIF_info_ind info_ind, |
| 258 | PCUIF_act_req act_req, |
| 259 | PCUIF_time_ind time_ind, |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 260 | PCUIF_pag_req pag_req, |
| 261 | PCUIF_app_info_req app_info_req |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 262 | } with { variant "" }; |
| 263 | |
| 264 | type record PCUIF_Message { |
| 265 | PCUIF_MsgType msg_type, |
| 266 | uint8_t bts_nr, |
| 267 | OCT2 spare, |
| 268 | PCUIF_MsgUnion u |
| 269 | } with { variant (u) "CROSSTAG( |
| 270 | data_req, msg_type = PCU_IF_MSG_DATA_REQ; |
| 271 | data_cnf, msg_type = PCU_IF_MSG_DATA_CNF; |
| 272 | data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT; |
| 273 | data_ind, msg_type = PCU_IF_MSG_DATA_IND; |
| 274 | susp_req, msg_type = PCU_IF_MSG_SUSP_REQ; |
| 275 | rts_req, msg_type = PCU_IF_MSG_RTS_REQ; |
| 276 | rach_ind, msg_type = PCU_IF_MSG_RACH_IND; |
| 277 | txt_ind, msg_type = PCU_IF_MSG_TXT_IND; |
| 278 | info_ind, msg_type = PCU_IF_MSG_INFO_IND; |
| 279 | act_req, msg_type = PCU_IF_MSG_ACT_REQ; |
| 280 | time_ind, msg_type = PCU_IF_MSG_TIME_IND; |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 281 | pag_req, msg_type = PCU_IF_MSG_PAG_REQ; |
| 282 | app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ)" |
Vadim Yanitskiy | 204fe62 | 2021-03-23 04:49:41 +0100 | [diff] [blame] | 283 | /* PCUIFv10: 1006 * 8 = 8048 bits */ |
| 284 | variant "PADDING(8048)" |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 285 | }; |
| 286 | |
| 287 | external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring |
| 288 | with { extension "prototype(convert) encode(RAW)" }; |
| 289 | external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message |
| 290 | with { extension "prototype(convert) decode(RAW)" }; |
| 291 | |
| 292 | |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 293 | /* Generic template for matching messages by type and/or the BTS number */ |
| 294 | template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?, |
| 295 | template uint8_t bts_nr := ?) := { |
| 296 | msg_type := msg_type, |
| 297 | bts_nr := bts_nr, |
| 298 | spare := ?, |
| 299 | u := ? |
| 300 | } |
| 301 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 302 | template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr, |
| 303 | template (value) uint8_t trx_nr, |
| 304 | template (value) uint8_t ts_nr, |
| 305 | template (value) PCUIF_Sapi sapi, |
| 306 | template (value) uint32_t fn, |
| 307 | template (value) uint16_t arfcn, |
| 308 | template (value) uint8_t block_nr |
| 309 | ) := { |
| 310 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 311 | bts_nr := bts_nr, |
| 312 | spare := '0000'O, |
| 313 | u := { |
| 314 | rts_req := { |
| 315 | sapi := sapi, |
| 316 | spare := '000000'O, |
| 317 | fn := fn, |
| 318 | arfcn := arfcn, |
| 319 | trx_nr := trx_nr, |
| 320 | ts_nr := ts_nr, |
| 321 | block_nr := block_nr |
| 322 | } |
| 323 | } |
| 324 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 325 | template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?, |
| 326 | template uint8_t trx_nr := ?, |
| 327 | template uint8_t ts_nr := ?, |
| 328 | template PCUIF_Sapi sapi := ?, |
| 329 | template uint32_t fn := ?, |
| 330 | template uint8_t block_nr := ? |
| 331 | ) := { |
| 332 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 333 | bts_nr := bts_nr, |
| 334 | spare := ?, |
| 335 | u := { |
| 336 | rts_req := { |
| 337 | sapi := sapi, |
| 338 | spare := ?, |
| 339 | fn := fn, |
| 340 | arfcn := ?, |
| 341 | trx_nr := trx_nr, |
| 342 | ts_nr := ts_nr, |
| 343 | block_nr := block_nr |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := { |
| 349 | msg_type := PCU_IF_MSG_TXT_IND, |
| 350 | bts_nr := bts_nr, |
| 351 | spare := '0000'O, |
| 352 | u := { |
| 353 | txt_ind := { |
| 354 | txt_type := tt, |
| 355 | text := text |
| 356 | } |
| 357 | } |
| 358 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 359 | template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt, |
| 360 | template charstring text := ?) := { |
| 361 | msg_type := PCU_IF_MSG_TXT_IND, |
| 362 | bts_nr := bts_nr, |
| 363 | spare := '0000'O, |
| 364 | u := { |
| 365 | txt_ind := { |
| 366 | txt_type := tt, |
| 367 | text := text |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 373 | |
| 374 | template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 375 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 376 | bts_nr := bts_nr, |
| 377 | spare := '0000'O, |
| 378 | u := { |
| 379 | act_req := { |
| 380 | is_activate := 1, |
| 381 | trx_nr := trx_nr, |
| 382 | ts_nr := ts_nr, |
| 383 | spare := '00'O |
| 384 | } |
| 385 | } |
| 386 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 387 | template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 388 | template uint8_t ts_nr) := { |
| 389 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 390 | bts_nr := bts_nr, |
| 391 | spare := '0000'O, |
| 392 | u := { |
| 393 | act_req := { |
| 394 | is_activate := 1, |
| 395 | trx_nr := trx_nr, |
| 396 | ts_nr := ts_nr, |
| 397 | spare := '00'O |
| 398 | } |
| 399 | } |
| 400 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 401 | |
| 402 | template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 403 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 404 | bts_nr := bts_nr, |
| 405 | spare := '0000'O, |
| 406 | u := { |
| 407 | act_req := { |
| 408 | is_activate := 0, |
| 409 | trx_nr := trx_nr, |
| 410 | ts_nr := ts_nr, |
| 411 | spare := '00'O |
| 412 | } |
| 413 | } |
| 414 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 415 | template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 416 | template uint8_t ts_nr) := { |
| 417 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 418 | bts_nr := bts_nr, |
| 419 | spare := '0000'O, |
| 420 | u := { |
| 421 | act_req := { |
| 422 | is_activate := 0, |
| 423 | trx_nr := trx_nr, |
| 424 | ts_nr := ts_nr, |
| 425 | spare := '00'O |
| 426 | } |
| 427 | } |
| 428 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 429 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 430 | template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr, |
| 431 | template (value) uint8_t trx_nr, |
| 432 | template (value) uint8_t ts_nr, |
| 433 | template (value) uint8_t block_nr, |
| 434 | template (value) PCUIF_Sapi sapi, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 435 | template (value) octetstring data, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 436 | template (value) uint32_t fn, |
| 437 | template (value) uint16_t arfcn, |
| 438 | template (value) int8_t rssi := -80, |
| 439 | template (value) uint16_t ber10k := 0, |
| 440 | template (value) int16_t ta_offs_qbits := 0, |
| 441 | template (value) uint16_t lqual_cb := 10) := { |
| 442 | msg_type := PCU_IF_MSG_DATA_IND, |
| 443 | bts_nr := bts_nr, |
| 444 | spare := '0000'O, |
| 445 | u := { |
| 446 | data_ind := { |
| 447 | sapi := sapi, |
| 448 | len := lengthof(valueof(data)), |
| 449 | data := data, |
| 450 | fn := fn, |
| 451 | arfcn := arfcn, |
| 452 | trx_nr := trx_nr, |
| 453 | ts_nr := ts_nr, |
| 454 | block_nr := block_nr, |
| 455 | rssi := rssi, |
| 456 | ber10k := ber10k, |
| 457 | ta_offs_qbits := ta_offs_qbits, |
| 458 | lqual_cb := lqual_cb |
| 459 | } |
| 460 | } |
| 461 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 462 | template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?, |
| 463 | template uint8_t trx_nr := ?, |
| 464 | template uint8_t ts_nr := ?, |
| 465 | template uint8_t block_nr := ?, |
| 466 | template PCUIF_Sapi sapi := ?, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 467 | template octetstring data := ?) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 468 | msg_type := PCU_IF_MSG_DATA_IND, |
| 469 | bts_nr := bts_nr, |
| 470 | spare := ?, |
| 471 | u := { |
| 472 | data_ind := { |
| 473 | sapi := sapi, |
| 474 | len := ?, |
| 475 | data := data, |
| 476 | fn := ?, |
| 477 | arfcn := ?, |
| 478 | trx_nr := trx_nr, |
| 479 | ts_nr := ts_nr, |
| 480 | block_nr := block_nr, |
| 481 | rssi := ?, |
| 482 | ber10k := ?, |
| 483 | ta_offs_qbits := ?, |
| 484 | lqual_cb := ? |
| 485 | } |
| 486 | } |
| 487 | } |
| 488 | |
Pau Espin Pedrol | cf5c33e | 2021-01-19 18:56:55 +0100 | [diff] [blame] | 489 | template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr, |
| 490 | template uint8_t ts_nr, |
| 491 | template uint8_t block_nr := ?, |
| 492 | template uint32_t fn := ?, |
| 493 | template PCUIF_Sapi sapi := ?, |
| 494 | template octetstring data := ?) := { |
| 495 | sapi := sapi, |
| 496 | len := ?, |
| 497 | data := data, |
| 498 | fn := fn, |
| 499 | arfcn := ?, /* unused in BTS */ |
| 500 | trx_nr := trx_nr, |
| 501 | ts_nr := ts_nr, |
| 502 | block_nr := block_nr, |
| 503 | /* measurement parameters below unused on Tx */ |
| 504 | rssi := 0, |
| 505 | ber10k := 0, |
| 506 | ta_offs_qbits := 0, |
| 507 | lqual_cb := 0 |
| 508 | |
| 509 | } |
| 510 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 511 | template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr, |
| 512 | uint8_t ts_nr, uint8_t block_nr, |
| 513 | uint32_t fn, PCUIF_Sapi sapi, |
| 514 | octetstring data) := { |
| 515 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 516 | bts_nr := bts_nr, |
| 517 | spare := '0000'O, |
| 518 | u := { |
| 519 | data_req := { |
| 520 | sapi := sapi, |
| 521 | len := lengthof(data), |
| 522 | data := data, |
| 523 | fn := fn, |
| 524 | arfcn := 0, /* unused in BTS */ |
| 525 | trx_nr := trx_nr, |
| 526 | ts_nr := ts_nr, |
| 527 | block_nr := block_nr, |
| 528 | /* measurement parameters below unused on Tx */ |
| 529 | rssi := 0, |
| 530 | ber10k := 0, |
| 531 | ta_offs_qbits := 0, |
| 532 | lqual_cb := 0 |
| 533 | } |
| 534 | } |
| 535 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 536 | template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr, |
| 537 | template uint8_t trx_nr, |
| 538 | template uint8_t ts_nr, |
| 539 | template uint8_t block_nr := ?, |
| 540 | template uint32_t fn := ?, |
| 541 | template PCUIF_Sapi sapi := ?, |
| 542 | template octetstring data := ?) := { |
| 543 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 544 | bts_nr := bts_nr, |
| 545 | spare := '0000'O, |
| 546 | u := { |
Pau Espin Pedrol | cf5c33e | 2021-01-19 18:56:55 +0100 | [diff] [blame] | 547 | data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data) |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 548 | } |
| 549 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 550 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 551 | template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr, |
| 552 | template (value) uint8_t trx_nr, |
| 553 | template (value) uint8_t ts_nr, |
| 554 | template (value) uint8_t block_nr, |
| 555 | template (value) uint32_t fn, |
| 556 | template (value) uint16_t arfcn, |
| 557 | template (value) PCUIF_Sapi sapi, |
| 558 | template (value) octetstring data) := { |
| 559 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 560 | bts_nr := bts_nr, |
| 561 | spare := '0000'O, |
| 562 | u := { |
| 563 | data_cnf := { |
| 564 | sapi := sapi, |
| 565 | len := 0, /* overwritten */ |
| 566 | data := data, |
| 567 | fn := fn, |
| 568 | arfcn := arfcn, |
| 569 | trx_nr := trx_nr, |
| 570 | ts_nr := ts_nr, |
| 571 | block_nr := block_nr, |
| 572 | rssi := 0, |
| 573 | ber10k := 0, |
| 574 | ta_offs_qbits := 0, |
| 575 | lqual_cb := 0 |
| 576 | } |
| 577 | } |
| 578 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 579 | template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?, |
| 580 | template uint8_t trx_nr := ?, |
| 581 | template uint8_t ts_nr := ?, |
| 582 | template PCUIF_Sapi sapi := ?, |
| 583 | template octetstring data := ?) := { |
| 584 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 585 | bts_nr := bts_nr, |
| 586 | spare := ?, |
| 587 | u := { |
| 588 | data_cnf := { |
| 589 | sapi := sapi, |
| 590 | len := ?, |
| 591 | data := data, |
| 592 | fn := ?, |
| 593 | arfcn := ?, |
| 594 | trx_nr := trx_nr, |
| 595 | ts_nr := ts_nr, |
| 596 | block_nr := ?, |
| 597 | rssi := ?, |
| 598 | ber10k := ?, |
| 599 | ta_offs_qbits := ?, |
| 600 | lqual_cb := ? |
| 601 | } |
| 602 | } |
| 603 | } |
| 604 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 605 | template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 606 | template (value) uint8_t trx_nr, |
| 607 | template (value) uint8_t ts_nr, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 608 | template (value) uint16_t ra, |
| 609 | template (value) uint8_t is_11bit, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 610 | template (value) PCUIF_BurstType burst_type, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 611 | template (value) uint32_t fn, |
| 612 | template (value) uint16_t arfcn, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 613 | template (value) int16_t qta := 0, |
| 614 | template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 615 | ) := { |
| 616 | msg_type := PCU_IF_MSG_RACH_IND, |
| 617 | bts_nr := bts_nr, |
| 618 | spare := '0000'O, |
| 619 | u := { |
| 620 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 621 | sapi := sapi, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 622 | ra := ra, |
| 623 | qta := qta, |
| 624 | fn := fn, |
| 625 | arfcn := arfcn, |
| 626 | is_11bit := is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 627 | burst_type := burst_type, |
| 628 | trx_nr := trx_nr, |
| 629 | ts_nr := ts_nr |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 630 | } |
| 631 | } |
| 632 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 633 | template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 634 | template uint8_t trx_nr := ?, |
| 635 | template uint8_t ts_nr := ?, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 636 | template uint16_t ra := ?, |
| 637 | template uint8_t is_11bit := ?, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 638 | template PCUIF_BurstType burst_type := ?, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 639 | template uint32_t fn := ?, |
| 640 | template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 641 | msg_type := PCU_IF_MSG_RACH_IND, |
| 642 | bts_nr := bts_nr, |
| 643 | spare := ?, |
| 644 | u := { |
| 645 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 646 | sapi := sapi, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 647 | ra := ra, |
| 648 | qta := ?, |
| 649 | fn := fn, |
| 650 | arfcn := ?, |
| 651 | is_11bit := is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 652 | burst_type := burst_type, |
| 653 | trx_nr := trx_nr, |
| 654 | ts_nr := ts_nr |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 655 | } |
| 656 | } |
| 657 | } |
| 658 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 659 | template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr, |
| 660 | template (value) OCT9 id_lv, |
| 661 | template (value) uint8_t chan_needed, |
| 662 | template (value) PCUIF_Sapi sapi) := { |
| 663 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 664 | bts_nr := bts_nr, |
| 665 | spare := '0000'O, |
| 666 | u := { |
| 667 | pag_req := { |
| 668 | sapi := sapi, |
| 669 | chan_needed := chan_needed, |
| 670 | identity_lv := id_lv |
| 671 | } |
| 672 | } |
| 673 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 674 | template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?, |
| 675 | template OCT9 id_lv := ?, |
| 676 | template uint8_t chan_needed := ?, |
| 677 | template PCUIF_Sapi sapi := ?) := { |
| 678 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 679 | bts_nr := bts_nr, |
| 680 | spare := ?, |
| 681 | u := { |
| 682 | pag_req := { |
| 683 | sapi := ?, |
| 684 | chan_needed := chan_needed, |
| 685 | identity_lv := id_lv |
| 686 | } |
| 687 | } |
| 688 | } |
| 689 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 690 | const PCUIF_Flags c_PCUIF_Flags_default := { |
| 691 | bts_active := true, |
| 692 | sysmo_direct_dsp := false, |
| 693 | spare := '00000000000000'B, |
| 694 | cs1 := true, |
| 695 | cs2 := true, |
| 696 | cs3 := true, |
| 697 | cs4 := true, |
| 698 | mcs1 := true, |
| 699 | mcs2 := true, |
| 700 | mcs3 := true, |
| 701 | mcs4 := true, |
| 702 | mcs5 := true, |
| 703 | mcs6 := true, |
| 704 | mcs7 := true, |
| 705 | mcs8 := true, |
| 706 | mcs9 := true, |
| 707 | spare2 := '000'B |
| 708 | }; |
| 709 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 710 | const PCUIF_Flags c_PCUIF_Flags_noMCS := { |
| 711 | bts_active := true, |
| 712 | sysmo_direct_dsp := false, |
| 713 | spare := '00000000000000'B, |
| 714 | cs1 := true, |
| 715 | cs2 := true, |
| 716 | cs3 := true, |
| 717 | cs4 := true, |
| 718 | mcs1 := false, |
| 719 | mcs2 := false, |
| 720 | mcs3 := false, |
| 721 | mcs4 := false, |
| 722 | mcs5 := false, |
| 723 | mcs6 := false, |
| 724 | mcs7 := false, |
| 725 | mcs8 := false, |
| 726 | mcs9 := false, |
| 727 | spare2 := '000'B |
| 728 | }; |
| 729 | |
| 730 | function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean { |
| 731 | return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or |
| 732 | flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or |
| 733 | flags.mcs9; |
| 734 | } |
| 735 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 736 | template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := { |
| 737 | tsc := tsc, |
| 738 | hopping := 0, |
| 739 | hsn := 0, maio := 0, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 740 | ma_bit_len := 0, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 741 | ma := f_pad_bit(''B, 64, '0'B) |
| 742 | }; |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 743 | template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := { |
| 744 | tsc := tsc, |
| 745 | hopping := 0, |
| 746 | hsn := ?, maio := ?, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 747 | ma_bit_len := ?, |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 748 | ma := ? |
| 749 | }; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 750 | |
| 751 | template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7, |
| 752 | template (value) uint6_t hsn := 0, |
| 753 | template (value) uint6_t maio := 0, |
| 754 | template (value) bitstring ma := ''B) := { |
| 755 | tsc := tsc, |
| 756 | hopping := 1, |
| 757 | hsn := hsn, |
| 758 | maio := maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 759 | ma_bit_len := lengthof(valueof(ma)), |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 760 | ma := f_pad_bit(valueof(ma), 64, '0'B) |
| 761 | }; |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 762 | template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?, |
| 763 | template uint6_t hsn := ?, |
| 764 | template uint6_t maio := ?, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 765 | template bitstring ma := ?, |
| 766 | template uint8_t ma_bit_len := ?) := { |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 767 | tsc := tsc, |
| 768 | hopping := 1, |
| 769 | hsn := hsn, |
| 770 | maio := maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 771 | ma_bit_len := ma_bit_len, |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 772 | ma := ma |
| 773 | }; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 774 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 775 | template (value) PCUIF_InfoTrx |
| 776 | ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871, |
| 777 | template (value) BIT8 pdch_mask := '00000001'B, |
| 778 | template (value) uint3_t tsc := 7) := { |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 779 | arfcn := arfcn, |
| 780 | pdch_mask := pdch_mask, |
Vadim Yanitskiy | d805172 | 2020-08-22 02:33:17 +0700 | [diff] [blame] | 781 | spare := '00'O, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 782 | hLayer1 := 0, |
| 783 | ts := { |
| 784 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 785 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 786 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 787 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc) |
| 788 | } |
| 789 | }; |
| 790 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 791 | template (value) PCUIF_InfoTrxs |
| 792 | ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := { |
| 793 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0), |
| 794 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1), |
| 795 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2), |
| 796 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3), |
| 797 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4), |
| 798 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5), |
| 799 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6), |
| 800 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7) |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 801 | }; |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 802 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 803 | template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr, |
Pau Espin Pedrol | f787b09 | 2019-10-04 18:34:05 +0200 | [diff] [blame] | 804 | template (value) PCUIF_info_ind info_ind) := { |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 805 | msg_type := PCU_IF_MSG_INFO_IND, |
| 806 | bts_nr := bts_nr, |
| 807 | spare := '0000'O, |
| 808 | u := { |
Pau Espin Pedrol | f787b09 | 2019-10-04 18:34:05 +0200 | [diff] [blame] | 809 | info_ind := info_ind |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 810 | } |
| 811 | } |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 812 | template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?, |
| 813 | template PCUIF_Flags flags := ?, |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 814 | template uint32_t version := mp_pcuif_version) := { |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 815 | msg_type := PCU_IF_MSG_INFO_IND, |
| 816 | bts_nr := bts_nr, |
| 817 | spare := ?, |
| 818 | u := { |
| 819 | info_ind := { |
| 820 | version := version, |
| 821 | flags := flags, |
| 822 | trx := ?, |
| 823 | bsic := ?, |
| 824 | mcc := ?, |
| 825 | mnc :=?, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 826 | mnc_3_digits := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 827 | lac := ?, |
| 828 | rac := ?, |
| 829 | nsei := ?, |
| 830 | nse_timer := ?, |
| 831 | cell_timer := ?, |
| 832 | cell_id := ?, |
| 833 | repeat_time := ?, |
| 834 | repeat_count := ?, |
| 835 | bvci := ?, |
| 836 | t3142 := ?, |
| 837 | t3169 := ?, |
| 838 | t3191 := ?, |
| 839 | t3193_10ms := ?, |
| 840 | t3195 := ?, |
Pau Espin Pedrol | 76de166 | 2021-03-01 17:40:58 +0100 | [diff] [blame] | 841 | n3101 := ?, |
| 842 | n3103 := ?, |
| 843 | n3105 := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 844 | cv_countdown := ?, |
| 845 | dl_tbf_ext := ?, |
| 846 | ul_tbf_ext := ?, |
| 847 | initial_cs := ?, |
| 848 | initial_mcs := ?, |
| 849 | nsvci := ?, |
Vadim Yanitskiy | 0d59080 | 2020-08-21 00:14:22 +0700 | [diff] [blame] | 850 | local_port := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 851 | remote_port := ?, |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 852 | remote_addr := ? |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 853 | } |
| 854 | } |
| 855 | } |
| 856 | |
Harald Welte | a321981 | 2019-03-02 00:02:28 +0100 | [diff] [blame] | 857 | template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr, |
| 858 | template (value) uint32_t fn) := { |
| 859 | msg_type := PCU_IF_MSG_TIME_IND, |
| 860 | bts_nr := bts_nr, |
| 861 | spare := '0000'O, |
| 862 | u := { |
| 863 | time_ind := { |
| 864 | fn := fn |
| 865 | } |
| 866 | } |
| 867 | } |
| 868 | template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr, |
| 869 | template uint32_t fn) := { |
| 870 | msg_type := PCU_IF_MSG_TIME_IND, |
| 871 | bts_nr := bts_nr, |
| 872 | spare := ?, |
| 873 | u := { |
| 874 | time_ind := { |
| 875 | fn := fn |
| 876 | } |
| 877 | } |
| 878 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 879 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 880 | template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr, |
| 881 | template (value) OCT4 tlli, |
| 882 | template (value) OCT6 ra_id, |
| 883 | template (value) uint8_t cause) := { |
| 884 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 885 | bts_nr := bts_nr, |
| 886 | spare := '0000'O, |
| 887 | u := { |
| 888 | susp_req := { |
| 889 | tlli := tlli, |
| 890 | ra_id := ra_id, |
| 891 | cause := cause |
| 892 | } |
| 893 | } |
| 894 | } |
| 895 | template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr, |
| 896 | template OCT4 tlli, |
| 897 | template OCT6 ra_id, |
| 898 | template uint8_t cause) := { |
| 899 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 900 | bts_nr := bts_nr, |
| 901 | spare := '0000'O, |
| 902 | u := { |
| 903 | susp_req := { |
| 904 | tlli := tlli, |
| 905 | ra_id := ra_id, |
| 906 | cause := cause |
| 907 | } |
| 908 | } |
| 909 | } |
| 910 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 911 | template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr, |
| 912 | template (value) uint8_t app_type, |
| 913 | template (value) octetstring app_data) := { |
| 914 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 915 | bts_nr := bts_nr, |
| 916 | spare := '0000'O, |
| 917 | u := { |
| 918 | app_info_req := { |
| 919 | application_type := app_type, |
| 920 | len := 0, /* overwritten */ |
| 921 | data := app_data |
| 922 | } |
| 923 | } |
| 924 | } |
| 925 | template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr, |
| 926 | template (present) uint8_t app_type, |
| 927 | template (present) octetstring app_data) := { |
| 928 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 929 | bts_nr := bts_nr, |
| 930 | spare := '0000'O, |
| 931 | u := { |
| 932 | app_info_req := { |
| 933 | application_type := app_type, |
| 934 | len := ?, |
| 935 | data := app_data |
| 936 | } |
| 937 | } |
| 938 | } |
| 939 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 940 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 941 | function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask, |
| 942 | template (present) uint8_t trx_nr := ?) |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 943 | { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 944 | for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) { |
| 945 | if (match(nr, trx_nr)) { |
| 946 | info.trx[nr].pdch_mask := pdch_mask; |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 947 | } |
| 948 | } |
| 949 | } |
| 950 | |
Alexander Couzens | e0f7c54 | 2020-09-13 17:25:18 +0200 | [diff] [blame] | 951 | function f_PCUIF_AF2addr_type(AddressFamily address_family) |
| 952 | return PCUIF_AddrType { |
| 953 | if (address_family == AF_INET) { |
| 954 | return PCUIF_ADDR_TYPE_IPV4; |
| 955 | } else if (address_family == AF_INET6) { |
| 956 | return PCUIF_ADDR_TYPE_IPV6; |
| 957 | } else { |
| 958 | return PCUIF_ADDR_TYPE_UNSPEC; |
| 959 | } |
| 960 | } |
| 961 | |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 962 | /* TODO: second (redundant) NSVC connection is not (yet) supported */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 963 | function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type, |
| 964 | charstring addr_str) |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 965 | return PCUIF_RemoteAddr { |
| 966 | var PCUIF_RemoteAddr remote_addr; |
| 967 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 968 | remote_addr.addr_type[0] := addr_type; |
| 969 | if (addr_type == PCUIF_ADDR_TYPE_IPV4) { |
| 970 | remote_addr.addr[0] := f_inet_addr(addr_str); |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 971 | } else { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 972 | remote_addr.addr[0] := f_inet6_addr(addr_str); |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 973 | } |
| 974 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 975 | remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC; |
| 976 | remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O); |
| 977 | |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 978 | return remote_addr; |
| 979 | } |
| 980 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 981 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 982 | } with { encode "RAW" variant "BYTEORDER(first)" }; |