blob: fe56459caa7aa1f4a4d81fef2bbeeaa18bc08b49 [file] [log] [blame]
Harald Weltef6543322017-07-16 07:35:10 +02001/* Data Types / Encoding / Decoding for OsmocomBB L1CTL interface */
2/* (C) 2017 by Harald Welte <laforge@gnumonks.org>, derived from l1ctl_proto.h
Harald Welte34b5a952019-05-27 11:54:11 +02003 * which is (C) 2010 by Harald Welte + Holger Hans Peter Freyther
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 Weltef6543322017-07-16 07:35:10 +020012module L1CTL_Types {
13
14 import from General_Types all;
15 import from GSM_Types all;
Harald Welte9419c8a2017-07-30 04:07:05 +020016 import from GSM_RR_Types all;
Harald Weltef6543322017-07-16 07:35:10 +020017 import from Osmocom_Types all;
18
19 type enumerated L1ctlMsgType {
20 L1CTL_NONE,
21 L1CTL_FBSB_REQ,
22 L1CTL_FBSB_CONF,
23 L1CTL_DATA_IND,
24 L1CTL_RACH_REQ,
25 L1CTL_DM_EST_REQ,
26 L1CTL_DATA_REQ,
27 L1CTL_RESET_IND,
28 L1CTL_PM_REQ, /* power measurement */
29 L1CTL_PM_CONF, /* power measurement */
30 L1CTL_ECHO_REQ,
31 L1CTL_ECHO_CONF,
32 L1CTL_RACH_CONF,
33 L1CTL_RESET_REQ,
34 L1CTL_RESET_CONF,
35 L1CTL_DATA_CONF,
36 L1CTL_CCCH_MODE_REQ,
37 L1CTL_CCCH_MODE_CONF,
38 L1CTL_DM_REL_REQ,
39 L1CTL_PARAM_REQ,
40 L1CTL_DM_FREQ_REQ,
41 L1CTL_CRYPTO_REQ,
42 L1CTL_SIM_REQ,
43 L1CTL_SIM_CONF,
44 L1CTL_TCH_MODE_REQ,
45 L1CTL_TCH_MODE_CONF,
46 L1CTL_NEIGH_PM_REQ,
47 L1CTL_NEIGH_PM_IND,
48 L1CTL_TRAFFIC_REQ,
49 L1CTL_TRAFFIC_CONF,
Harald Welte00d4dac2017-07-30 00:50:32 +020050 L1CTL_TRAFFIC_IND,
Vadim Yanitskiy4e79ff52019-04-22 06:38:21 +070051 L1CTL_BURST_IND,
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +070052 L1CTL_GPRS_UL_TBF_CFG_REQ,
53 L1CTL_GPRS_DL_TBF_CFG_REQ,
54 L1CTL_GPRS_UL_BLOCK_REQ,
55 L1CTL_GPRS_DL_BLOCK_IND,
56 L1CTL_EXT_RACH_REQ
Harald Weltef6543322017-07-16 07:35:10 +020057 } with { variant "FIELDLENGTH(8)" };
58
59 type enumerated L1ctlCcchMode {
60 CCCH_MODE_NONE (0),
61 CCCH_MODE_NON_COMBINED,
Harald Welte990a3612019-05-27 14:02:13 +020062 CCCH_MODE_COMBINED,
63 CCCH_MODE_COMBINED_CBCH
Harald Weltef6543322017-07-16 07:35:10 +020064 } with { variant "FIELDLENGTH(8)" };
65
66 type enumerated L1ctlNeighMode {
67 NEIGH_MODE_NONE (0),
68 NEIGH_MODE_PM,
69 NEIGH_MODE_SB
70 } with { variant "FIELDLENGTH(8)" };
71
72 type enumerated L1ctlResetType {
73 L1CTL_RES_T_BOOT (0),
74 L1CTL_RES_T_FULL,
75 L1CTL_RES_T_SCHED
76 } with { variant "FIELDLENGTH(8)" };
77
Harald Weltef6543322017-07-16 07:35:10 +020078 type record L1ctlHdrFlags {
79 BIT7 padding,
80 boolean f_done
81 } with { variant "" };
82
83 type record L1ctlHeader {
84 L1ctlMsgType msg_type,
85 L1ctlHdrFlags flags,
86 OCT2 padding
87 } with { variant "" };
88
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +070089 template L1ctlHeader
90 tr_L1ctlHeader(template (present) L1ctlMsgType msg_type) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +010091 msg_type := msg_type,
92 flags := ?,
93 padding := ?
94 };
95
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +070096 template (value) L1ctlHeader
97 ts_L1ctlHeader(template (value) L1ctlMsgType msg_type) := {
Harald Welte52c713c2017-07-16 15:44:44 +020098 msg_type := msg_type,
99 flags := { padding := '0000000'B, f_done := false },
100 padding := '0000'O
101 };
102
Harald Weltef6543322017-07-16 07:35:10 +0200103 type record L1ctlDlInfo {
Harald Welte8e4db2c2017-07-16 18:54:55 +0200104 RslChannelNr chan_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200105 RslLinkId link_id,
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700106 GsmBandArfcn arfcn,
Harald Welte5f0d5c82017-07-16 18:56:01 +0200107 uint32_t frame_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200108 GsmRxLev rx_level,
109 uint8_t snr,
110 uint8_t num_biterr,
111 uint8_t fire_crc
112 } with { variant "" };
113
114 type record L1ctlFbsbConf {
115 int16_t initial_freq_err,
116 uint8_t result,
117 uint8_t bsic
118 } with { variant "" };
119
120 type record L1ctlCcchModeConf {
121 L1ctlCcchMode ccch_mode,
122 OCT3 padding
123 } with { variant "" };
124
125 /* gsm48_chan_mode */
Vadim Yanitskiyfe052962020-10-19 13:27:09 +0700126 type enumerated L1ctlTchMode {
127 L1CTL_CHAN_MODE_SIGN ('00000000'B), /* Signalling */
128 L1CTL_CHAN_MODE_SPEECH_V1 ('00000001'B), /* FR or HR codec */
129 L1CTL_CHAN_MODE_SPEECH_V2 ('00100001'B), /* EFR codec */
Vadim Yanitskiy8fd78f72023-05-26 19:21:55 +0700130 L1CTL_CHAN_MODE_SPEECH_V3 ('01000001'B), /* AMR codec */
131 L1CTL_CHAN_MODE_DATA_14k5 ('00001111'B), /* CSD: TCH/F14.4 */
132 L1CTL_CHAN_MODE_DATA_12k0 ('00000011'B), /* CSD: TCH/F9.6 */
133 L1CTL_CHAN_MODE_DATA_6k0 ('00001011'B), /* CSD: TCH/{FH}4.8 */
134 L1CTL_CHAN_MODE_DATA_3k6 ('00010011'B) /* CSD: TCH/{FH}2.4 */
Vadim Yanitskiyfe052962020-10-19 13:27:09 +0700135 } with { variant "FIELDLENGTH(8)" };
Harald Weltef6543322017-07-16 07:35:10 +0200136
Vadim Yanitskiy7ce605f2020-10-19 16:04:38 +0700137 type enumerated L1ctlLoopMode {
138 L1CTL_LOOP_MODE_OPEN ('00000000'B),
139 L1CTL_LOOP_MODE_A ('00000001'B),
140 L1CTL_LOOP_MODE_B ('00000010'B),
141 L1CTL_LOOP_MODE_C ('00000011'B),
142 L1CTL_LOOP_MODE_D ('00000100'B),
143 L1CTL_LOOP_MODE_E ('00000101'B),
144 L1CTL_LOOP_MODE_F ('00000110'B),
145 L1CTL_LOOP_MODE_I ('00000111'B)
146 } with { variant "FIELDLENGTH(8)" };
147
Harald Weltef6543322017-07-16 07:35:10 +0200148 type record L1ctlAudioMode {
149 BIT4 padding,
150 boolean tx_microphone,
151 boolean tx_traffic_req,
152 boolean rx_speaker,
153 boolean rx_traffic_ind
154 } with { variant "" };
155
Harald Weltef8df4cb2018-03-10 15:15:08 +0100156 template (value) L1ctlAudioMode t_L1CTL_AudioModeNone := { '0000'B, false, false, false, false };
Harald Welte66110f02017-07-16 21:05:18 +0200157
Vadim Yanitskiy16185832020-10-19 21:20:43 +0700158 /* Traffic forwarding mode (see TRAFFIC.{req,cnf,ind} messages) */
159 template (value) L1ctlAudioMode t_L1CTL_AudioModeFwd
160 modifies t_L1CTL_AudioModeNone := {
161 tx_traffic_req := true,
162 rx_traffic_ind := true
163 };
164
Harald Weltef6543322017-07-16 07:35:10 +0200165 type record L1ctlTchModeConf {
166 L1ctlTchMode tch_mode,
167 L1ctlAudioMode audio_mode,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200168 record {
169 uint8_t start_codec,
170 BIT8 codecs_bitmask
171 } amr
Harald Weltef6543322017-07-16 07:35:10 +0200172 } with { variant "" };
173
174 type record L1ctlDataInd {
Vadim Yanitskiy2a92e2a2019-05-28 21:13:35 +0700175 octetstring payload
Harald Welte7024baa2018-03-02 23:37:51 +0100176 } with {
177 variant (payload) "BYTEORDER(first)"
178 };
Harald Weltef6543322017-07-16 07:35:10 +0200179
Harald Weltef6543322017-07-16 07:35:10 +0200180
181 type record L1ctlUlInfo {
Harald Welte8e4db2c2017-07-16 18:54:55 +0200182 RslChannelNr chan_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200183 RslLinkId link_id,
184 OCT2 padding
185 } with { variant "" };
186
187 type record L1ctlFbsbFlags {
188 BIT5 padding,
189 boolean sb,
190 boolean fb1,
191 boolean fb0
Harald Welte344c0cf2018-03-09 16:17:45 +0100192 } with { variant "FIELDORDER(msb)" };
Harald Weltef6543322017-07-16 07:35:10 +0200193
Harald Weltef8df4cb2018-03-10 15:15:08 +0100194 template (value) L1ctlFbsbFlags t_L1CTL_FBSB_F_ALL := {
Harald Welte66110f02017-07-16 21:05:18 +0200195 padding := '00000'B,
196 sb := true,
197 fb1 := true,
198 fb0 := true
199 };
200
Harald Weltef6543322017-07-16 07:35:10 +0200201 type record L1ctlFbsbReq {
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700202 GsmBandArfcn arfcn,
Harald Weltef6543322017-07-16 07:35:10 +0200203 uint16_t timeout_tdma_frames,
204 uint16_t freq_err_thresh1,
205 uint16_t freq_err_thresh2,
206 uint8_t num_freqerr_avg,
207 L1ctlFbsbFlags flags,
208 uint8_t sync_info_idx,
209 L1ctlCcchMode ccch_mode,
210 GsmRxLev rxlev_exp
211 } with { variant "" };
212
213 type record L1ctlCcchModeReq {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100214 L1ctlCcchMode ccch_mode,
215 OCT3 padding
Harald Weltef6543322017-07-16 07:35:10 +0200216 } with { variant "" };
217
218 type record L1ctlTchModeReq {
219 L1ctlTchMode tch_mode,
220 L1ctlAudioMode audio_mode,
Vadim Yanitskiy7ce605f2020-10-19 16:04:38 +0700221 L1ctlLoopMode loop_mode,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200222 record {
223 uint8_t start_codec,
224 BIT8 codecs_bitmask
225 } amr
Harald Weltef6543322017-07-16 07:35:10 +0200226 } with { variant "" };
227
228 type record L1ctlRachReq {
229 uint8_t ra,
230 uint8_t combined,
231 uint16_t offset
232 } with { variant "" };
233
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700234 type enumerated L1ctlRachSynchSeq {
235 RACH_SYNCH_SEQ_TS0 (0),
236 RACH_SYNCH_SEQ_TS1,
237 RACH_SYNCH_SEQ_TS2
238 } with { variant "FIELDLENGTH(8)" };
239
240 type record L1ctlExtRachReq {
241 uint16_t ra11,
242 L1ctlRachSynchSeq synch_seq,
243 uint8_t combined,
244 uint16_t offset
245 } with { variant "" };
246
Harald Weltef6543322017-07-16 07:35:10 +0200247 type record L1ctlParReq {
248 int8_t ta,
249 uint8_t tx_power,
250 OCT2 padding
251 } with { variant "" };
252
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200253 type record L1ctlDataReq {
254 SacchL1Header l1header optional,
255 octetstring l2_payload
256 } with { variant "" };
257
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700258 type record L1ctlH0 {
259 uint8_t h,
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700260 GsmBandArfcn arfcn,
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700261 octetstring padding length(130)
262 } with { variant "" };
263
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700264 type record length(0..64) of GsmBandArfcn L1ctlMA;
Harald Weltef6543322017-07-16 07:35:10 +0200265 type record L1ctlH1 {
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700266 uint8_t h,
Harald Weltef6543322017-07-16 07:35:10 +0200267 uint8_t hsn,
268 uint8_t maio,
269 uint8_t n,
Vadim Yanitskiye8ea3ee2020-05-27 13:29:48 +0700270 OCT1 spare,
271 L1ctlMA ma,
272 octetstring padding
273 } with {
274 variant (n) "LENGTHTO(ma)"
275 variant (n) "UNIT(elements)"
276 /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562849.
277 * TL;DR The reference point of the PADDING attribute is the beginning
278 * of the message, not the beginning of the type/field it's applied on.
279 * Therefore we cannot use it here, and have to add padding manually.
280 * variant (ma) "PADDING(128)" */
281 };
Harald Weltef6543322017-07-16 07:35:10 +0200282
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700283 type union L1ctlH0H1 {
284 L1ctlH0 h0,
285 L1ctlH1 h1
286 } with { variant "TAG(h0, h = 0; h1, h = 1)" };
287
Harald Weltef6543322017-07-16 07:35:10 +0200288 type record L1ctlDmEstReq {
289 GsmTsc tsc,
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700290 L1ctlH0H1 h0h1,
Harald Weltef6543322017-07-16 07:35:10 +0200291 L1ctlTchMode tch_mode,
292 L1ctlAudioMode audio_mode
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700293 } with { variant "" };
Harald Weltef6543322017-07-16 07:35:10 +0200294
295 type record L1ctlReset {
296 L1ctlResetType reset_type,
297 OCT3 padding
298 } with { variant "" };
299
Harald Weltee613f962018-04-18 22:38:16 +0200300 type record L1CtlCryptoReq {
301 uint8_t algo,
302 uint8_t key_len,
303 octetstring key
304 } with { variant (key_len) "LENGTHTO(key)" };
305
Harald Weltef6543322017-07-16 07:35:10 +0200306
307 type record L1ctlTrafficReq {
Vadim Yanitskiye01691d2018-10-29 00:18:04 +0700308 octetstring data
Harald Welte7024baa2018-03-02 23:37:51 +0100309 } with {
310 variant (data) "BYTEORDER(first)"
311 }
Harald Weltef6543322017-07-16 07:35:10 +0200312
Harald Welte00d4dac2017-07-30 00:50:32 +0200313
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700314 /* payload of L1CTL_GPRS_UL_TBF_CFG_REQ */
315 type record L1ctlGprsUlTbfCfgReq {
316 uint8_t tbf_ref,
317 BIT8 slotmask,
318 OCT2 pad ('0000'O)
319 } with { variant (slotmask) "BITORDER(msb)" };
320
321 /* payload of L1CTL_GPRS_DL_TBF_CFG_REQ */
322 type record L1ctlGprsDlTbfCfgReq {
323 uint8_t tbf_ref,
324 BIT8 slotmask,
325 uint8_t dl_tfi,
326 OCT1 pad ('00'O)
327 } with { variant (slotmask) "BITORDER(msb)" };
328
329 /* part of L1CTL_GPRS_{UL,DL}_BLOCK_{REQ,IND} */
330 type record L1ctlGprsBlockHdr {
331 uint32_t fn,
332 uint8_t tn,
333 OCT3 pad ('000000'O)
334 } with { variant "" };
335
336 /* payload of L1CTL_GPRS_UL_BLOCK_REQ */
337 type record L1ctlGprsUlBlockReq {
338 L1ctlGprsBlockHdr hdr,
339 octetstring data
340 } with { variant (data) "BYTEORDER(first)" };
341
342 /* payload of L1CTL_GPRS_DL_BLOCK_IND */
343 type record L1ctlGprsDlBlockInd {
344 L1ctlGprsBlockHdr hdr,
345 record {
346 uint16_t ber10k, /* Bit Error Rate */
347 int16_t ci_cb, /* C/I in centiBels */
348 uint8_t rx_level /* RxLev 0..63 */
349 } meas,
350 uint8_t usf,
351 octetstring data
352 } with { variant (data) "BYTEORDER(first)" };
353
Harald Welte00d4dac2017-07-30 00:50:32 +0200354
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700355 type union L1ctlMsgPayload {
Harald Weltef6543322017-07-16 07:35:10 +0200356 L1ctlFbsbReq fbsb_req,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700357 L1ctlFbsbConf fbsb_conf,
358 L1ctlDataInd data_ind,
Harald Weltef6543322017-07-16 07:35:10 +0200359 L1ctlRachReq rach_req,
Harald Weltef6543322017-07-16 07:35:10 +0200360 L1ctlDmEstReq dm_est_req,
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200361 L1ctlDataReq data_req,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700362 /* TODO: L1CTL_RESET_IND */
363 /* TODO: L1CTL_PM_REQ */
364 /* TODO: L1CTL_PM_CONF */
365 L1ctlReset reset_req,
366 L1ctlCcchModeReq ccch_mode_req,
367 L1ctlCcchModeConf ccch_mode_conf,
368 L1ctlParReq par_req,
369 /* TODO: L1CTL_DM_FREQ_REQ */
370 L1CtlCryptoReq crypto_req,
371 /* TODO: L1CTL_SIM_REQ */
372 /* TODO: L1CTL_SIM_CONF */
373 L1ctlTchModeReq tch_mode_req,
374 L1ctlTchModeConf tch_mode_conf,
375 /* TODO: L1CTL_NEIGH_PM_REQ */
376 /* TODO: L1CTL_NEIGH_PM_IND */
377 L1ctlTrafficReq traffic_req,
378 L1ctlTrafficReq traffic_ind,
379 /* TODO: L1CTL_BURST_IND */
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700380 L1ctlGprsUlTbfCfgReq ul_tbf_cfg_req,
381 L1ctlGprsDlTbfCfgReq dl_tbf_cfg_req,
382 L1ctlGprsUlBlockReq ul_block_req,
383 L1ctlGprsDlBlockInd dl_block_ind,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700384 L1ctlExtRachReq ext_rach_req,
Harald Weltef6543322017-07-16 07:35:10 +0200385 octetstring other
Harald Welte7024baa2018-03-02 23:37:51 +0100386 } with {
387 variant (other) "BYTEORDER(first)"
388 };
Harald Weltef6543322017-07-16 07:35:10 +0200389
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700390 type record L1ctlMessage {
Harald Weltef6543322017-07-16 07:35:10 +0200391 L1ctlHeader header,
392 L1ctlUlInfo ul_info optional,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700393 L1ctlDlInfo dl_info optional,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700394 L1ctlMsgPayload payload optional
Harald Weltef6543322017-07-16 07:35:10 +0200395 } with { variant (ul_info) "PRESENCE(header.msg_type = L1CTL_RACH_REQ,
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700396 header.msg_type = L1CTL_EXT_RACH_REQ,
Harald Weltef6543322017-07-16 07:35:10 +0200397 header.msg_type = L1CTL_PARAM_REQ,
398 header.msg_type = L1CTL_CRYPTO_REQ,
399 header.msg_type = L1CTL_DATA_REQ,
400 header.msg_type = L1CTL_DM_EST_REQ,
401 header.msg_type = L1CTL_DM_FREQ_REQ,
402 header.msg_type = L1CTL_DM_REL_REQ,
403 header.msg_type = L1CTL_TRAFFIC_REQ)"
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700404 variant (dl_info) "PRESENCE(header.msg_type = L1CTL_FBSB_CONF,
405 header.msg_type = L1CTL_RACH_CONF,
406 header.msg_type = L1CTL_DATA_IND,
407 header.msg_type = L1CTL_DATA_CONF,
408 header.msg_type = L1CTL_TRAFFIC_IND,
409 header.msg_type = L1CTL_TRAFFIC_CONF)"
Harald Weltef6543322017-07-16 07:35:10 +0200410 variant (payload) "CROSSTAG(fbsb_req, header.msg_type = L1CTL_FBSB_REQ;
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700411 fbsb_conf, header.msg_type = L1CTL_FBSB_CONF;
412 data_ind, header.msg_type = L1CTL_DATA_IND;
Harald Weltef6543322017-07-16 07:35:10 +0200413 rach_req, header.msg_type = L1CTL_RACH_REQ;
Harald Weltef6543322017-07-16 07:35:10 +0200414 dm_est_req, header.msg_type = L1CTL_DM_EST_REQ;
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200415 data_req, header.msg_type = L1CTL_DATA_REQ;
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700416 /* TODO: reset_ind, header.msg_type = L1CTL_RESET_IND */
417 /* TODO: pm_req, header.msg_type = L1CTL_PM_REQ */
418 /* TODO: pm_conf, header.msg_type = L1CTL_PM_CONF */
419 reset_req, header.msg_type = L1CTL_RESET_REQ;
420 ccch_mode_req, header.msg_type = L1CTL_CCCH_MODE_REQ;
421 ccch_mode_conf, header.msg_type = L1CTL_CCCH_MODE_CONF;
422 par_req, header.msg_type = L1CTL_PARAM_REQ;
423 /* TODO: freq_req, header.msg_type = L1CTL_DM_FREQ_REQ */
424 crypto_req, header.msg_type = L1CTL_CRYPTO_REQ;
425 /* TODO: sim_req, header.msg_type = L1CTL_SIM_REQ */
426 /* TODO: sim_conf, header.msg_type = L1CTL_SIM_CONF */
427 tch_mode_req, header.msg_type = L1CTL_TCH_MODE_REQ;
428 tch_mode_conf, header.msg_type = L1CTL_TCH_MODE_CONF;
429 /* TODO: neigh_pm_req, header.msg_type = L1CTL_NEIGH_PM_REQ */
430 /* TODO: neigh_pm_ind, header.msg_type = L1CTL_NEIGH_PM_IND */
431 traffic_req, header.msg_type = L1CTL_TRAFFIC_REQ;
432 traffic_ind, header.msg_type = L1CTL_TRAFFIC_IND;
433 /* TODO: burst_ind, header.msg_type = L1CTL_BURST_IND */
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700434 ul_tbf_cfg_req, header.msg_type = L1CTL_GPRS_UL_TBF_CFG_REQ;
435 dl_tbf_cfg_req, header.msg_type = L1CTL_GPRS_DL_TBF_CFG_REQ;
436 ul_block_req, header.msg_type = L1CTL_GPRS_UL_BLOCK_REQ;
437 dl_block_ind, header.msg_type = L1CTL_GPRS_DL_BLOCK_IND;
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700438 ext_rach_req, header.msg_type = L1CTL_EXT_RACH_REQ;
Harald Weltef6543322017-07-16 07:35:10 +0200439 other, OTHERWISE;
440 )" };
441
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700442 external function enc_L1ctlMessage(in L1ctlMessage msg) return octetstring
Harald Weltef6543322017-07-16 07:35:10 +0200443 with { extension "prototype(convert) encode(RAW)" };
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700444 external function dec_L1ctlMessage(in octetstring stream) return L1ctlMessage
Harald Weltef6543322017-07-16 07:35:10 +0200445 with { extension "prototype(convert) decode(RAW)" };
446
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700447 type record L1ctlMessageLV {
Harald Welte52c713c2017-07-16 15:44:44 +0200448 uint16_t len,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700449 L1ctlMessage msg
Harald Welte52c713c2017-07-16 15:44:44 +0200450 } with { variant (len) "LENGTHTO(msg)" };
451
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700452 external function enc_L1ctlMessageLV(in L1ctlMessageLV msg) return octetstring
Harald Welte52c713c2017-07-16 15:44:44 +0200453 with { extension "prototype(convert) encode(RAW)" };
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700454 external function dec_L1ctlMessageLV(in octetstring stream) return L1ctlMessageLV
Harald Welte52c713c2017-07-16 15:44:44 +0200455 with { extension "prototype(convert) decode(RAW)" };
456
457
Harald Welte9e4725d2017-07-16 23:18:09 +0200458
Harald Welte9e4725d2017-07-16 23:18:09 +0200459 /* for generating RESET_REQ */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700460 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700461 t_L1ctlResetReq(template (value) L1ctlResetType rst_type) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100462 header := ts_L1ctlHeader(L1CTL_RESET_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200463 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700464 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200465 payload := {
466 reset_req := {
467 reset_type := rst_type,
468 padding := '000000'O
469 }
470 }
471 };
472
473 /* for generating FBSB_REQ */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700474 template (value) L1ctlMessage
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700475 ts_L1CTL_FBSB_REQ(template (value) GsmBandArfcn arfcn,
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700476 template (value) L1ctlFbsbFlags flags,
477 template (value) uint8_t sync_info_idx,
478 template (value) L1ctlCcchMode ccch_mode,
479 template (value) GsmRxLev rxlev_exp) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100480 header := ts_L1ctlHeader(L1CTL_FBSB_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200481 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700482 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200483 payload := {
484 fbsb_req := {
485 arfcn := arfcn,
Harald Weltea82f7e62018-02-22 18:51:33 +0100486 timeout_tdma_frames := 250, /* about 1s */
Harald Welte9e4725d2017-07-16 23:18:09 +0200487 freq_err_thresh1 := 10000,
488 freq_err_thresh2 := 800,
489 num_freqerr_avg := 3,
490 flags := flags,
491 sync_info_idx := sync_info_idx,
492 ccch_mode := ccch_mode,
493 rxlev_exp := rxlev_exp
494 }
495 }
496 };
497
498 /* for matching against incoming FBSB_CONF */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700499 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700500 tr_L1CTL_FBSB_CONF(template (present) uint8_t result) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100501 header := tr_L1ctlHeader(L1CTL_FBSB_CONF),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700502 ul_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200503 dl_info := ?,
504 payload := {
505 fbsb_conf := {
506 initial_freq_err := ?,
507 result := result,
508 bsic := ?
509 }
510 }
511 };
512
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700513 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700514 ts_L1CTL_CCCH_MODE_REQ(template (value) L1ctlCcchMode ccch_mode) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100515 header := ts_L1ctlHeader(L1CTL_CCCH_MODE_REQ),
516 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700517 dl_info := omit,
Harald Weltef8df4cb2018-03-10 15:15:08 +0100518 payload := {
519 ccch_mode_req := {
520 ccch_mode := ccch_mode,
521 padding := '000000'O
522 }
523 }
524 };
525
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700526 template (value) L1ctlMessage
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700527 ts_L1CTL_TCH_MODE_REQ(template (value) L1ctlTchMode tch_mode := L1CTL_CHAN_MODE_SIGN,
Vadim Yanitskiy16185832020-10-19 21:20:43 +0700528 template (value) L1ctlAudioMode audio_mode := t_L1CTL_AudioModeFwd,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200529 template (value) L1ctlLoopMode loop_mode := L1CTL_LOOP_MODE_OPEN,
530 template (value) uint8_t amr_start_codec := 0,
531 template (value) BIT8 amr_codecs_bitmask := '00000000'B) := {
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700532 header := ts_L1ctlHeader(L1CTL_TCH_MODE_REQ),
533 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700534 dl_info := omit,
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700535 payload := {
536 tch_mode_req := {
537 tch_mode := tch_mode,
538 audio_mode := audio_mode,
539 loop_mode := loop_mode,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200540 amr := {
541 start_codec := amr_start_codec,
542 codecs_bitmask := amr_codecs_bitmask
543 }
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700544 }
545 }
546 };
547
Harald Welte3757e602018-03-10 17:12:02 +0100548
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700549 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700550 tr_L1CTL_MsgType(template (present) L1ctlMsgType msg_type) := {
Harald Welte3757e602018-03-10 17:12:02 +0100551 header := tr_L1ctlHeader(msg_type),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700552 ul_info := *,
Harald Welte3757e602018-03-10 17:12:02 +0100553 dl_info := *,
Harald Weltef56cc492018-04-15 10:58:43 +0200554 payload := *
Harald Welte3757e602018-03-10 17:12:02 +0100555 }
556
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700557 template L1ctlMessage tr_L1CTL_CCCH_MODE_CONF := tr_L1CTL_MsgType(L1CTL_CCCH_MODE_CONF);
Harald Weltef8df4cb2018-03-10 15:15:08 +0100558
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700559 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700560 ts_L1CTL_RACH_REQ(template (value) uint8_t ra,
561 template (value) uint8_t combined,
562 template (value) uint16_t offset,
563 template (value) RslChannelNr chan_nr := ts_RslChanNr_RACH(0),
564 template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0)) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100565 header := ts_L1ctlHeader(L1CTL_RACH_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200566 ul_info := {
Vadim Yanitskiye432ba92019-05-31 18:44:13 +0700567 chan_nr := chan_nr,
568 link_id := link_id,
Harald Welte9e4725d2017-07-16 23:18:09 +0200569 padding := '0000'O
570 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700571 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200572 payload := {
573 rach_req := {
574 ra := ra,
575 combined := combined,
576 offset := offset
577 }
578 }
579 }
580
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700581 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700582 ts_L1CTL_EXT_RACH_REQ(template (value) uint16_t ra11,
583 template (value) L1ctlRachSynchSeq seq,
584 template (value) uint8_t combined,
585 template (value) uint16_t offset) := {
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700586 header := ts_L1ctlHeader(L1CTL_EXT_RACH_REQ),
587 ul_info := {
588 /* FIXME: both RSL chan_nr and link_id should be configurable */
Vadim Yanitskiy443891b2022-03-12 17:46:57 +0300589 chan_nr := ts_RslChanNr_RACH(0),
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700590 link_id := ts_RslLinkID_DCCH(0),
591 padding := '0000'O
592 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700593 dl_info := omit,
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700594 payload := {
595 ext_rach_req := {
596 ra11 := ra11,
597 synch_seq := seq,
598 combined := combined,
599 offset := offset
600 }
601 }
602 }
603
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700604 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700605 ts_L1CTL_PAR_REQ(template (value) uint8_t ta,
606 template (value) uint8_t tx_power) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100607 header := ts_L1ctlHeader(L1CTL_PARAM_REQ),
Harald Welte37052732018-03-09 19:38:46 +0100608 ul_info := {
Vadim Yanitskiy443891b2022-03-12 17:46:57 +0300609 chan_nr := ts_RslChanNr_RACH(0),
Harald Welte37052732018-03-09 19:38:46 +0100610 link_id := ts_RslLinkID_DCCH(0),
611 padding := '0000'O
612 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700613 dl_info := omit,
Harald Welte37052732018-03-09 19:38:46 +0100614 payload := {
615 par_req := {
616 ta := ta,
617 tx_power := tx_power,
618 padding := '0000'O
619 }
620 }
621 }
622
Vadim Yanitskiy5afe8852020-05-27 14:40:51 +0700623 /* Base template to be inherited by ts_L1CTL_DM_EST_REQ_H0 and ts_L1CTL_DM_EST_REQ_H1 */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700624 private template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700625 ts_L1CTL_DM_EST_REQ(template (value) RslChannelNr chan_nr,
626 template (value) GsmTsc tsc) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100627 header := ts_L1ctlHeader(L1CTL_DM_EST_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200628 ul_info := {
629 chan_nr := chan_nr,
630 link_id := ts_RslLinkID_DCCH(0),
631 padding := '0000'O
632 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700633 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200634 payload := {
635 dm_est_req := {
636 tsc := tsc,
Vadim Yanitskiy0a3e31c2022-12-18 08:09:38 +0700637 h0h1 := -,
Vadim Yanitskiyfe052962020-10-19 13:27:09 +0700638 tch_mode := L1CTL_CHAN_MODE_SIGN,
Vadim Yanitskiy16185832020-10-19 21:20:43 +0700639 audio_mode := t_L1CTL_AudioModeFwd
Harald Welte9e4725d2017-07-16 23:18:09 +0200640 }
641 }
642 }
643
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700644 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700645 ts_L1CTL_DM_EST_REQ_H0(template (value) RslChannelNr chan_nr,
646 template (value) GsmTsc tsc,
647 template (value) GsmArfcn arfcn)
Vadim Yanitskiy5afe8852020-05-27 14:40:51 +0700648 modifies ts_L1CTL_DM_EST_REQ := {
649 payload := {
650 dm_est_req := {
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700651 h0h1 := {
652 h0 := {
653 h := 0,
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700654 arfcn := ts_GsmBandArfcn(arfcn),
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700655 padding := f_pad_oct(''O, 130, '00'O)
656 }
657 }
Vadim Yanitskiy5afe8852020-05-27 14:40:51 +0700658 }
659 }
660 }
661
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700662 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700663 ts_L1CTL_DM_EST_REQ_H1(template (value) RslChannelNr chan_nr,
664 template (value) GsmTsc tsc,
665 template (value) uint6_t hsn,
666 template (value) uint6_t maio,
667 template (value) L1ctlMA ma)
Vadim Yanitskiyeda90812020-05-27 14:51:18 +0700668 modifies ts_L1CTL_DM_EST_REQ := {
669 payload := {
670 dm_est_req := {
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700671 h0h1 := {
672 h1 := {
673 h := 1,
674 hsn := hsn,
675 maio := maio,
676 n := sizeof(ma),
677 spare := '00'O,
678 ma := ma,
679 /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562849 */
680 padding := f_pad_oct(''O, (64 - sizeof(ma)) * 2, '00'O)
681 }
Vadim Yanitskiyeda90812020-05-27 14:51:18 +0700682 }
683 }
684 }
685 }
686
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700687 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700688 ts_L1CTL_DM_REL_REQ(template (value) RslChannelNr chan_nr) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100689 header := ts_L1ctlHeader(L1CTL_DM_REL_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200690 ul_info := {
691 chan_nr := chan_nr,
692 link_id := ts_RslLinkID_DCCH(0),
693 padding := '0000'O
694 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700695 dl_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700696 payload := omit
Harald Welte9e4725d2017-07-16 23:18:09 +0200697 }
698
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700699 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700700 ts_L1CTL_DATA_REQ(template (value) RslChannelNr chan_nr,
701 template (value) RslLinkId link_id,
702 octetstring l2_data) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100703 header := ts_L1ctlHeader(L1CTL_DATA_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200704 ul_info := {
705 chan_nr := chan_nr,
706 link_id := link_id,
707 padding := '0000'O
708 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700709 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200710 payload := {
Vadim Yanitskiy0a8d6da2019-05-28 22:18:28 +0700711 data_req := {
712 l1header := omit,
713 l2_payload := l2_data
714 }
Harald Welte9e4725d2017-07-16 23:18:09 +0200715 }
716 }
717
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700718 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700719 ts_L1CTL_DATA_REQ_SACCH(template (value) RslChannelNr chan_nr,
720 template (value) RslLinkId link_id,
721 template (value) SacchL1Header l1h,
722 octetstring l2_data) := {
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200723 header := ts_L1ctlHeader(L1CTL_DATA_REQ),
724 ul_info := {
725 chan_nr := chan_nr,
726 link_id := link_id,
727 padding := '0000'O
728 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700729 dl_info := omit,
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200730 payload := {
Vadim Yanitskiy0a8d6da2019-05-28 22:18:28 +0700731 data_req := {
732 l1header := l1h,
733 l2_payload := l2_data
734 }
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200735 }
736 }
737
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700738 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700739 ts_L1CTL_TRAFFIC_REQ(template (value) RslChannelNr chan_nr,
740 template (value) RslLinkId link_id,
741 octetstring frame) := {
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700742 header := ts_L1ctlHeader(L1CTL_TRAFFIC_REQ),
743 ul_info := {
744 chan_nr := chan_nr,
745 link_id := link_id,
746 padding := '0000'O
747 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700748 dl_info := omit,
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700749 payload := {
750 traffic_req := {
751 data := frame
752 }
753 }
754 };
755
Harald Welte9e4725d2017-07-16 23:18:09 +0200756 /* for matching against incoming RACH_CONF */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700757 template L1ctlMessage tr_L1CTL_RACH_CONF := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100758 header := tr_L1ctlHeader(L1CTL_RACH_CONF),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700759 ul_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200760 dl_info := ?,
Harald Weltef56cc492018-04-15 10:58:43 +0200761 payload := *
Harald Welte9e4725d2017-07-16 23:18:09 +0200762 };
763
Vadim Yanitskiy60b61882022-12-18 06:02:22 +0700764 /* for sending and matching L1CTL_DATA_IND */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700765 template (value) L1ctlMessage
Vadim Yanitskiy60b61882022-12-18 06:02:22 +0700766 ts_L1CTL_DATA_IND(template (value) RslChannelNr chan_nr,
767 template (value) RslLinkId link_id,
768 template (value) octetstring l2_data,
769 template (value) GsmBandArfcn arfcn,
770 template (value) uint32_t fn := 1337,
771 template (value) GsmRxLev rx_level := 63,
772 template (value) uint8_t num_biterr := 0,
773 template (value) uint8_t fire_crc := 0) := {
774 header := ts_L1ctlHeader(L1CTL_DATA_IND),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700775 ul_info := omit,
Vadim Yanitskiy60b61882022-12-18 06:02:22 +0700776 dl_info := {
777 chan_nr := chan_nr,
778 link_id := link_id,
779 arfcn := arfcn,
780 frame_nr := fn,
781 rx_level := rx_level,
782 snr := 0,
783 num_biterr := num_biterr,
784 fire_crc := fire_crc
785 },
786 payload := {
787 data_ind := {
788 payload := l2_data
789 }
790 }
791 };
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700792 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700793 tr_L1CTL_DATA_IND(template (present) RslChannelNr chan_nr,
794 template (present) RslLinkId link_id := ?,
795 template (present) octetstring l2_data := ?,
796 template (present) uint8_t num_biterr := 0,
797 template (present) uint8_t fire_crc := 0) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100798 header := tr_L1ctlHeader(L1CTL_DATA_IND),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700799 ul_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200800 dl_info := {
801 chan_nr := chan_nr,
Harald Weltece6dc442018-02-21 22:00:21 +0100802 link_id := link_id,
Harald Welte9e4725d2017-07-16 23:18:09 +0200803 arfcn := ?,
804 frame_nr := ?,
805 rx_level := ?,
806 snr := ?,
Harald Welte629cc6b2018-03-11 17:19:05 +0100807 num_biterr := num_biterr,
Pau Espin Pedrol17da3232022-09-02 16:35:32 +0200808 fire_crc := fire_crc
Harald Welte9e4725d2017-07-16 23:18:09 +0200809 },
810 payload := {
Harald Welte68e495b2018-02-25 00:05:57 +0100811 data_ind := {
812 payload := l2_data
813 }
Harald Welte9e4725d2017-07-16 23:18:09 +0200814 }
815 };
816
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700817 /* for matching against incoming TRAFFIC_IND */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700818 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700819 tr_L1CTL_TRAFFIC_IND(template (present) RslChannelNr chan_nr,
820 template (present) RslLinkId link_id := ?,
821 template (present) octetstring frame := ?,
822 template (present) uint8_t num_biterr := ?,
823 template (present) uint8_t fire_crc := ?) := {
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700824 header := tr_L1ctlHeader(L1CTL_TRAFFIC_IND),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700825 ul_info := omit,
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700826 dl_info := {
827 chan_nr := chan_nr,
828 link_id := link_id,
829 arfcn := ?,
830 frame_nr := ?,
831 rx_level := ?,
832 snr := ?,
833 num_biterr := num_biterr,
834 fire_crc := fire_crc
835 },
836 payload := {
837 traffic_ind := {
838 data := frame
839 }
840 }
841 };
842
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700843 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700844 ts_L1CTL_CRYPTO_REQ(template (value) RslChannelNr chan_nr,
845 template (value) uint8_t algo,
846 template (value) octetstring key) := {
Harald Weltee613f962018-04-18 22:38:16 +0200847 header := ts_L1ctlHeader(L1CTL_CRYPTO_REQ),
848 ul_info := {
849 chan_nr := chan_nr,
850 link_id := ts_RslLinkID_DCCH(0),
851 padding := '0000'O
852 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700853 dl_info := omit,
Harald Weltee613f962018-04-18 22:38:16 +0200854 payload := {
855 crypto_req := {
856 algo := algo,
857 key_len := 0, /* overwritten */
858 key := key
859 }
860 }
861 };
862
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700863
864 template (value) L1ctlMessage
865 ts_L1CTL_GPRS_UL_TBF_CFG_REQ(template (value) uint8_t tbf_ref,
866 template (value) BIT8 slotmask := '00000000'B) := {
867 header := ts_L1ctlHeader(L1CTL_GPRS_UL_TBF_CFG_REQ),
868 ul_info := omit,
869 dl_info := omit,
870 payload := {
871 ul_tbf_cfg_req := {
872 tbf_ref := tbf_ref,
873 slotmask := slotmask,
874 pad := '0000'O
875 }
876 }
877 };
878 template L1ctlMessage
879 tr_L1CTL_GPRS_UL_TBF_CFG_REQ(template (present) uint8_t tbf_ref := ?,
880 template (present) BIT8 slotmask := ?) := {
881 header := tr_L1ctlHeader(L1CTL_GPRS_UL_TBF_CFG_REQ),
882 ul_info := omit,
883 dl_info := omit,
884 payload := {
885 ul_tbf_cfg_req := {
886 tbf_ref := tbf_ref,
887 slotmask := slotmask,
888 pad := ?
889 }
890 }
891 };
892
893 template (value) L1ctlMessage
894 ts_L1CTL_GPRS_DL_TBF_CFG_REQ(template (value) uint8_t tbf_ref,
895 template (value) BIT8 slotmask := '00000000'B,
896 template (value) uint5_t dl_tfi := 0) := {
897 header := ts_L1ctlHeader(L1CTL_GPRS_DL_TBF_CFG_REQ),
898 ul_info := omit,
899 dl_info := omit,
900 payload := {
901 dl_tbf_cfg_req := {
902 tbf_ref := tbf_ref,
903 slotmask := slotmask,
904 dl_tfi := dl_tfi,
905 pad := '00'O
906 }
907 }
908 };
909 template L1ctlMessage
910 tr_L1CTL_GPRS_DL_TBF_CFG_REQ(template (present) uint8_t tbf_ref := ?,
911 template (present) BIT8 slotmask := ?,
912 template (present) uint5_t dl_tfi := ?) := {
913 header := tr_L1ctlHeader(L1CTL_GPRS_DL_TBF_CFG_REQ),
914 ul_info := omit,
915 dl_info := omit,
916 payload := {
917 dl_tbf_cfg_req := {
918 tbf_ref := tbf_ref,
919 slotmask := slotmask,
920 dl_tfi := dl_tfi,
921 pad := ?
922 }
923 }
924 };
925
926 template (value) L1ctlMessage
927 ts_L1CTL_GPRS_UL_BLOCK_REQ(template (value) GsmFrameNumber fn,
928 template (value) uint3_t tn,
929 template (value) octetstring data) := {
930 header := ts_L1ctlHeader(L1CTL_GPRS_UL_BLOCK_REQ),
931 ul_info := omit,
932 dl_info := omit,
933 payload := {
934 ul_block_req := {
935 hdr := {
936 fn := fn,
937 tn := tn,
938 pad := '000000'O
939 },
940 data := data
941 }
942 }
943 };
944 template L1ctlMessage
945 tr_L1CTL_GPRS_UL_BLOCK_REQ(template (present) GsmFrameNumber fn := ?,
946 template (present) uint3_t tn := ?,
947 template (present) octetstring data := ?) := {
948 header := tr_L1ctlHeader(L1CTL_GPRS_UL_BLOCK_REQ),
949 ul_info := omit,
950 dl_info := omit,
951 payload := {
952 ul_block_req := {
953 hdr := {
954 fn := fn,
955 tn := tn,
956 pad := ?
957 },
958 data := data
959 }
960 }
961 };
962
963 template (value) L1ctlMessage
964 ts_L1CTL_GPRS_DL_BLOCK_IND(template (value) GsmFrameNumber fn,
965 template (value) uint3_t tn,
966 template (value) uint3_t usf,
967 template (value) octetstring data,
968 template (value) uint16_t ber10k := 0,
969 template (value) int16_t ci_cb := 180 /* 18 dB */,
970 template (value) GsmRxLev rx_level := 63) := {
971 header := ts_L1ctlHeader(L1CTL_GPRS_DL_BLOCK_IND),
972 ul_info := omit,
973 dl_info := omit,
974 payload := {
975 dl_block_ind := {
976 hdr := {
977 fn := fn,
978 tn := tn,
979 pad := '000000'O
980 },
981 meas := {
982 ber10k := ber10k,
983 ci_cb := ci_cb,
984 rx_level := rx_level
985 },
986 usf := usf,
987 data := data
988 }
989 }
990 };
991 template L1ctlMessage
992 tr_L1CTL_GPRS_DL_BLOCK_IND(template (present) GsmFrameNumber fn := ?,
993 template (present) uint3_t tn := ?,
994 template (present) uint3_t usf := ?,
995 template (present) octetstring data := ?,
996 template (present) uint16_t ber10k := ?,
997 template (present) int16_t ci_cb := ?,
998 template (present) GsmRxLev rx_level := ?) := {
999 header := tr_L1ctlHeader(L1CTL_GPRS_DL_BLOCK_IND),
1000 ul_info := omit,
1001 dl_info := omit,
1002 payload := {
1003 dl_block_ind := {
1004 hdr := {
1005 fn := fn,
1006 tn := tn,
1007 pad := ?
1008 },
1009 meas := {
1010 ber10k := ber10k,
1011 ci_cb := ci_cb,
1012 rx_level := rx_level
1013 },
1014 usf := usf,
1015 data := data
1016 }
1017 }
1018 };
1019
Harald Welte68e495b2018-02-25 00:05:57 +01001020 const octetstring c_DummyUI := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O;
1021
Harald Welte7024baa2018-03-02 23:37:51 +01001022/* We use "BYTEORDER(last)" so we get little-endian integers. Unfortuantely, this also
1023 switches the byte ordering in octet strings, so we need to explicitly annotate them :/ */
Harald Weltef6543322017-07-16 07:35:10 +02001024} with { encode "RAW" };