blob: 8144d972f81b34e514a59a703e13d27d4f147dbc [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,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700156 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700157 uint32_t hLayer1,
158 PCUIF_InfoTrxTsList ts
159} with { variant (pdch_mask) "BITORDER(msb)" };
160private type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList;
161
162/* Version <= 9 specific coding */
163private type record PCUIF_InfoV09Trx {
Harald Welte883340c2018-02-28 18:59:29 +0100164 uint16_t arfcn,
165 BIT8 pdch_mask,
166 OCT1 spare,
167 OCT8 tsc,
168 uint32_t hLayer1
Harald Weltef1486592018-04-04 19:26:41 +0200169} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700170private type record length(8) of PCUIF_InfoV09Trx PCUIF_InfoV09TrxList;
171
172type union PCUIF_InfoTrxs {
173 PCUIF_InfoV09TrxList v09,
174 PCUIF_InfoV10TrxList v10
175} with { variant "" };
Harald Welte883340c2018-02-28 18:59:29 +0100176
177type record PCUIF_info_ind {
178 uint32_t version,
179 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100180 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100181 uint8_t bsic,
182
183 uint16_t mcc,
184 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100185 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100186 uint16_t lac,
187 uint16_t rac,
188
189 uint16_t nsei,
190 record length(7) of uint8_t nse_timer,
191 record length(11) of uint8_t cell_timer,
192
193 uint16_t cell_id,
194 uint16_t repeat_time,
195 uint8_t repeat_count,
196 uint16_t bvci,
197 uint8_t t3142,
198 uint8_t t3169,
199 uint8_t t3191,
200 uint8_t t3193_10ms,
201 uint8_t t3195,
202 uint8_t t3101,
203 uint8_t t3103,
204 uint8_t t3105,
205 uint8_t cv_countdown,
206 uint16_t dl_tbf_ext,
207 uint16_t ul_tbf_ext,
208 uint8_t initial_cs,
209 uint8_t initial_mcs,
210
211 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700212 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100213 record length(2) of uint16_t remote_port,
Harald Welte07e8dde2019-02-18 20:38:45 +0100214 record length(2) of OCT4 remote_ip
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700215} with {
216 /* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9',
217 * so we cannot support more than two versions at the same time here. Sigh. */
218 variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)"
219};
Harald Welte883340c2018-02-28 18:59:29 +0100220
221type record PCUIF_act_req {
222 uint8_t is_activate,
223 uint8_t trx_nr,
224 uint8_t ts_nr,
225 OCT1 spare
226} with { variant "" };
227
228type record PCUIF_time_ind {
229 uint32_t fn
230} with { variant "" };
231
232type record PCUIF_pag_req {
233 PCUIF_Sapi sapi,
234 uint8_t chan_needed,
235 OCT9 identity_lv
236} with { variant "" };
237
Harald Welte11b734c2019-09-05 14:17:54 +0200238type record PCUIF_app_info_req {
239 uint8_t application_type,
240 uint8_t len,
241 octetstring data
242} with {
243 variant (len) "LENGTHTO(data)"
244}
245
Harald Welte883340c2018-02-28 18:59:29 +0100246type record PCUIF_susp_req {
247 OCT4 tlli,
248 OCT6 ra_id,
249 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200250} with {
251 variant (tlli) "BYTEORDER(last)"
252};
Harald Welte883340c2018-02-28 18:59:29 +0100253
254
255type union PCUIF_MsgUnion {
256 PCUIF_data data_req,
257 PCUIF_data data_cnf,
258 PCUIF_data_cnf_dt data_cnf_dt,
259 PCUIF_data data_ind,
260 PCUIF_susp_req susp_req,
261 PCUIF_rts_req rts_req,
262 PCUIF_rach_ind rach_ind,
263 PCUIF_txt_ind txt_ind,
264 PCUIF_info_ind info_ind,
265 PCUIF_act_req act_req,
266 PCUIF_time_ind time_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200267 PCUIF_pag_req pag_req,
268 PCUIF_app_info_req app_info_req
Harald Welte883340c2018-02-28 18:59:29 +0100269} with { variant "" };
270
271type record PCUIF_Message {
272 PCUIF_MsgType msg_type,
273 uint8_t bts_nr,
274 OCT2 spare,
275 PCUIF_MsgUnion u
276} with { variant (u) "CROSSTAG(
277 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
278 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
279 data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT;
280 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
281 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
282 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
283 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
284 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
285 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
286 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
287 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200288 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
289 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ)"
Harald Welte3568dc72018-03-13 17:06:51 +0100290 variant "PADDING(1696)" /* 212 * 8 */
Harald Welte883340c2018-02-28 18:59:29 +0100291};
292
293external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
294 with { extension "prototype(convert) encode(RAW)" };
295external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
296 with { extension "prototype(convert) decode(RAW)" };
297
298
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200299/* Generic template for matching messages by type and/or the BTS number */
300template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
301 template uint8_t bts_nr := ?) := {
302 msg_type := msg_type,
303 bts_nr := bts_nr,
304 spare := ?,
305 u := ?
306}
307
Harald Weltee1fd9162019-02-18 19:47:53 +0100308template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
309 template (value) uint8_t trx_nr,
310 template (value) uint8_t ts_nr,
311 template (value) PCUIF_Sapi sapi,
312 template (value) uint32_t fn,
313 template (value) uint16_t arfcn,
314 template (value) uint8_t block_nr
315 ) := {
316 msg_type := PCU_IF_MSG_RTS_REQ,
317 bts_nr := bts_nr,
318 spare := '0000'O,
319 u := {
320 rts_req := {
321 sapi := sapi,
322 spare := '000000'O,
323 fn := fn,
324 arfcn := arfcn,
325 trx_nr := trx_nr,
326 ts_nr := ts_nr,
327 block_nr := block_nr
328 }
329 }
330}
Harald Welte883340c2018-02-28 18:59:29 +0100331template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
332 template uint8_t trx_nr := ?,
333 template uint8_t ts_nr := ?,
334 template PCUIF_Sapi sapi := ?,
335 template uint32_t fn := ?,
336 template uint8_t block_nr := ?
337 ) := {
338 msg_type := PCU_IF_MSG_RTS_REQ,
339 bts_nr := bts_nr,
340 spare := ?,
341 u := {
342 rts_req := {
343 sapi := sapi,
344 spare := ?,
345 fn := fn,
346 arfcn := ?,
347 trx_nr := trx_nr,
348 ts_nr := ts_nr,
349 block_nr := block_nr
350 }
351 }
352}
353
354template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
355 msg_type := PCU_IF_MSG_TXT_IND,
356 bts_nr := bts_nr,
357 spare := '0000'O,
358 u := {
359 txt_ind := {
360 txt_type := tt,
361 text := text
362 }
363 }
364}
Harald Weltee1fd9162019-02-18 19:47:53 +0100365template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
366 template charstring text := ?) := {
367 msg_type := PCU_IF_MSG_TXT_IND,
368 bts_nr := bts_nr,
369 spare := '0000'O,
370 u := {
371 txt_ind := {
372 txt_type := tt,
373 text := text
374 }
375 }
376}
377
378
Harald Welte883340c2018-02-28 18:59:29 +0100379
380template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
381 msg_type := PCU_IF_MSG_ACT_REQ,
382 bts_nr := bts_nr,
383 spare := '0000'O,
384 u := {
385 act_req := {
386 is_activate := 1,
387 trx_nr := trx_nr,
388 ts_nr := ts_nr,
389 spare := '00'O
390 }
391 }
392}
Harald Weltee1fd9162019-02-18 19:47:53 +0100393template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
394 template uint8_t ts_nr) := {
395 msg_type := PCU_IF_MSG_ACT_REQ,
396 bts_nr := bts_nr,
397 spare := '0000'O,
398 u := {
399 act_req := {
400 is_activate := 1,
401 trx_nr := trx_nr,
402 ts_nr := ts_nr,
403 spare := '00'O
404 }
405 }
406}
Harald Welte883340c2018-02-28 18:59:29 +0100407
408template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
409 msg_type := PCU_IF_MSG_ACT_REQ,
410 bts_nr := bts_nr,
411 spare := '0000'O,
412 u := {
413 act_req := {
414 is_activate := 0,
415 trx_nr := trx_nr,
416 ts_nr := ts_nr,
417 spare := '00'O
418 }
419 }
420}
Harald Weltee1fd9162019-02-18 19:47:53 +0100421template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
422 template uint8_t ts_nr) := {
423 msg_type := PCU_IF_MSG_ACT_REQ,
424 bts_nr := bts_nr,
425 spare := '0000'O,
426 u := {
427 act_req := {
428 is_activate := 0,
429 trx_nr := trx_nr,
430 ts_nr := ts_nr,
431 spare := '00'O
432 }
433 }
434}
Harald Welte883340c2018-02-28 18:59:29 +0100435
Harald Weltee1fd9162019-02-18 19:47:53 +0100436template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
437 template (value) uint8_t trx_nr,
438 template (value) uint8_t ts_nr,
439 template (value) uint8_t block_nr,
440 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700441 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100442 template (value) uint32_t fn,
443 template (value) uint16_t arfcn,
444 template (value) int8_t rssi := -80,
445 template (value) uint16_t ber10k := 0,
446 template (value) int16_t ta_offs_qbits := 0,
447 template (value) uint16_t lqual_cb := 10) := {
448 msg_type := PCU_IF_MSG_DATA_IND,
449 bts_nr := bts_nr,
450 spare := '0000'O,
451 u := {
452 data_ind := {
453 sapi := sapi,
454 len := lengthof(valueof(data)),
455 data := data,
456 fn := fn,
457 arfcn := arfcn,
458 trx_nr := trx_nr,
459 ts_nr := ts_nr,
460 block_nr := block_nr,
461 rssi := rssi,
462 ber10k := ber10k,
463 ta_offs_qbits := ta_offs_qbits,
464 lqual_cb := lqual_cb
465 }
466 }
467}
Harald Welte883340c2018-02-28 18:59:29 +0100468template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
469 template uint8_t trx_nr := ?,
470 template uint8_t ts_nr := ?,
471 template uint8_t block_nr := ?,
472 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700473 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100474 msg_type := PCU_IF_MSG_DATA_IND,
475 bts_nr := bts_nr,
476 spare := ?,
477 u := {
478 data_ind := {
479 sapi := sapi,
480 len := ?,
481 data := data,
482 fn := ?,
483 arfcn := ?,
484 trx_nr := trx_nr,
485 ts_nr := ts_nr,
486 block_nr := block_nr,
487 rssi := ?,
488 ber10k := ?,
489 ta_offs_qbits := ?,
490 lqual_cb := ?
491 }
492 }
493}
494
495template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
496 uint8_t ts_nr, uint8_t block_nr,
497 uint32_t fn, PCUIF_Sapi sapi,
498 octetstring data) := {
499 msg_type := PCU_IF_MSG_DATA_REQ,
500 bts_nr := bts_nr,
501 spare := '0000'O,
502 u := {
503 data_req := {
504 sapi := sapi,
505 len := lengthof(data),
506 data := data,
507 fn := fn,
508 arfcn := 0, /* unused in BTS */
509 trx_nr := trx_nr,
510 ts_nr := ts_nr,
511 block_nr := block_nr,
512 /* measurement parameters below unused on Tx */
513 rssi := 0,
514 ber10k := 0,
515 ta_offs_qbits := 0,
516 lqual_cb := 0
517 }
518 }
519}
Harald Weltee1fd9162019-02-18 19:47:53 +0100520template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
521 template uint8_t trx_nr,
522 template uint8_t ts_nr,
523 template uint8_t block_nr := ?,
524 template uint32_t fn := ?,
525 template PCUIF_Sapi sapi := ?,
526 template octetstring data := ?) := {
527 msg_type := PCU_IF_MSG_DATA_REQ,
528 bts_nr := bts_nr,
529 spare := '0000'O,
530 u := {
531 data_req := {
532 sapi := sapi,
533 len := ?,
534 data := data,
535 fn := fn,
Harald Welte0a3d63f2019-03-02 00:02:07 +0100536 arfcn := ?, /* unused in BTS */
Harald Weltee1fd9162019-02-18 19:47:53 +0100537 trx_nr := trx_nr,
538 ts_nr := ts_nr,
539 block_nr := block_nr,
540 /* measurement parameters below unused on Tx */
541 rssi := 0,
542 ber10k := 0,
543 ta_offs_qbits := 0,
544 lqual_cb := 0
545 }
546 }
547}
Harald Welte883340c2018-02-28 18:59:29 +0100548
Harald Weltee1fd9162019-02-18 19:47:53 +0100549template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
550 template (value) uint8_t trx_nr,
551 template (value) uint8_t ts_nr,
552 template (value) uint8_t block_nr,
553 template (value) uint32_t fn,
554 template (value) uint16_t arfcn,
555 template (value) PCUIF_Sapi sapi,
556 template (value) octetstring data) := {
557 msg_type := PCU_IF_MSG_DATA_CNF,
558 bts_nr := bts_nr,
559 spare := '0000'O,
560 u := {
561 data_cnf := {
562 sapi := sapi,
563 len := 0, /* overwritten */
564 data := data,
565 fn := fn,
566 arfcn := arfcn,
567 trx_nr := trx_nr,
568 ts_nr := ts_nr,
569 block_nr := block_nr,
570 rssi := 0,
571 ber10k := 0,
572 ta_offs_qbits := 0,
573 lqual_cb := 0
574 }
575 }
576}
Harald Welte883340c2018-02-28 18:59:29 +0100577template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
578 template uint8_t trx_nr := ?,
579 template uint8_t ts_nr := ?,
580 template PCUIF_Sapi sapi := ?,
581 template octetstring data := ?) := {
582 msg_type := PCU_IF_MSG_DATA_CNF,
583 bts_nr := bts_nr,
584 spare := ?,
585 u := {
586 data_cnf := {
587 sapi := sapi,
588 len := ?,
589 data := data,
590 fn := ?,
591 arfcn := ?,
592 trx_nr := trx_nr,
593 ts_nr := ts_nr,
594 block_nr := ?,
595 rssi := ?,
596 ber10k := ?,
597 ta_offs_qbits := ?,
598 lqual_cb := ?
599 }
600 }
601}
602
Harald Weltee1fd9162019-02-18 19:47:53 +0100603template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700604 template (value) uint8_t trx_nr,
605 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100606 template (value) uint16_t ra,
607 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100608 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100609 template (value) uint32_t fn,
610 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700611 template (value) int16_t qta := 0,
612 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100613) := {
614 msg_type := PCU_IF_MSG_RACH_IND,
615 bts_nr := bts_nr,
616 spare := '0000'O,
617 u := {
618 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700619 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100620 ra := ra,
621 qta := qta,
622 fn := fn,
623 arfcn := arfcn,
624 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700625 burst_type := burst_type,
626 trx_nr := trx_nr,
627 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100628 }
629 }
630}
Harald Welte883340c2018-02-28 18:59:29 +0100631template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700632 template uint8_t trx_nr := ?,
633 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100634 template uint16_t ra := ?,
635 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100636 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700637 template uint32_t fn := ?,
638 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100639 msg_type := PCU_IF_MSG_RACH_IND,
640 bts_nr := bts_nr,
641 spare := ?,
642 u := {
643 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700644 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100645 ra := ra,
646 qta := ?,
647 fn := fn,
648 arfcn := ?,
649 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700650 burst_type := burst_type,
651 trx_nr := trx_nr,
652 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100653 }
654 }
655}
656
Harald Weltee1fd9162019-02-18 19:47:53 +0100657template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
658 template (value) OCT9 id_lv,
659 template (value) uint8_t chan_needed,
660 template (value) PCUIF_Sapi sapi) := {
661 msg_type := PCU_IF_MSG_PAG_REQ,
662 bts_nr := bts_nr,
663 spare := '0000'O,
664 u := {
665 pag_req := {
666 sapi := sapi,
667 chan_needed := chan_needed,
668 identity_lv := id_lv
669 }
670 }
671}
Harald Welte883340c2018-02-28 18:59:29 +0100672template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
673 template OCT9 id_lv := ?,
674 template uint8_t chan_needed := ?,
675 template PCUIF_Sapi sapi := ?) := {
676 msg_type := PCU_IF_MSG_PAG_REQ,
677 bts_nr := bts_nr,
678 spare := ?,
679 u := {
680 pag_req := {
681 sapi := ?,
682 chan_needed := chan_needed,
683 identity_lv := id_lv
684 }
685 }
686}
687
Harald Weltee1fd9162019-02-18 19:47:53 +0100688const PCUIF_Flags c_PCUIF_Flags_default := {
689 bts_active := true,
690 sysmo_direct_dsp := false,
691 spare := '00000000000000'B,
692 cs1 := true,
693 cs2 := true,
694 cs3 := true,
695 cs4 := true,
696 mcs1 := true,
697 mcs2 := true,
698 mcs3 := true,
699 mcs4 := true,
700 mcs5 := true,
701 mcs6 := true,
702 mcs7 := true,
703 mcs8 := true,
704 mcs9 := true,
705 spare2 := '000'B
706};
707
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700708template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
709 tsc := tsc,
710 hopping := 0,
711 hsn := 0, maio := 0,
712 ma := f_pad_bit(''B, 64, '0'B)
713};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700714template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
715 tsc := tsc,
716 hopping := 0,
717 hsn := ?, maio := ?,
718 ma := ?
719};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700720
721template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
722 template (value) uint6_t hsn := 0,
723 template (value) uint6_t maio := 0,
724 template (value) bitstring ma := ''B) := {
725 tsc := tsc,
726 hopping := 1,
727 hsn := hsn,
728 maio := maio,
729 ma := f_pad_bit(valueof(ma), 64, '0'B)
730};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700731template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
732 template uint6_t hsn := ?,
733 template uint6_t maio := ?,
734 template bitstring ma := ?) := {
735 tsc := tsc,
736 hopping := 1,
737 hsn := hsn,
738 maio := maio,
739 ma := ma
740};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700741
742template (value) PCUIF_InfoV10Trx ts_PCUIF_InfoV10Trx(template (value) uint16_t arfcn := 871,
743 template (value) BIT8 pdch_mask := '00000001'B,
744 template (value) uint3_t tsc := 7) := {
745 arfcn := arfcn,
746 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700747 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700748 hLayer1 := 0,
749 ts := {
750 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
751 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
752 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
753 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
754 }
755};
756
757template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09Trx(template (value) uint16_t arfcn := 871,
758 template (value) BIT8 pdch_mask := '00000001'B,
759 OCT1 tsc := '07'O) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100760 arfcn := arfcn,
761 pdch_mask := pdch_mask,
762 spare := '00'O,
763 tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc,
764 hLayer1 := 0
765}
766
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700767template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := ts_PCUIF_InfoV09Trx(0, '00000000'B, '00'O);
Harald Weltee1fd9162019-02-18 19:47:53 +0100768
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700769template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := {
770 v09 := {
771 ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL,
772 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
773 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
774 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL
775 }
776};
777
778template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := {
779 v10 := {
780 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
781 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
782 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
783 ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx
784 }
785};
Harald Weltee1fd9162019-02-18 19:47:53 +0100786
Harald Weltee1fd9162019-02-18 19:47:53 +0100787template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200788 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100789 msg_type := PCU_IF_MSG_INFO_IND,
790 bts_nr := bts_nr,
791 spare := '0000'O,
792 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200793 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100794 }
795}
Harald Welted378a252018-03-13 17:02:14 +0100796template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
797 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700798 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100799 msg_type := PCU_IF_MSG_INFO_IND,
800 bts_nr := bts_nr,
801 spare := ?,
802 u := {
803 info_ind := {
804 version := version,
805 flags := flags,
806 trx := ?,
807 bsic := ?,
808 mcc := ?,
809 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100810 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100811 lac := ?,
812 rac := ?,
813 nsei := ?,
814 nse_timer := ?,
815 cell_timer := ?,
816 cell_id := ?,
817 repeat_time := ?,
818 repeat_count := ?,
819 bvci := ?,
820 t3142 := ?,
821 t3169 := ?,
822 t3191 := ?,
823 t3193_10ms := ?,
824 t3195 := ?,
825 t3101 := ?,
826 t3103 := ?,
827 t3105 := ?,
828 cv_countdown := ?,
829 dl_tbf_ext := ?,
830 ul_tbf_ext := ?,
831 initial_cs := ?,
832 initial_mcs := ?,
833 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700834 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100835 remote_port := ?,
836 remote_ip := ?
837 }
838 }
839}
840
Harald Weltea3219812019-03-02 00:02:28 +0100841template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
842 template (value) uint32_t fn) := {
843 msg_type := PCU_IF_MSG_TIME_IND,
844 bts_nr := bts_nr,
845 spare := '0000'O,
846 u := {
847 time_ind := {
848 fn := fn
849 }
850 }
851}
852template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
853 template uint32_t fn) := {
854 msg_type := PCU_IF_MSG_TIME_IND,
855 bts_nr := bts_nr,
856 spare := ?,
857 u := {
858 time_ind := {
859 fn := fn
860 }
861 }
862}
Harald Welte883340c2018-02-28 18:59:29 +0100863
Harald Welte4bff40a2019-03-21 21:34:10 +0100864template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
865 template (value) OCT4 tlli,
866 template (value) OCT6 ra_id,
867 template (value) uint8_t cause) := {
868 msg_type := PCU_IF_MSG_SUSP_REQ,
869 bts_nr := bts_nr,
870 spare := '0000'O,
871 u := {
872 susp_req := {
873 tlli := tlli,
874 ra_id := ra_id,
875 cause := cause
876 }
877 }
878}
879template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
880 template OCT4 tlli,
881 template OCT6 ra_id,
882 template uint8_t cause) := {
883 msg_type := PCU_IF_MSG_SUSP_REQ,
884 bts_nr := bts_nr,
885 spare := '0000'O,
886 u := {
887 susp_req := {
888 tlli := tlli,
889 ra_id := ra_id,
890 cause := cause
891 }
892 }
893}
894
Harald Welte11b734c2019-09-05 14:17:54 +0200895template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
896 template (value) uint8_t app_type,
897 template (value) octetstring app_data) := {
898 msg_type := PCU_IF_MSG_APP_INFO_REQ,
899 bts_nr := bts_nr,
900 spare := '0000'O,
901 u := {
902 app_info_req := {
903 application_type := app_type,
904 len := 0, /* overwritten */
905 data := app_data
906 }
907 }
908}
909template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
910 template (present) uint8_t app_type,
911 template (present) octetstring app_data) := {
912 msg_type := PCU_IF_MSG_APP_INFO_REQ,
913 bts_nr := bts_nr,
914 spare := '0000'O,
915 u := {
916 app_info_req := {
917 application_type := app_type,
918 len := ?,
919 data := app_data
920 }
921 }
922}
923
Harald Welte4bff40a2019-03-21 21:34:10 +0100924
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700925/* TODO: remove this as soon as we drop version 9 support */
926function f_PCUIF_ver_INFO_Trxs()
927return PCUIF_InfoTrxs {
928 if (PCUIF_Types.mp_pcuif_version >= 10) {
929 return valueof(ts_PCUIF_InfoV10Trxs_def);
930 } else {
931 return valueof(ts_PCUIF_InfoV09Trxs_def);
932 }
933}
934
935function f_PCUIF_ver_INFO_PDCHMask(in PCUIF_info_ind info, uint8_t trx_nr)
936return bitstring {
937 if (PCUIF_Types.mp_pcuif_version >= 10) {
938 return info.trx.v10[trx_nr].pdch_mask;
939 } else {
940 return info.trx.v09[trx_nr].pdch_mask;
941 }
942}
943
944
Harald Welte883340c2018-02-28 18:59:29 +0100945} with { encode "RAW" variant "BYTEORDER(first)" };