blob: fd989a5e7d5ec430a0bcc62f1e97b679dbfda854 [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
Neels Hofmeyrbdc55fa2018-02-21 00:39:07 +01008#define PCU_IF_VERSION 0x09
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;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400111} __attribute__ ((packed));
112
113struct gsm_pcu_if_info_trx {
114 uint16_t arfcn;
115 uint8_t pdch_mask; /* PDCH channels per TS */
116 uint8_t spare;
117 uint8_t tsc[8]; /* TSC per channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200118 uint32_t hlayer1;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400119} __attribute__ ((packed));
120
121struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200122 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400123 uint32_t flags;
124 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200125 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400126 /* RAI */
Neels Hofmeyrbdc55fa2018-02-21 00:39:07 +0100127 uint16_t mcc, mnc;
128 uint8_t mnc_3_digits;
129 uint16_t lac, rac;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400130 /* NSE */
131 uint16_t nsei;
132 uint8_t nse_timer[7];
133 uint8_t cell_timer[11];
Alexander Couzensd2a219e2018-02-28 02:56:12 +0100134 /* cell */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400135 uint16_t cell_id;
136 uint16_t repeat_time;
137 uint8_t repeat_count;
138 uint16_t bvci;
139 uint8_t t3142;
140 uint8_t t3169;
141 uint8_t t3191;
142 uint8_t t3193_10ms;
143 uint8_t t3195;
144 uint8_t n3101;
145 uint8_t n3103;
146 uint8_t n3105;
147 uint8_t cv_countdown;
148 uint16_t dl_tbf_ext;
149 uint16_t ul_tbf_ext;
150 uint8_t initial_cs;
151 uint8_t initial_mcs;
152 /* NSVC */
153 uint16_t nsvci[2];
154 uint16_t local_port[2];
155 uint16_t remote_port[2];
156 uint32_t remote_ip[2];
157} __attribute__ ((packed));
158
159struct gsm_pcu_if_act_req {
160 uint8_t activate;
161 uint8_t trx_nr;
162 uint8_t ts_nr;
163 uint8_t spare;
164} __attribute__ ((packed));
165
166struct gsm_pcu_if_time_ind {
167 uint32_t fn;
168} __attribute__ ((packed));
169
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200170struct gsm_pcu_if_pag_req {
171 uint8_t sapi;
172 uint8_t chan_needed;
173 uint8_t identity_lv[9];
174} __attribute__ ((packed));
175
Oliver Smithcfb63212019-09-05 17:13:33 +0200176/* BTS tells PCU to [once] send given application data via PACCH to all UE with active TBF */
177struct gsm_pcu_if_app_info_req {
178 uint8_t application_type; /* 4bit field, see TS 44.060 11.2.47 */
179 uint8_t len; /* length of data */
180 uint8_t data[162]; /* random size choice; ETWS needs 56 bytes */
181} __attribute__ ((packed));
182
Harald Welte3447c4a2017-07-11 00:06:38 +0200183/* BTS tells PCU about a GPRS SUSPENSION REQUEST received on DCCH */
184struct gsm_pcu_if_susp_req {
185 uint32_t tlli;
186 uint8_t ra_id[6];
187 uint8_t cause;
188} __attribute__ ((packed));
189
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400190struct gsm_pcu_if {
191 /* context based information */
192 uint8_t msg_type; /* message type */
193 uint8_t bts_nr; /* bts number */
194 uint8_t spare[2];
195
196 union {
197 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200198 struct gsm_pcu_if_data data_cnf;
Alexander Couzens8343b4a2018-02-28 03:03:49 +0100199 struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400200 struct gsm_pcu_if_data data_ind;
Harald Welte3447c4a2017-07-11 00:06:38 +0200201 struct gsm_pcu_if_susp_req susp_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400202 struct gsm_pcu_if_rts_req rts_req;
203 struct gsm_pcu_if_rach_ind rach_ind;
Max0a8fae82017-03-08 18:53:30 +0100204 struct gsm_pcu_if_txt_ind txt_ind;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400205 struct gsm_pcu_if_info_ind info_ind;
206 struct gsm_pcu_if_act_req act_req;
207 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200208 struct gsm_pcu_if_pag_req pag_req;
Oliver Smithcfb63212019-09-05 17:13:33 +0200209 struct gsm_pcu_if_app_info_req app_info_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400210 } u;
211} __attribute__ ((packed));
212
213#endif /* _PCUIF_PROTO_H */