blob: 61c63af6eaeb3890c266a3f9e355fda7dbf9e800 [file] [log] [blame]
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +04001#ifndef _PCUIF_PROTO_H
2#define _PCUIF_PROTO_H
3
bhargava959d1de2016-08-17 15:17:21 +05304#include <osmocom/gsm/l1sap.h>
5
Pau Espin Pedrolc4178e52017-08-08 15:03:50 +02006#define PCU_SOCK_DEFAULT "/tmp/pcu_bts"
7
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +07008#define PCU_IF_VERSION 0x0a
Max0a8fae82017-03-08 18:53:30 +01009#define TXT_MAX_LEN 128
Andreas Eversberg8389fd02012-07-18 10:06:48 +020010
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040011/* msg_type */
12#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */
Andreas Eversberga9be1542012-09-27 09:23:24 +020013#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */
Alexander Couzensd2a219e2018-02-28 02:56:12 +010014#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */
Harald Welte3447c4a2017-07-11 00:06:38 +020015#define PCU_IF_MSG_SUSP_REQ 0x03 /* BTS forwards GPRS SUSP REQ to PCU */
Oliver Smithcfb63212019-09-05 17:13:33 +020016#define PCU_IF_MSG_APP_INFO_REQ 0x04 /* BTS asks PCU to transmit APP INFO via PACCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020017#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010018#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020019#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040020#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
21#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020022#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
23#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Max0a8fae82017-03-08 18:53:30 +010024#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040025
26/* sapi */
27#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020028#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
29#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040030#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
31#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
32#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
33#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010034#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040035
36/* flags */
37#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
38#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
39#define PCU_IF_FLAG_CS1 (1 << 16)
40#define PCU_IF_FLAG_CS2 (1 << 17)
41#define PCU_IF_FLAG_CS3 (1 << 18)
42#define PCU_IF_FLAG_CS4 (1 << 19)
43#define PCU_IF_FLAG_MCS1 (1 << 20)
44#define PCU_IF_FLAG_MCS2 (1 << 21)
45#define PCU_IF_FLAG_MCS3 (1 << 22)
46#define PCU_IF_FLAG_MCS4 (1 << 23)
47#define PCU_IF_FLAG_MCS5 (1 << 24)
48#define PCU_IF_FLAG_MCS6 (1 << 25)
49#define PCU_IF_FLAG_MCS7 (1 << 26)
50#define PCU_IF_FLAG_MCS8 (1 << 27)
51#define PCU_IF_FLAG_MCS9 (1 << 28)
52
Max0a8fae82017-03-08 18:53:30 +010053enum gsm_pcu_if_text_type {
54 PCU_VERSION,
55 PCU_OML_ALERT,
56};
57
58struct gsm_pcu_if_txt_ind {
59 uint8_t type; /* gsm_pcu_if_text_type */
60 char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */
61} __attribute__ ((packed));
62
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040063struct gsm_pcu_if_data {
64 uint8_t sapi;
65 uint8_t len;
66 uint8_t data[162];
67 uint32_t fn;
68 uint16_t arfcn;
69 uint8_t trx_nr;
70 uint8_t ts_nr;
71 uint8_t block_nr;
Andreas Eversberg570b44b2013-03-16 16:15:01 +010072 int8_t rssi;
Alexander Couzensd2a219e2018-02-28 02:56:12 +010073 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
74 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
75 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040076} __attribute__ ((packed));
77
Alexander Couzens8343b4a2018-02-28 03:03:49 +010078/* data confirmation with direct tlli (instead of raw mac block with tlli) */
79struct gsm_pcu_if_data_cnf_dt {
80 uint8_t sapi;
81 uint32_t tlli;
82 uint32_t fn;
83 uint16_t arfcn;
84 uint8_t trx_nr;
85 uint8_t ts_nr;
86 uint8_t block_nr;
87 int8_t rssi;
88 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
89 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
90 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
91} __attribute__ ((packed));
92
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040093struct gsm_pcu_if_rts_req {
94 uint8_t sapi;
95 uint8_t spare[3];
96 uint32_t fn;
97 uint16_t arfcn;
98 uint8_t trx_nr;
99 uint8_t ts_nr;
100 uint8_t block_nr;
101} __attribute__ ((packed));
102
103struct gsm_pcu_if_rach_ind {
104 uint8_t sapi;
bhargava959d1de2016-08-17 15:17:21 +0530105 uint16_t ra;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400106 int16_t qta;
107 uint32_t fn;
108 uint16_t arfcn;
bhargava959d1de2016-08-17 15:17:21 +0530109 uint8_t is_11bit;
110 uint8_t burst_type;
Vadim Yanitskiy17954da2019-10-05 23:21:33 +0700111 uint8_t trx_nr;
112 uint8_t ts_nr;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400113} __attribute__ ((packed));
114
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +0700115struct gsm_pcu_if_info_ts {
116 uint8_t tsc;
117 uint8_t h;
118 uint8_t hsn;
119 uint8_t maio;
120 uint8_t ma_bit_len;
121 uint8_t ma[8];
122} __attribute__ ((packed));
123
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400124struct gsm_pcu_if_info_trx {
125 uint16_t arfcn;
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +0700126 uint8_t pdch_mask; /* PDCH timeslot mask */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400127 uint8_t spare;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200128 uint32_t hlayer1;
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +0700129 struct gsm_pcu_if_info_ts ts[8]; /* timeslots per TRX */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400130} __attribute__ ((packed));
131
132struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200133 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400134 uint32_t flags;
135 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200136 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400137 /* RAI */
Neels Hofmeyrbdc55fa2018-02-21 00:39:07 +0100138 uint16_t mcc, mnc;
139 uint8_t mnc_3_digits;
140 uint16_t lac, rac;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400141 /* NSE */
142 uint16_t nsei;
143 uint8_t nse_timer[7];
144 uint8_t cell_timer[11];
Alexander Couzensd2a219e2018-02-28 02:56:12 +0100145 /* cell */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400146 uint16_t cell_id;
147 uint16_t repeat_time;
148 uint8_t repeat_count;
149 uint16_t bvci;
150 uint8_t t3142;
151 uint8_t t3169;
152 uint8_t t3191;
153 uint8_t t3193_10ms;
154 uint8_t t3195;
155 uint8_t n3101;
156 uint8_t n3103;
157 uint8_t n3105;
158 uint8_t cv_countdown;
159 uint16_t dl_tbf_ext;
160 uint16_t ul_tbf_ext;
161 uint8_t initial_cs;
162 uint8_t initial_mcs;
163 /* NSVC */
164 uint16_t nsvci[2];
165 uint16_t local_port[2];
166 uint16_t remote_port[2];
Alexander Couzens40a9e602020-09-16 03:22:06 +0200167 uint32_t remote_ip[2];
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400168} __attribute__ ((packed));
169
170struct gsm_pcu_if_act_req {
171 uint8_t activate;
172 uint8_t trx_nr;
173 uint8_t ts_nr;
174 uint8_t spare;
175} __attribute__ ((packed));
176
177struct gsm_pcu_if_time_ind {
178 uint32_t fn;
179} __attribute__ ((packed));
180
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200181struct gsm_pcu_if_pag_req {
182 uint8_t sapi;
183 uint8_t chan_needed;
184 uint8_t identity_lv[9];
185} __attribute__ ((packed));
186
Oliver Smithcfb63212019-09-05 17:13:33 +0200187/* BTS tells PCU to [once] send given application data via PACCH to all UE with active TBF */
188struct gsm_pcu_if_app_info_req {
189 uint8_t application_type; /* 4bit field, see TS 44.060 11.2.47 */
190 uint8_t len; /* length of data */
191 uint8_t data[162]; /* random size choice; ETWS needs 56 bytes */
192} __attribute__ ((packed));
193
Harald Welte3447c4a2017-07-11 00:06:38 +0200194/* BTS tells PCU about a GPRS SUSPENSION REQUEST received on DCCH */
195struct gsm_pcu_if_susp_req {
196 uint32_t tlli;
197 uint8_t ra_id[6];
198 uint8_t cause;
199} __attribute__ ((packed));
200
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400201struct gsm_pcu_if {
202 /* context based information */
203 uint8_t msg_type; /* message type */
204 uint8_t bts_nr; /* bts number */
205 uint8_t spare[2];
206
207 union {
208 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200209 struct gsm_pcu_if_data data_cnf;
Alexander Couzens8343b4a2018-02-28 03:03:49 +0100210 struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400211 struct gsm_pcu_if_data data_ind;
Harald Welte3447c4a2017-07-11 00:06:38 +0200212 struct gsm_pcu_if_susp_req susp_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400213 struct gsm_pcu_if_rts_req rts_req;
214 struct gsm_pcu_if_rach_ind rach_ind;
Max0a8fae82017-03-08 18:53:30 +0100215 struct gsm_pcu_if_txt_ind txt_ind;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400216 struct gsm_pcu_if_info_ind info_ind;
217 struct gsm_pcu_if_act_req act_req;
218 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200219 struct gsm_pcu_if_pag_req pag_req;
Oliver Smithcfb63212019-09-05 17:13:33 +0200220 struct gsm_pcu_if_app_info_req app_info_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400221 } u;
222} __attribute__ ((packed));
223
224#endif /* _PCUIF_PROTO_H */