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