blob: 23b7a2cb4e7bdc0aaea548651773414bd75b5fb2 [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>
Alexander Couzens9b5c9602020-07-28 13:47:18 +02005#include <arpa/inet.h>
bhargava959d1de2016-08-17 15:17:21 +05306
Pau Espin Pedrolc4178e52017-08-08 15:03:50 +02007#define PCU_SOCK_DEFAULT "/tmp/pcu_bts"
8
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +07009#define PCU_IF_VERSION 0x0a
Max0a8fae82017-03-08 18:53:30 +010010#define TXT_MAX_LEN 128
Andreas Eversberg8389fd02012-07-18 10:06:48 +020011
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040012/* msg_type */
13#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */
Andreas Eversberga9be1542012-09-27 09:23:24 +020014#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */
Alexander Couzensd2a219e2018-02-28 02:56:12 +010015#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */
Harald Welte3447c4a2017-07-11 00:06:38 +020016#define PCU_IF_MSG_SUSP_REQ 0x03 /* BTS forwards GPRS SUSP REQ to PCU */
Oliver Smithcfb63212019-09-05 17:13:33 +020017#define PCU_IF_MSG_APP_INFO_REQ 0x04 /* BTS asks PCU to transmit APP INFO via PACCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020018#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010019#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020020#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040021#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
22#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020023#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
Vadim Yanitskiy94dc6a82021-06-20 21:00:40 +020024#define PCU_IF_MSG_INTERF_IND 0x53 /* interference report */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020025#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Max0a8fae82017-03-08 18:53:30 +010026#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
Pau Espin Pedrol8c292362021-06-23 17:47:59 +020027#define PCU_IF_MSG_CONTAINER 0x80 /* Transparent container message */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040028
29/* sapi */
30#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020031#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
32#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040033#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
34#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
35#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
36#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010037#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040038
39/* flags */
40#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
41#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
42#define PCU_IF_FLAG_CS1 (1 << 16)
43#define PCU_IF_FLAG_CS2 (1 << 17)
44#define PCU_IF_FLAG_CS3 (1 << 18)
45#define PCU_IF_FLAG_CS4 (1 << 19)
46#define PCU_IF_FLAG_MCS1 (1 << 20)
47#define PCU_IF_FLAG_MCS2 (1 << 21)
48#define PCU_IF_FLAG_MCS3 (1 << 22)
49#define PCU_IF_FLAG_MCS4 (1 << 23)
50#define PCU_IF_FLAG_MCS5 (1 << 24)
51#define PCU_IF_FLAG_MCS6 (1 << 25)
52#define PCU_IF_FLAG_MCS7 (1 << 26)
53#define PCU_IF_FLAG_MCS8 (1 << 27)
54#define PCU_IF_FLAG_MCS9 (1 << 28)
55
Alexander Couzens9b5c9602020-07-28 13:47:18 +020056/* NSVC address type */
57#define PCU_IF_ADDR_TYPE_UNSPEC 0x00 /* No address - empty entry */
58#define PCU_IF_ADDR_TYPE_IPV4 0x04 /* IPv4 address */
59#define PCU_IF_ADDR_TYPE_IPV6 0x29 /* IPv6 address */
60
Alexander Couzens5bece2a2020-10-12 02:27:22 +020061#define PCU_IF_NUM_NSVC 2
62
Max0a8fae82017-03-08 18:53:30 +010063enum gsm_pcu_if_text_type {
64 PCU_VERSION,
65 PCU_OML_ALERT,
66};
67
68struct gsm_pcu_if_txt_ind {
69 uint8_t type; /* gsm_pcu_if_text_type */
70 char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */
71} __attribute__ ((packed));
72
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040073struct gsm_pcu_if_data {
74 uint8_t sapi;
75 uint8_t len;
76 uint8_t data[162];
77 uint32_t fn;
78 uint16_t arfcn;
79 uint8_t trx_nr;
80 uint8_t ts_nr;
81 uint8_t block_nr;
Andreas Eversberg570b44b2013-03-16 16:15:01 +010082 int8_t rssi;
Alexander Couzensd2a219e2018-02-28 02:56:12 +010083 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
84 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
85 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040086} __attribute__ ((packed));
87
Alexander Couzens8343b4a2018-02-28 03:03:49 +010088/* data confirmation with direct tlli (instead of raw mac block with tlli) */
89struct gsm_pcu_if_data_cnf_dt {
90 uint8_t sapi;
91 uint32_t tlli;
92 uint32_t fn;
93 uint16_t arfcn;
94 uint8_t trx_nr;
95 uint8_t ts_nr;
96 uint8_t block_nr;
97 int8_t rssi;
98 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
99 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
100 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
101} __attribute__ ((packed));
102
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400103struct gsm_pcu_if_rts_req {
104 uint8_t sapi;
105 uint8_t spare[3];
106 uint32_t fn;
107 uint16_t arfcn;
108 uint8_t trx_nr;
109 uint8_t ts_nr;
110 uint8_t block_nr;
111} __attribute__ ((packed));
112
113struct gsm_pcu_if_rach_ind {
114 uint8_t sapi;
bhargava959d1de2016-08-17 15:17:21 +0530115 uint16_t ra;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400116 int16_t qta;
117 uint32_t fn;
118 uint16_t arfcn;
bhargava959d1de2016-08-17 15:17:21 +0530119 uint8_t is_11bit;
120 uint8_t burst_type;
Vadim Yanitskiy17954da2019-10-05 23:21:33 +0700121 uint8_t trx_nr;
122 uint8_t ts_nr;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400123} __attribute__ ((packed));
124
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +0700125struct gsm_pcu_if_info_ts {
126 uint8_t tsc;
127 uint8_t h;
128 uint8_t hsn;
129 uint8_t maio;
130 uint8_t ma_bit_len;
131 uint8_t ma[8];
132} __attribute__ ((packed));
133
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400134struct gsm_pcu_if_info_trx {
135 uint16_t arfcn;
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +0700136 uint8_t pdch_mask; /* PDCH timeslot mask */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400137 uint8_t spare;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200138 uint32_t hlayer1;
Vadim Yanitskiy8e2bd1e2020-07-21 00:54:42 +0700139 struct gsm_pcu_if_info_ts ts[8]; /* timeslots per TRX */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400140} __attribute__ ((packed));
141
142struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200143 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400144 uint32_t flags;
145 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200146 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400147 /* RAI */
Neels Hofmeyrbdc55fa2018-02-21 00:39:07 +0100148 uint16_t mcc, mnc;
149 uint8_t mnc_3_digits;
150 uint16_t lac, rac;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400151 /* NSE */
152 uint16_t nsei;
153 uint8_t nse_timer[7];
154 uint8_t cell_timer[11];
Alexander Couzensd2a219e2018-02-28 02:56:12 +0100155 /* cell */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400156 uint16_t cell_id;
157 uint16_t repeat_time;
158 uint8_t repeat_count;
159 uint16_t bvci;
160 uint8_t t3142;
161 uint8_t t3169;
162 uint8_t t3191;
163 uint8_t t3193_10ms;
164 uint8_t t3195;
165 uint8_t n3101;
166 uint8_t n3103;
167 uint8_t n3105;
168 uint8_t cv_countdown;
169 uint16_t dl_tbf_ext;
170 uint16_t ul_tbf_ext;
171 uint8_t initial_cs;
172 uint8_t initial_mcs;
173 /* NSVC */
Alexander Couzens5bece2a2020-10-12 02:27:22 +0200174 uint16_t nsvci[PCU_IF_NUM_NSVC];
175 uint16_t local_port[PCU_IF_NUM_NSVC];
176 uint16_t remote_port[PCU_IF_NUM_NSVC];
177 uint8_t address_type[PCU_IF_NUM_NSVC];
Alexander Couzens9b5c9602020-07-28 13:47:18 +0200178 union {
179 struct in_addr v4;
180 struct in6_addr v6;
Alexander Couzens5bece2a2020-10-12 02:27:22 +0200181 } remote_ip[PCU_IF_NUM_NSVC];
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400182} __attribute__ ((packed));
183
184struct gsm_pcu_if_act_req {
185 uint8_t activate;
186 uint8_t trx_nr;
187 uint8_t ts_nr;
188 uint8_t spare;
189} __attribute__ ((packed));
190
191struct gsm_pcu_if_time_ind {
192 uint32_t fn;
193} __attribute__ ((packed));
194
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200195struct gsm_pcu_if_pag_req {
196 uint8_t sapi;
197 uint8_t chan_needed;
198 uint8_t identity_lv[9];
199} __attribute__ ((packed));
200
Oliver Smithcfb63212019-09-05 17:13:33 +0200201/* BTS tells PCU to [once] send given application data via PACCH to all UE with active TBF */
202struct gsm_pcu_if_app_info_req {
203 uint8_t application_type; /* 4bit field, see TS 44.060 11.2.47 */
204 uint8_t len; /* length of data */
205 uint8_t data[162]; /* random size choice; ETWS needs 56 bytes */
206} __attribute__ ((packed));
207
Harald Welte3447c4a2017-07-11 00:06:38 +0200208/* BTS tells PCU about a GPRS SUSPENSION REQUEST received on DCCH */
209struct gsm_pcu_if_susp_req {
210 uint32_t tlli;
211 uint8_t ra_id[6];
212 uint8_t cause;
213} __attribute__ ((packed));
214
Vadim Yanitskiy94dc6a82021-06-20 21:00:40 +0200215/* Interference measurements on PDCH timeslots */
216struct gsm_pcu_if_interf_ind {
217 uint8_t trx_nr;
218 uint8_t spare[3];
219 uint32_t fn;
220 uint8_t interf[8];
221} __attribute__ ((packed));
222
Pau Espin Pedrol8c292362021-06-23 17:47:59 +0200223/* Contains messages transmitted BSC<->PCU, potentially forwarded by BTS via IPA/PCU */
224struct gsm_pcu_if_container {
225 uint8_t msg_type;
226 uint8_t spare;
227 uint16_t length; /* network byte order */
228 uint8_t data[0];
229} __attribute__ ((packed));
230
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400231struct gsm_pcu_if {
232 /* context based information */
233 uint8_t msg_type; /* message type */
234 uint8_t bts_nr; /* bts number */
235 uint8_t spare[2];
236
237 union {
238 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200239 struct gsm_pcu_if_data data_cnf;
Alexander Couzens8343b4a2018-02-28 03:03:49 +0100240 struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400241 struct gsm_pcu_if_data data_ind;
Harald Welte3447c4a2017-07-11 00:06:38 +0200242 struct gsm_pcu_if_susp_req susp_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400243 struct gsm_pcu_if_rts_req rts_req;
244 struct gsm_pcu_if_rach_ind rach_ind;
Max0a8fae82017-03-08 18:53:30 +0100245 struct gsm_pcu_if_txt_ind txt_ind;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400246 struct gsm_pcu_if_info_ind info_ind;
247 struct gsm_pcu_if_act_req act_req;
248 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200249 struct gsm_pcu_if_pag_req pag_req;
Oliver Smithcfb63212019-09-05 17:13:33 +0200250 struct gsm_pcu_if_app_info_req app_info_req;
Vadim Yanitskiy94dc6a82021-06-20 21:00:40 +0200251 struct gsm_pcu_if_interf_ind interf_ind;
Pau Espin Pedrol8c292362021-06-23 17:47:59 +0200252 struct gsm_pcu_if_container container;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400253 } u;
254} __attribute__ ((packed));
255
256#endif /* _PCUIF_PROTO_H */