blob: 39103ee28c1f6cce02642e36c7117681c4c6e885 [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
bhargava959d1de2016-08-17 15:17:21 +05308#define PCU_IF_VERSION 0x07
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) */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040014#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 */
16#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040017#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
18#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020019#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
20#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Max0a8fae82017-03-08 18:53:30 +010021#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040022
23/* sapi */
24#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020025#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
26#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040027#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
28#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
29#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
30#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
31
32/* flags */
33#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
34#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
35#define PCU_IF_FLAG_CS1 (1 << 16)
36#define PCU_IF_FLAG_CS2 (1 << 17)
37#define PCU_IF_FLAG_CS3 (1 << 18)
38#define PCU_IF_FLAG_CS4 (1 << 19)
39#define PCU_IF_FLAG_MCS1 (1 << 20)
40#define PCU_IF_FLAG_MCS2 (1 << 21)
41#define PCU_IF_FLAG_MCS3 (1 << 22)
42#define PCU_IF_FLAG_MCS4 (1 << 23)
43#define PCU_IF_FLAG_MCS5 (1 << 24)
44#define PCU_IF_FLAG_MCS6 (1 << 25)
45#define PCU_IF_FLAG_MCS7 (1 << 26)
46#define PCU_IF_FLAG_MCS8 (1 << 27)
47#define PCU_IF_FLAG_MCS9 (1 << 28)
48
Max0a8fae82017-03-08 18:53:30 +010049enum gsm_pcu_if_text_type {
50 PCU_VERSION,
51 PCU_OML_ALERT,
52};
53
54struct gsm_pcu_if_txt_ind {
55 uint8_t type; /* gsm_pcu_if_text_type */
56 char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */
57} __attribute__ ((packed));
58
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040059struct gsm_pcu_if_data {
60 uint8_t sapi;
61 uint8_t len;
62 uint8_t data[162];
63 uint32_t fn;
64 uint16_t arfcn;
65 uint8_t trx_nr;
66 uint8_t ts_nr;
67 uint8_t block_nr;
Andreas Eversberg570b44b2013-03-16 16:15:01 +010068 int8_t rssi;
Maxcbf9a722016-07-28 14:54:13 +020069 uint16_t ber10k; /*!< \brief BER in units of 0.01% */
70 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
71 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040072} __attribute__ ((packed));
73
74struct gsm_pcu_if_rts_req {
75 uint8_t sapi;
76 uint8_t spare[3];
77 uint32_t fn;
78 uint16_t arfcn;
79 uint8_t trx_nr;
80 uint8_t ts_nr;
81 uint8_t block_nr;
82} __attribute__ ((packed));
83
84struct gsm_pcu_if_rach_ind {
85 uint8_t sapi;
bhargava959d1de2016-08-17 15:17:21 +053086 uint16_t ra;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040087 int16_t qta;
88 uint32_t fn;
89 uint16_t arfcn;
bhargava959d1de2016-08-17 15:17:21 +053090 uint8_t is_11bit;
91 uint8_t burst_type;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040092} __attribute__ ((packed));
93
94struct gsm_pcu_if_info_trx {
95 uint16_t arfcn;
96 uint8_t pdch_mask; /* PDCH channels per TS */
97 uint8_t spare;
98 uint8_t tsc[8]; /* TSC per channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020099 uint32_t hlayer1;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400100} __attribute__ ((packed));
101
102struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200103 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400104 uint32_t flags;
105 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200106 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400107 /* RAI */
108 uint16_t mcc, mnc, lac, rac;
109 /* NSE */
110 uint16_t nsei;
111 uint8_t nse_timer[7];
112 uint8_t cell_timer[11];
113 /* cell */
114 uint16_t cell_id;
115 uint16_t repeat_time;
116 uint8_t repeat_count;
117 uint16_t bvci;
118 uint8_t t3142;
119 uint8_t t3169;
120 uint8_t t3191;
121 uint8_t t3193_10ms;
122 uint8_t t3195;
123 uint8_t n3101;
124 uint8_t n3103;
125 uint8_t n3105;
126 uint8_t cv_countdown;
127 uint16_t dl_tbf_ext;
128 uint16_t ul_tbf_ext;
129 uint8_t initial_cs;
130 uint8_t initial_mcs;
131 /* NSVC */
132 uint16_t nsvci[2];
133 uint16_t local_port[2];
134 uint16_t remote_port[2];
135 uint32_t remote_ip[2];
136} __attribute__ ((packed));
137
138struct gsm_pcu_if_act_req {
139 uint8_t activate;
140 uint8_t trx_nr;
141 uint8_t ts_nr;
142 uint8_t spare;
143} __attribute__ ((packed));
144
145struct gsm_pcu_if_time_ind {
146 uint32_t fn;
147} __attribute__ ((packed));
148
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200149struct gsm_pcu_if_pag_req {
150 uint8_t sapi;
151 uint8_t chan_needed;
152 uint8_t identity_lv[9];
153} __attribute__ ((packed));
154
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400155struct gsm_pcu_if {
156 /* context based information */
157 uint8_t msg_type; /* message type */
158 uint8_t bts_nr; /* bts number */
159 uint8_t spare[2];
160
161 union {
162 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200163 struct gsm_pcu_if_data data_cnf;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400164 struct gsm_pcu_if_data data_ind;
165 struct gsm_pcu_if_rts_req rts_req;
166 struct gsm_pcu_if_rach_ind rach_ind;
Max0a8fae82017-03-08 18:53:30 +0100167 struct gsm_pcu_if_txt_ind txt_ind;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400168 struct gsm_pcu_if_info_ind info_ind;
169 struct gsm_pcu_if_act_req act_req;
170 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200171 struct gsm_pcu_if_pag_req pag_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400172 } u;
173} __attribute__ ((packed));
174
175#endif /* _PCUIF_PROTO_H */