1 /* Messages to be sent between the different layers */
3 /* (C) 2010 by Harald Welte <laforge@gnumonks.org>
4 * (C) 2010 by Holger Hans Peter Freyther
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.
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.
20 #ifndef __L1CTL_PROTO_H__
21 #define __L1CTL_PROTO_H__
25 L1CTL_FBSB_REQ
= 0x01,
26 L1CTL_FBSB_CONF
= 0x02,
27 L1CTL_DATA_IND
= 0x03,
28 L1CTL_RACH_REQ
= 0x04,
29 L1CTL_DM_EST_REQ
= 0x05,
30 L1CTL_DATA_REQ
= 0x06,
31 L1CTL_RESET_IND
= 0x07,
32 L1CTL_PM_REQ
= 0x08, /* power measurement */
33 L1CTL_PM_CONF
= 0x09, /* power measurement */
34 L1CTL_ECHO_REQ
= 0x0a,
35 L1CTL_ECHO_CONF
= 0x0b,
36 L1CTL_RACH_CONF
= 0x0c,
37 L1CTL_RESET_REQ
= 0x0d,
38 L1CTL_RESET_CONF
= 0x0e,
39 L1CTL_DATA_CONF
= 0x0f,
40 L1CTL_CCCH_MODE_REQ
= 0x10,
41 L1CTL_CCCH_MODE_CONF
= 0x11,
42 L1CTL_DM_REL_REQ
= 0x12,
43 L1CTL_PARAM_REQ
= 0x13,
44 L1CTL_DM_FREQ_REQ
= 0x14,
45 L1CTL_CRYPTO_REQ
= 0x15,
47 L1CTL_SIM_CONF
= 0x17,
48 L1CTL_TCH_MODE_REQ
= 0x18,
49 L1CTL_TCH_MODE_CONF
= 0x19,
50 L1CTL_NEIGH_PM_REQ
= 0x1a,
51 L1CTL_NEIGH_PM_IND
= 0x1b,
52 L1CTL_TRAFFIC_REQ
= 0x1c,
53 L1CTL_TRAFFIC_CONF
= 0x1d,
54 L1CTL_TRAFFIC_IND
= 0x1e,
55 L1CTL_BURST_IND
= 0x1f,
56 L1CTL_GPRS_UL_TBF_CFG_REQ
= 0x20,
57 L1CTL_GPRS_DL_TBF_CFG_REQ
= 0x21,
58 L1CTL_GPRS_UL_BLOCK_REQ
= 0x22,
59 L1CTL_GPRS_DL_BLOCK_IND
= 0x23,
60 /* Extended (11-bit) RACH (see 3GPP TS 05.02, section 5.2.7) */
61 L1CTL_EXT_RACH_REQ
= 0x24,
62 L1CTL_GPRS_RTS_IND
= 0x25,
63 L1CTL_GPRS_UL_BLOCK_CNF
= 0x26,
68 CCCH_MODE_NON_COMBINED
,
70 CCCH_MODE_COMBINED_CBCH
,
80 * NOTE: struct size. We do add manual padding out of the believe
81 * that it will avoid some unaligned access.
84 /* there are no more messages in a sequence */
85 #define L1CTL_F_DONE 0x01
92 } __attribute__((packed
));
95 * downlink info ... down from the BTS..
97 struct l1ctl_info_dl
{
98 /* GSM 08.58 channel number (9.3.1) */
100 /* GSM 08.58 link identifier (9.3.2) */
102 /* the ARFCN and the band. FIXME: what about MAIO? */
107 uint8_t rx_level
; /* 0 .. 63 in typical GSM notation (dBm+110) */
108 uint8_t snr
; /* Signal/Noise Ration (dB) */
113 } __attribute__((packed
));
115 /* new CCCH was found. This is following the header */
116 struct l1ctl_fbsb_conf
{
117 int16_t initial_freq_err
;
120 /* FIXME: contents of cell_info ? */
121 } __attribute__((packed
));
123 /* CCCH mode was changed */
124 struct l1ctl_ccch_mode_conf
{
125 uint8_t ccch_mode
; /* enum ccch_mode */
127 } __attribute__((packed
));
129 /* 3GPP TS 44.014, section 5.1 (Calypso specific numbers) */
130 enum l1ctl_tch_loop_mode
{
131 L1CTL_TCH_LOOP_OPEN
= 0x00,
132 L1CTL_TCH_LOOP_A
= 0x01,
133 L1CTL_TCH_LOOP_B
= 0x02,
134 L1CTL_TCH_LOOP_C
= 0x03,
135 L1CTL_TCH_LOOP_D
= 0x04,
136 L1CTL_TCH_LOOP_E
= 0x05,
137 L1CTL_TCH_LOOP_F
= 0x06,
138 L1CTL_TCH_LOOP_I
= 0x07,
141 /* TCH mode was changed */
142 struct l1ctl_tch_mode_conf
{
143 uint8_t tch_mode
; /* enum tch_mode */
145 uint8_t tch_loop_mode
; /* enum l1ctl_tch_loop_mode */
146 struct { /* 3GPP TS 08.58 9.3.52, 3GPP TS 44.018 10.5.2.21aa */
148 uint8_t codecs_bitmask
;
151 } __attribute__((packed
));
153 /* data on the CCCH was found. This is following the header */
154 struct l1ctl_data_ind
{
156 } __attribute__((packed
));
158 /* traffic from the network */
159 struct l1ctl_traffic_ind
{
161 } __attribute__((packed
));
166 struct l1ctl_info_ul
{
167 /* GSM 08.58 channel number (9.3.1) */
169 /* GSM 08.58 link identifier (9.3.2) */
174 } __attribute__((packed
));
178 * the l1_info_ul header is in front
180 struct l1ctl_fbsb_req
{
182 uint16_t timeout
; /* in TDMA frames */
184 uint16_t freq_err_thresh1
;
185 uint16_t freq_err_thresh2
;
187 uint8_t num_freqerr_avg
;
188 uint8_t flags
; /* L1CTL_FBSB_F_* */
189 uint8_t sync_info_idx
;
190 uint8_t ccch_mode
; /* enum ccch_mode */
191 uint8_t rxlev_exp
; /* expected signal level */
192 } __attribute__((packed
));
194 #define L1CTL_FBSB_F_FB0 (1 << 0)
195 #define L1CTL_FBSB_F_FB1 (1 << 1)
196 #define L1CTL_FBSB_F_SB (1 << 2)
197 #define L1CTL_FBSB_F_FB01SB (L1CTL_FBSB_F_FB0|L1CTL_FBSB_F_FB1|L1CTL_FBSB_F_SB)
200 * msg for CCCH_MODE_REQ
201 * the l1_info_ul header is in front
203 struct l1ctl_ccch_mode_req
{
204 uint8_t ccch_mode
; /* enum ccch_mode */
206 } __attribute__((packed
));
209 * msg for TCH_MODE_REQ
210 * the l1_info_ul header is in front
212 struct l1ctl_tch_mode_req
{
213 uint8_t tch_mode
; /* enum gsm48_chan_mode */
214 #define AUDIO_TX_MICROPHONE (1<<0)
215 #define AUDIO_TX_TRAFFIC_REQ (1<<1)
216 #define AUDIO_RX_SPEAKER (1<<2)
217 #define AUDIO_RX_TRAFFIC_IND (1<<3)
219 uint8_t tch_loop_mode
; /* enum l1ctl_tch_loop_mode */
220 struct { /* 3GPP TS 08.58 9.3.52, 3GPP TS 44.018 10.5.2.21aa */
222 uint8_t codecs_bitmask
;
225 } __attribute__((packed
));
227 #define L1CTL_TCH_FLAG_RXONLY (1<<0) /* TX disabled */
229 /* the l1_info_ul header is in front */
230 struct l1ctl_rach_req
{
235 } __attribute__((packed
));
238 /* the l1_info_ul header is in front */
239 struct l1ctl_ext_rach_req
{
244 } __attribute__((packed
));
246 /* the l1_info_ul header is in front */
247 struct l1ctl_par_req
{
251 } __attribute__((packed
));
255 } __attribute__((packed
));
263 } __attribute__((packed
));
265 struct l1ctl_dm_est_req
{
275 } __attribute__((packed
));
277 struct l1ctl_dm_freq_req
{
285 } __attribute__((packed
));
287 struct l1ctl_crypto_req
{
291 } __attribute__((packed
));
293 struct l1ctl_pm_req
{
299 uint16_t band_arfcn_from
;
300 uint16_t band_arfcn_to
;
303 } __attribute__((packed
));
305 #define BI_FLG_DUMMY (1 << 4)
306 #define BI_FLG_SACCH (1 << 5)
308 struct l1ctl_burst_ind
{
310 uint16_t band_arfcn
; /* ARFCN + band + ul indicator */
311 uint8_t chan_nr
; /* GSM 08.58 channel number (9.3.1) */
312 uint8_t flags
; /* BI_FLG_xxx + burst_id = 2LSBs */
313 uint8_t rx_level
; /* 0 .. 63 in typical GSM notation (dBm+110) */
314 uint8_t snr
; /* Reported SNR >> 8 (0-255) */
315 uint8_t bits
[15]; /* 114 bits + 2 steal bits. Filled MSB first */
316 } __attribute__((packed
));
318 /* a single L1CTL_PM response */
319 struct l1ctl_pm_conf
{
322 } __attribute__((packed
));
324 enum l1ctl_reset_type
{
325 L1CTL_RES_T_BOOT
, /* only _IND */
330 /* argument to L1CTL_RESET_REQ and L1CTL_RESET_IND */
334 } __attribute__((packed
));
336 struct l1ctl_neigh_pm_req
{
339 uint16_t band_arfcn
[64];
341 } __attribute__((packed
));
343 /* neighbour cell measurement results */
344 struct l1ctl_neigh_pm_ind
{
349 } __attribute__((packed
));
351 /* traffic data to network */
352 struct l1ctl_traffic_req
{
354 } __attribute__((packed
));
356 /* payload of L1CTL_GPRS_UL_TBF_CFG_REQ */
357 struct l1ctl_gprs_ul_tbf_cfg_req
{
361 uint32_t start_fn
; /* TBF Starting Time (absolute Fn) */
362 } __attribute__((packed
));
364 /* payload of L1CTL_GPRS_DL_TBF_CFG_REQ */
365 struct l1ctl_gprs_dl_tbf_cfg_req
{
370 uint32_t start_fn
; /* TBF Starting Time (absolute Fn) */
371 } __attribute__((packed
));
373 /* part of L1CTL_GPRS_{UL,DL}_BLOCK_{REQ,IND} */
374 struct l1ctl_gprs_block_hdr
{
378 } __attribute__((packed
));
380 /* payload of L1CTL_GPRS_UL_BLOCK_REQ */
381 struct l1ctl_gprs_ul_block_req
{
382 struct l1ctl_gprs_block_hdr hdr
;
384 } __attribute__((packed
));
386 /* payload of L1CTL_GPRS_DL_BLOCK_IND */
387 struct l1ctl_gprs_dl_block_ind
{
388 struct l1ctl_gprs_block_hdr hdr
;
389 struct __attribute__((packed
)) {
390 uint16_t ber10k
; /* Bit Error Rate */
391 int16_t ci_cb
; /* C/I in centiBels */
392 uint8_t rx_lev
; /* RxLev 0..63 */
396 } __attribute__((packed
));
398 /* payload of L1CTL_GPRS_RTS_IND */
399 struct l1ctl_gprs_rts_ind
{
403 } __attribute__((packed
));
405 /* payload of L1CTL_GPRS_UL_BLOCK_CNF */
406 struct l1ctl_gprs_ul_block_cnf
{
410 } __attribute__((packed
));
412 #endif /* __L1CTL_PROTO_H__ */