blob: 144fba684e3476100f99caa3fb516c787ce27700 [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 */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020016#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010017#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020018#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040019#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
20#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020021#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
22#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Max0a8fae82017-03-08 18:53:30 +010023#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040024
25/* sapi */
26#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020027#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
28#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040029#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
30#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
31#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
32#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010033#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040034
35/* flags */
36#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
37#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
38#define PCU_IF_FLAG_CS1 (1 << 16)
39#define PCU_IF_FLAG_CS2 (1 << 17)
40#define PCU_IF_FLAG_CS3 (1 << 18)
41#define PCU_IF_FLAG_CS4 (1 << 19)
42#define PCU_IF_FLAG_MCS1 (1 << 20)
43#define PCU_IF_FLAG_MCS2 (1 << 21)
44#define PCU_IF_FLAG_MCS3 (1 << 22)
45#define PCU_IF_FLAG_MCS4 (1 << 23)
46#define PCU_IF_FLAG_MCS5 (1 << 24)
47#define PCU_IF_FLAG_MCS6 (1 << 25)
48#define PCU_IF_FLAG_MCS7 (1 << 26)
49#define PCU_IF_FLAG_MCS8 (1 << 27)
50#define PCU_IF_FLAG_MCS9 (1 << 28)
51
Max0a8fae82017-03-08 18:53:30 +010052enum gsm_pcu_if_text_type {
53 PCU_VERSION,
54 PCU_OML_ALERT,
55};
56
57struct gsm_pcu_if_txt_ind {
58 uint8_t type; /* gsm_pcu_if_text_type */
59 char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */
60} __attribute__ ((packed));
61
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040062struct gsm_pcu_if_data {
63 uint8_t sapi;
64 uint8_t len;
65 uint8_t data[162];
66 uint32_t fn;
67 uint16_t arfcn;
68 uint8_t trx_nr;
69 uint8_t ts_nr;
70 uint8_t block_nr;
Andreas Eversberg570b44b2013-03-16 16:15:01 +010071 int8_t rssi;
Alexander Couzensd2a219e2018-02-28 02:56:12 +010072 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
73 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
74 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040075} __attribute__ ((packed));
76
Alexander Couzens8343b4a2018-02-28 03:03:49 +010077/* data confirmation with direct tlli (instead of raw mac block with tlli) */
78struct gsm_pcu_if_data_cnf_dt {
79 uint8_t sapi;
80 uint32_t tlli;
81 uint32_t fn;
82 uint16_t arfcn;
83 uint8_t trx_nr;
84 uint8_t ts_nr;
85 uint8_t block_nr;
86 int8_t rssi;
87 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
88 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
89 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
90} __attribute__ ((packed));
91
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040092struct gsm_pcu_if_rts_req {
93 uint8_t sapi;
94 uint8_t spare[3];
95 uint32_t fn;
96 uint16_t arfcn;
97 uint8_t trx_nr;
98 uint8_t ts_nr;
99 uint8_t block_nr;
100} __attribute__ ((packed));
101
102struct gsm_pcu_if_rach_ind {
103 uint8_t sapi;
bhargava959d1de2016-08-17 15:17:21 +0530104 uint16_t ra;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400105 int16_t qta;
106 uint32_t fn;
107 uint16_t arfcn;
bhargava959d1de2016-08-17 15:17:21 +0530108 uint8_t is_11bit;
109 uint8_t burst_type;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400110} __attribute__ ((packed));
111
112struct gsm_pcu_if_info_trx {
113 uint16_t arfcn;
114 uint8_t pdch_mask; /* PDCH channels per TS */
115 uint8_t spare;
116 uint8_t tsc[8]; /* TSC per channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200117 uint32_t hlayer1;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400118} __attribute__ ((packed));
119
120struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200121 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400122 uint32_t flags;
123 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200124 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400125 /* RAI */
Neels Hofmeyrbdc55fa2018-02-21 00:39:07 +0100126 uint16_t mcc, mnc;
127 uint8_t mnc_3_digits;
128 uint16_t lac, rac;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400129 /* NSE */
130 uint16_t nsei;
131 uint8_t nse_timer[7];
132 uint8_t cell_timer[11];
Alexander Couzensd2a219e2018-02-28 02:56:12 +0100133 /* cell */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400134 uint16_t cell_id;
135 uint16_t repeat_time;
136 uint8_t repeat_count;
137 uint16_t bvci;
138 uint8_t t3142;
139 uint8_t t3169;
140 uint8_t t3191;
141 uint8_t t3193_10ms;
142 uint8_t t3195;
143 uint8_t n3101;
144 uint8_t n3103;
145 uint8_t n3105;
146 uint8_t cv_countdown;
147 uint16_t dl_tbf_ext;
148 uint16_t ul_tbf_ext;
149 uint8_t initial_cs;
150 uint8_t initial_mcs;
151 /* NSVC */
152 uint16_t nsvci[2];
153 uint16_t local_port[2];
154 uint16_t remote_port[2];
155 uint32_t remote_ip[2];
156} __attribute__ ((packed));
157
158struct gsm_pcu_if_act_req {
159 uint8_t activate;
160 uint8_t trx_nr;
161 uint8_t ts_nr;
162 uint8_t spare;
163} __attribute__ ((packed));
164
165struct gsm_pcu_if_time_ind {
166 uint32_t fn;
167} __attribute__ ((packed));
168
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200169struct gsm_pcu_if_pag_req {
170 uint8_t sapi;
171 uint8_t chan_needed;
172 uint8_t identity_lv[9];
173} __attribute__ ((packed));
174
Harald Welte3447c4a2017-07-11 00:06:38 +0200175/* BTS tells PCU about a GPRS SUSPENSION REQUEST received on DCCH */
176struct gsm_pcu_if_susp_req {
177 uint32_t tlli;
178 uint8_t ra_id[6];
179 uint8_t cause;
180} __attribute__ ((packed));
181
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400182struct gsm_pcu_if {
183 /* context based information */
184 uint8_t msg_type; /* message type */
185 uint8_t bts_nr; /* bts number */
186 uint8_t spare[2];
187
188 union {
189 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200190 struct gsm_pcu_if_data data_cnf;
Alexander Couzens8343b4a2018-02-28 03:03:49 +0100191 struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400192 struct gsm_pcu_if_data data_ind;
Harald Welte3447c4a2017-07-11 00:06:38 +0200193 struct gsm_pcu_if_susp_req susp_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400194 struct gsm_pcu_if_rts_req rts_req;
195 struct gsm_pcu_if_rach_ind rach_ind;
Max0a8fae82017-03-08 18:53:30 +0100196 struct gsm_pcu_if_txt_ind txt_ind;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400197 struct gsm_pcu_if_info_ind info_ind;
198 struct gsm_pcu_if_act_req act_req;
199 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200200 struct gsm_pcu_if_pag_req pag_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400201 } u;
202} __attribute__ ((packed));
203
204#endif /* _PCUIF_PROTO_H */