blob: 88dc09ec0686ed341681e3a3d001cb3446702151 [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
6#define PCU_IF_VERSION 0x07
Max0a8fae82017-03-08 18:53:30 +01007#define TXT_MAX_LEN 128
Andreas Eversberg8389fd02012-07-18 10:06:48 +02008
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +04009/* msg_type */
10#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */
Andreas Eversberga9be1542012-09-27 09:23:24 +020011#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040012#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020013#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
14#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040015#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
16#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020017#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
18#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Max0a8fae82017-03-08 18:53:30 +010019#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040020
21/* sapi */
22#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020023#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
24#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040025#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
26#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
27#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
28#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
29
30/* flags */
31#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
32#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
33#define PCU_IF_FLAG_CS1 (1 << 16)
34#define PCU_IF_FLAG_CS2 (1 << 17)
35#define PCU_IF_FLAG_CS3 (1 << 18)
36#define PCU_IF_FLAG_CS4 (1 << 19)
37#define PCU_IF_FLAG_MCS1 (1 << 20)
38#define PCU_IF_FLAG_MCS2 (1 << 21)
39#define PCU_IF_FLAG_MCS3 (1 << 22)
40#define PCU_IF_FLAG_MCS4 (1 << 23)
41#define PCU_IF_FLAG_MCS5 (1 << 24)
42#define PCU_IF_FLAG_MCS6 (1 << 25)
43#define PCU_IF_FLAG_MCS7 (1 << 26)
44#define PCU_IF_FLAG_MCS8 (1 << 27)
45#define PCU_IF_FLAG_MCS9 (1 << 28)
46
Max0a8fae82017-03-08 18:53:30 +010047enum gsm_pcu_if_text_type {
48 PCU_VERSION,
49 PCU_OML_ALERT,
50};
51
52struct gsm_pcu_if_txt_ind {
53 uint8_t type; /* gsm_pcu_if_text_type */
54 char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */
55} __attribute__ ((packed));
56
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040057struct gsm_pcu_if_data {
58 uint8_t sapi;
59 uint8_t len;
60 uint8_t data[162];
61 uint32_t fn;
62 uint16_t arfcn;
63 uint8_t trx_nr;
64 uint8_t ts_nr;
65 uint8_t block_nr;
Andreas Eversberg570b44b2013-03-16 16:15:01 +010066 int8_t rssi;
Maxcbf9a722016-07-28 14:54:13 +020067 uint16_t ber10k; /*!< \brief BER in units of 0.01% */
68 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
69 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040070} __attribute__ ((packed));
71
72struct gsm_pcu_if_rts_req {
73 uint8_t sapi;
74 uint8_t spare[3];
75 uint32_t fn;
76 uint16_t arfcn;
77 uint8_t trx_nr;
78 uint8_t ts_nr;
79 uint8_t block_nr;
80} __attribute__ ((packed));
81
82struct gsm_pcu_if_rach_ind {
83 uint8_t sapi;
bhargava959d1de2016-08-17 15:17:21 +053084 uint16_t ra;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040085 int16_t qta;
86 uint32_t fn;
87 uint16_t arfcn;
bhargava959d1de2016-08-17 15:17:21 +053088 uint8_t is_11bit;
89 uint8_t burst_type;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040090} __attribute__ ((packed));
91
92struct gsm_pcu_if_info_trx {
93 uint16_t arfcn;
94 uint8_t pdch_mask; /* PDCH channels per TS */
95 uint8_t spare;
96 uint8_t tsc[8]; /* TSC per channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020097 uint32_t hlayer1;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040098} __attribute__ ((packed));
99
100struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200101 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400102 uint32_t flags;
103 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200104 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400105 /* RAI */
106 uint16_t mcc, mnc, lac, rac;
107 /* NSE */
108 uint16_t nsei;
109 uint8_t nse_timer[7];
110 uint8_t cell_timer[11];
111 /* cell */
112 uint16_t cell_id;
113 uint16_t repeat_time;
114 uint8_t repeat_count;
115 uint16_t bvci;
116 uint8_t t3142;
117 uint8_t t3169;
118 uint8_t t3191;
119 uint8_t t3193_10ms;
120 uint8_t t3195;
121 uint8_t n3101;
122 uint8_t n3103;
123 uint8_t n3105;
124 uint8_t cv_countdown;
125 uint16_t dl_tbf_ext;
126 uint16_t ul_tbf_ext;
127 uint8_t initial_cs;
128 uint8_t initial_mcs;
129 /* NSVC */
130 uint16_t nsvci[2];
131 uint16_t local_port[2];
132 uint16_t remote_port[2];
133 uint32_t remote_ip[2];
134} __attribute__ ((packed));
135
136struct gsm_pcu_if_act_req {
137 uint8_t activate;
138 uint8_t trx_nr;
139 uint8_t ts_nr;
140 uint8_t spare;
141} __attribute__ ((packed));
142
143struct gsm_pcu_if_time_ind {
144 uint32_t fn;
145} __attribute__ ((packed));
146
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200147struct gsm_pcu_if_pag_req {
148 uint8_t sapi;
149 uint8_t chan_needed;
150 uint8_t identity_lv[9];
151} __attribute__ ((packed));
152
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400153struct gsm_pcu_if {
154 /* context based information */
155 uint8_t msg_type; /* message type */
156 uint8_t bts_nr; /* bts number */
157 uint8_t spare[2];
158
159 union {
160 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200161 struct gsm_pcu_if_data data_cnf;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400162 struct gsm_pcu_if_data data_ind;
163 struct gsm_pcu_if_rts_req rts_req;
164 struct gsm_pcu_if_rach_ind rach_ind;
Max0a8fae82017-03-08 18:53:30 +0100165 struct gsm_pcu_if_txt_ind txt_ind;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400166 struct gsm_pcu_if_info_ind info_ind;
167 struct gsm_pcu_if_act_req act_req;
168 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200169 struct gsm_pcu_if_pag_req pag_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400170 } u;
171} __attribute__ ((packed));
172
173#endif /* _PCUIF_PROTO_H */