blob: 2e1f34bf9d000947543bc3dabeb4d7ebe415e91a [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,
Vadim Yanitskiy9f40dc52023-12-15 13:55:59 +070056 L1CTL_EXT_RACH_REQ,
57 L1CTL_GPRS_RTS_IND
Harald Weltef6543322017-07-16 07:35:10 +020058 } with { variant "FIELDLENGTH(8)" };
59
60 type enumerated L1ctlCcchMode {
61 CCCH_MODE_NONE (0),
62 CCCH_MODE_NON_COMBINED,
Harald Welte990a3612019-05-27 14:02:13 +020063 CCCH_MODE_COMBINED,
64 CCCH_MODE_COMBINED_CBCH
Harald Weltef6543322017-07-16 07:35:10 +020065 } with { variant "FIELDLENGTH(8)" };
66
67 type enumerated L1ctlNeighMode {
68 NEIGH_MODE_NONE (0),
69 NEIGH_MODE_PM,
70 NEIGH_MODE_SB
71 } with { variant "FIELDLENGTH(8)" };
72
73 type enumerated L1ctlResetType {
74 L1CTL_RES_T_BOOT (0),
75 L1CTL_RES_T_FULL,
76 L1CTL_RES_T_SCHED
77 } with { variant "FIELDLENGTH(8)" };
78
Harald Weltef6543322017-07-16 07:35:10 +020079 type record L1ctlHdrFlags {
80 BIT7 padding,
81 boolean f_done
82 } with { variant "" };
83
84 type record L1ctlHeader {
85 L1ctlMsgType msg_type,
86 L1ctlHdrFlags flags,
87 OCT2 padding
88 } with { variant "" };
89
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +070090 template L1ctlHeader
91 tr_L1ctlHeader(template (present) L1ctlMsgType msg_type) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +010092 msg_type := msg_type,
93 flags := ?,
94 padding := ?
95 };
96
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +070097 template (value) L1ctlHeader
98 ts_L1ctlHeader(template (value) L1ctlMsgType msg_type) := {
Harald Welte52c713c2017-07-16 15:44:44 +020099 msg_type := msg_type,
100 flags := { padding := '0000000'B, f_done := false },
101 padding := '0000'O
102 };
103
Harald Weltef6543322017-07-16 07:35:10 +0200104 type record L1ctlDlInfo {
Harald Welte8e4db2c2017-07-16 18:54:55 +0200105 RslChannelNr chan_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200106 RslLinkId link_id,
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700107 GsmBandArfcn arfcn,
Harald Welte5f0d5c82017-07-16 18:56:01 +0200108 uint32_t frame_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200109 GsmRxLev rx_level,
110 uint8_t snr,
111 uint8_t num_biterr,
112 uint8_t fire_crc
113 } with { variant "" };
114
115 type record L1ctlFbsbConf {
116 int16_t initial_freq_err,
117 uint8_t result,
118 uint8_t bsic
119 } with { variant "" };
120
121 type record L1ctlCcchModeConf {
122 L1ctlCcchMode ccch_mode,
123 OCT3 padding
124 } with { variant "" };
125
126 /* gsm48_chan_mode */
Vadim Yanitskiyfe052962020-10-19 13:27:09 +0700127 type enumerated L1ctlTchMode {
128 L1CTL_CHAN_MODE_SIGN ('00000000'B), /* Signalling */
129 L1CTL_CHAN_MODE_SPEECH_V1 ('00000001'B), /* FR or HR codec */
130 L1CTL_CHAN_MODE_SPEECH_V2 ('00100001'B), /* EFR codec */
Vadim Yanitskiy8fd78f72023-05-26 19:21:55 +0700131 L1CTL_CHAN_MODE_SPEECH_V3 ('01000001'B), /* AMR codec */
132 L1CTL_CHAN_MODE_DATA_14k5 ('00001111'B), /* CSD: TCH/F14.4 */
133 L1CTL_CHAN_MODE_DATA_12k0 ('00000011'B), /* CSD: TCH/F9.6 */
134 L1CTL_CHAN_MODE_DATA_6k0 ('00001011'B), /* CSD: TCH/{FH}4.8 */
135 L1CTL_CHAN_MODE_DATA_3k6 ('00010011'B) /* CSD: TCH/{FH}2.4 */
Vadim Yanitskiyfe052962020-10-19 13:27:09 +0700136 } with { variant "FIELDLENGTH(8)" };
Harald Weltef6543322017-07-16 07:35:10 +0200137
Vadim Yanitskiy7ce605f2020-10-19 16:04:38 +0700138 type enumerated L1ctlLoopMode {
139 L1CTL_LOOP_MODE_OPEN ('00000000'B),
140 L1CTL_LOOP_MODE_A ('00000001'B),
141 L1CTL_LOOP_MODE_B ('00000010'B),
142 L1CTL_LOOP_MODE_C ('00000011'B),
143 L1CTL_LOOP_MODE_D ('00000100'B),
144 L1CTL_LOOP_MODE_E ('00000101'B),
145 L1CTL_LOOP_MODE_F ('00000110'B),
146 L1CTL_LOOP_MODE_I ('00000111'B)
147 } with { variant "FIELDLENGTH(8)" };
148
Harald Weltef6543322017-07-16 07:35:10 +0200149 type record L1ctlAudioMode {
150 BIT4 padding,
151 boolean tx_microphone,
152 boolean tx_traffic_req,
153 boolean rx_speaker,
154 boolean rx_traffic_ind
155 } with { variant "" };
156
Harald Weltef8df4cb2018-03-10 15:15:08 +0100157 template (value) L1ctlAudioMode t_L1CTL_AudioModeNone := { '0000'B, false, false, false, false };
Harald Welte66110f02017-07-16 21:05:18 +0200158
Vadim Yanitskiy16185832020-10-19 21:20:43 +0700159 /* Traffic forwarding mode (see TRAFFIC.{req,cnf,ind} messages) */
160 template (value) L1ctlAudioMode t_L1CTL_AudioModeFwd
161 modifies t_L1CTL_AudioModeNone := {
162 tx_traffic_req := true,
163 rx_traffic_ind := true
164 };
165
Harald Weltef6543322017-07-16 07:35:10 +0200166 type record L1ctlTchModeConf {
167 L1ctlTchMode tch_mode,
168 L1ctlAudioMode audio_mode,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200169 record {
170 uint8_t start_codec,
171 BIT8 codecs_bitmask
172 } amr
Harald Weltef6543322017-07-16 07:35:10 +0200173 } with { variant "" };
174
175 type record L1ctlDataInd {
Vadim Yanitskiy2a92e2a2019-05-28 21:13:35 +0700176 octetstring payload
Harald Welte7024baa2018-03-02 23:37:51 +0100177 } with {
178 variant (payload) "BYTEORDER(first)"
179 };
Harald Weltef6543322017-07-16 07:35:10 +0200180
Harald Weltef6543322017-07-16 07:35:10 +0200181
182 type record L1ctlUlInfo {
Harald Welte8e4db2c2017-07-16 18:54:55 +0200183 RslChannelNr chan_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200184 RslLinkId link_id,
185 OCT2 padding
186 } with { variant "" };
187
188 type record L1ctlFbsbFlags {
189 BIT5 padding,
190 boolean sb,
191 boolean fb1,
192 boolean fb0
Harald Welte344c0cf2018-03-09 16:17:45 +0100193 } with { variant "FIELDORDER(msb)" };
Harald Weltef6543322017-07-16 07:35:10 +0200194
Harald Weltef8df4cb2018-03-10 15:15:08 +0100195 template (value) L1ctlFbsbFlags t_L1CTL_FBSB_F_ALL := {
Harald Welte66110f02017-07-16 21:05:18 +0200196 padding := '00000'B,
197 sb := true,
198 fb1 := true,
199 fb0 := true
200 };
201
Harald Weltef6543322017-07-16 07:35:10 +0200202 type record L1ctlFbsbReq {
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700203 GsmBandArfcn arfcn,
Harald Weltef6543322017-07-16 07:35:10 +0200204 uint16_t timeout_tdma_frames,
205 uint16_t freq_err_thresh1,
206 uint16_t freq_err_thresh2,
207 uint8_t num_freqerr_avg,
208 L1ctlFbsbFlags flags,
209 uint8_t sync_info_idx,
210 L1ctlCcchMode ccch_mode,
211 GsmRxLev rxlev_exp
212 } with { variant "" };
213
214 type record L1ctlCcchModeReq {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100215 L1ctlCcchMode ccch_mode,
216 OCT3 padding
Harald Weltef6543322017-07-16 07:35:10 +0200217 } with { variant "" };
218
219 type record L1ctlTchModeReq {
220 L1ctlTchMode tch_mode,
221 L1ctlAudioMode audio_mode,
Vadim Yanitskiy7ce605f2020-10-19 16:04:38 +0700222 L1ctlLoopMode loop_mode,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200223 record {
224 uint8_t start_codec,
225 BIT8 codecs_bitmask
226 } amr
Harald Weltef6543322017-07-16 07:35:10 +0200227 } with { variant "" };
228
229 type record L1ctlRachReq {
230 uint8_t ra,
231 uint8_t combined,
232 uint16_t offset
233 } with { variant "" };
234
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700235 type enumerated L1ctlRachSynchSeq {
236 RACH_SYNCH_SEQ_TS0 (0),
237 RACH_SYNCH_SEQ_TS1,
238 RACH_SYNCH_SEQ_TS2
239 } with { variant "FIELDLENGTH(8)" };
240
241 type record L1ctlExtRachReq {
242 uint16_t ra11,
243 L1ctlRachSynchSeq synch_seq,
244 uint8_t combined,
245 uint16_t offset
246 } with { variant "" };
247
Harald Weltef6543322017-07-16 07:35:10 +0200248 type record L1ctlParReq {
249 int8_t ta,
250 uint8_t tx_power,
251 OCT2 padding
252 } with { variant "" };
253
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200254 type record L1ctlDataReq {
255 SacchL1Header l1header optional,
256 octetstring l2_payload
257 } with { variant "" };
258
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700259 type record L1ctlH0 {
260 uint8_t h,
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700261 GsmBandArfcn arfcn,
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700262 octetstring padding length(130)
263 } with { variant "" };
264
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700265 type record length(0..64) of GsmBandArfcn L1ctlMA;
Harald Weltef6543322017-07-16 07:35:10 +0200266 type record L1ctlH1 {
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700267 uint8_t h,
Harald Weltef6543322017-07-16 07:35:10 +0200268 uint8_t hsn,
269 uint8_t maio,
270 uint8_t n,
Vadim Yanitskiye8ea3ee2020-05-27 13:29:48 +0700271 OCT1 spare,
272 L1ctlMA ma,
273 octetstring padding
274 } with {
275 variant (n) "LENGTHTO(ma)"
276 variant (n) "UNIT(elements)"
277 /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562849.
278 * TL;DR The reference point of the PADDING attribute is the beginning
279 * of the message, not the beginning of the type/field it's applied on.
280 * Therefore we cannot use it here, and have to add padding manually.
281 * variant (ma) "PADDING(128)" */
282 };
Harald Weltef6543322017-07-16 07:35:10 +0200283
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700284 type union L1ctlH0H1 {
285 L1ctlH0 h0,
286 L1ctlH1 h1
287 } with { variant "TAG(h0, h = 0; h1, h = 1)" };
288
Harald Weltef6543322017-07-16 07:35:10 +0200289 type record L1ctlDmEstReq {
290 GsmTsc tsc,
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700291 L1ctlH0H1 h0h1,
Harald Weltef6543322017-07-16 07:35:10 +0200292 L1ctlTchMode tch_mode,
293 L1ctlAudioMode audio_mode
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700294 } with { variant "" };
Harald Weltef6543322017-07-16 07:35:10 +0200295
296 type record L1ctlReset {
297 L1ctlResetType reset_type,
298 OCT3 padding
299 } with { variant "" };
300
Harald Weltee613f962018-04-18 22:38:16 +0200301 type record L1CtlCryptoReq {
302 uint8_t algo,
303 uint8_t key_len,
304 octetstring key
305 } with { variant (key_len) "LENGTHTO(key)" };
306
Harald Weltef6543322017-07-16 07:35:10 +0200307
308 type record L1ctlTrafficReq {
Vadim Yanitskiye01691d2018-10-29 00:18:04 +0700309 octetstring data
Harald Welte7024baa2018-03-02 23:37:51 +0100310 } with {
311 variant (data) "BYTEORDER(first)"
312 }
Harald Weltef6543322017-07-16 07:35:10 +0200313
Harald Welte00d4dac2017-07-30 00:50:32 +0200314
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700315 /* payload of L1CTL_GPRS_UL_TBF_CFG_REQ */
316 type record L1ctlGprsUlTbfCfgReq {
317 uint8_t tbf_ref,
318 BIT8 slotmask,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700319 OCT2 pad ('0000'O),
320 uint32_t start_fn /* TBF Starting Time (absolute Fn) */
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700321 } with { variant (slotmask) "BITORDER(msb)" };
322
323 /* payload of L1CTL_GPRS_DL_TBF_CFG_REQ */
324 type record L1ctlGprsDlTbfCfgReq {
325 uint8_t tbf_ref,
326 BIT8 slotmask,
327 uint8_t dl_tfi,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700328 OCT1 pad ('00'O),
329 uint32_t start_fn /* TBF Starting Time (absolute Fn) */
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700330 } with { variant (slotmask) "BITORDER(msb)" };
331
332 /* part of L1CTL_GPRS_{UL,DL}_BLOCK_{REQ,IND} */
333 type record L1ctlGprsBlockHdr {
334 uint32_t fn,
335 uint8_t tn,
336 OCT3 pad ('000000'O)
337 } with { variant "" };
338
339 /* payload of L1CTL_GPRS_UL_BLOCK_REQ */
340 type record L1ctlGprsUlBlockReq {
341 L1ctlGprsBlockHdr hdr,
342 octetstring data
343 } with { variant (data) "BYTEORDER(first)" };
344
345 /* payload of L1CTL_GPRS_DL_BLOCK_IND */
346 type record L1ctlGprsDlBlockInd {
347 L1ctlGprsBlockHdr hdr,
348 record {
349 uint16_t ber10k, /* Bit Error Rate */
350 int16_t ci_cb, /* C/I in centiBels */
351 uint8_t rx_level /* RxLev 0..63 */
352 } meas,
353 uint8_t usf,
354 octetstring data
355 } with { variant (data) "BYTEORDER(first)" };
356
Vadim Yanitskiy9f40dc52023-12-15 13:55:59 +0700357 /* payload of L1CTL_GPRS_RTS_IND */
358 type record L1ctlGprsRtsInd {
359 uint32_t fn,
360 uint8_t tn,
361 uint8_t usf
362 } with { variant "" };
363
Harald Welte00d4dac2017-07-30 00:50:32 +0200364
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700365 type union L1ctlMsgPayload {
Harald Weltef6543322017-07-16 07:35:10 +0200366 L1ctlFbsbReq fbsb_req,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700367 L1ctlFbsbConf fbsb_conf,
368 L1ctlDataInd data_ind,
Harald Weltef6543322017-07-16 07:35:10 +0200369 L1ctlRachReq rach_req,
Harald Weltef6543322017-07-16 07:35:10 +0200370 L1ctlDmEstReq dm_est_req,
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200371 L1ctlDataReq data_req,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700372 /* TODO: L1CTL_RESET_IND */
373 /* TODO: L1CTL_PM_REQ */
374 /* TODO: L1CTL_PM_CONF */
375 L1ctlReset reset_req,
376 L1ctlCcchModeReq ccch_mode_req,
377 L1ctlCcchModeConf ccch_mode_conf,
378 L1ctlParReq par_req,
379 /* TODO: L1CTL_DM_FREQ_REQ */
380 L1CtlCryptoReq crypto_req,
381 /* TODO: L1CTL_SIM_REQ */
382 /* TODO: L1CTL_SIM_CONF */
383 L1ctlTchModeReq tch_mode_req,
384 L1ctlTchModeConf tch_mode_conf,
385 /* TODO: L1CTL_NEIGH_PM_REQ */
386 /* TODO: L1CTL_NEIGH_PM_IND */
387 L1ctlTrafficReq traffic_req,
388 L1ctlTrafficReq traffic_ind,
389 /* TODO: L1CTL_BURST_IND */
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700390 L1ctlGprsUlTbfCfgReq ul_tbf_cfg_req,
391 L1ctlGprsDlTbfCfgReq dl_tbf_cfg_req,
392 L1ctlGprsUlBlockReq ul_block_req,
393 L1ctlGprsDlBlockInd dl_block_ind,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700394 L1ctlExtRachReq ext_rach_req,
Vadim Yanitskiy9f40dc52023-12-15 13:55:59 +0700395 L1ctlGprsRtsInd rts_ind,
Harald Weltef6543322017-07-16 07:35:10 +0200396 octetstring other
Harald Welte7024baa2018-03-02 23:37:51 +0100397 } with {
398 variant (other) "BYTEORDER(first)"
399 };
Harald Weltef6543322017-07-16 07:35:10 +0200400
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700401 type record L1ctlMessage {
Harald Weltef6543322017-07-16 07:35:10 +0200402 L1ctlHeader header,
403 L1ctlUlInfo ul_info optional,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700404 L1ctlDlInfo dl_info optional,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700405 L1ctlMsgPayload payload optional
Harald Weltef6543322017-07-16 07:35:10 +0200406 } with { variant (ul_info) "PRESENCE(header.msg_type = L1CTL_RACH_REQ,
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700407 header.msg_type = L1CTL_EXT_RACH_REQ,
Harald Weltef6543322017-07-16 07:35:10 +0200408 header.msg_type = L1CTL_PARAM_REQ,
409 header.msg_type = L1CTL_CRYPTO_REQ,
410 header.msg_type = L1CTL_DATA_REQ,
411 header.msg_type = L1CTL_DM_EST_REQ,
412 header.msg_type = L1CTL_DM_FREQ_REQ,
413 header.msg_type = L1CTL_DM_REL_REQ,
414 header.msg_type = L1CTL_TRAFFIC_REQ)"
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700415 variant (dl_info) "PRESENCE(header.msg_type = L1CTL_FBSB_CONF,
416 header.msg_type = L1CTL_RACH_CONF,
417 header.msg_type = L1CTL_DATA_IND,
418 header.msg_type = L1CTL_DATA_CONF,
419 header.msg_type = L1CTL_TRAFFIC_IND,
420 header.msg_type = L1CTL_TRAFFIC_CONF)"
Harald Weltef6543322017-07-16 07:35:10 +0200421 variant (payload) "CROSSTAG(fbsb_req, header.msg_type = L1CTL_FBSB_REQ;
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700422 fbsb_conf, header.msg_type = L1CTL_FBSB_CONF;
423 data_ind, header.msg_type = L1CTL_DATA_IND;
Harald Weltef6543322017-07-16 07:35:10 +0200424 rach_req, header.msg_type = L1CTL_RACH_REQ;
Harald Weltef6543322017-07-16 07:35:10 +0200425 dm_est_req, header.msg_type = L1CTL_DM_EST_REQ;
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200426 data_req, header.msg_type = L1CTL_DATA_REQ;
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700427 /* TODO: reset_ind, header.msg_type = L1CTL_RESET_IND */
428 /* TODO: pm_req, header.msg_type = L1CTL_PM_REQ */
429 /* TODO: pm_conf, header.msg_type = L1CTL_PM_CONF */
430 reset_req, header.msg_type = L1CTL_RESET_REQ;
431 ccch_mode_req, header.msg_type = L1CTL_CCCH_MODE_REQ;
432 ccch_mode_conf, header.msg_type = L1CTL_CCCH_MODE_CONF;
433 par_req, header.msg_type = L1CTL_PARAM_REQ;
434 /* TODO: freq_req, header.msg_type = L1CTL_DM_FREQ_REQ */
435 crypto_req, header.msg_type = L1CTL_CRYPTO_REQ;
436 /* TODO: sim_req, header.msg_type = L1CTL_SIM_REQ */
437 /* TODO: sim_conf, header.msg_type = L1CTL_SIM_CONF */
438 tch_mode_req, header.msg_type = L1CTL_TCH_MODE_REQ;
439 tch_mode_conf, header.msg_type = L1CTL_TCH_MODE_CONF;
440 /* TODO: neigh_pm_req, header.msg_type = L1CTL_NEIGH_PM_REQ */
441 /* TODO: neigh_pm_ind, header.msg_type = L1CTL_NEIGH_PM_IND */
442 traffic_req, header.msg_type = L1CTL_TRAFFIC_REQ;
443 traffic_ind, header.msg_type = L1CTL_TRAFFIC_IND;
444 /* TODO: burst_ind, header.msg_type = L1CTL_BURST_IND */
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700445 ul_tbf_cfg_req, header.msg_type = L1CTL_GPRS_UL_TBF_CFG_REQ;
446 dl_tbf_cfg_req, header.msg_type = L1CTL_GPRS_DL_TBF_CFG_REQ;
447 ul_block_req, header.msg_type = L1CTL_GPRS_UL_BLOCK_REQ;
448 dl_block_ind, header.msg_type = L1CTL_GPRS_DL_BLOCK_IND;
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700449 ext_rach_req, header.msg_type = L1CTL_EXT_RACH_REQ;
Vadim Yanitskiy9f40dc52023-12-15 13:55:59 +0700450 rts_ind, header.msg_type = L1CTL_GPRS_RTS_IND;
Harald Weltef6543322017-07-16 07:35:10 +0200451 other, OTHERWISE;
452 )" };
453
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700454 external function enc_L1ctlMessage(in L1ctlMessage msg) return octetstring
Harald Weltef6543322017-07-16 07:35:10 +0200455 with { extension "prototype(convert) encode(RAW)" };
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700456 external function dec_L1ctlMessage(in octetstring stream) return L1ctlMessage
Harald Weltef6543322017-07-16 07:35:10 +0200457 with { extension "prototype(convert) decode(RAW)" };
458
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700459 type record L1ctlMessageLV {
Harald Welte52c713c2017-07-16 15:44:44 +0200460 uint16_t len,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700461 L1ctlMessage msg
Harald Welte52c713c2017-07-16 15:44:44 +0200462 } with { variant (len) "LENGTHTO(msg)" };
463
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700464 external function enc_L1ctlMessageLV(in L1ctlMessageLV msg) return octetstring
Harald Welte52c713c2017-07-16 15:44:44 +0200465 with { extension "prototype(convert) encode(RAW)" };
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700466 external function dec_L1ctlMessageLV(in octetstring stream) return L1ctlMessageLV
Harald Welte52c713c2017-07-16 15:44:44 +0200467 with { extension "prototype(convert) decode(RAW)" };
468
469
Harald Welte9e4725d2017-07-16 23:18:09 +0200470
Harald Welte9e4725d2017-07-16 23:18:09 +0200471 /* for generating RESET_REQ */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700472 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700473 t_L1ctlResetReq(template (value) L1ctlResetType rst_type) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100474 header := ts_L1ctlHeader(L1CTL_RESET_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200475 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700476 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200477 payload := {
478 reset_req := {
479 reset_type := rst_type,
480 padding := '000000'O
481 }
482 }
483 };
484
485 /* for generating FBSB_REQ */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700486 template (value) L1ctlMessage
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700487 ts_L1CTL_FBSB_REQ(template (value) GsmBandArfcn arfcn,
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700488 template (value) L1ctlFbsbFlags flags,
489 template (value) uint8_t sync_info_idx,
490 template (value) L1ctlCcchMode ccch_mode,
491 template (value) GsmRxLev rxlev_exp) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100492 header := ts_L1ctlHeader(L1CTL_FBSB_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200493 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700494 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200495 payload := {
496 fbsb_req := {
497 arfcn := arfcn,
Harald Weltea82f7e62018-02-22 18:51:33 +0100498 timeout_tdma_frames := 250, /* about 1s */
Harald Welte9e4725d2017-07-16 23:18:09 +0200499 freq_err_thresh1 := 10000,
500 freq_err_thresh2 := 800,
501 num_freqerr_avg := 3,
502 flags := flags,
503 sync_info_idx := sync_info_idx,
504 ccch_mode := ccch_mode,
505 rxlev_exp := rxlev_exp
506 }
507 }
508 };
509
510 /* for matching against incoming FBSB_CONF */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700511 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700512 tr_L1CTL_FBSB_CONF(template (present) uint8_t result) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100513 header := tr_L1ctlHeader(L1CTL_FBSB_CONF),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700514 ul_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200515 dl_info := ?,
516 payload := {
517 fbsb_conf := {
518 initial_freq_err := ?,
519 result := result,
520 bsic := ?
521 }
522 }
523 };
524
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700525 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700526 ts_L1CTL_CCCH_MODE_REQ(template (value) L1ctlCcchMode ccch_mode) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100527 header := ts_L1ctlHeader(L1CTL_CCCH_MODE_REQ),
528 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700529 dl_info := omit,
Harald Weltef8df4cb2018-03-10 15:15:08 +0100530 payload := {
531 ccch_mode_req := {
532 ccch_mode := ccch_mode,
533 padding := '000000'O
534 }
535 }
536 };
537
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700538 template (value) L1ctlMessage
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700539 ts_L1CTL_TCH_MODE_REQ(template (value) L1ctlTchMode tch_mode := L1CTL_CHAN_MODE_SIGN,
Vadim Yanitskiy16185832020-10-19 21:20:43 +0700540 template (value) L1ctlAudioMode audio_mode := t_L1CTL_AudioModeFwd,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200541 template (value) L1ctlLoopMode loop_mode := L1CTL_LOOP_MODE_OPEN,
542 template (value) uint8_t amr_start_codec := 0,
543 template (value) BIT8 amr_codecs_bitmask := '00000000'B) := {
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700544 header := ts_L1ctlHeader(L1CTL_TCH_MODE_REQ),
545 ul_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700546 dl_info := omit,
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700547 payload := {
548 tch_mode_req := {
549 tch_mode := tch_mode,
550 audio_mode := audio_mode,
551 loop_mode := loop_mode,
Pau Espin Pedrol440e1dc2022-09-02 16:35:49 +0200552 amr := {
553 start_codec := amr_start_codec,
554 codecs_bitmask := amr_codecs_bitmask
555 }
Vadim Yanitskiy3b1fae42020-10-19 16:16:41 +0700556 }
557 }
558 };
559
Harald Welte3757e602018-03-10 17:12:02 +0100560
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700561 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700562 tr_L1CTL_MsgType(template (present) L1ctlMsgType msg_type) := {
Harald Welte3757e602018-03-10 17:12:02 +0100563 header := tr_L1ctlHeader(msg_type),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700564 ul_info := *,
Harald Welte3757e602018-03-10 17:12:02 +0100565 dl_info := *,
Harald Weltef56cc492018-04-15 10:58:43 +0200566 payload := *
Harald Welte3757e602018-03-10 17:12:02 +0100567 }
568
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700569 template L1ctlMessage tr_L1CTL_CCCH_MODE_CONF := tr_L1CTL_MsgType(L1CTL_CCCH_MODE_CONF);
Harald Weltef8df4cb2018-03-10 15:15:08 +0100570
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700571 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700572 ts_L1CTL_RACH_REQ(template (value) uint8_t ra,
573 template (value) uint8_t combined,
574 template (value) uint16_t offset,
575 template (value) RslChannelNr chan_nr := ts_RslChanNr_RACH(0),
576 template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0)) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100577 header := ts_L1ctlHeader(L1CTL_RACH_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200578 ul_info := {
Vadim Yanitskiye432ba92019-05-31 18:44:13 +0700579 chan_nr := chan_nr,
580 link_id := link_id,
Harald Welte9e4725d2017-07-16 23:18:09 +0200581 padding := '0000'O
582 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700583 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200584 payload := {
585 rach_req := {
586 ra := ra,
587 combined := combined,
588 offset := offset
589 }
590 }
591 }
592
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700593 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700594 ts_L1CTL_EXT_RACH_REQ(template (value) uint16_t ra11,
595 template (value) L1ctlRachSynchSeq seq,
596 template (value) uint8_t combined,
597 template (value) uint16_t offset) := {
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700598 header := ts_L1ctlHeader(L1CTL_EXT_RACH_REQ),
599 ul_info := {
600 /* FIXME: both RSL chan_nr and link_id should be configurable */
Vadim Yanitskiy443891b2022-03-12 17:46:57 +0300601 chan_nr := ts_RslChanNr_RACH(0),
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700602 link_id := ts_RslLinkID_DCCH(0),
603 padding := '0000'O
604 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700605 dl_info := omit,
Vadim Yanitskiy5c836792019-04-22 05:45:03 +0700606 payload := {
607 ext_rach_req := {
608 ra11 := ra11,
609 synch_seq := seq,
610 combined := combined,
611 offset := offset
612 }
613 }
614 }
615
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700616 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700617 ts_L1CTL_PAR_REQ(template (value) uint8_t ta,
618 template (value) uint8_t tx_power) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100619 header := ts_L1ctlHeader(L1CTL_PARAM_REQ),
Harald Welte37052732018-03-09 19:38:46 +0100620 ul_info := {
Vadim Yanitskiy443891b2022-03-12 17:46:57 +0300621 chan_nr := ts_RslChanNr_RACH(0),
Harald Welte37052732018-03-09 19:38:46 +0100622 link_id := ts_RslLinkID_DCCH(0),
623 padding := '0000'O
624 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700625 dl_info := omit,
Harald Welte37052732018-03-09 19:38:46 +0100626 payload := {
627 par_req := {
628 ta := ta,
629 tx_power := tx_power,
630 padding := '0000'O
631 }
632 }
633 }
634
Vadim Yanitskiy5afe8852020-05-27 14:40:51 +0700635 /* 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 +0700636 private template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700637 ts_L1CTL_DM_EST_REQ(template (value) RslChannelNr chan_nr,
638 template (value) GsmTsc tsc) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100639 header := ts_L1ctlHeader(L1CTL_DM_EST_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200640 ul_info := {
641 chan_nr := chan_nr,
642 link_id := ts_RslLinkID_DCCH(0),
643 padding := '0000'O
644 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700645 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200646 payload := {
647 dm_est_req := {
648 tsc := tsc,
Vadim Yanitskiy0a3e31c2022-12-18 08:09:38 +0700649 h0h1 := -,
Vadim Yanitskiyfe052962020-10-19 13:27:09 +0700650 tch_mode := L1CTL_CHAN_MODE_SIGN,
Vadim Yanitskiy16185832020-10-19 21:20:43 +0700651 audio_mode := t_L1CTL_AudioModeFwd
Harald Welte9e4725d2017-07-16 23:18:09 +0200652 }
653 }
654 }
655
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700656 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700657 ts_L1CTL_DM_EST_REQ_H0(template (value) RslChannelNr chan_nr,
658 template (value) GsmTsc tsc,
659 template (value) GsmArfcn arfcn)
Vadim Yanitskiy5afe8852020-05-27 14:40:51 +0700660 modifies ts_L1CTL_DM_EST_REQ := {
661 payload := {
662 dm_est_req := {
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700663 h0h1 := {
664 h0 := {
665 h := 0,
Vadim Yanitskiy1acc7bb2020-11-14 04:24:57 +0700666 arfcn := ts_GsmBandArfcn(arfcn),
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700667 padding := f_pad_oct(''O, 130, '00'O)
668 }
669 }
Vadim Yanitskiy5afe8852020-05-27 14:40:51 +0700670 }
671 }
672 }
673
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700674 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700675 ts_L1CTL_DM_EST_REQ_H1(template (value) RslChannelNr chan_nr,
676 template (value) GsmTsc tsc,
677 template (value) uint6_t hsn,
678 template (value) uint6_t maio,
679 template (value) L1ctlMA ma)
Vadim Yanitskiyeda90812020-05-27 14:51:18 +0700680 modifies ts_L1CTL_DM_EST_REQ := {
681 payload := {
682 dm_est_req := {
Vadim Yanitskiy2cdb97f2020-10-19 14:17:38 +0700683 h0h1 := {
684 h1 := {
685 h := 1,
686 hsn := hsn,
687 maio := maio,
688 n := sizeof(ma),
689 spare := '00'O,
690 ma := ma,
691 /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562849 */
692 padding := f_pad_oct(''O, (64 - sizeof(ma)) * 2, '00'O)
693 }
Vadim Yanitskiyeda90812020-05-27 14:51:18 +0700694 }
695 }
696 }
697 }
698
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700699 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700700 ts_L1CTL_DM_REL_REQ(template (value) RslChannelNr chan_nr) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100701 header := ts_L1ctlHeader(L1CTL_DM_REL_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200702 ul_info := {
703 chan_nr := chan_nr,
704 link_id := ts_RslLinkID_DCCH(0),
705 padding := '0000'O
706 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700707 dl_info := omit,
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700708 payload := omit
Harald Welte9e4725d2017-07-16 23:18:09 +0200709 }
710
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700711 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700712 ts_L1CTL_DATA_REQ(template (value) RslChannelNr chan_nr,
713 template (value) RslLinkId link_id,
714 octetstring l2_data) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100715 header := ts_L1ctlHeader(L1CTL_DATA_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200716 ul_info := {
717 chan_nr := chan_nr,
718 link_id := link_id,
719 padding := '0000'O
720 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700721 dl_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200722 payload := {
Vadim Yanitskiy0a8d6da2019-05-28 22:18:28 +0700723 data_req := {
724 l1header := omit,
725 l2_payload := l2_data
726 }
Harald Welte9e4725d2017-07-16 23:18:09 +0200727 }
728 }
729
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700730 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700731 ts_L1CTL_DATA_REQ_SACCH(template (value) RslChannelNr chan_nr,
732 template (value) RslLinkId link_id,
733 template (value) SacchL1Header l1h,
734 octetstring l2_data) := {
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200735 header := ts_L1ctlHeader(L1CTL_DATA_REQ),
736 ul_info := {
737 chan_nr := chan_nr,
738 link_id := link_id,
739 padding := '0000'O
740 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700741 dl_info := omit,
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200742 payload := {
Vadim Yanitskiy0a8d6da2019-05-28 22:18:28 +0700743 data_req := {
744 l1header := l1h,
745 l2_payload := l2_data
746 }
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200747 }
748 }
749
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700750 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700751 ts_L1CTL_TRAFFIC_REQ(template (value) RslChannelNr chan_nr,
752 template (value) RslLinkId link_id,
753 octetstring frame) := {
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700754 header := ts_L1ctlHeader(L1CTL_TRAFFIC_REQ),
755 ul_info := {
756 chan_nr := chan_nr,
757 link_id := link_id,
758 padding := '0000'O
759 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700760 dl_info := omit,
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700761 payload := {
762 traffic_req := {
763 data := frame
764 }
765 }
766 };
767
Harald Welte9e4725d2017-07-16 23:18:09 +0200768 /* for matching against incoming RACH_CONF */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700769 template L1ctlMessage tr_L1CTL_RACH_CONF := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100770 header := tr_L1ctlHeader(L1CTL_RACH_CONF),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700771 ul_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200772 dl_info := ?,
Harald Weltef56cc492018-04-15 10:58:43 +0200773 payload := *
Harald Welte9e4725d2017-07-16 23:18:09 +0200774 };
775
Vadim Yanitskiy60b61882022-12-18 06:02:22 +0700776 /* for sending and matching L1CTL_DATA_IND */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700777 template (value) L1ctlMessage
Vadim Yanitskiy60b61882022-12-18 06:02:22 +0700778 ts_L1CTL_DATA_IND(template (value) RslChannelNr chan_nr,
779 template (value) RslLinkId link_id,
780 template (value) octetstring l2_data,
781 template (value) GsmBandArfcn arfcn,
782 template (value) uint32_t fn := 1337,
783 template (value) GsmRxLev rx_level := 63,
784 template (value) uint8_t num_biterr := 0,
785 template (value) uint8_t fire_crc := 0) := {
786 header := ts_L1ctlHeader(L1CTL_DATA_IND),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700787 ul_info := omit,
Vadim Yanitskiy60b61882022-12-18 06:02:22 +0700788 dl_info := {
789 chan_nr := chan_nr,
790 link_id := link_id,
791 arfcn := arfcn,
792 frame_nr := fn,
793 rx_level := rx_level,
794 snr := 0,
795 num_biterr := num_biterr,
796 fire_crc := fire_crc
797 },
798 payload := {
799 data_ind := {
800 payload := l2_data
801 }
802 }
803 };
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700804 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700805 tr_L1CTL_DATA_IND(template (present) RslChannelNr chan_nr,
806 template (present) RslLinkId link_id := ?,
807 template (present) octetstring l2_data := ?,
808 template (present) uint8_t num_biterr := 0,
809 template (present) uint8_t fire_crc := 0) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100810 header := tr_L1ctlHeader(L1CTL_DATA_IND),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700811 ul_info := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200812 dl_info := {
813 chan_nr := chan_nr,
Harald Weltece6dc442018-02-21 22:00:21 +0100814 link_id := link_id,
Harald Welte9e4725d2017-07-16 23:18:09 +0200815 arfcn := ?,
816 frame_nr := ?,
817 rx_level := ?,
818 snr := ?,
Harald Welte629cc6b2018-03-11 17:19:05 +0100819 num_biterr := num_biterr,
Pau Espin Pedrol17da3232022-09-02 16:35:32 +0200820 fire_crc := fire_crc
Harald Welte9e4725d2017-07-16 23:18:09 +0200821 },
822 payload := {
Harald Welte68e495b2018-02-25 00:05:57 +0100823 data_ind := {
824 payload := l2_data
825 }
Harald Welte9e4725d2017-07-16 23:18:09 +0200826 }
827 };
828
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700829 /* for matching against incoming TRAFFIC_IND */
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700830 template L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700831 tr_L1CTL_TRAFFIC_IND(template (present) RslChannelNr chan_nr,
832 template (present) RslLinkId link_id := ?,
833 template (present) octetstring frame := ?,
834 template (present) uint8_t num_biterr := ?,
835 template (present) uint8_t fire_crc := ?) := {
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700836 header := tr_L1ctlHeader(L1CTL_TRAFFIC_IND),
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700837 ul_info := omit,
Vadim Yanitskiyf3cc6492019-06-30 16:34:30 +0700838 dl_info := {
839 chan_nr := chan_nr,
840 link_id := link_id,
841 arfcn := ?,
842 frame_nr := ?,
843 rx_level := ?,
844 snr := ?,
845 num_biterr := num_biterr,
846 fire_crc := fire_crc
847 },
848 payload := {
849 traffic_ind := {
850 data := frame
851 }
852 }
853 };
854
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700855 template (value) L1ctlMessage
Vadim Yanitskiybe33f6b2020-11-14 04:05:34 +0700856 ts_L1CTL_CRYPTO_REQ(template (value) RslChannelNr chan_nr,
857 template (value) uint8_t algo,
858 template (value) octetstring key) := {
Harald Weltee613f962018-04-18 22:38:16 +0200859 header := ts_L1ctlHeader(L1CTL_CRYPTO_REQ),
860 ul_info := {
861 chan_nr := chan_nr,
862 link_id := ts_RslLinkID_DCCH(0),
863 padding := '0000'O
864 },
Vadim Yanitskiyaf0aae62023-03-18 06:49:18 +0700865 dl_info := omit,
Harald Weltee613f962018-04-18 22:38:16 +0200866 payload := {
867 crypto_req := {
868 algo := algo,
869 key_len := 0, /* overwritten */
870 key := key
871 }
872 }
873 };
874
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700875
876 template (value) L1ctlMessage
877 ts_L1CTL_GPRS_UL_TBF_CFG_REQ(template (value) uint8_t tbf_ref,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700878 template (value) BIT8 slotmask := '00000000'B,
879 template (value) uint32_t start_fn := c_UINT32_MAX) := {
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700880 header := ts_L1ctlHeader(L1CTL_GPRS_UL_TBF_CFG_REQ),
881 ul_info := omit,
882 dl_info := omit,
883 payload := {
884 ul_tbf_cfg_req := {
885 tbf_ref := tbf_ref,
886 slotmask := slotmask,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700887 pad := '0000'O,
888 start_fn := start_fn
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700889 }
890 }
891 };
892 template L1ctlMessage
893 tr_L1CTL_GPRS_UL_TBF_CFG_REQ(template (present) uint8_t tbf_ref := ?,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700894 template (present) BIT8 slotmask := ?,
895 template (present) uint32_t start_fn := ?) := {
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700896 header := tr_L1ctlHeader(L1CTL_GPRS_UL_TBF_CFG_REQ),
897 ul_info := omit,
898 dl_info := omit,
899 payload := {
900 ul_tbf_cfg_req := {
901 tbf_ref := tbf_ref,
902 slotmask := slotmask,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700903 pad := ?,
904 start_fn := start_fn
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700905 }
906 }
907 };
908
909 template (value) L1ctlMessage
910 ts_L1CTL_GPRS_DL_TBF_CFG_REQ(template (value) uint8_t tbf_ref,
911 template (value) BIT8 slotmask := '00000000'B,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700912 template (value) uint32_t start_fn := c_UINT32_MAX,
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700913 template (value) uint5_t dl_tfi := 0) := {
914 header := ts_L1ctlHeader(L1CTL_GPRS_DL_TBF_CFG_REQ),
915 ul_info := omit,
916 dl_info := omit,
917 payload := {
918 dl_tbf_cfg_req := {
919 tbf_ref := tbf_ref,
920 slotmask := slotmask,
921 dl_tfi := dl_tfi,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700922 pad := '00'O,
923 start_fn := start_fn
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700924 }
925 }
926 };
927 template L1ctlMessage
928 tr_L1CTL_GPRS_DL_TBF_CFG_REQ(template (present) uint8_t tbf_ref := ?,
929 template (present) BIT8 slotmask := ?,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700930 template (present) uint32_t start_fn := ?,
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700931 template (present) uint5_t dl_tfi := ?) := {
932 header := tr_L1ctlHeader(L1CTL_GPRS_DL_TBF_CFG_REQ),
933 ul_info := omit,
934 dl_info := omit,
935 payload := {
936 dl_tbf_cfg_req := {
937 tbf_ref := tbf_ref,
938 slotmask := slotmask,
939 dl_tfi := dl_tfi,
Vadim Yanitskiy0e5693f2023-08-27 14:09:32 +0700940 pad := ?,
941 start_fn := start_fn
Vadim Yanitskiy72a76b52023-03-18 00:12:09 +0700942 }
943 }
944 };
945
946 template (value) L1ctlMessage
947 ts_L1CTL_GPRS_UL_BLOCK_REQ(template (value) GsmFrameNumber fn,
948 template (value) uint3_t tn,
949 template (value) octetstring data) := {
950 header := ts_L1ctlHeader(L1CTL_GPRS_UL_BLOCK_REQ),
951 ul_info := omit,
952 dl_info := omit,
953 payload := {
954 ul_block_req := {
955 hdr := {
956 fn := fn,
957 tn := tn,
958 pad := '000000'O
959 },
960 data := data
961 }
962 }
963 };
964 template L1ctlMessage
965 tr_L1CTL_GPRS_UL_BLOCK_REQ(template (present) GsmFrameNumber fn := ?,
966 template (present) uint3_t tn := ?,
967 template (present) octetstring data := ?) := {
968 header := tr_L1ctlHeader(L1CTL_GPRS_UL_BLOCK_REQ),
969 ul_info := omit,
970 dl_info := omit,
971 payload := {
972 ul_block_req := {
973 hdr := {
974 fn := fn,
975 tn := tn,
976 pad := ?
977 },
978 data := data
979 }
980 }
981 };
982
983 template (value) L1ctlMessage
984 ts_L1CTL_GPRS_DL_BLOCK_IND(template (value) GsmFrameNumber fn,
985 template (value) uint3_t tn,
986 template (value) uint3_t usf,
987 template (value) octetstring data,
988 template (value) uint16_t ber10k := 0,
989 template (value) int16_t ci_cb := 180 /* 18 dB */,
990 template (value) GsmRxLev rx_level := 63) := {
991 header := ts_L1ctlHeader(L1CTL_GPRS_DL_BLOCK_IND),
992 ul_info := omit,
993 dl_info := omit,
994 payload := {
995 dl_block_ind := {
996 hdr := {
997 fn := fn,
998 tn := tn,
999 pad := '000000'O
1000 },
1001 meas := {
1002 ber10k := ber10k,
1003 ci_cb := ci_cb,
1004 rx_level := rx_level
1005 },
1006 usf := usf,
1007 data := data
1008 }
1009 }
1010 };
1011 template L1ctlMessage
1012 tr_L1CTL_GPRS_DL_BLOCK_IND(template (present) GsmFrameNumber fn := ?,
1013 template (present) uint3_t tn := ?,
1014 template (present) uint3_t usf := ?,
1015 template (present) octetstring data := ?,
1016 template (present) uint16_t ber10k := ?,
1017 template (present) int16_t ci_cb := ?,
1018 template (present) GsmRxLev rx_level := ?) := {
1019 header := tr_L1ctlHeader(L1CTL_GPRS_DL_BLOCK_IND),
1020 ul_info := omit,
1021 dl_info := omit,
1022 payload := {
1023 dl_block_ind := {
1024 hdr := {
1025 fn := fn,
1026 tn := tn,
1027 pad := ?
1028 },
1029 meas := {
1030 ber10k := ber10k,
1031 ci_cb := ci_cb,
1032 rx_level := rx_level
1033 },
1034 usf := usf,
1035 data := data
1036 }
1037 }
1038 };
1039
Harald Welte68e495b2018-02-25 00:05:57 +01001040 const octetstring c_DummyUI := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O;
1041
Harald Welte7024baa2018-03-02 23:37:51 +01001042/* We use "BYTEORDER(last)" so we get little-endian integers. Unfortuantely, this also
1043 switches the byte ordering in octet strings, so we need to explicitly annotate them :/ */
Harald Weltef6543322017-07-16 07:35:10 +02001044} with { encode "RAW" };