blob: f0200af9f97bb401d4861dba61b1775de0b3d36a [file] [log] [blame]
Harald Welte34b5a952019-05-27 11:54:11 +02001/* 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 Welte883340c2018-02-28 18:59:29 +010012module PCUIF_Types {
13
14import from General_Types all;
15import from Osmocom_Types all;
16
Vadim Yanitskiyc1559302020-07-19 16:39:12 +070017modulepar {
18 /* PCUIF version supported by the IUT */
19 PCUIF_Version mp_pcuif_version := 9;
20};
21
Harald Welte883340c2018-02-28 18:59:29 +010022const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +070023type integer PCUIF_Version (9..10); /* supported versions */
Harald Welte883340c2018-02-28 18:59:29 +010024
25type enumerated PCUIF_MsgType {
26 PCU_IF_MSG_DATA_REQ ('00'O),
27 PCU_IF_MSG_DATA_CNF ('01'O),
28 PCU_IF_MSG_DATA_IND ('02'O),
29 PCU_IF_MSG_SUSP_REQ ('03'O),
Harald Welte11b734c2019-09-05 14:17:54 +020030 PCU_IF_MSG_APP_INFO_REQ ('04'O),
Harald Welte883340c2018-02-28 18:59:29 +010031 PCU_IF_MSG_RTS_REQ ('10'O),
32 PCU_IF_MSG_DATA_CNF_DT ('11'O),
33 PCU_IF_MSG_RACH_IND ('22'O),
34 PCU_IF_MSG_INFO_IND ('32'O),
35 PCU_IF_MSG_ACT_REQ ('40'O),
36 PCU_IF_MSG_TIME_IND ('52'O),
37 PCU_IF_MSG_PAG_REQ ('60'O),
38 PCU_IF_MSG_TXT_IND ('70'O)
39} with { variant "FIELDLENGTH(8)" };
40
41type enumerated PCUIF_Sapi {
42 PCU_IF_SAPI_UNKNOWN ('00'O),
43 PCU_IF_SAPI_RACH ('01'O),
44 PCU_IF_SAPI_AGCH ('02'O),
45 PCU_IF_SAPI_PCH ('03'O),
46 PCU_IF_SAPI_BCCH ('04'O),
47 PCU_IF_SAPI_PDTCH ('05'O),
48 PCU_IF_SAPI_PRACH ('06'O),
49 PCU_IF_SAPI_PTCCH ('07'O),
50 PCU_IF_SAPI_AGCH_DT ('08'O)
51} with { variant "FIELDLENGTH(8)" };
52
53type record PCUIF_Flags {
54 boolean bts_active,
55 boolean sysmo_direct_dsp,
56 BIT14 spare,
57 boolean cs1,
58 boolean cs2,
59 boolean cs3,
60 boolean cs4,
61 boolean mcs1,
62 boolean mcs2,
63 boolean mcs3,
64 boolean mcs4,
65 boolean mcs5,
66 boolean mcs6,
67 boolean mcs7,
68 boolean mcs8,
69 boolean mcs9,
70 BIT3 spare2
71} with { variant "" };
72
73type enumerated PCUIF_TextType {
74 PCU_VERSION (0),
75 PCU_OML_ALERT (1)
76} with { variant "FIELDLENGTH(8)" };
77
Vadim Yanitskiye1527f72019-09-09 02:15:33 +020078type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" };
Harald Welte883340c2018-02-28 18:59:29 +010079
80type record PCUIF_txt_ind {
81 PCUIF_TextType txt_type,
82 PCUIF_Text text
83} with { variant "" };
84
Harald Welte883340c2018-02-28 18:59:29 +010085type record PCUIF_data {
86 PCUIF_Sapi sapi,
87 uint8_t len,
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +020088 octetstring data length(162),
Harald Welte883340c2018-02-28 18:59:29 +010089 uint32_t fn,
90 uint16_t arfcn,
91 uint8_t trx_nr,
92 uint8_t ts_nr,
93 uint8_t block_nr,
94 int8_t rssi,
95 uint16_t ber10k,
96 int16_t ta_offs_qbits,
97 int16_t lqual_cb
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +020098} with { variant (data) "FIELDLENGTH(162), ALIGN(left)" };
Harald Welte883340c2018-02-28 18:59:29 +010099
100type record PCUIF_data_cnf_dt {
101 PCUIF_Sapi sapi,
102 OCT4 tlli,
103 uint32_t fn,
104 uint16_t arfcn,
105 uint8_t trx_nr,
106 uint8_t ts_nr,
107 uint8_t block_nr,
108 int8_t rssi,
109 uint16_t ber10k,
110 int16_t ta_offs_qbits,
111 int16_t lqual_cb
112} with { variant "" };
113
114type record PCUIF_rts_req {
115 PCUIF_Sapi sapi,
116 OCT3 spare,
117 uint32_t fn,
118 uint16_t arfcn,
119 uint8_t trx_nr,
120 uint8_t ts_nr,
121 uint8_t block_nr
122} with { variant "" };
123
Harald Welte913bbf62019-03-01 00:39:19 +0100124type enumerated PCUIF_BurstType {
125 BURST_TYPE_NONE (0),
126 BURST_TYPE_0 (1),
127 BURST_TYPE_1 (2),
128 BURST_TYPE_2 (3)
129} with { variant "FIELDLENGTH(8)" };
130
Harald Welte883340c2018-02-28 18:59:29 +0100131type record PCUIF_rach_ind {
132 PCUIF_Sapi sapi,
133 uint16_t ra,
134 int16_t qta,
135 uint32_t fn,
136 uint16_t arfcn,
137 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700138 PCUIF_BurstType burst_type,
139 uint8_t trx_nr,
140 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100141} with { variant "" };
142
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700143type record PCUIF_InfoTrxTs {
144 uint8_t tsc,
145 uint8_t hopping,
146 uint8_t hsn,
147 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700148 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700149 bitstring ma length(64)
150} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
151private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
152
153/* Version >= 10 specific coding */
154private type record PCUIF_InfoV10Trx {
155 uint16_t arfcn,
156 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700157 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700158 uint32_t hLayer1,
159 PCUIF_InfoTrxTsList ts
160} with { variant (pdch_mask) "BITORDER(msb)" };
161private type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList;
162
163/* Version <= 9 specific coding */
164private type record PCUIF_InfoV09Trx {
Harald Welte883340c2018-02-28 18:59:29 +0100165 uint16_t arfcn,
166 BIT8 pdch_mask,
167 OCT1 spare,
168 OCT8 tsc,
169 uint32_t hLayer1
Harald Weltef1486592018-04-04 19:26:41 +0200170} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700171private type record length(8) of PCUIF_InfoV09Trx PCUIF_InfoV09TrxList;
172
173type union PCUIF_InfoTrxs {
174 PCUIF_InfoV09TrxList v09,
175 PCUIF_InfoV10TrxList v10
176} with { variant "" };
Harald Welte883340c2018-02-28 18:59:29 +0100177
178type record PCUIF_info_ind {
179 uint32_t version,
180 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100181 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100182 uint8_t bsic,
183
184 uint16_t mcc,
185 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100186 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100187 uint16_t lac,
188 uint16_t rac,
189
190 uint16_t nsei,
191 record length(7) of uint8_t nse_timer,
192 record length(11) of uint8_t cell_timer,
193
194 uint16_t cell_id,
195 uint16_t repeat_time,
196 uint8_t repeat_count,
197 uint16_t bvci,
198 uint8_t t3142,
199 uint8_t t3169,
200 uint8_t t3191,
201 uint8_t t3193_10ms,
202 uint8_t t3195,
203 uint8_t t3101,
204 uint8_t t3103,
205 uint8_t t3105,
206 uint8_t cv_countdown,
207 uint16_t dl_tbf_ext,
208 uint16_t ul_tbf_ext,
209 uint8_t initial_cs,
210 uint8_t initial_mcs,
211
212 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700213 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100214 record length(2) of uint16_t remote_port,
Harald Welte07e8dde2019-02-18 20:38:45 +0100215 record length(2) of OCT4 remote_ip
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700216} with {
217 /* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9',
218 * so we cannot support more than two versions at the same time here. Sigh. */
219 variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)"
220};
Harald Welte883340c2018-02-28 18:59:29 +0100221
222type record PCUIF_act_req {
223 uint8_t is_activate,
224 uint8_t trx_nr,
225 uint8_t ts_nr,
226 OCT1 spare
227} with { variant "" };
228
229type record PCUIF_time_ind {
230 uint32_t fn
231} with { variant "" };
232
233type record PCUIF_pag_req {
234 PCUIF_Sapi sapi,
235 uint8_t chan_needed,
236 OCT9 identity_lv
237} with { variant "" };
238
Harald Welte11b734c2019-09-05 14:17:54 +0200239type record PCUIF_app_info_req {
240 uint8_t application_type,
241 uint8_t len,
242 octetstring data
243} with {
244 variant (len) "LENGTHTO(data)"
245}
246
Harald Welte883340c2018-02-28 18:59:29 +0100247type record PCUIF_susp_req {
248 OCT4 tlli,
249 OCT6 ra_id,
250 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200251} with {
252 variant (tlli) "BYTEORDER(last)"
253};
Harald Welte883340c2018-02-28 18:59:29 +0100254
255
256type union PCUIF_MsgUnion {
257 PCUIF_data data_req,
258 PCUIF_data data_cnf,
259 PCUIF_data_cnf_dt data_cnf_dt,
260 PCUIF_data data_ind,
261 PCUIF_susp_req susp_req,
262 PCUIF_rts_req rts_req,
263 PCUIF_rach_ind rach_ind,
264 PCUIF_txt_ind txt_ind,
265 PCUIF_info_ind info_ind,
266 PCUIF_act_req act_req,
267 PCUIF_time_ind time_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200268 PCUIF_pag_req pag_req,
269 PCUIF_app_info_req app_info_req
Harald Welte883340c2018-02-28 18:59:29 +0100270} with { variant "" };
271
272type record PCUIF_Message {
273 PCUIF_MsgType msg_type,
274 uint8_t bts_nr,
275 OCT2 spare,
276 PCUIF_MsgUnion u
277} with { variant (u) "CROSSTAG(
278 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
279 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
280 data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT;
281 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
282 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
283 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
284 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
285 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
286 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
287 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
288 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200289 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
290 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ)"
Harald Welte3568dc72018-03-13 17:06:51 +0100291 variant "PADDING(1696)" /* 212 * 8 */
Harald Welte883340c2018-02-28 18:59:29 +0100292};
293
294external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
295 with { extension "prototype(convert) encode(RAW)" };
296external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
297 with { extension "prototype(convert) decode(RAW)" };
298
299
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200300/* Generic template for matching messages by type and/or the BTS number */
301template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
302 template uint8_t bts_nr := ?) := {
303 msg_type := msg_type,
304 bts_nr := bts_nr,
305 spare := ?,
306 u := ?
307}
308
Harald Weltee1fd9162019-02-18 19:47:53 +0100309template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
310 template (value) uint8_t trx_nr,
311 template (value) uint8_t ts_nr,
312 template (value) PCUIF_Sapi sapi,
313 template (value) uint32_t fn,
314 template (value) uint16_t arfcn,
315 template (value) uint8_t block_nr
316 ) := {
317 msg_type := PCU_IF_MSG_RTS_REQ,
318 bts_nr := bts_nr,
319 spare := '0000'O,
320 u := {
321 rts_req := {
322 sapi := sapi,
323 spare := '000000'O,
324 fn := fn,
325 arfcn := arfcn,
326 trx_nr := trx_nr,
327 ts_nr := ts_nr,
328 block_nr := block_nr
329 }
330 }
331}
Harald Welte883340c2018-02-28 18:59:29 +0100332template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
333 template uint8_t trx_nr := ?,
334 template uint8_t ts_nr := ?,
335 template PCUIF_Sapi sapi := ?,
336 template uint32_t fn := ?,
337 template uint8_t block_nr := ?
338 ) := {
339 msg_type := PCU_IF_MSG_RTS_REQ,
340 bts_nr := bts_nr,
341 spare := ?,
342 u := {
343 rts_req := {
344 sapi := sapi,
345 spare := ?,
346 fn := fn,
347 arfcn := ?,
348 trx_nr := trx_nr,
349 ts_nr := ts_nr,
350 block_nr := block_nr
351 }
352 }
353}
354
355template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
356 msg_type := PCU_IF_MSG_TXT_IND,
357 bts_nr := bts_nr,
358 spare := '0000'O,
359 u := {
360 txt_ind := {
361 txt_type := tt,
362 text := text
363 }
364 }
365}
Harald Weltee1fd9162019-02-18 19:47:53 +0100366template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
367 template charstring text := ?) := {
368 msg_type := PCU_IF_MSG_TXT_IND,
369 bts_nr := bts_nr,
370 spare := '0000'O,
371 u := {
372 txt_ind := {
373 txt_type := tt,
374 text := text
375 }
376 }
377}
378
379
Harald Welte883340c2018-02-28 18:59:29 +0100380
381template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
382 msg_type := PCU_IF_MSG_ACT_REQ,
383 bts_nr := bts_nr,
384 spare := '0000'O,
385 u := {
386 act_req := {
387 is_activate := 1,
388 trx_nr := trx_nr,
389 ts_nr := ts_nr,
390 spare := '00'O
391 }
392 }
393}
Harald Weltee1fd9162019-02-18 19:47:53 +0100394template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
395 template uint8_t ts_nr) := {
396 msg_type := PCU_IF_MSG_ACT_REQ,
397 bts_nr := bts_nr,
398 spare := '0000'O,
399 u := {
400 act_req := {
401 is_activate := 1,
402 trx_nr := trx_nr,
403 ts_nr := ts_nr,
404 spare := '00'O
405 }
406 }
407}
Harald Welte883340c2018-02-28 18:59:29 +0100408
409template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
410 msg_type := PCU_IF_MSG_ACT_REQ,
411 bts_nr := bts_nr,
412 spare := '0000'O,
413 u := {
414 act_req := {
415 is_activate := 0,
416 trx_nr := trx_nr,
417 ts_nr := ts_nr,
418 spare := '00'O
419 }
420 }
421}
Harald Weltee1fd9162019-02-18 19:47:53 +0100422template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
423 template uint8_t ts_nr) := {
424 msg_type := PCU_IF_MSG_ACT_REQ,
425 bts_nr := bts_nr,
426 spare := '0000'O,
427 u := {
428 act_req := {
429 is_activate := 0,
430 trx_nr := trx_nr,
431 ts_nr := ts_nr,
432 spare := '00'O
433 }
434 }
435}
Harald Welte883340c2018-02-28 18:59:29 +0100436
Harald Weltee1fd9162019-02-18 19:47:53 +0100437template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
438 template (value) uint8_t trx_nr,
439 template (value) uint8_t ts_nr,
440 template (value) uint8_t block_nr,
441 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700442 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100443 template (value) uint32_t fn,
444 template (value) uint16_t arfcn,
445 template (value) int8_t rssi := -80,
446 template (value) uint16_t ber10k := 0,
447 template (value) int16_t ta_offs_qbits := 0,
448 template (value) uint16_t lqual_cb := 10) := {
449 msg_type := PCU_IF_MSG_DATA_IND,
450 bts_nr := bts_nr,
451 spare := '0000'O,
452 u := {
453 data_ind := {
454 sapi := sapi,
455 len := lengthof(valueof(data)),
456 data := data,
457 fn := fn,
458 arfcn := arfcn,
459 trx_nr := trx_nr,
460 ts_nr := ts_nr,
461 block_nr := block_nr,
462 rssi := rssi,
463 ber10k := ber10k,
464 ta_offs_qbits := ta_offs_qbits,
465 lqual_cb := lqual_cb
466 }
467 }
468}
Harald Welte883340c2018-02-28 18:59:29 +0100469template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
470 template uint8_t trx_nr := ?,
471 template uint8_t ts_nr := ?,
472 template uint8_t block_nr := ?,
473 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700474 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100475 msg_type := PCU_IF_MSG_DATA_IND,
476 bts_nr := bts_nr,
477 spare := ?,
478 u := {
479 data_ind := {
480 sapi := sapi,
481 len := ?,
482 data := data,
483 fn := ?,
484 arfcn := ?,
485 trx_nr := trx_nr,
486 ts_nr := ts_nr,
487 block_nr := block_nr,
488 rssi := ?,
489 ber10k := ?,
490 ta_offs_qbits := ?,
491 lqual_cb := ?
492 }
493 }
494}
495
496template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
497 uint8_t ts_nr, uint8_t block_nr,
498 uint32_t fn, PCUIF_Sapi sapi,
499 octetstring data) := {
500 msg_type := PCU_IF_MSG_DATA_REQ,
501 bts_nr := bts_nr,
502 spare := '0000'O,
503 u := {
504 data_req := {
505 sapi := sapi,
506 len := lengthof(data),
507 data := data,
508 fn := fn,
509 arfcn := 0, /* unused in BTS */
510 trx_nr := trx_nr,
511 ts_nr := ts_nr,
512 block_nr := block_nr,
513 /* measurement parameters below unused on Tx */
514 rssi := 0,
515 ber10k := 0,
516 ta_offs_qbits := 0,
517 lqual_cb := 0
518 }
519 }
520}
Harald Weltee1fd9162019-02-18 19:47:53 +0100521template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
522 template uint8_t trx_nr,
523 template uint8_t ts_nr,
524 template uint8_t block_nr := ?,
525 template uint32_t fn := ?,
526 template PCUIF_Sapi sapi := ?,
527 template octetstring data := ?) := {
528 msg_type := PCU_IF_MSG_DATA_REQ,
529 bts_nr := bts_nr,
530 spare := '0000'O,
531 u := {
532 data_req := {
533 sapi := sapi,
534 len := ?,
535 data := data,
536 fn := fn,
Harald Welte0a3d63f2019-03-02 00:02:07 +0100537 arfcn := ?, /* unused in BTS */
Harald Weltee1fd9162019-02-18 19:47:53 +0100538 trx_nr := trx_nr,
539 ts_nr := ts_nr,
540 block_nr := block_nr,
541 /* measurement parameters below unused on Tx */
542 rssi := 0,
543 ber10k := 0,
544 ta_offs_qbits := 0,
545 lqual_cb := 0
546 }
547 }
548}
Harald Welte883340c2018-02-28 18:59:29 +0100549
Harald Weltee1fd9162019-02-18 19:47:53 +0100550template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
551 template (value) uint8_t trx_nr,
552 template (value) uint8_t ts_nr,
553 template (value) uint8_t block_nr,
554 template (value) uint32_t fn,
555 template (value) uint16_t arfcn,
556 template (value) PCUIF_Sapi sapi,
557 template (value) octetstring data) := {
558 msg_type := PCU_IF_MSG_DATA_CNF,
559 bts_nr := bts_nr,
560 spare := '0000'O,
561 u := {
562 data_cnf := {
563 sapi := sapi,
564 len := 0, /* overwritten */
565 data := data,
566 fn := fn,
567 arfcn := arfcn,
568 trx_nr := trx_nr,
569 ts_nr := ts_nr,
570 block_nr := block_nr,
571 rssi := 0,
572 ber10k := 0,
573 ta_offs_qbits := 0,
574 lqual_cb := 0
575 }
576 }
577}
Harald Welte883340c2018-02-28 18:59:29 +0100578template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
579 template uint8_t trx_nr := ?,
580 template uint8_t ts_nr := ?,
581 template PCUIF_Sapi sapi := ?,
582 template octetstring data := ?) := {
583 msg_type := PCU_IF_MSG_DATA_CNF,
584 bts_nr := bts_nr,
585 spare := ?,
586 u := {
587 data_cnf := {
588 sapi := sapi,
589 len := ?,
590 data := data,
591 fn := ?,
592 arfcn := ?,
593 trx_nr := trx_nr,
594 ts_nr := ts_nr,
595 block_nr := ?,
596 rssi := ?,
597 ber10k := ?,
598 ta_offs_qbits := ?,
599 lqual_cb := ?
600 }
601 }
602}
603
Harald Weltee1fd9162019-02-18 19:47:53 +0100604template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700605 template (value) uint8_t trx_nr,
606 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100607 template (value) uint16_t ra,
608 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100609 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100610 template (value) uint32_t fn,
611 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700612 template (value) int16_t qta := 0,
613 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100614) := {
615 msg_type := PCU_IF_MSG_RACH_IND,
616 bts_nr := bts_nr,
617 spare := '0000'O,
618 u := {
619 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700620 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100621 ra := ra,
622 qta := qta,
623 fn := fn,
624 arfcn := arfcn,
625 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700626 burst_type := burst_type,
627 trx_nr := trx_nr,
628 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100629 }
630 }
631}
Harald Welte883340c2018-02-28 18:59:29 +0100632template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700633 template uint8_t trx_nr := ?,
634 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100635 template uint16_t ra := ?,
636 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100637 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700638 template uint32_t fn := ?,
639 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100640 msg_type := PCU_IF_MSG_RACH_IND,
641 bts_nr := bts_nr,
642 spare := ?,
643 u := {
644 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700645 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100646 ra := ra,
647 qta := ?,
648 fn := fn,
649 arfcn := ?,
650 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700651 burst_type := burst_type,
652 trx_nr := trx_nr,
653 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100654 }
655 }
656}
657
Harald Weltee1fd9162019-02-18 19:47:53 +0100658template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
659 template (value) OCT9 id_lv,
660 template (value) uint8_t chan_needed,
661 template (value) PCUIF_Sapi sapi) := {
662 msg_type := PCU_IF_MSG_PAG_REQ,
663 bts_nr := bts_nr,
664 spare := '0000'O,
665 u := {
666 pag_req := {
667 sapi := sapi,
668 chan_needed := chan_needed,
669 identity_lv := id_lv
670 }
671 }
672}
Harald Welte883340c2018-02-28 18:59:29 +0100673template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
674 template OCT9 id_lv := ?,
675 template uint8_t chan_needed := ?,
676 template PCUIF_Sapi sapi := ?) := {
677 msg_type := PCU_IF_MSG_PAG_REQ,
678 bts_nr := bts_nr,
679 spare := ?,
680 u := {
681 pag_req := {
682 sapi := ?,
683 chan_needed := chan_needed,
684 identity_lv := id_lv
685 }
686 }
687}
688
Harald Weltee1fd9162019-02-18 19:47:53 +0100689const PCUIF_Flags c_PCUIF_Flags_default := {
690 bts_active := true,
691 sysmo_direct_dsp := false,
692 spare := '00000000000000'B,
693 cs1 := true,
694 cs2 := true,
695 cs3 := true,
696 cs4 := true,
697 mcs1 := true,
698 mcs2 := true,
699 mcs3 := true,
700 mcs4 := true,
701 mcs5 := true,
702 mcs6 := true,
703 mcs7 := true,
704 mcs8 := true,
705 mcs9 := true,
706 spare2 := '000'B
707};
708
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700709template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
710 tsc := tsc,
711 hopping := 0,
712 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700713 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700714 ma := f_pad_bit(''B, 64, '0'B)
715};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700716template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
717 tsc := tsc,
718 hopping := 0,
719 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700720 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700721 ma := ?
722};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700723
724template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
725 template (value) uint6_t hsn := 0,
726 template (value) uint6_t maio := 0,
727 template (value) bitstring ma := ''B) := {
728 tsc := tsc,
729 hopping := 1,
730 hsn := hsn,
731 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700732 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700733 ma := f_pad_bit(valueof(ma), 64, '0'B)
734};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700735template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
736 template uint6_t hsn := ?,
737 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700738 template bitstring ma := ?,
739 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700740 tsc := tsc,
741 hopping := 1,
742 hsn := hsn,
743 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700744 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700745 ma := ma
746};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700747
748template (value) PCUIF_InfoV10Trx ts_PCUIF_InfoV10Trx(template (value) uint16_t arfcn := 871,
749 template (value) BIT8 pdch_mask := '00000001'B,
750 template (value) uint3_t tsc := 7) := {
751 arfcn := arfcn,
752 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700753 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700754 hLayer1 := 0,
755 ts := {
756 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
757 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
758 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
759 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
760 }
761};
762
763template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09Trx(template (value) uint16_t arfcn := 871,
764 template (value) BIT8 pdch_mask := '00000001'B,
765 OCT1 tsc := '07'O) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100766 arfcn := arfcn,
767 pdch_mask := pdch_mask,
768 spare := '00'O,
769 tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc,
770 hLayer1 := 0
771}
772
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700773template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := ts_PCUIF_InfoV09Trx(0, '00000000'B, '00'O);
Harald Weltee1fd9162019-02-18 19:47:53 +0100774
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700775template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := {
776 v09 := {
777 ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL,
778 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
779 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
780 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL
781 }
782};
783
784template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := {
785 v10 := {
786 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
787 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
788 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
789 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx
790 }
791};
Harald Weltee1fd9162019-02-18 19:47:53 +0100792
Harald Weltee1fd9162019-02-18 19:47:53 +0100793template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200794 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100795 msg_type := PCU_IF_MSG_INFO_IND,
796 bts_nr := bts_nr,
797 spare := '0000'O,
798 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200799 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100800 }
801}
Harald Welted378a252018-03-13 17:02:14 +0100802template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
803 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700804 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100805 msg_type := PCU_IF_MSG_INFO_IND,
806 bts_nr := bts_nr,
807 spare := ?,
808 u := {
809 info_ind := {
810 version := version,
811 flags := flags,
812 trx := ?,
813 bsic := ?,
814 mcc := ?,
815 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100816 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100817 lac := ?,
818 rac := ?,
819 nsei := ?,
820 nse_timer := ?,
821 cell_timer := ?,
822 cell_id := ?,
823 repeat_time := ?,
824 repeat_count := ?,
825 bvci := ?,
826 t3142 := ?,
827 t3169 := ?,
828 t3191 := ?,
829 t3193_10ms := ?,
830 t3195 := ?,
831 t3101 := ?,
832 t3103 := ?,
833 t3105 := ?,
834 cv_countdown := ?,
835 dl_tbf_ext := ?,
836 ul_tbf_ext := ?,
837 initial_cs := ?,
838 initial_mcs := ?,
839 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700840 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100841 remote_port := ?,
842 remote_ip := ?
843 }
844 }
845}
846
Harald Weltea3219812019-03-02 00:02:28 +0100847template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
848 template (value) uint32_t fn) := {
849 msg_type := PCU_IF_MSG_TIME_IND,
850 bts_nr := bts_nr,
851 spare := '0000'O,
852 u := {
853 time_ind := {
854 fn := fn
855 }
856 }
857}
858template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
859 template uint32_t fn) := {
860 msg_type := PCU_IF_MSG_TIME_IND,
861 bts_nr := bts_nr,
862 spare := ?,
863 u := {
864 time_ind := {
865 fn := fn
866 }
867 }
868}
Harald Welte883340c2018-02-28 18:59:29 +0100869
Harald Welte4bff40a2019-03-21 21:34:10 +0100870template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
871 template (value) OCT4 tlli,
872 template (value) OCT6 ra_id,
873 template (value) uint8_t cause) := {
874 msg_type := PCU_IF_MSG_SUSP_REQ,
875 bts_nr := bts_nr,
876 spare := '0000'O,
877 u := {
878 susp_req := {
879 tlli := tlli,
880 ra_id := ra_id,
881 cause := cause
882 }
883 }
884}
885template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
886 template OCT4 tlli,
887 template OCT6 ra_id,
888 template uint8_t cause) := {
889 msg_type := PCU_IF_MSG_SUSP_REQ,
890 bts_nr := bts_nr,
891 spare := '0000'O,
892 u := {
893 susp_req := {
894 tlli := tlli,
895 ra_id := ra_id,
896 cause := cause
897 }
898 }
899}
900
Harald Welte11b734c2019-09-05 14:17:54 +0200901template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
902 template (value) uint8_t app_type,
903 template (value) octetstring app_data) := {
904 msg_type := PCU_IF_MSG_APP_INFO_REQ,
905 bts_nr := bts_nr,
906 spare := '0000'O,
907 u := {
908 app_info_req := {
909 application_type := app_type,
910 len := 0, /* overwritten */
911 data := app_data
912 }
913 }
914}
915template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
916 template (present) uint8_t app_type,
917 template (present) octetstring app_data) := {
918 msg_type := PCU_IF_MSG_APP_INFO_REQ,
919 bts_nr := bts_nr,
920 spare := '0000'O,
921 u := {
922 app_info_req := {
923 application_type := app_type,
924 len := ?,
925 data := app_data
926 }
927 }
928}
929
Harald Welte4bff40a2019-03-21 21:34:10 +0100930
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700931/* TODO: remove this as soon as we drop version 9 support */
932function f_PCUIF_ver_INFO_Trxs()
933return PCUIF_InfoTrxs {
934 if (PCUIF_Types.mp_pcuif_version >= 10) {
935 return valueof(ts_PCUIF_InfoV10Trxs_def);
936 } else {
937 return valueof(ts_PCUIF_InfoV09Trxs_def);
938 }
939}
940
941function f_PCUIF_ver_INFO_PDCHMask(in PCUIF_info_ind info, uint8_t trx_nr)
942return bitstring {
943 if (PCUIF_Types.mp_pcuif_version >= 10) {
944 return info.trx.v10[trx_nr].pdch_mask;
945 } else {
946 return info.trx.v09[trx_nr].pdch_mask;
947 }
948}
949
950
Harald Welte883340c2018-02-28 18:59:29 +0100951} with { encode "RAW" variant "BYTEORDER(first)" };