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