blob: 7a527ffa888da2fa87891341d8bd805695ece0ce [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gsm_08_58.h
2 * GSM Radio Signalling Link messages on the A-bis interface.
Harald Welteec8b4502010-02-20 20:34:29 +01003 * 3GPP TS 08.58 version 8.6.0 Release 1999 / ETSI TS 100 596 V8.6.0 */
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02004/*
5 * (C) 2008 by Harald Welte <laforge@gnumonks.org>
Harald Welteec8b4502010-02-20 20:34:29 +01006 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
Harald Welteec8b4502010-02-20 20:34:29 +010018 */
19
Neels Hofmeyr17518fe2017-06-20 04:35:06 +020020#pragma once
21
Harald Welteec8b4502010-02-20 20:34:29 +010022#include <stdint.h>
23
Pau Espin Pedrol42908032018-10-10 17:04:28 +020024#include <osmocom/core/endian.h>
25
Harald Welte8f2c7e52011-08-17 18:52:03 +020026/*! \addtogroup rsl
27 * @{
Neels Hofmeyr17518fe2017-06-20 04:35:06 +020028 * \file gsm_08_58.h */
Harald Welte8f2c7e52011-08-17 18:52:03 +020029
Pau Espin Pedrolfb97e722018-10-10 20:41:40 +020030/* Channel Number 9.3.1 */
31union abis_rsl_chan_nr {
32#if OSMO_IS_BIG_ENDIAN
33 uint8_t cbits:5,
34 tn:3;
35#elif OSMO_IS_LITTLE_ENDIAN
36 uint8_t tn:3,
37 cbits:5;
38#endif
39 uint8_t chan_nr;
40} __attribute__ ((packed));
41#define ABIS_RSL_CHAN_NR_CBITS_Bm_ACCHs 0x01
42#define ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(ss) (0x02 + (ss))
43#define ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(ss) (0x04 + (ss))
44#define ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(ss) (0x08 + (ss))
45#define ABIS_RSL_CHAN_NR_CBITS_BCCH 0x10
46#define ABIS_RSL_CHAN_NR_CBITS_RACH 0x11
47#define ABIS_RSL_CHAN_NR_CBITS_PCH_AGCH 0x12
48#define ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCH 0x18 /*< non-standard, for dyn TS */
Harald Weltea8d7ebb2019-05-27 16:51:23 +020049#define ABIS_RSL_CHAN_NR_CBITS_OSMO_CBCH4 0x19 /*< non-standard, for CBCH/SDCCH4 */
50#define ABIS_RSL_CHAN_NR_CBITS_OSMO_CBCH8 0x1a /*< non-standard, for CBCH/SDCCH8 */
Pau Espin Pedrolfb97e722018-10-10 20:41:40 +020051
Vadim Yanitskiyfc02ff42021-05-26 18:19:03 +020052/* non-standard, Osmocom specific Bm/Lm equivalents for VAMOS */
53#define ABIS_RSL_CHAN_NR_CBITS_OSMO_VAMOS_Bm_ACCHs 0x1d /*< VAMOS TCH/F */
54#define ABIS_RSL_CHAN_NR_CBITS_OSMO_VAMOS_Lm_ACCHs(ss) (0x1e + (ss)) /*< VAMOS TCH/H */
55
Pau Espin Pedrol42908032018-10-10 17:04:28 +020056/* Link Identifier 9.3.2 */
57union abis_rsl_link_id {
58#if OSMO_IS_BIG_ENDIAN
59 uint8_t cbits:2,
60 na:1,
Martin Haukee63b8872018-11-15 14:53:13 +010061 reserved:2,
Pau Espin Pedrol42908032018-10-10 17:04:28 +020062 sapi:3;
63#elif OSMO_IS_LITTLE_ENDIAN
64 uint8_t sapi:3,
65 reserved:2,
66 na:1,
67 cbits:2;
68#endif
69 uint8_t link_id;
70} __attribute__ ((packed));
71#define ABIS_RSL_LINK_ID_CBITS_FACCH_SDCCH 0x00
72#define ABIS_RSL_LINK_ID_CBITS_SACCH 0x01
73
Neels Hofmeyr87e45502017-06-20 00:17:59 +020074/*! RSL common header */
Harald Welteec8b4502010-02-20 20:34:29 +010075struct abis_rsl_common_hdr {
Neels Hofmeyr87e45502017-06-20 00:17:59 +020076 uint8_t msg_discr; /*!< message discriminator (ABIS_RSL_MDISC_*) */
77 uint8_t msg_type; /*!< message type (\ref abis_rsl_msgtype) */
78 uint8_t data[0]; /*!< actual payload data */
Harald Welteec8b4502010-02-20 20:34:29 +010079} __attribute__ ((packed));
80
Neels Hofmeyr87e45502017-06-20 00:17:59 +020081/* RSL RLL header (Chapter 8.3) */
Harald Welteec8b4502010-02-20 20:34:29 +010082struct abis_rsl_rll_hdr {
83 struct abis_rsl_common_hdr c;
Neels Hofmeyr87e45502017-06-20 00:17:59 +020084 uint8_t ie_chan; /*!< \ref RSL_IE_CHAN_NR (tag) */
Pau Espin Pedrolfb97e722018-10-10 20:41:40 +020085 union {
86 uint8_t chan_nr; /* API backward compat */
87 union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */
88 };
Neels Hofmeyr87e45502017-06-20 00:17:59 +020089 uint8_t ie_link_id; /*!< \ref RSL_IE_LINK_IDENT (tag) */
Pau Espin Pedrol42908032018-10-10 17:04:28 +020090 union {
91 uint8_t link_id; /* API backward compat */
92 union abis_rsl_link_id link_id_fields; /*!< RSL link identifier (value) */
93 };
Neels Hofmeyr87e45502017-06-20 00:17:59 +020094 uint8_t data[0]; /*!< message payload data */
Harald Welteec8b4502010-02-20 20:34:29 +010095} __attribute__ ((packed));
96
Neels Hofmeyr87e45502017-06-20 00:17:59 +020097/* RSL Dedicated Channel header (Chapter 8.3 and 8.4) */
Harald Welteec8b4502010-02-20 20:34:29 +010098struct abis_rsl_dchan_hdr {
99 struct abis_rsl_common_hdr c;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200100 uint8_t ie_chan; /*!< \ref RSL_IE_CHAN_NR (tag) */
Pau Espin Pedrolfb97e722018-10-10 20:41:40 +0200101 union {
102 uint8_t chan_nr; /* API backward compat */
103 union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */
104 };
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200105 uint8_t data[0]; /*!< message payload data */
Harald Welteec8b4502010-02-20 20:34:29 +0100106} __attribute__ ((packed));
107
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200108/* RSL Common Channel header (Chapter 8.5) */
Harald Welte6eb7d6c2010-07-13 13:48:13 +0200109struct abis_rsl_cchan_hdr {
110 struct abis_rsl_common_hdr c;
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200111 uint8_t ie_chan; /*!< \ref RSL_IE_CHAN_NR (tag) */
Pau Espin Pedrolfb97e722018-10-10 20:41:40 +0200112 union {
113 uint8_t chan_nr; /* API backward compat */
114 union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */
115 };
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200116 uint8_t data[0]; /*!< message payload data */
Harald Welte6eb7d6c2010-07-13 13:48:13 +0200117} __attribute__ ((packed));
118
Philipp Maier439ddbe2020-11-16 17:49:34 +0100119/* Osmocom specific IE to negotiate repeated ACCH capabilities */
120struct abis_rsl_osmo_rep_acch_cap {
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100121#if OSMO_IS_LITTLE_ENDIAN
Philipp Maier55ce87d2021-08-31 09:24:37 +0200122 uint8_t dl_facch_cmd:1,
123 dl_facch_all:1,
124 dl_sacch:1,
125 ul_sacch:1,
126 rxqual:3,
127 reserved:1;
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100128#elif OSMO_IS_BIG_ENDIAN
129/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
130 uint8_t reserved:1, rxqual:3, ul_sacch:1, dl_sacch:1, dl_facch_all:1, dl_facch_cmd:1;
Philipp Maier439ddbe2020-11-16 17:49:34 +0100131#endif
132} __attribute__ ((packed));
Harald Welteec8b4502010-02-20 20:34:29 +0100133
Philipp Maier0e44a722021-08-30 10:51:52 +0200134/* Osmocom specific IE to negotiate temporary overpower of ACCH channels */
135struct abis_rsl_osmo_temp_ovp_acch_cap {
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100136#if OSMO_IS_LITTLE_ENDIAN
Vadim Yanitskiy8db64ee2021-10-20 14:36:18 +0300137 uint8_t overpower_db:3,
138 rxqual:3,
139 facch_enable:1,
140 sacch_enable:1;
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100141#elif OSMO_IS_BIG_ENDIAN
142/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
143 uint8_t sacch_enable:1, facch_enable:1, rxqual:3, overpower_db:3;
Vadim Yanitskiy8db64ee2021-10-20 14:36:18 +0300144#endif
Philipp Maier0e44a722021-08-30 10:51:52 +0200145} __attribute__ ((packed));
146
Harald Welteec8b4502010-02-20 20:34:29 +0100147/* Chapter 9.1 */
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200148/* RSL Message Discriminator: RLL */
Harald Welteec8b4502010-02-20 20:34:29 +0100149#define ABIS_RSL_MDISC_RLL 0x02
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200150/* RSL Message Discriminator: Dedicated Channel */
Harald Welteec8b4502010-02-20 20:34:29 +0100151#define ABIS_RSL_MDISC_DED_CHAN 0x08
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200152/* RSL Message Discriminator: Common Channel */
Harald Welteec8b4502010-02-20 20:34:29 +0100153#define ABIS_RSL_MDISC_COM_CHAN 0x0c
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200154/* RSL Message Discriminator: TRX Management */
Harald Welteec8b4502010-02-20 20:34:29 +0100155#define ABIS_RSL_MDISC_TRX 0x10
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200156/* RSL Message Discriminator: Location Service */
Harald Welteec8b4502010-02-20 20:34:29 +0100157#define ABIS_RSL_MDISC_LOC 0x20
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200158/* RSL Message Discriminator: ip.access */
Harald Welteec8b4502010-02-20 20:34:29 +0100159#define ABIS_RSL_MDISC_IPACCESS 0x7e
160#define ABIS_RSL_MDISC_TRANSP 0x01
161
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200162/* Check if given RSL message discriminator is transparent */
Harald Welteec8b4502010-02-20 20:34:29 +0100163#define ABIS_RSL_MDISC_IS_TRANSP(x) (x & 0x01)
164
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200165/* RSL Message Type (Chapter 9.1) */
Harald Welteec8b4502010-02-20 20:34:29 +0100166enum abis_rsl_msgtype {
167 /* Radio Link Layer Management */
168 RSL_MT_DATA_REQ = 0x01,
169 RSL_MT_DATA_IND,
170 RSL_MT_ERROR_IND,
171 RSL_MT_EST_REQ,
172 RSL_MT_EST_CONF,
173 RSL_MT_EST_IND,
174 RSL_MT_REL_REQ,
175 RSL_MT_REL_CONF,
176 RSL_MT_REL_IND,
177 RSL_MT_UNIT_DATA_REQ,
178 RSL_MT_UNIT_DATA_IND, /* 0x0b */
Andreas Eversberg816e24c2010-06-25 02:50:56 +0200179 RSL_MT_SUSP_REQ, /* non-standard elements */
180 RSL_MT_SUSP_CONF,
181 RSL_MT_RES_REQ,
182 RSL_MT_RECON_REQ, /* 0x0f */
Harald Welteec8b4502010-02-20 20:34:29 +0100183
184 /* Common Channel Management / TRX Management */
185 RSL_MT_BCCH_INFO = 0x11,
186 RSL_MT_CCCH_LOAD_IND,
187 RSL_MT_CHAN_RQD,
188 RSL_MT_DELETE_IND,
189 RSL_MT_PAGING_CMD,
190 RSL_MT_IMMEDIATE_ASSIGN_CMD,
191 RSL_MT_SMS_BC_REQ,
Harald Welte6eb7d6c2010-07-13 13:48:13 +0200192 RSL_MT_CHAN_CONF, /* non-standard element */
Harald Welteec8b4502010-02-20 20:34:29 +0100193 /* empty */
194 RSL_MT_RF_RES_IND = 0x19,
195 RSL_MT_SACCH_FILL,
196 RSL_MT_OVERLOAD,
197 RSL_MT_ERROR_REPORT,
198 RSL_MT_SMS_BC_CMD,
199 RSL_MT_CBCH_LOAD_IND,
200 RSL_MT_NOT_CMD, /* 0x1f */
201
202 /* Dedicate Channel Management */
203 RSL_MT_CHAN_ACTIV = 0x21,
204 RSL_MT_CHAN_ACTIV_ACK,
205 RSL_MT_CHAN_ACTIV_NACK,
206 RSL_MT_CONN_FAIL,
207 RSL_MT_DEACTIVATE_SACCH,
208 RSL_MT_ENCR_CMD,
209 RSL_MT_HANDO_DET,
210 RSL_MT_MEAS_RES,
211 RSL_MT_MODE_MODIFY_REQ,
212 RSL_MT_MODE_MODIFY_ACK,
213 RSL_MT_MODE_MODIFY_NACK,
214 RSL_MT_PHY_CONTEXT_REQ,
215 RSL_MT_PHY_CONTEXT_CONF,
216 RSL_MT_RF_CHAN_REL,
217 RSL_MT_MS_POWER_CONTROL,
218 RSL_MT_BS_POWER_CONTROL, /* 0x30 */
219 RSL_MT_PREPROC_CONFIG,
220 RSL_MT_PREPROC_MEAS_RES,
221 RSL_MT_RF_CHAN_REL_ACK,
222 RSL_MT_SACCH_INFO_MODIFY,
223 RSL_MT_TALKER_DET,
224 RSL_MT_LISTENER_DET,
225 RSL_MT_REMOTE_CODEC_CONF_REP,
226 RSL_MT_RTD_REP,
227 RSL_MT_PRE_HANDO_NOTIF,
228 RSL_MT_MR_CODEC_MOD_REQ,
229 RSL_MT_MR_CODEC_MOD_ACK,
230 RSL_MT_MR_CODEC_MOD_NACK,
231 RSL_MT_MR_CODEC_MOD_PER,
232 RSL_MT_TFO_REP,
233 RSL_MT_TFO_MOD_REQ, /* 0x3f */
234 RSL_MT_LOCATION_INFO = 0x41,
235
236 /* ip.access specific RSL message types */
237 RSL_MT_IPAC_DIR_RETR_ENQ = 0x40,
238 RSL_MT_IPAC_PDCH_ACT = 0x48,
239 RSL_MT_IPAC_PDCH_ACT_ACK,
240 RSL_MT_IPAC_PDCH_ACT_NACK,
241 RSL_MT_IPAC_PDCH_DEACT = 0x4b,
242 RSL_MT_IPAC_PDCH_DEACT_ACK,
243 RSL_MT_IPAC_PDCH_DEACT_NACK,
244 RSL_MT_IPAC_CONNECT_MUX = 0x50,
245 RSL_MT_IPAC_CONNECT_MUX_ACK,
246 RSL_MT_IPAC_CONNECT_MUX_NACK,
247 RSL_MT_IPAC_BIND_MUX = 0x53,
248 RSL_MT_IPAC_BIND_MUX_ACK,
249 RSL_MT_IPAC_BIND_MUX_NACK,
250 RSL_MT_IPAC_DISC_MUX = 0x56,
251 RSL_MT_IPAC_DISC_MUX_ACK,
252 RSL_MT_IPAC_DISC_MUX_NACK,
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400253 RSL_MT_IPAC_MEAS_PREPROC_DFT = 0x60, /*Extented Common Channel Management */
254 RSL_MT_IPAC_HO_CAN_ENQ = 0x61,
255 RSL_MT_IPAC_HO_CAN_RES = 0x62,
Harald Welteec8b4502010-02-20 20:34:29 +0100256 RSL_MT_IPAC_CRCX = 0x70, /* Bind to local BTS RTP port */
257 RSL_MT_IPAC_CRCX_ACK,
258 RSL_MT_IPAC_CRCX_NACK,
259 RSL_MT_IPAC_MDCX = 0x73,
260 RSL_MT_IPAC_MDCX_ACK,
261 RSL_MT_IPAC_MDCX_NACK,
262 RSL_MT_IPAC_DLCX_IND = 0x76,
263 RSL_MT_IPAC_DLCX = 0x77,
264 RSL_MT_IPAC_DLCX_ACK,
265 RSL_MT_IPAC_DLCX_NACK,
Harald Weltef9456892019-09-03 13:56:00 +0200266
267 RSL_MT_OSMO_ETWS_CMD = 0x7f,
Harald Welteec8b4502010-02-20 20:34:29 +0100268};
269
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200270/*! Siemens vendor-specific RSL message types */
Harald Welteec8b4502010-02-20 20:34:29 +0100271enum abis_rsl_msgtype_siemens {
272 RSL_MT_SIEMENS_MRPCI = 0x41,
273 RSL_MT_SIEMENS_INTRAC_HO_COND_IND = 0x42,
274 RSL_MT_SIEMENS_INTERC_HO_COND_IND = 0x43,
275 RSL_MT_SIEMENS_FORCED_HO_REQ = 0x44,
276 RSL_MT_SIEMENS_PREF_AREA_REQ = 0x45,
277 RSL_MT_SIEMENS_PREF_AREA = 0x46,
278 RSL_MT_SIEMENS_START_TRACE = 0x47,
279 RSL_MT_SIEMENS_START_TRACE_ACK = 0x48,
280 RSL_MT_SIEMENS_STOP_TRACE = 0x49,
281 RSL_MT_SIEMENS_TRMR = 0x4a,
282 RSL_MT_SIEMENS_HO_FAIL_IND = 0x4b,
283 RSL_MT_SIEMENS_STOP_TRACE_ACK = 0x4c,
284 RSL_MT_SIEMENS_UPLF = 0x4d,
285 RSL_MT_SIEMENS_UPLB = 0x4e,
286 RSL_MT_SIEMENS_SET_SYS_INFO_10 = 0x4f,
287 RSL_MT_SIEMENS_MODIF_COND_IND = 0x50,
288};
289
Pau Espin Pedrol95959a82018-04-21 22:47:54 +0200290/*! Ericsson vendor-specific RSL message types */
291enum abis_rsl_msgtype_ericsson {
292 RSL_MT_ERICSSON_IMM_ASS_SENT = 0x10,
293};
294
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200295/*! RSL Information Element Identifiers (Chapter 9.3) */
Harald Welteec8b4502010-02-20 20:34:29 +0100296enum abis_rsl_ie {
297 RSL_IE_CHAN_NR = 0x01,
298 RSL_IE_LINK_IDENT,
299 RSL_IE_ACT_TYPE,
300 RSL_IE_BS_POWER,
301 RSL_IE_CHAN_IDENT,
302 RSL_IE_CHAN_MODE,
303 RSL_IE_ENCR_INFO,
304 RSL_IE_FRAME_NUMBER,
305 RSL_IE_HANDO_REF,
306 RSL_IE_L1_INFO,
307 RSL_IE_L3_INFO,
308 RSL_IE_MS_IDENTITY,
309 RSL_IE_MS_POWER,
310 RSL_IE_PAGING_GROUP,
311 RSL_IE_PAGING_LOAD,
312 RSL_IE_PYHS_CONTEXT = 0x10,
313 RSL_IE_ACCESS_DELAY,
314 RSL_IE_RACH_LOAD,
315 RSL_IE_REQ_REFERENCE,
316 RSL_IE_RELEASE_MODE,
317 RSL_IE_RESOURCE_INFO,
318 RSL_IE_RLM_CAUSE,
319 RSL_IE_STARTNG_TIME,
320 RSL_IE_TIMING_ADVANCE,
321 RSL_IE_UPLINK_MEAS,
322 RSL_IE_CAUSE,
323 RSL_IE_MEAS_RES_NR,
324 RSL_IE_MSG_ID,
325 /* reserved */
326 RSL_IE_SYSINFO_TYPE = 0x1e,
327 RSL_IE_MS_POWER_PARAM,
328 RSL_IE_BS_POWER_PARAM,
329 RSL_IE_PREPROC_PARAM,
330 RSL_IE_PREPROC_MEAS,
331 RSL_IE_IMM_ASS_INFO, /* Phase 1 (3.6.0), later Full below */
332 RSL_IE_SMSCB_INFO = 0x24,
333 RSL_IE_MS_TIMING_OFFSET,
334 RSL_IE_ERR_MSG,
335 RSL_IE_FULL_BCCH_INFO,
336 RSL_IE_CHAN_NEEDED,
337 RSL_IE_CB_CMD_TYPE,
338 RSL_IE_SMSCB_MSG,
339 RSL_IE_FULL_IMM_ASS_INFO,
340 RSL_IE_SACCH_INFO,
341 RSL_IE_CBCH_LOAD_INFO,
342 RSL_IE_SMSCB_CHAN_INDICATOR,
343 RSL_IE_GROUP_CALL_REF,
344 RSL_IE_CHAN_DESC = 0x30,
345 RSL_IE_NCH_DRX_INFO,
346 RSL_IE_CMD_INDICATOR,
347 RSL_IE_EMLPP_PRIO,
348 RSL_IE_UIC,
349 RSL_IE_MAIN_CHAN_REF,
350 RSL_IE_MR_CONFIG,
351 RSL_IE_MR_CONTROL,
352 RSL_IE_SUP_CODEC_TYPES,
353 RSL_IE_CODEC_CONFIG,
354 RSL_IE_RTD,
355 RSL_IE_TFO_STATUS,
356 RSL_IE_LLP_APDU,
357 /* Siemens vendor-specific */
358 RSL_IE_SIEMENS_MRPCI = 0x40,
359 RSL_IE_SIEMENS_PREF_AREA_TYPE = 0x43,
360 RSL_IE_SIEMENS_ININ_CELL_HO_PAR = 0x45,
361 RSL_IE_SIEMENS_TRACE_REF_NR = 0x46,
362 RSL_IE_SIEMENS_INT_TRACE_IDX = 0x47,
363 RSL_IE_SIEMENS_L2_HDR_INFO = 0x48,
364 RSL_IE_SIEMENS_HIGHEST_RATE = 0x4e,
365 RSL_IE_SIEMENS_SUGGESTED_RATE = 0x4f,
366
Philipp Maiera15967b2020-11-06 21:37:16 +0100367 /* Osmocom specific */
Philipp Maiere67edfd2021-08-31 09:46:35 +0200368 RSL_IE_OSMO_REP_ACCH_CAP = 0x60,
Neels Hofmeyrdd6f1362021-04-20 23:02:59 +0200369 RSL_IE_OSMO_TRAINING_SEQUENCE = 0x61,
Philipp Maier0e44a722021-08-30 10:51:52 +0200370 RSL_IE_OSMO_TEMP_OVP_ACCH_CAP = 0x62,
Philipp Maiera15967b2020-11-06 21:37:16 +0100371
Harald Welteec8b4502010-02-20 20:34:29 +0100372 /* ip.access */
373 RSL_IE_IPAC_SRTP_CONFIG = 0xe0,
374 RSL_IE_IPAC_PROXY_UDP = 0xe1,
375 RSL_IE_IPAC_BSCMPL_TOUT = 0xe2,
376 RSL_IE_IPAC_REMOTE_IP = 0xf0,
377 RSL_IE_IPAC_REMOTE_PORT = 0xf1,
378 RSL_IE_IPAC_RTP_PAYLOAD = 0xf2,
379 RSL_IE_IPAC_LOCAL_PORT = 0xf3,
380 RSL_IE_IPAC_SPEECH_MODE = 0xf4,
381 RSL_IE_IPAC_LOCAL_IP = 0xf5,
382 RSL_IE_IPAC_CONN_STAT = 0xf6,
383 RSL_IE_IPAC_HO_C_PARMS = 0xf7,
384 RSL_IE_IPAC_CONN_ID = 0xf8,
385 RSL_IE_IPAC_RTP_CSD_FMT = 0xf9,
386 RSL_IE_IPAC_RTP_JIT_BUF = 0xfa,
387 RSL_IE_IPAC_RTP_COMPR = 0xfb,
388 RSL_IE_IPAC_RTP_PAYLOAD2= 0xfc,
389 RSL_IE_IPAC_RTP_MPLEX = 0xfd,
390 RSL_IE_IPAC_RTP_MPLEX_ID= 0xfe,
391};
392
Harald Welte6e363e72016-11-16 16:58:52 +0100393/* Ericsson specific IEs, clash with above partially, so they're not
394 * part of the enum */
Alexander Couzens9f39d892018-04-21 21:20:25 +0200395#define RSL_IE_ERIC_PAGING_GROUP 0x0e
Harald Welte6e363e72016-11-16 16:58:52 +0100396#define RSL_IE_ERIC_INST_NR 0x48
397#define RSL_IE_ERIC_PGSL_TIMERS 0x49
398#define RSL_IE_ERIC_REPEAT_DL_FACCH 0x4a
399#define RSL_IE_ERIC_POWER_INFO 0xf0
400#define RSL_IE_ERIC_MOBILE_ID 0xf1
401#define RSL_IE_ERIC_BCCH_MAPPING 0xf2
402#define RSL_IE_ERIC_PACKET_PAG_IND 0xf3
403#define RSL_IE_ERIC_CNTR_CTRL 0xf4
404#define RSL_IE_ERIC_CNTR_CTRL_ACK 0xf5
405#define RSL_IE_ERIC_CNTR_REPORT 0xf6
406#define RSL_IE_ERIC_ICP_CONN 0xf7
407#define RSL_IE_ERIC_EMR_SUPPORT 0xf8
408#define RSL_IE_ERIC_EGPRS_REQ_REF 0xf9
409#define RSL_IE_ERIC_VGCS_REL 0xfa
410#define RSL_IE_ERIC_REP_PER_NCH 0xfb
411#define RSL_IE_ERIC_NY2 0xfc
412#define RSL_IE_ERIC_T3115 0xfd
413#define RSL_IE_ERIC_ACTIVATE_FLAG 0xfe
414#define RSL_IE_ERIC_FULL_NCH_INFO 0xff
415
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400416/* IPAC MEAS_PREPROC AVERAGING METHOD */
417enum {
418 IPAC_UNWEIGHTED_AVE = 0,
419 IPAC_WEIGHTED_AVE,
Vadim Yanitskiyc8158ec2020-12-15 08:04:30 +0100420 IPAC_MEDIAN_AVE,
421 /* EWMA is an Osmocom specific extension */
422 IPAC_OSMO_EWMA_AVE,
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400423};
424
Pau Espin Pedrol9da16b52021-08-26 15:25:16 +0200425/* IPAC MEAS_PREPROC AVERAGING PARAM ID */
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400426enum {
427 IPAC_RXLEV_AVE = 0,
428 IPAC_RXQUAL_AVE,
429 IPAC_MS_BTS_DIS_AVE
430};
431
432/* IPAC MEAS_PREPROC HO CAUSES */
433enum {
434 IPAC_HO_RQD_CAUSE_L_RXLEV_UL_H = 0x01,
435 IPAC_HO_RQD_CAUSE_L_RXLEV_DL_H,
436 IPAC_HO_RQD_CAUSE_L_RXQUAL_UL_H,
437 IPAC_HO_RQD_CAUSE_L_RXQUAL_DL_H,
438 IPAC_HO_RQD_CAUSE_RXLEV_UL_IH,
439 IPAC_HO_RQD_CAUSE_RXLEV_DL_IH,
440 IPAC_HO_RQD_CAUSE_MAX_MS_RANGE,
441 IPAC_HO_RQD_CAUSE_POWER_BUDGET,
442 IPAC_HO_RQD_CAUSE_ENQUIRY,
443 IPAC_HO_RQD_CAUSE_ENQUIRY_FAILED,
444 IPAC_HO_RQD_CAUSE_NORMAL3G,
445 IPAC_HO_RQD_CAUSE_EMERGENCY3G,
446 IPAC_HO_RQD_CAUSE_SERVICE_PREFERRED3G,
447 IPAC_HO_RQD_CAUSE_O_M_SHUTDOWN,
448 IPAC_HO_RQD_CAUSE_QUALITY_PROMOTION,
449 IPAC_HO_RQD_CAUSE_LOAD_PROMOTION,
450 IPAC_HO_RQD_CAUSE_LOAD_DEMOTION,
451 IPAC_HO_RQD_CAUSE_MAX,
452};
453
Harald Welteec8b4502010-02-20 20:34:29 +0100454/* Chapter 9.3.1 */
455#define RSL_CHAN_NR_MASK 0xf8
Neels Hofmeyr15b96ff2016-07-18 23:33:48 +0200456#define RSL_CHAN_NR_1 0x08 /*< bit to add for 2nd,... lchan */
Harald Welteec8b4502010-02-20 20:34:29 +0100457#define RSL_CHAN_Bm_ACCHs 0x08
458#define RSL_CHAN_Lm_ACCHs 0x10 /* .. 0x18 */
459#define RSL_CHAN_SDCCH4_ACCH 0x20 /* .. 0x38 */
460#define RSL_CHAN_SDCCH8_ACCH 0x40 /* ...0x78 */
461#define RSL_CHAN_BCCH 0x80
462#define RSL_CHAN_RACH 0x88
463#define RSL_CHAN_PCH_AGCH 0x90
Neels Hofmeyrfd80f5a2016-07-14 03:21:05 +0200464#define RSL_CHAN_OSMO_PDCH 0xc0 /*< non-standard, for dyn TS */
Harald Weltea8d7ebb2019-05-27 16:51:23 +0200465#define RSL_CHAN_OSMO_CBCH4 0xc8 /*< non-standard, for CBCH/SDCCH4 */
466#define RSL_CHAN_OSMO_CBCH8 0xd0 /*< non-standard, for CBCH/SDCCH8 */
Harald Welteec8b4502010-02-20 20:34:29 +0100467
Vadim Yanitskiyfc02ff42021-05-26 18:19:03 +0200468/* non-standard, Osmocom specific Bm/Lm equivalents for VAMOS */
469#define RSL_CHAN_OSMO_VAMOS_Bm_ACCHs 0xe8 /* VAMOS TCH/F */
470#define RSL_CHAN_OSMO_VAMOS_Lm_ACCHs 0xf0 /* VAMOS TCH/H */
Vadim Yanitskiy442ff642021-06-01 19:55:43 +0200471#define RSL_CHAN_OSMO_VAMOS_MASK 0xe0 /* VAMOS TCH/{F,H} */
Vadim Yanitskiyfc02ff42021-05-26 18:19:03 +0200472
Harald Welteec8b4502010-02-20 20:34:29 +0100473/* Chapter 9.3.3 */
474#define RSL_ACT_TYPE_INITIAL 0x00
475#define RSL_ACT_TYPE_REACT 0x80
476#define RSL_ACT_INTRA_IMM_ASS 0x00
477#define RSL_ACT_INTRA_NORM_ASS 0x01
478#define RSL_ACT_INTER_ASYNC 0x02
479#define RSL_ACT_INTER_SYNC 0x03
480#define RSL_ACT_SECOND_ADD 0x04
481#define RSL_ACT_SECOND_MULTI 0x05
Neels Hofmeyrfd80f5a2016-07-14 03:21:05 +0200482#define RSL_ACT_OSMO_PDCH 0x0f /*< non-standard, for dyn TS */
Harald Welteec8b4502010-02-20 20:34:29 +0100483
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200484/*! RSL Channel Mode IF (Chapter 9.3.6) */
Harald Welteec8b4502010-02-20 20:34:29 +0100485struct rsl_ie_chan_mode {
486 uint8_t dtx_dtu;
487 uint8_t spd_ind;
488 uint8_t chan_rt;
489 uint8_t chan_rate;
490} __attribute__ ((packed));
491#define RSL_CMOD_DTXu 0x01 /* uplink */
492#define RSL_CMOD_DTXd 0x02 /* downlink */
493enum rsl_cmod_spd {
494 RSL_CMOD_SPD_SPEECH = 0x01,
495 RSL_CMOD_SPD_DATA = 0x02,
496 RSL_CMOD_SPD_SIGN = 0x03,
497};
Vadim Yanitskiy307b2012021-04-19 04:42:34 +0200498#define RSL_CMOD_CRT_SDCCH 0x01
499#define RSL_CMOD_CRT_TCH_Bm 0x08 /* full-rate */
500#define RSL_CMOD_CRT_TCH_Lm 0x09 /* half-rate */
501#define RSL_CMOD_CRT_TCH_BI_Bm 0x0a /* full-rate: bi-directional (multislot) */
502#define RSL_CMOD_CRT_TCH_UNI_Bm 0x1a /* full-rate: uni-directional (multislot) */
503#define RSL_CMOD_CRT_TCH_GROUP_Bm 0x18 /* full-rate: group call channel */
504#define RSL_CMOD_CRT_TCH_GROUP_Lm 0x19 /* half-rate: group call channel */
505#define RSL_CMOD_CRT_TCH_BCAST_Bm 0x28 /* full-rate: broadcast call channel */
506#define RSL_CMOD_CRT_TCH_BCAST_Lm 0x29 /* half-rate: broadcast call channel */
Neels Hofmeyrfef61cd2021-04-22 21:54:31 +0200507#define RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm 0x88 /* full-rate in VAMOS mode */
508#define RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm 0x89 /* half-rate in VAMOS mode */
Harald Welteec8b4502010-02-20 20:34:29 +0100509/* Speech */
510#define RSL_CMOD_SP_GSM1 0x01
511#define RSL_CMOD_SP_GSM2 0x11
512#define RSL_CMOD_SP_GSM3 0x21
Vadim Yanitskiy99f6cd52021-04-19 04:26:10 +0200513#define RSL_CMOD_SP_GSM4 0x31
514#define RSL_CMOD_SP_GSM5 0x09
515#define RSL_CMOD_SP_GSM6 0x0d
Vadim Yanitskiye731a7d2021-04-19 04:59:51 +0200516/* non-transparent data (asymmetric) */
517#define RSL_CMOD_CSD_NTA_43k5_14k5 0x61 /* asymmetric 43.5 kbit/s (DL) + 14.5 kbit/s (UL) */
518#define RSL_CMOD_CSD_NTA_29k0_14k5 0x62 /* asymmetric 29.0 kbit/s (DL) + 14.5 kbit/s (UL) */
519#define RSL_CMOD_CSD_NTA_43k5_29k0 0x63 /* asymmetric 43.5 kbit/s (DL) + 29.0 kbit/s (UL) */
520#define RSL_CMOD_CSD_NTA_14k5_43k5 0x69 /* asymmetric 14.5 kbit/s (DL) + 43.5 kbit/s (UL) */
521#define RSL_CMOD_CSD_NTA_14k5_29k0 0x6a /* asymmetric 14.5 kbit/s (DL) + 29.0 kbit/s (UL) */
522#define RSL_CMOD_CSD_NTA_29k0_43k5 0x6b /* asymmetric 29.0 kbit/s (DL) + 43.5 kbit/s (UL) */
Harald Welteeed26112012-08-24 15:35:34 +0200523/* non-transparent data */
524#define RSL_CMOD_CSD_NT_43k5 0x74
525#define RSL_CMOD_CSD_NT_28k8 0x71
526#define RSL_CMOD_CSD_NT_14k5 0x58
527#define RSL_CMOD_CSD_NT_12k0 0x50
528#define RSL_CMOD_CSD_NT_6k0 0x51
529/* legacy #defines with wrong name */
530#define RSL_CMOD_SP_NT_14k5 RSL_CMOD_CSD_NT_14k5
531#define RSL_CMOD_SP_NT_12k0 RSL_CMOD_CSD_NT_12k0
532#define RSL_CMOD_SP_NT_6k0 RSL_CMOD_CSD_NT_6k0
533/* transparent data */
534#define RSL_CMOD_CSD_T_32000 0x38
535#define RSL_CMOD_CSD_T_29000 0x39
536#define RSL_CMOD_CSD_T_14400 0x18
537#define RSL_CMOD_CSD_T_9600 0x10
538#define RSL_CMOD_CSD_T_4800 0x11
539#define RSL_CMOD_CSD_T_2400 0x12
540#define RSL_CMOD_CSD_T_1200 0x13
541#define RSL_CMOD_CSD_T_600 0x14
542#define RSL_CMOD_CSD_T_1200_75 0x15
Harald Welteec8b4502010-02-20 20:34:29 +0100543
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200544/*! RSL Channel Identification IE (Chapter 9.3.5) */
Harald Welteec8b4502010-02-20 20:34:29 +0100545struct rsl_ie_chan_ident {
546 /* GSM 04.08 10.5.2.5 */
547 struct {
548 uint8_t iei;
549 uint8_t chan_nr; /* enc_chan_nr */
550 uint8_t oct3;
551 uint8_t oct4;
552 } chan_desc;
553#if 0 /* spec says we need this but Abissim doesn't use it */
554 struct {
555 uint8_t tag;
556 uint8_t len;
557 } mobile_alloc;
558#endif
559} __attribute__ ((packed));
560
561/* Chapter 9.3.22 */
562#define RLL_CAUSE_T200_EXPIRED 0x01
563#define RLL_CAUSE_REEST_REQ 0x02
564#define RLL_CAUSE_UNSOL_UA_RESP 0x03
565#define RLL_CAUSE_UNSOL_DM_RESP 0x04
566#define RLL_CAUSE_UNSOL_DM_RESP_MF 0x05
567#define RLL_CAUSE_UNSOL_SPRV_RESP 0x06
568#define RLL_CAUSE_SEQ_ERR 0x07
569#define RLL_CAUSE_UFRM_INC_PARAM 0x08
570#define RLL_CAUSE_SFRM_INC_PARAM 0x09
571#define RLL_CAUSE_IFRM_INC_MBITS 0x0a
572#define RLL_CAUSE_IFRM_INC_LEN 0x0b
573#define RLL_CAUSE_FRM_UNIMPL 0x0c
574#define RLL_CAUSE_SABM_MF 0x0d
575#define RLL_CAUSE_SABM_INFO_NOTALL 0x0e
576
577/* Chapter 9.3.26 */
578#define RSL_ERRCLS_NORMAL 0x00
579#define RSL_ERRCLS_RESOURCE_UNAVAIL 0x20
580#define RSL_ERRCLS_SERVICE_UNAVAIL 0x30
581#define RSL_ERRCLS_SERVICE_UNIMPL 0x40
582#define RSL_ERRCLS_INVAL_MSG 0x50
583#define RSL_ERRCLS_PROTO_ERROR 0x60
584#define RSL_ERRCLS_INTERWORKING 0x70
585
586/* normal event */
587#define RSL_ERR_RADIO_IF_FAIL 0x00
588#define RSL_ERR_RADIO_LINK_FAIL 0x01
589#define RSL_ERR_HANDOVER_ACC_FAIL 0x02
590#define RSL_ERR_TALKER_ACC_FAIL 0x03
591#define RSL_ERR_OM_INTERVENTION 0x07
592#define RSL_ERR_NORMAL_UNSPEC 0x0f
593#define RSL_ERR_T_MSRFPCI_EXP 0x18
594/* resource unavailable */
595#define RSL_ERR_EQUIPMENT_FAIL 0x20
596#define RSL_ERR_RR_UNAVAIL 0x21
597#define RSL_ERR_TERR_CH_FAIL 0x22
598#define RSL_ERR_CCCH_OVERLOAD 0x23
599#define RSL_ERR_ACCH_OVERLOAD 0x24
600#define RSL_ERR_PROCESSOR_OVERLOAD 0x25
Philipp Maier6d214482020-07-28 16:53:27 +0200601#define RSL_ERR_BTS_NOT_EQUIPPED 0x27
602#define RSL_ERR_REMOTE_TRANSC_FAIL 0x28
603#define RSL_ERR_NOTIFICATION_OVERFL 0x29
Harald Welteec8b4502010-02-20 20:34:29 +0100604#define RSL_ERR_RES_UNAVAIL 0x2f
605/* service or option not available */
606#define RSL_ERR_TRANSC_UNAVAIL 0x30
607#define RSL_ERR_SERV_OPT_UNAVAIL 0x3f
608/* service or option not implemented */
609#define RSL_ERR_ENCR_UNIMPL 0x40
610#define RSL_ERR_SERV_OPT_UNIMPL 0x4f
611/* invalid message */
612#define RSL_ERR_RCH_ALR_ACTV_ALLOC 0x50
613#define RSL_ERR_INVALID_MESSAGE 0x5f
614/* protocol error */
615#define RSL_ERR_MSG_DISCR 0x60
616#define RSL_ERR_MSG_TYPE 0x61
617#define RSL_ERR_MSG_SEQ 0x62
618#define RSL_ERR_IE_ERROR 0x63
619#define RSL_ERR_MAND_IE_ERROR 0x64
620#define RSL_ERR_OPT_IE_ERROR 0x65
621#define RSL_ERR_IE_NONEXIST 0x66
622#define RSL_ERR_IE_LENGTH 0x67
623#define RSL_ERR_IE_CONTENT 0x68
624#define RSL_ERR_PROTO 0x6f
625/* interworking */
626#define RSL_ERR_INTERWORKING 0x7f
627
628/* Chapter 9.3.30 */
629#define RSL_SYSTEM_INFO_8 0x00
630#define RSL_SYSTEM_INFO_1 0x01
631#define RSL_SYSTEM_INFO_2 0x02
632#define RSL_SYSTEM_INFO_3 0x03
633#define RSL_SYSTEM_INFO_4 0x04
634#define RSL_SYSTEM_INFO_5 0x05
635#define RSL_SYSTEM_INFO_6 0x06
636#define RSL_SYSTEM_INFO_7 0x07
637#define RSL_SYSTEM_INFO_16 0x08
638#define RSL_SYSTEM_INFO_17 0x09
639#define RSL_SYSTEM_INFO_2bis 0x0a
640#define RSL_SYSTEM_INFO_2ter 0x0b
641#define RSL_SYSTEM_INFO_5bis 0x0d
642#define RSL_SYSTEM_INFO_5ter 0x0e
643#define RSL_SYSTEM_INFO_10 0x0f
Harald Welte3d732272011-06-25 21:39:01 +0200644#define RSL_EXT_MEAS_ORDER 0x47
Harald Welteec8b4502010-02-20 20:34:29 +0100645#define RSL_MEAS_INFO 0x48
646#define RSL_SYSTEM_INFO_13 0x28
Philipp00b15392016-11-14 12:34:15 +0100647#define RSL_ERIC_SYSTEM_INFO_13 0x0C
Harald Welteec8b4502010-02-20 20:34:29 +0100648#define RSL_SYSTEM_INFO_2quater 0x29
649#define RSL_SYSTEM_INFO_9 0x2a
650#define RSL_SYSTEM_INFO_18 0x2b
651#define RSL_SYSTEM_INFO_19 0x2c
652#define RSL_SYSTEM_INFO_20 0x2d
653
654/* Chapter 9.3.40 */
655#define RSL_CHANNEED_ANY 0x00
656#define RSL_CHANNEED_SDCCH 0x01
657#define RSL_CHANNEED_TCH_F 0x02
658#define RSL_CHANNEED_TCH_ForH 0x03
659
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200660/*! RSL Cell Broadcast Command (Chapter 9.3.45) */
Alex Badea84930182010-11-27 23:34:46 +0200661struct rsl_ie_cb_cmd_type {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100662#if OSMO_IS_LITTLE_ENDIAN
Alex Badea84930182010-11-27 23:34:46 +0200663 uint8_t last_block:2;
664 uint8_t spare:1;
665 uint8_t def_bcast:1;
666 uint8_t command:4;
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100667#elif OSMO_IS_BIG_ENDIAN
668/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
669 uint8_t command:4, def_bcast:1, spare:1, last_block:2;
670#endif
Alex Badea84930182010-11-27 23:34:46 +0200671} __attribute__ ((packed));
672/* ->command */
673#define RSL_CB_CMD_TYPE_NORMAL 0x00
674#define RSL_CB_CMD_TYPE_SCHEDULE 0x08
675#define RSL_CB_CMD_TYPE_DEFAULT 0x0e
676#define RSL_CB_CMD_TYPE_NULL 0x0f
677/* ->def_bcast */
678#define RSL_CB_CMD_DEFBCAST_NORMAL 0
679#define RSL_CB_CMD_DEFBCAST_NULL 1
680/* ->last_block */
681#define RSL_CB_CMD_LASTBLOCK_4 0
682#define RSL_CB_CMD_LASTBLOCK_1 1
683#define RSL_CB_CMD_LASTBLOCK_2 2
684#define RSL_CB_CMD_LASTBLOCK_3 3
685
Harald Welteec8b4502010-02-20 20:34:29 +0100686/* Chapter 3.3.2.3 Brocast control channel */
687/* CCCH-CONF, NC is not combined */
688#define RSL_BCCH_CCCH_CONF_1_NC 0x00
689#define RSL_BCCH_CCCH_CONF_1_C 0x01
690#define RSL_BCCH_CCCH_CONF_2_NC 0x02
691#define RSL_BCCH_CCCH_CONF_3_NC 0x04
692#define RSL_BCCH_CCCH_CONF_4_NC 0x06
693
694/* BS-PA-MFRMS */
695#define RSL_BS_PA_MFRMS_2 0x00
696#define RSL_BS_PA_MFRMS_3 0x01
697#define RSL_BS_PA_MFRMS_4 0x02
698#define RSL_BS_PA_MFRMS_5 0x03
699#define RSL_BS_PA_MFRMS_6 0x04
700#define RSL_BS_PA_MFRMS_7 0x05
701#define RSL_BS_PA_MFRMS_8 0x06
702#define RSL_BS_PA_MFRMS_9 0x07
703
704/* RSL_IE_IPAC_RTP_PAYLOAD[2] */
705enum rsl_ipac_rtp_payload {
706 RSL_IPAC_RTP_GSM = 1,
707 RSL_IPAC_RTP_EFR,
708 RSL_IPAC_RTP_AMR,
709 RSL_IPAC_RTP_CSD,
710 RSL_IPAC_RTP_MUX,
711};
712
713/* RSL_IE_IPAC_SPEECH_MODE, lower four bits */
714enum rsl_ipac_speech_mode_s {
715 RSL_IPAC_SPEECH_GSM_FR = 0, /* GSM FR (Type 1, FS) */
716 RSL_IPAC_SPEECH_GSM_EFR = 1, /* GSM EFR (Type 2, FS) */
717 RSL_IPAC_SPEECH_GSM_AMR_FR = 2, /* GSM AMR/FR (Type 3, FS) */
718 RSL_IPAC_SPEECH_GSM_HR = 3, /* GSM HR (Type 1, HS) */
719 RSL_IPAC_SPEECH_GSM_AMR_HR = 5, /* GSM AMR/hr (Type 3, HS) */
720 RSL_IPAC_SPEECH_AS_RTP = 0xf, /* As specified by RTP Payload IE */
721};
722/* RSL_IE_IPAC_SPEECH_MODE, upper four bits */
723enum rsl_ipac_speech_mode_m {
724 RSL_IPAC_SPEECH_M_RXTX = 0, /* Send and Receive */
725 RSL_IPAC_SPEECH_M_RX = 1, /* Receive only */
726 RSL_IPAC_SPEECH_M_TX = 2, /* Send only */
727};
728
729/* RSL_IE_IPAC_RTP_CSD_FMT, lower four bits */
730enum rsl_ipac_rtp_csd_format_d {
731 RSL_IPAC_RTP_CSD_EXT_TRAU = 0,
732 RSL_IPAC_RTP_CSD_NON_TRAU = 1,
733 RSL_IPAC_RTP_CSD_TRAU_BTS = 2,
734 RSL_IPAC_RTP_CSD_IWF_FREE = 3,
735};
736/* RSL_IE_IPAC_RTP_CSD_FMT, upper four bits */
737enum rsl_ipac_rtp_csd_format_ir {
738 RSL_IPAC_RTP_CSD_IR_8k = 0,
739 RSL_IPAC_RTP_CSD_IR_16k = 1,
740 RSL_IPAC_RTP_CSD_IR_32k = 2,
741 RSL_IPAC_RTP_CSD_IR_64k = 3,
742};
743
744/* Siemens vendor-specific RSL extensions */
745struct rsl_mrpci {
746 uint8_t power_class:3,
747 vgcs_capable:1,
748 vbs_capable:1,
749 gsm_phase:2;
750} __attribute__ ((packed));
751
752enum rsl_mrpci_pwrclass {
753 RSL_MRPCI_PWRC_1 = 0,
754 RSL_MRPCI_PWRC_2 = 1,
755 RSL_MRPCI_PWRC_3 = 2,
756 RSL_MRPCI_PWRC_4 = 3,
757 RSL_MRPCI_PWRC_5 = 4,
758};
759enum rsl_mrpci_phase {
760 RSL_MRPCI_PHASE_1 = 0,
761 /* reserved */
762 RSL_MRPCI_PHASE_2 = 2,
763 RSL_MRPCI_PHASE_2PLUS = 3,
764};
765
Holger Hans Peter Freyther0357e9b2012-12-06 11:57:31 +0100766/* 9.3.20 Release Mode */
767enum rsl_rel_mode {
768 RSL_REL_NORMAL = 0,
769 RSL_REL_LOCAL_END = 1,
770};
771
Neels Hofmeyr87e45502017-06-20 00:17:59 +0200772/*! ip.access specific embedded information elements */
Harald Weltefad57522015-12-13 11:56:36 +0100773enum rsl_ipac_embedded_ie {
774 RSL_IPAC_EIE_RXLEV = 0x00,
775 RSL_IPAC_EIE_RXQUAL = 0x01,
776 RSL_IPAC_EIE_FREQ_ERR = 0x02,
777 RSL_IPAC_EIE_TIMING_ERR = 0x03,
778 RSL_IPAC_EIE_MEAS_AVG_CFG = 0x04,
779 RSL_IPAC_EIE_BS_PWR_CTL = 0x05,
780 RSL_IPAC_EIE_MS_PWR_CTL = 0x06,
781 RSL_IPAC_EIE_HANDO_THRESH = 0x07,
782 RSL_IPAC_EIE_NCELL_DEFAULTS = 0x08,
783 RSL_IPAC_EIE_NCELL_LIST = 0x09,
784 RSL_IPAC_EIE_PC_THRESH_COMP = 0x0a,
785 RSL_IPAC_EIE_HO_THRESH_COMP = 0x0b,
786 RSL_IPAC_EIE_HO_CAUSE = 0x0c,
787 RSL_IPAC_EIE_HO_CANDIDATES = 0x0d,
788 RSL_IPAC_EIE_NCELL_BA_CHG_LIST = 0x0e,
789 RSL_IPAC_EIE_NUM_OF_MS = 0x10,
790 RSL_IPAC_EIE_HO_CAND_EXT = 0x11,
791 RSL_IPAC_EIE_NCELL_DEF_EXT = 0x12,
792 RSL_IPAC_EIE_NCELL_LIST_EXT = 0x13,
793 RSL_IPAC_EIE_MASTER_KEY = 0x14,
794 RSL_IPAC_EIE_MASTER_SALT = 0x15,
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400795 /* additional IPAC measurement pre-processing related IEI */
796 RSL_IPAC_EIE_MEAS_TRANS_RES = 0x16,
797 RSL_IPAC_EIE_3G_HO_PARAM = 0x17,
798 RSL_IPAC_EIE_3G_NCELL_LIST = 0x18,
799 RSL_IPAC_EIE_SDCCH_CTL_PARAM = 0x1a,
800 RSL_IPAC_EIE_AMR_CONV_THRESH = 0x1b,
801
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200802 /* Osmocom specific extensions: */
803 RSL_IPAC_EIE_OSMO_MEAS_AVG_CFG = 0xf0,
804 RSL_IPAC_EIE_OSMO_MS_PWR_CTL = 0xf1,
805 RSL_IPAC_EIE_OSMO_PC_THRESH_COMP = 0xf2,
806
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400807};
808
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200809/* Value of TLV IE RSL_IPAC_EIE_MEAS_AVG_CFG */
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400810struct ipac_preproc_ave_cfg {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100811#if OSMO_IS_LITTLE_ENDIAN
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400812 uint8_t h_reqave:5,
813 param_id:2,
814 reserved:1;
815 uint8_t h_reqt:5,
816 ave_method:3;
Vadim Yanitskiy8f5844e2020-12-25 00:19:45 +0100817 uint8_t params[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100818#elif OSMO_IS_BIG_ENDIAN
819/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
820 uint8_t reserved:1, param_id:2, h_reqave:5;
821 uint8_t ave_method:3, h_reqt:5;
Vadim Yanitskiy8f5844e2020-12-25 00:19:45 +0100822 uint8_t params[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100823#endif
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400824}__attribute__ ((packed));
825
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200826
827struct osmo_preproc_ave_cfg_field {
828#if OSMO_IS_LITTLE_ENDIAN
829 uint8_t h_reqave:5,
830 ave_enabled:1,
831 reserved:2;
832 uint8_t h_reqt:5,
833 ave_method:3;
834#elif OSMO_IS_BIG_ENDIAN
835/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
836 uint8_t reserved:2, ave_enabled:1, h_reqave:5;
837 uint8_t ave_method:3, h_reqt:5;
838#endif
839}__attribute__ ((packed));
840/* Value of TLV IE RSL_IPAC_EIE_OSMO_MEAS_AVG_CFG: */
841struct osmo_preproc_ave_cfg {
842 struct osmo_preproc_ave_cfg_field ci_fr;
843 struct osmo_preproc_ave_cfg_field ci_hr;
844 struct osmo_preproc_ave_cfg_field ci_amr_fr;
845 struct osmo_preproc_ave_cfg_field ci_amr_hr;
846 struct osmo_preproc_ave_cfg_field ci_sdcch;
847 struct osmo_preproc_ave_cfg_field ci_gprs;
848 uint8_t params[0]; /* Contains params for each above, appended one after the other */
849}__attribute__ ((packed));
850
851/*! MS/BS Power Control Thresholds (RSL_IPAC_EIE_MS_PWR_CTL) */
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100852struct ipac_preproc_pc_thresh {
853#if OSMO_IS_LITTLE_ENDIAN
854 uint8_t l_rxlev:6, reserved_l_rxlev:2;
855 uint8_t u_rxlev:6, reserved_u_rxlev:2;
Vadim Yanitskiy2060bbb2020-12-19 17:33:41 +0100856 uint8_t u_rxqual:3, reserved_u_rxqual:1,
857 l_rxqual:3, reserved_l_rxqual:1;
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100858#elif OSMO_IS_BIG_ENDIAN
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100859/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100860 uint8_t reserved_l_rxlev:2, l_rxlev:6;
861 uint8_t reserved_u_rxlev:2, u_rxlev:6;
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100862 uint8_t reserved_l_rxqual:1, l_rxqual:3, reserved_u_rxqual:1, u_rxqual:3;
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100863#endif
864}__attribute__ ((packed));
865
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200866/*! Osmocom extension for: MS/BS Power Control Thresholds (RSL_IPAC_EIE_OSMO_MS_PWR_CTL) */
867struct osmo_preproc_pc_thresh {
868 /* Carrier-to-Interference (C/I), in dB: */
869 int8_t l_ci_fr; int8_t u_ci_fr; /* FR/EFR */
870 int8_t l_ci_hr; int8_t u_ci_hr; /* HR */
871 int8_t l_ci_amr_fr; int8_t u_ci_amr_fr; /* AMR FR */
872 int8_t l_ci_amr_hr; int8_t u_ci_amr_hr; /* AMR HR */
873 int8_t l_ci_sdcch; int8_t u_ci_sdcch; /* SDCCH */
874 int8_t l_ci_gprs; int8_t u_ci_gprs; /* GPRS */
875}__attribute__ ((packed));
876
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100877/*! Handover Thresholds */
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400878struct ipac_preproc_ho_thresh {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100879#if OSMO_IS_LITTLE_ENDIAN
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400880 uint8_t l_rxlev_ul_h:6,
881 reserved_l_rxlev_ul:2;
882 uint8_t l_rxlev_dl_h:6,
883 reserved_l_rxlev_dl:2;
884 uint8_t rxlev_ul_ih:6,
885 reserved_rxlev_ul:2;
886 uint8_t rxlev_dl_ih:6,
887 reserved_rxlev_dl:2;
888 uint8_t l_rxqual_ul_h:3,
889 reserved_rxlqual_ul:1,
890 l_rxqual_dl_h:3,
891 reserved_rxqual_dl:1;
892 uint8_t ms_range_max:6,
893 reserved_ms_range:2;
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100894#elif OSMO_IS_BIG_ENDIAN
895/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
896 uint8_t reserved_l_rxlev_ul:2, l_rxlev_ul_h:6;
897 uint8_t reserved_l_rxlev_dl:2, l_rxlev_dl_h:6;
898 uint8_t reserved_rxlev_ul:2, rxlev_ul_ih:6;
899 uint8_t reserved_rxlev_dl:2, rxlev_dl_ih:6;
900 uint8_t reserved_rxqual_dl:1, l_rxqual_dl_h:3, reserved_rxlqual_ul:1, l_rxqual_ul_h:3;
901 uint8_t reserved_ms_range:2, ms_range_max:6;
902#endif
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400903}__attribute__ ((packed));
904
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200905/*! PC Threshold Comparators (RSL_IPAC_EIE_PC_THRESH_COMP) */
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100906struct ipac_preproc_pc_comp {
907#if OSMO_IS_LITTLE_ENDIAN
908 uint8_t p1:5, reserved_p1:3;
909 uint8_t n1:5, reserved_n1:3;
910 uint8_t p2:5, reserved_p2:3;
911 uint8_t n2:5, reserved_n2:3;
912 uint8_t p3:5, reserved_p3:3;
913 uint8_t n3:5, reserved_n3:3;
914 uint8_t p4:5, reserved_p4:3;
915 uint8_t n4:5, reserved_n4:3;
916 uint8_t pc_interval:5, reserved_pc:3;
917 uint8_t red_step_size:4, inc_step_size:4;
918#elif OSMO_IS_BIG_ENDIAN
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100919/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100920 uint8_t reserved_p1:3, p1:5;
921 uint8_t reserved_n1:3, n1:5;
922 uint8_t reserved_p2:3, p2:5;
923 uint8_t reserved_n2:3, n2:5;
924 uint8_t reserved_p3:3, p3:5;
925 uint8_t reserved_n3:3, n3:5;
926 uint8_t reserved_p4:3, p4:5;
927 uint8_t reserved_n4:3, n4:5;
928 uint8_t reserved_pc:3, pc_interval:5;
929 uint8_t inc_step_size:4, red_step_size:4;
930#endif
931}__attribute__ ((packed));
932
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200933/*! Osmocom extension for: PC Threshold Comparators (RSL_IPAC_EIE_OSMO_PC_THRESH_COMP) */
934struct ipac_preproc_pc_comp_field {
935#if OSMO_IS_LITTLE_ENDIAN
936 uint8_t lower_p:5, reserved_lower_p:3;
937 uint8_t lower_n:5, reserved_lower_n:3;
938 uint8_t upper_p:5, reserved_upper_p:3;
939 uint8_t upper_n:5, reserved_upper_n:3;
940#elif OSMO_IS_BIG_ENDIAN
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100941/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200942 uint8_t reserved_lower_p:3, lower_p:5;
943 uint8_t reserved_lower_n:3, lower_n:5;
944 uint8_t reserved_upper_p:3, upper_p:5;
945 uint8_t reserved_upper_n:3, upper_n:5;
Pau Espin Pedrol28c43882021-12-22 13:56:42 +0100946#endif
Pau Espin Pedrol51933842021-08-30 13:50:56 +0200947}__attribute__ ((packed));
948struct osmo_preproc_pc_comp {
949 /* Used for Carrier-to-Interference (C/I), in dB: */
950 struct ipac_preproc_pc_comp_field ci_fr;
951 struct ipac_preproc_pc_comp_field ci_hr;
952 struct ipac_preproc_pc_comp_field ci_amr_fr;
953 struct ipac_preproc_pc_comp_field ci_amr_hr;
954 struct ipac_preproc_pc_comp_field ci_sdcch;
955 struct ipac_preproc_pc_comp_field ci_gprs;
956}__attribute__ ((packed));
957
Vadim Yanitskiya346c452020-12-15 07:48:58 +0100958/*! HO Threshold Comparators */
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400959struct ipac_preproc_ho_comp {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100960#if OSMO_IS_LITTLE_ENDIAN
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400961 uint8_t p5:5,
962 reserved_p5:3;
963 uint8_t n5:5,
964 reserved_n5:3;
965 uint8_t p6:5,
966 reserved_p6:3;
967 uint8_t n6:5,
968 reserved_n6:3;
969 uint8_t p7:5,
970 reserved_p7:3;
971 uint8_t n7:5,
972 reserved_n7:3;
973 uint8_t p8:5,
974 reserved_p8:3;
975 uint8_t n8:5,
976 reserved_n8:3;
977 uint8_t ho_interval:5,
978 reserved_ho:3;
979 uint8_t reserved;
980
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100981#elif OSMO_IS_BIG_ENDIAN
982/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
983 uint8_t reserved_p5:3, p5:5;
984 uint8_t reserved_n5:3, n5:5;
985 uint8_t reserved_p6:3, p6:5;
986 uint8_t reserved_n6:3, n6:5;
987 uint8_t reserved_p7:3, p7:5;
988 uint8_t reserved_n7:3, n7:5;
989 uint8_t reserved_p8:3, p8:5;
990 uint8_t reserved_n8:3, n8:5;
991 uint8_t reserved_ho:3, ho_interval:5;
992 uint8_t reserved;
993#endif
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400994}__attribute__ ((packed));
995
996struct ipac_preproc_ho_candidates {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100997#if OSMO_IS_LITTLE_ENDIAN
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -0400998 uint8_t bsic:6,
999 reserved0:2;
1000 uint8_t bcch_freq:5,
1001 ba_used:1,
1002 s:1,
1003 reserved1:1;
Neels Hofmeyrb2600392018-11-16 00:20:39 +01001004#elif OSMO_IS_BIG_ENDIAN
1005/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
1006 uint8_t reserved0:2, bsic:6;
1007 uint8_t reserved1:1, s:1, ba_used:1, bcch_freq:5;
1008#endif
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -04001009}__attribute__ ((packed));
1010
1011struct ipac_preproc_ncell_dflts {
Neels Hofmeyrb2600392018-11-16 00:20:39 +01001012#if OSMO_IS_LITTLE_ENDIAN
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -04001013 uint8_t rxlev_min_def:6,
1014 reserved_rxlev_min_def:2;
1015 uint8_t ho_margin_def:5,
1016 reserved_ho_margin_def:3;
1017 uint8_t ms_txpwr_max_def:5,
1018 reserved_ms_txpwr_max_def:3;
Neels Hofmeyrb2600392018-11-16 00:20:39 +01001019#elif OSMO_IS_BIG_ENDIAN
1020/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
1021 uint8_t reserved_rxlev_min_def:2, rxlev_min_def:6;
1022 uint8_t reserved_ho_margin_def:3, ho_margin_def:5;
1023 uint8_t reserved_ms_txpwr_max_def:3, ms_txpwr_max_def:5;
1024#endif
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -04001025}__attribute__ ((packed));
1026
Minh-Quang Nguyenadc28dc2017-02-06 11:13:31 -05001027struct ipac_preproc_ho_ctl_param {
Neels Hofmeyrb2600392018-11-16 00:20:39 +01001028#if OSMO_IS_LITTLE_ENDIAN
Minh-Quang Nguyenadc28dc2017-02-06 11:13:31 -05001029 uint8_t sdcch_ho_gsm:1,
1030 sdcch_ho_umts:1,
1031 reserved:6;
Neels Hofmeyrb2600392018-11-16 00:20:39 +01001032#elif OSMO_IS_BIG_ENDIAN
1033/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
1034 uint8_t reserved:6, sdcch_ho_umts:1, sdcch_ho_gsm:1;
1035#endif
Minh-Quang Nguyenadc28dc2017-02-06 11:13:31 -05001036}__attribute__ ((packed));
1037
Minh-Quang Nguyen17a87482016-09-02 11:28:31 -04001038struct ipac_preproc_cfg {
1039 uint8_t meas_rep_mode;
1040 uint32_t meas_mode_flags;
1041 struct ipac_preproc_ave_cfg ms_ave_cfg[3];
1042 struct ipac_preproc_ave_cfg ave_cfg;
1043 struct ipac_preproc_ho_thresh ho_thresh;
1044 struct ipac_preproc_ho_comp ho_comp;
1045 struct ipac_preproc_ncell_dflts ncell_dflts;
Minh-Quang Nguyenadc28dc2017-02-06 11:13:31 -05001046 struct ipac_preproc_ho_ctl_param ho_ctl_param;
Harald Weltefad57522015-12-13 11:56:36 +01001047};
1048
Philipp Maierca770ae2021-02-16 17:31:22 +01001049struct rsl_l1_info {
Pau Espin Pedrol28c43882021-12-22 13:56:42 +01001050#if OSMO_IS_LITTLE_ENDIAN
Philipp Maierca770ae2021-02-16 17:31:22 +01001051 uint8_t reserved:1,
1052 srr_sro:1,
1053 fpc_epc:1,
1054 ms_pwr:5;
1055 uint8_t ta;
Pau Espin Pedrol28c43882021-12-22 13:56:42 +01001056#elif OSMO_IS_BIG_ENDIAN
1057/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
1058 uint8_t ms_pwr:5, fpc_epc:1, srr_sro:1, reserved:1;
1059 uint8_t ta;
Philipp Maierca770ae2021-02-16 17:31:22 +01001060#endif
1061} __attribute__ ((packed));
1062
Sylvain Munautdca7d2c2012-04-18 21:53:23 +02001063/*! @} */