blob: b9f61b6f1d5385f1f3d341e9b0e999de75f0af1e [file] [log] [blame]
Philipp Maierb4999b62016-10-26 15:19:41 +02001#ifndef _PCUIF_PROTO_H
2#define _PCUIF_PROTO_H
3
Alexander Couzens1231ebe2018-02-28 02:53:18 +01004#include <osmocom/gsm/l1sap.h>
5
Neels Hofmeyr4ac77632018-02-22 06:15:58 +01006#define PCU_IF_VERSION 0x09
Alexander Couzens1231ebe2018-02-28 02:53:18 +01007#define TXT_MAX_LEN 128
Philipp Maierb4999b62016-10-26 15:19:41 +02008
9/* msg_type */
10#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */
11#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */
12#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */
13#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
Alexander Couzens1231ebe2018-02-28 02:53:18 +010014#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */
Philipp Maierb4999b62016-10-26 15:19:41 +020015#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
16#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
17#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
18#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
19#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Alexander Couzens1231ebe2018-02-28 02:53:18 +010020#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
Philipp Maierb4999b62016-10-26 15:19:41 +020021
22/* sapi */
23#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
24#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
25#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
26#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
27#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
28#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
29#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
Alexander Couzensf14cb352016-12-02 18:27:01 +010030#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
Philipp Maierb4999b62016-10-26 15:19:41 +020031
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
Alexander Couzens1231ebe2018-02-28 02:53:18 +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
Philipp Maierb4999b62016-10-26 15:19:41 +020059struct 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;
68 int8_t rssi;
Alexander Couzens50eed422018-02-28 02:52:49 +010069 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
Philipp Maierb4999b62016-10-26 15:19:41 +020070 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
71 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
72} __attribute__ ((packed));
73
Philipp Maierf8aeb2c2016-12-02 19:04:34 +010074/* data confirmation with direct tlli (instead of raw mac block with tlli) */
75struct gsm_pcu_if_data_cnf_dt {
76 uint8_t sapi;
77 uint32_t tlli;
78 uint32_t fn;
79 uint16_t arfcn;
80 uint8_t trx_nr;
81 uint8_t ts_nr;
82 uint8_t block_nr;
83 int8_t rssi;
Alexander Couzens50eed422018-02-28 02:52:49 +010084 uint16_t ber10k; /* !< \brief BER in units of 0.01% */
85 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
86 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Philipp Maierf8aeb2c2016-12-02 19:04:34 +010087} __attribute__ ((packed));
88
Philipp Maierb4999b62016-10-26 15:19:41 +020089struct gsm_pcu_if_rts_req {
90 uint8_t sapi;
91 uint8_t spare[3];
92 uint32_t fn;
93 uint16_t arfcn;
94 uint8_t trx_nr;
95 uint8_t ts_nr;
96 uint8_t block_nr;
97} __attribute__ ((packed));
98
99struct gsm_pcu_if_rach_ind {
100 uint8_t sapi;
101 uint16_t ra;
102 int16_t qta;
103 uint32_t fn;
104 uint16_t arfcn;
105 uint8_t is_11bit;
Alexander Couzens50eed422018-02-28 02:52:49 +0100106 uint8_t burst_type;
Philipp Maierb4999b62016-10-26 15:19:41 +0200107} __attribute__ ((packed));
108
109struct gsm_pcu_if_info_trx {
110 uint16_t arfcn;
111 uint8_t pdch_mask; /* PDCH channels per TS */
112 uint8_t spare;
113 uint8_t tsc[8]; /* TSC per channel */
114 uint32_t hlayer1;
115} __attribute__ ((packed));
116
117struct gsm_pcu_if_info_ind {
118 uint32_t version;
119 uint32_t flags;
120 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
121 uint8_t bsic;
122 /* RAI */
Neels Hofmeyr4ac77632018-02-22 06:15:58 +0100123 uint16_t mcc, mnc;
124 uint8_t mnc_3_digits;
125 uint16_t lac, rac;
Philipp Maierb4999b62016-10-26 15:19:41 +0200126 /* NSE */
127 uint16_t nsei;
128 uint8_t nse_timer[7];
129 uint8_t cell_timer[11];
130 /* cell */
131 uint16_t cell_id;
132 uint16_t repeat_time;
133 uint8_t repeat_count;
134 uint16_t bvci;
135 uint8_t t3142;
136 uint8_t t3169;
137 uint8_t t3191;
138 uint8_t t3193_10ms;
139 uint8_t t3195;
140 uint8_t n3101;
141 uint8_t n3103;
142 uint8_t n3105;
143 uint8_t cv_countdown;
144 uint16_t dl_tbf_ext;
145 uint16_t ul_tbf_ext;
146 uint8_t initial_cs;
147 uint8_t initial_mcs;
148 /* NSVC */
149 uint16_t nsvci[2];
150 uint16_t local_port[2];
151 uint16_t remote_port[2];
152 uint32_t remote_ip[2];
153} __attribute__ ((packed));
154
155struct gsm_pcu_if_act_req {
156 uint8_t activate;
157 uint8_t trx_nr;
158 uint8_t ts_nr;
159 uint8_t spare;
160} __attribute__ ((packed));
161
162struct gsm_pcu_if_time_ind {
163 uint32_t fn;
164} __attribute__ ((packed));
165
166struct gsm_pcu_if_pag_req {
167 uint8_t sapi;
168 uint8_t chan_needed;
169 uint8_t identity_lv[9];
170} __attribute__ ((packed));
171
172struct gsm_pcu_if {
173 /* context based information */
174 uint8_t msg_type; /* message type */
175 uint8_t bts_nr; /* bts number */
176 uint8_t spare[2];
177
178 union {
179 struct gsm_pcu_if_data data_req;
180 struct gsm_pcu_if_data data_cnf;
Philipp Maierf8aeb2c2016-12-02 19:04:34 +0100181 struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
Philipp Maierb4999b62016-10-26 15:19:41 +0200182 struct gsm_pcu_if_data data_ind;
183 struct gsm_pcu_if_rts_req rts_req;
184 struct gsm_pcu_if_rach_ind rach_ind;
Alexander Couzens1231ebe2018-02-28 02:53:18 +0100185 struct gsm_pcu_if_txt_ind txt_ind;
Philipp Maierb4999b62016-10-26 15:19:41 +0200186 struct gsm_pcu_if_info_ind info_ind;
187 struct gsm_pcu_if_act_req act_req;
188 struct gsm_pcu_if_time_ind time_ind;
189 struct gsm_pcu_if_pag_req pag_req;
190 } u;
191} __attribute__ ((packed));
192
193#endif /* _PCUIF_PROTO_H */