blob: 1c5b0af22b817cb24eb62729d91a65e5ad5f2cc4 [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,
148 bitstring ma length(64)
149} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
150private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
151
152/* Version >= 10 specific coding */
153private type record PCUIF_InfoV10Trx {
154 uint16_t arfcn,
155 BIT8 pdch_mask,
156 uint32_t hLayer1,
157 PCUIF_InfoTrxTsList ts
158} with { variant (pdch_mask) "BITORDER(msb)" };
159private type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList;
160
161/* Version <= 9 specific coding */
162private type record PCUIF_InfoV09Trx {
Harald Welte883340c2018-02-28 18:59:29 +0100163 uint16_t arfcn,
164 BIT8 pdch_mask,
165 OCT1 spare,
166 OCT8 tsc,
167 uint32_t hLayer1
Harald Weltef1486592018-04-04 19:26:41 +0200168} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700169private type record length(8) of PCUIF_InfoV09Trx PCUIF_InfoV09TrxList;
170
171type union PCUIF_InfoTrxs {
172 PCUIF_InfoV09TrxList v09,
173 PCUIF_InfoV10TrxList v10
174} with { variant "" };
Harald Welte883340c2018-02-28 18:59:29 +0100175
176type record PCUIF_info_ind {
177 uint32_t version,
178 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100179 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100180 uint8_t bsic,
181
182 uint16_t mcc,
183 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100184 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100185 uint16_t lac,
186 uint16_t rac,
187
188 uint16_t nsei,
189 record length(7) of uint8_t nse_timer,
190 record length(11) of uint8_t cell_timer,
191
192 uint16_t cell_id,
193 uint16_t repeat_time,
194 uint8_t repeat_count,
195 uint16_t bvci,
196 uint8_t t3142,
197 uint8_t t3169,
198 uint8_t t3191,
199 uint8_t t3193_10ms,
200 uint8_t t3195,
201 uint8_t t3101,
202 uint8_t t3103,
203 uint8_t t3105,
204 uint8_t cv_countdown,
205 uint16_t dl_tbf_ext,
206 uint16_t ul_tbf_ext,
207 uint8_t initial_cs,
208 uint8_t initial_mcs,
209
210 record length(2) of uint16_t nsvci,
211 record length(2) of uint16_t local_pprt,
212 record length(2) of uint16_t remote_port,
Harald Welte07e8dde2019-02-18 20:38:45 +0100213 record length(2) of OCT4 remote_ip
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700214} with {
215 /* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9',
216 * so we cannot support more than two versions at the same time here. Sigh. */
217 variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)"
218};
Harald Welte883340c2018-02-28 18:59:29 +0100219
220type record PCUIF_act_req {
221 uint8_t is_activate,
222 uint8_t trx_nr,
223 uint8_t ts_nr,
224 OCT1 spare
225} with { variant "" };
226
227type record PCUIF_time_ind {
228 uint32_t fn
229} with { variant "" };
230
231type record PCUIF_pag_req {
232 PCUIF_Sapi sapi,
233 uint8_t chan_needed,
234 OCT9 identity_lv
235} with { variant "" };
236
Harald Welte11b734c2019-09-05 14:17:54 +0200237type record PCUIF_app_info_req {
238 uint8_t application_type,
239 uint8_t len,
240 octetstring data
241} with {
242 variant (len) "LENGTHTO(data)"
243}
244
Harald Welte883340c2018-02-28 18:59:29 +0100245type record PCUIF_susp_req {
246 OCT4 tlli,
247 OCT6 ra_id,
248 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200249} with {
250 variant (tlli) "BYTEORDER(last)"
251};
Harald Welte883340c2018-02-28 18:59:29 +0100252
253
254type union PCUIF_MsgUnion {
255 PCUIF_data data_req,
256 PCUIF_data data_cnf,
257 PCUIF_data_cnf_dt data_cnf_dt,
258 PCUIF_data data_ind,
259 PCUIF_susp_req susp_req,
260 PCUIF_rts_req rts_req,
261 PCUIF_rach_ind rach_ind,
262 PCUIF_txt_ind txt_ind,
263 PCUIF_info_ind info_ind,
264 PCUIF_act_req act_req,
265 PCUIF_time_ind time_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200266 PCUIF_pag_req pag_req,
267 PCUIF_app_info_req app_info_req
Harald Welte883340c2018-02-28 18:59:29 +0100268} with { variant "" };
269
270type record PCUIF_Message {
271 PCUIF_MsgType msg_type,
272 uint8_t bts_nr,
273 OCT2 spare,
274 PCUIF_MsgUnion u
275} with { variant (u) "CROSSTAG(
276 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
277 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
278 data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT;
279 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
280 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
281 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
282 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
283 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
284 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
285 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
286 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200287 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
288 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ)"
Harald Welte3568dc72018-03-13 17:06:51 +0100289 variant "PADDING(1696)" /* 212 * 8 */
Harald Welte883340c2018-02-28 18:59:29 +0100290};
291
292external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
293 with { extension "prototype(convert) encode(RAW)" };
294external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
295 with { extension "prototype(convert) decode(RAW)" };
296
297
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200298/* Generic template for matching messages by type and/or the BTS number */
299template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
300 template uint8_t bts_nr := ?) := {
301 msg_type := msg_type,
302 bts_nr := bts_nr,
303 spare := ?,
304 u := ?
305}
306
Harald Weltee1fd9162019-02-18 19:47:53 +0100307template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
308 template (value) uint8_t trx_nr,
309 template (value) uint8_t ts_nr,
310 template (value) PCUIF_Sapi sapi,
311 template (value) uint32_t fn,
312 template (value) uint16_t arfcn,
313 template (value) uint8_t block_nr
314 ) := {
315 msg_type := PCU_IF_MSG_RTS_REQ,
316 bts_nr := bts_nr,
317 spare := '0000'O,
318 u := {
319 rts_req := {
320 sapi := sapi,
321 spare := '000000'O,
322 fn := fn,
323 arfcn := arfcn,
324 trx_nr := trx_nr,
325 ts_nr := ts_nr,
326 block_nr := block_nr
327 }
328 }
329}
Harald Welte883340c2018-02-28 18:59:29 +0100330template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
331 template uint8_t trx_nr := ?,
332 template uint8_t ts_nr := ?,
333 template PCUIF_Sapi sapi := ?,
334 template uint32_t fn := ?,
335 template uint8_t block_nr := ?
336 ) := {
337 msg_type := PCU_IF_MSG_RTS_REQ,
338 bts_nr := bts_nr,
339 spare := ?,
340 u := {
341 rts_req := {
342 sapi := sapi,
343 spare := ?,
344 fn := fn,
345 arfcn := ?,
346 trx_nr := trx_nr,
347 ts_nr := ts_nr,
348 block_nr := block_nr
349 }
350 }
351}
352
353template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
354 msg_type := PCU_IF_MSG_TXT_IND,
355 bts_nr := bts_nr,
356 spare := '0000'O,
357 u := {
358 txt_ind := {
359 txt_type := tt,
360 text := text
361 }
362 }
363}
Harald Weltee1fd9162019-02-18 19:47:53 +0100364template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
365 template charstring text := ?) := {
366 msg_type := PCU_IF_MSG_TXT_IND,
367 bts_nr := bts_nr,
368 spare := '0000'O,
369 u := {
370 txt_ind := {
371 txt_type := tt,
372 text := text
373 }
374 }
375}
376
377
Harald Welte883340c2018-02-28 18:59:29 +0100378
379template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
380 msg_type := PCU_IF_MSG_ACT_REQ,
381 bts_nr := bts_nr,
382 spare := '0000'O,
383 u := {
384 act_req := {
385 is_activate := 1,
386 trx_nr := trx_nr,
387 ts_nr := ts_nr,
388 spare := '00'O
389 }
390 }
391}
Harald Weltee1fd9162019-02-18 19:47:53 +0100392template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
393 template uint8_t ts_nr) := {
394 msg_type := PCU_IF_MSG_ACT_REQ,
395 bts_nr := bts_nr,
396 spare := '0000'O,
397 u := {
398 act_req := {
399 is_activate := 1,
400 trx_nr := trx_nr,
401 ts_nr := ts_nr,
402 spare := '00'O
403 }
404 }
405}
Harald Welte883340c2018-02-28 18:59:29 +0100406
407template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
408 msg_type := PCU_IF_MSG_ACT_REQ,
409 bts_nr := bts_nr,
410 spare := '0000'O,
411 u := {
412 act_req := {
413 is_activate := 0,
414 trx_nr := trx_nr,
415 ts_nr := ts_nr,
416 spare := '00'O
417 }
418 }
419}
Harald Weltee1fd9162019-02-18 19:47:53 +0100420template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
421 template uint8_t ts_nr) := {
422 msg_type := PCU_IF_MSG_ACT_REQ,
423 bts_nr := bts_nr,
424 spare := '0000'O,
425 u := {
426 act_req := {
427 is_activate := 0,
428 trx_nr := trx_nr,
429 ts_nr := ts_nr,
430 spare := '00'O
431 }
432 }
433}
Harald Welte883340c2018-02-28 18:59:29 +0100434
Harald Weltee1fd9162019-02-18 19:47:53 +0100435template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
436 template (value) uint8_t trx_nr,
437 template (value) uint8_t ts_nr,
438 template (value) uint8_t block_nr,
439 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700440 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100441 template (value) uint32_t fn,
442 template (value) uint16_t arfcn,
443 template (value) int8_t rssi := -80,
444 template (value) uint16_t ber10k := 0,
445 template (value) int16_t ta_offs_qbits := 0,
446 template (value) uint16_t lqual_cb := 10) := {
447 msg_type := PCU_IF_MSG_DATA_IND,
448 bts_nr := bts_nr,
449 spare := '0000'O,
450 u := {
451 data_ind := {
452 sapi := sapi,
453 len := lengthof(valueof(data)),
454 data := data,
455 fn := fn,
456 arfcn := arfcn,
457 trx_nr := trx_nr,
458 ts_nr := ts_nr,
459 block_nr := block_nr,
460 rssi := rssi,
461 ber10k := ber10k,
462 ta_offs_qbits := ta_offs_qbits,
463 lqual_cb := lqual_cb
464 }
465 }
466}
Harald Welte883340c2018-02-28 18:59:29 +0100467template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
468 template uint8_t trx_nr := ?,
469 template uint8_t ts_nr := ?,
470 template uint8_t block_nr := ?,
471 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700472 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100473 msg_type := PCU_IF_MSG_DATA_IND,
474 bts_nr := bts_nr,
475 spare := ?,
476 u := {
477 data_ind := {
478 sapi := sapi,
479 len := ?,
480 data := data,
481 fn := ?,
482 arfcn := ?,
483 trx_nr := trx_nr,
484 ts_nr := ts_nr,
485 block_nr := block_nr,
486 rssi := ?,
487 ber10k := ?,
488 ta_offs_qbits := ?,
489 lqual_cb := ?
490 }
491 }
492}
493
494template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
495 uint8_t ts_nr, uint8_t block_nr,
496 uint32_t fn, PCUIF_Sapi sapi,
497 octetstring data) := {
498 msg_type := PCU_IF_MSG_DATA_REQ,
499 bts_nr := bts_nr,
500 spare := '0000'O,
501 u := {
502 data_req := {
503 sapi := sapi,
504 len := lengthof(data),
505 data := data,
506 fn := fn,
507 arfcn := 0, /* unused in BTS */
508 trx_nr := trx_nr,
509 ts_nr := ts_nr,
510 block_nr := block_nr,
511 /* measurement parameters below unused on Tx */
512 rssi := 0,
513 ber10k := 0,
514 ta_offs_qbits := 0,
515 lqual_cb := 0
516 }
517 }
518}
Harald Weltee1fd9162019-02-18 19:47:53 +0100519template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
520 template uint8_t trx_nr,
521 template uint8_t ts_nr,
522 template uint8_t block_nr := ?,
523 template uint32_t fn := ?,
524 template PCUIF_Sapi sapi := ?,
525 template 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 := ?,
533 data := data,
534 fn := fn,
Harald Welte0a3d63f2019-03-02 00:02:07 +0100535 arfcn := ?, /* unused in BTS */
Harald Weltee1fd9162019-02-18 19:47:53 +0100536 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 Welte883340c2018-02-28 18:59:29 +0100547
Harald Weltee1fd9162019-02-18 19:47:53 +0100548template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
549 template (value) uint8_t trx_nr,
550 template (value) uint8_t ts_nr,
551 template (value) uint8_t block_nr,
552 template (value) uint32_t fn,
553 template (value) uint16_t arfcn,
554 template (value) PCUIF_Sapi sapi,
555 template (value) octetstring data) := {
556 msg_type := PCU_IF_MSG_DATA_CNF,
557 bts_nr := bts_nr,
558 spare := '0000'O,
559 u := {
560 data_cnf := {
561 sapi := sapi,
562 len := 0, /* overwritten */
563 data := data,
564 fn := fn,
565 arfcn := arfcn,
566 trx_nr := trx_nr,
567 ts_nr := ts_nr,
568 block_nr := block_nr,
569 rssi := 0,
570 ber10k := 0,
571 ta_offs_qbits := 0,
572 lqual_cb := 0
573 }
574 }
575}
Harald Welte883340c2018-02-28 18:59:29 +0100576template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
577 template uint8_t trx_nr := ?,
578 template uint8_t ts_nr := ?,
579 template PCUIF_Sapi sapi := ?,
580 template octetstring data := ?) := {
581 msg_type := PCU_IF_MSG_DATA_CNF,
582 bts_nr := bts_nr,
583 spare := ?,
584 u := {
585 data_cnf := {
586 sapi := sapi,
587 len := ?,
588 data := data,
589 fn := ?,
590 arfcn := ?,
591 trx_nr := trx_nr,
592 ts_nr := ts_nr,
593 block_nr := ?,
594 rssi := ?,
595 ber10k := ?,
596 ta_offs_qbits := ?,
597 lqual_cb := ?
598 }
599 }
600}
601
Harald Weltee1fd9162019-02-18 19:47:53 +0100602template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700603 template (value) uint8_t trx_nr,
604 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100605 template (value) uint16_t ra,
606 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100607 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100608 template (value) uint32_t fn,
609 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700610 template (value) int16_t qta := 0,
611 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100612) := {
613 msg_type := PCU_IF_MSG_RACH_IND,
614 bts_nr := bts_nr,
615 spare := '0000'O,
616 u := {
617 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700618 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100619 ra := ra,
620 qta := qta,
621 fn := fn,
622 arfcn := arfcn,
623 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700624 burst_type := burst_type,
625 trx_nr := trx_nr,
626 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100627 }
628 }
629}
Harald Welte883340c2018-02-28 18:59:29 +0100630template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700631 template uint8_t trx_nr := ?,
632 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100633 template uint16_t ra := ?,
634 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100635 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700636 template uint32_t fn := ?,
637 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100638 msg_type := PCU_IF_MSG_RACH_IND,
639 bts_nr := bts_nr,
640 spare := ?,
641 u := {
642 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700643 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100644 ra := ra,
645 qta := ?,
646 fn := fn,
647 arfcn := ?,
648 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700649 burst_type := burst_type,
650 trx_nr := trx_nr,
651 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100652 }
653 }
654}
655
Harald Weltee1fd9162019-02-18 19:47:53 +0100656template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
657 template (value) OCT9 id_lv,
658 template (value) uint8_t chan_needed,
659 template (value) PCUIF_Sapi sapi) := {
660 msg_type := PCU_IF_MSG_PAG_REQ,
661 bts_nr := bts_nr,
662 spare := '0000'O,
663 u := {
664 pag_req := {
665 sapi := sapi,
666 chan_needed := chan_needed,
667 identity_lv := id_lv
668 }
669 }
670}
Harald Welte883340c2018-02-28 18:59:29 +0100671template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
672 template OCT9 id_lv := ?,
673 template uint8_t chan_needed := ?,
674 template PCUIF_Sapi sapi := ?) := {
675 msg_type := PCU_IF_MSG_PAG_REQ,
676 bts_nr := bts_nr,
677 spare := ?,
678 u := {
679 pag_req := {
680 sapi := ?,
681 chan_needed := chan_needed,
682 identity_lv := id_lv
683 }
684 }
685}
686
Harald Weltee1fd9162019-02-18 19:47:53 +0100687const PCUIF_Flags c_PCUIF_Flags_default := {
688 bts_active := true,
689 sysmo_direct_dsp := false,
690 spare := '00000000000000'B,
691 cs1 := true,
692 cs2 := true,
693 cs3 := true,
694 cs4 := true,
695 mcs1 := true,
696 mcs2 := true,
697 mcs3 := true,
698 mcs4 := true,
699 mcs5 := true,
700 mcs6 := true,
701 mcs7 := true,
702 mcs8 := true,
703 mcs9 := true,
704 spare2 := '000'B
705};
706
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700707template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
708 tsc := tsc,
709 hopping := 0,
710 hsn := 0, maio := 0,
711 ma := f_pad_bit(''B, 64, '0'B)
712};
713
714template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
715 template (value) uint6_t hsn := 0,
716 template (value) uint6_t maio := 0,
717 template (value) bitstring ma := ''B) := {
718 tsc := tsc,
719 hopping := 1,
720 hsn := hsn,
721 maio := maio,
722 ma := f_pad_bit(valueof(ma), 64, '0'B)
723};
724
725template (value) PCUIF_InfoV10Trx ts_PCUIF_InfoV10Trx(template (value) uint16_t arfcn := 871,
726 template (value) BIT8 pdch_mask := '00000001'B,
727 template (value) uint3_t tsc := 7) := {
728 arfcn := arfcn,
729 pdch_mask := pdch_mask,
730 hLayer1 := 0,
731 ts := {
732 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
733 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
734 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
735 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
736 }
737};
738
739template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09Trx(template (value) uint16_t arfcn := 871,
740 template (value) BIT8 pdch_mask := '00000001'B,
741 OCT1 tsc := '07'O) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100742 arfcn := arfcn,
743 pdch_mask := pdch_mask,
744 spare := '00'O,
745 tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc,
746 hLayer1 := 0
747}
748
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700749template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := ts_PCUIF_InfoV09Trx(0, '00000000'B, '00'O);
Harald Weltee1fd9162019-02-18 19:47:53 +0100750
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700751template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := {
752 v09 := {
753 ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL,
754 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
755 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
756 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL
757 }
758};
759
760template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := {
761 v10 := {
762 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
763 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
764 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
765 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx
766 }
767};
Harald Weltee1fd9162019-02-18 19:47:53 +0100768
Harald Weltee1fd9162019-02-18 19:47:53 +0100769template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200770 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100771 msg_type := PCU_IF_MSG_INFO_IND,
772 bts_nr := bts_nr,
773 spare := '0000'O,
774 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200775 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100776 }
777}
Harald Welted378a252018-03-13 17:02:14 +0100778template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
779 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700780 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100781 msg_type := PCU_IF_MSG_INFO_IND,
782 bts_nr := bts_nr,
783 spare := ?,
784 u := {
785 info_ind := {
786 version := version,
787 flags := flags,
788 trx := ?,
789 bsic := ?,
790 mcc := ?,
791 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100792 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100793 lac := ?,
794 rac := ?,
795 nsei := ?,
796 nse_timer := ?,
797 cell_timer := ?,
798 cell_id := ?,
799 repeat_time := ?,
800 repeat_count := ?,
801 bvci := ?,
802 t3142 := ?,
803 t3169 := ?,
804 t3191 := ?,
805 t3193_10ms := ?,
806 t3195 := ?,
807 t3101 := ?,
808 t3103 := ?,
809 t3105 := ?,
810 cv_countdown := ?,
811 dl_tbf_ext := ?,
812 ul_tbf_ext := ?,
813 initial_cs := ?,
814 initial_mcs := ?,
815 nsvci := ?,
816 local_pprt := ?,
817 remote_port := ?,
818 remote_ip := ?
819 }
820 }
821}
822
Harald Weltea3219812019-03-02 00:02:28 +0100823template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
824 template (value) uint32_t fn) := {
825 msg_type := PCU_IF_MSG_TIME_IND,
826 bts_nr := bts_nr,
827 spare := '0000'O,
828 u := {
829 time_ind := {
830 fn := fn
831 }
832 }
833}
834template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
835 template uint32_t fn) := {
836 msg_type := PCU_IF_MSG_TIME_IND,
837 bts_nr := bts_nr,
838 spare := ?,
839 u := {
840 time_ind := {
841 fn := fn
842 }
843 }
844}
Harald Welte883340c2018-02-28 18:59:29 +0100845
Harald Welte4bff40a2019-03-21 21:34:10 +0100846template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
847 template (value) OCT4 tlli,
848 template (value) OCT6 ra_id,
849 template (value) uint8_t cause) := {
850 msg_type := PCU_IF_MSG_SUSP_REQ,
851 bts_nr := bts_nr,
852 spare := '0000'O,
853 u := {
854 susp_req := {
855 tlli := tlli,
856 ra_id := ra_id,
857 cause := cause
858 }
859 }
860}
861template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
862 template OCT4 tlli,
863 template OCT6 ra_id,
864 template uint8_t cause) := {
865 msg_type := PCU_IF_MSG_SUSP_REQ,
866 bts_nr := bts_nr,
867 spare := '0000'O,
868 u := {
869 susp_req := {
870 tlli := tlli,
871 ra_id := ra_id,
872 cause := cause
873 }
874 }
875}
876
Harald Welte11b734c2019-09-05 14:17:54 +0200877template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
878 template (value) uint8_t app_type,
879 template (value) octetstring app_data) := {
880 msg_type := PCU_IF_MSG_APP_INFO_REQ,
881 bts_nr := bts_nr,
882 spare := '0000'O,
883 u := {
884 app_info_req := {
885 application_type := app_type,
886 len := 0, /* overwritten */
887 data := app_data
888 }
889 }
890}
891template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
892 template (present) uint8_t app_type,
893 template (present) octetstring app_data) := {
894 msg_type := PCU_IF_MSG_APP_INFO_REQ,
895 bts_nr := bts_nr,
896 spare := '0000'O,
897 u := {
898 app_info_req := {
899 application_type := app_type,
900 len := ?,
901 data := app_data
902 }
903 }
904}
905
Harald Welte4bff40a2019-03-21 21:34:10 +0100906
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700907/* TODO: remove this as soon as we drop version 9 support */
908function f_PCUIF_ver_INFO_Trxs()
909return PCUIF_InfoTrxs {
910 if (PCUIF_Types.mp_pcuif_version >= 10) {
911 return valueof(ts_PCUIF_InfoV10Trxs_def);
912 } else {
913 return valueof(ts_PCUIF_InfoV09Trxs_def);
914 }
915}
916
917function f_PCUIF_ver_INFO_PDCHMask(in PCUIF_info_ind info, uint8_t trx_nr)
918return bitstring {
919 if (PCUIF_Types.mp_pcuif_version >= 10) {
920 return info.trx.v10[trx_nr].pdch_mask;
921 } else {
922 return info.trx.v09[trx_nr].pdch_mask;
923 }
924}
925
926
Harald Welte883340c2018-02-28 18:59:29 +0100927} with { encode "RAW" variant "BYTEORDER(first)" };