blob: b06077c38a2a39c6b41c06655d60bf04f0df7e3f [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 */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020015#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010016#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020017#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040018#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
19#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020020#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
21#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Max0a8fae82017-03-08 18:53:30 +010022#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040023
24/* sapi */
25#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020026#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
27#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040028#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
29#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
30#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
31#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
Alexander Couzens8343b4a2018-02-28 03:03:49 +010032#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040033
34/* flags */
35#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
36#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
37#define PCU_IF_FLAG_CS1 (1 << 16)
38#define PCU_IF_FLAG_CS2 (1 << 17)
39#define PCU_IF_FLAG_CS3 (1 << 18)
40#define PCU_IF_FLAG_CS4 (1 << 19)
41#define PCU_IF_FLAG_MCS1 (1 << 20)
42#define PCU_IF_FLAG_MCS2 (1 << 21)
43#define PCU_IF_FLAG_MCS3 (1 << 22)
44#define PCU_IF_FLAG_MCS4 (1 << 23)
45#define PCU_IF_FLAG_MCS5 (1 << 24)
46#define PCU_IF_FLAG_MCS6 (1 << 25)
47#define PCU_IF_FLAG_MCS7 (1 << 26)
48#define PCU_IF_FLAG_MCS8 (1 << 27)
49#define PCU_IF_FLAG_MCS9 (1 << 28)
50
Max0a8fae82017-03-08 18:53:30 +010051enum gsm_pcu_if_text_type {
52 PCU_VERSION,
53 PCU_OML_ALERT,
54};
55
56struct gsm_pcu_if_txt_ind {
57 uint8_t type; /* gsm_pcu_if_text_type */
58 char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */
59} __attribute__ ((packed));
60
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040061struct gsm_pcu_if_data {
62 uint8_t sapi;
63 uint8_t len;
64 uint8_t data[162];
65 uint32_t fn;
66 uint16_t arfcn;
67 uint8_t trx_nr;
68 uint8_t ts_nr;
69 uint8_t block_nr;
Andreas Eversberg570b44b2013-03-16 16:15:01 +010070 int8_t rssi;
Alexander Couzensd2a219e2018-02-28 02:56:12 +010071 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
72 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
73 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040074} __attribute__ ((packed));
75
Alexander Couzens8343b4a2018-02-28 03:03:49 +010076/* data confirmation with direct tlli (instead of raw mac block with tlli) */
77struct gsm_pcu_if_data_cnf_dt {
78 uint8_t sapi;
79 uint32_t tlli;
80 uint32_t fn;
81 uint16_t arfcn;
82 uint8_t trx_nr;
83 uint8_t ts_nr;
84 uint8_t block_nr;
85 int8_t rssi;
86 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
87 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
88 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
89} __attribute__ ((packed));
90
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040091struct gsm_pcu_if_rts_req {
92 uint8_t sapi;
93 uint8_t spare[3];
94 uint32_t fn;
95 uint16_t arfcn;
96 uint8_t trx_nr;
97 uint8_t ts_nr;
98 uint8_t block_nr;
99} __attribute__ ((packed));
100
101struct gsm_pcu_if_rach_ind {
102 uint8_t sapi;
bhargava959d1de2016-08-17 15:17:21 +0530103 uint16_t ra;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400104 int16_t qta;
105 uint32_t fn;
106 uint16_t arfcn;
bhargava959d1de2016-08-17 15:17:21 +0530107 uint8_t is_11bit;
108 uint8_t burst_type;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400109} __attribute__ ((packed));
110
111struct gsm_pcu_if_info_trx {
112 uint16_t arfcn;
113 uint8_t pdch_mask; /* PDCH channels per TS */
114 uint8_t spare;
115 uint8_t tsc[8]; /* TSC per channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200116 uint32_t hlayer1;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400117} __attribute__ ((packed));
118
119struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200120 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400121 uint32_t flags;
122 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200123 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400124 /* RAI */
Neels Hofmeyrbdc55fa2018-02-21 00:39:07 +0100125 uint16_t mcc, mnc;
126 uint8_t mnc_3_digits;
127 uint16_t lac, rac;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400128 /* NSE */
129 uint16_t nsei;
130 uint8_t nse_timer[7];
131 uint8_t cell_timer[11];
Alexander Couzensd2a219e2018-02-28 02:56:12 +0100132 /* cell */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400133 uint16_t cell_id;
134 uint16_t repeat_time;
135 uint8_t repeat_count;
136 uint16_t bvci;
137 uint8_t t3142;
138 uint8_t t3169;
139 uint8_t t3191;
140 uint8_t t3193_10ms;
141 uint8_t t3195;
142 uint8_t n3101;
143 uint8_t n3103;
144 uint8_t n3105;
145 uint8_t cv_countdown;
146 uint16_t dl_tbf_ext;
147 uint16_t ul_tbf_ext;
148 uint8_t initial_cs;
149 uint8_t initial_mcs;
150 /* NSVC */
151 uint16_t nsvci[2];
152 uint16_t local_port[2];
153 uint16_t remote_port[2];
154 uint32_t remote_ip[2];
155} __attribute__ ((packed));
156
157struct gsm_pcu_if_act_req {
158 uint8_t activate;
159 uint8_t trx_nr;
160 uint8_t ts_nr;
161 uint8_t spare;
162} __attribute__ ((packed));
163
164struct gsm_pcu_if_time_ind {
165 uint32_t fn;
166} __attribute__ ((packed));
167
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200168struct gsm_pcu_if_pag_req {
169 uint8_t sapi;
170 uint8_t chan_needed;
171 uint8_t identity_lv[9];
172} __attribute__ ((packed));
173
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400174struct gsm_pcu_if {
175 /* context based information */
176 uint8_t msg_type; /* message type */
177 uint8_t bts_nr; /* bts number */
178 uint8_t spare[2];
179
180 union {
181 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200182 struct gsm_pcu_if_data data_cnf;
Alexander Couzens8343b4a2018-02-28 03:03:49 +0100183 struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400184 struct gsm_pcu_if_data data_ind;
185 struct gsm_pcu_if_rts_req rts_req;
186 struct gsm_pcu_if_rach_ind rach_ind;
Max0a8fae82017-03-08 18:53:30 +0100187 struct gsm_pcu_if_txt_ind txt_ind;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400188 struct gsm_pcu_if_info_ind info_ind;
189 struct gsm_pcu_if_act_req act_req;
190 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200191 struct gsm_pcu_if_pag_req pag_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400192 } u;
193} __attribute__ ((packed));
194
195#endif /* _PCUIF_PROTO_H */