blob: 944f36443a6c72e91b4e0e26baa7d4629e214c8d [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
Andreas Eversberg8389fd02012-07-18 10:06:48 +02007
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +04008/* msg_type */
9#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */
Andreas Eversberga9be1542012-09-27 09:23:24 +020010#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040011#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020012#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
13#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040014#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
15#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020016#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
17#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040018
19/* sapi */
20#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020021#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
22#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040023#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
24#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
25#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
26#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
27
28/* flags */
29#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
30#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
31#define PCU_IF_FLAG_CS1 (1 << 16)
32#define PCU_IF_FLAG_CS2 (1 << 17)
33#define PCU_IF_FLAG_CS3 (1 << 18)
34#define PCU_IF_FLAG_CS4 (1 << 19)
35#define PCU_IF_FLAG_MCS1 (1 << 20)
36#define PCU_IF_FLAG_MCS2 (1 << 21)
37#define PCU_IF_FLAG_MCS3 (1 << 22)
38#define PCU_IF_FLAG_MCS4 (1 << 23)
39#define PCU_IF_FLAG_MCS5 (1 << 24)
40#define PCU_IF_FLAG_MCS6 (1 << 25)
41#define PCU_IF_FLAG_MCS7 (1 << 26)
42#define PCU_IF_FLAG_MCS8 (1 << 27)
43#define PCU_IF_FLAG_MCS9 (1 << 28)
44
45struct gsm_pcu_if_data {
46 uint8_t sapi;
47 uint8_t len;
48 uint8_t data[162];
49 uint32_t fn;
50 uint16_t arfcn;
51 uint8_t trx_nr;
52 uint8_t ts_nr;
53 uint8_t block_nr;
Andreas Eversberg570b44b2013-03-16 16:15:01 +010054 int8_t rssi;
Maxcbf9a722016-07-28 14:54:13 +020055 uint16_t ber10k; /*!< \brief BER in units of 0.01% */
56 int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
57 int16_t lqual_cb; /* !< \brief Link quality in centiBel */
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040058} __attribute__ ((packed));
59
60struct gsm_pcu_if_rts_req {
61 uint8_t sapi;
62 uint8_t spare[3];
63 uint32_t fn;
64 uint16_t arfcn;
65 uint8_t trx_nr;
66 uint8_t ts_nr;
67 uint8_t block_nr;
68} __attribute__ ((packed));
69
70struct gsm_pcu_if_rach_ind {
71 uint8_t sapi;
bhargava959d1de2016-08-17 15:17:21 +053072 uint16_t ra;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040073 int16_t qta;
74 uint32_t fn;
75 uint16_t arfcn;
bhargava959d1de2016-08-17 15:17:21 +053076 uint8_t is_11bit;
77 uint8_t burst_type;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040078} __attribute__ ((packed));
79
80struct gsm_pcu_if_info_trx {
81 uint16_t arfcn;
82 uint8_t pdch_mask; /* PDCH channels per TS */
83 uint8_t spare;
84 uint8_t tsc[8]; /* TSC per channel */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020085 uint32_t hlayer1;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040086} __attribute__ ((packed));
87
88struct gsm_pcu_if_info_ind {
Andreas Eversberg8389fd02012-07-18 10:06:48 +020089 uint32_t version;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040090 uint32_t flags;
91 struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
Andreas Eversberg8389fd02012-07-18 10:06:48 +020092 uint8_t bsic;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040093 /* RAI */
94 uint16_t mcc, mnc, lac, rac;
95 /* NSE */
96 uint16_t nsei;
97 uint8_t nse_timer[7];
98 uint8_t cell_timer[11];
99 /* cell */
100 uint16_t cell_id;
101 uint16_t repeat_time;
102 uint8_t repeat_count;
103 uint16_t bvci;
104 uint8_t t3142;
105 uint8_t t3169;
106 uint8_t t3191;
107 uint8_t t3193_10ms;
108 uint8_t t3195;
109 uint8_t n3101;
110 uint8_t n3103;
111 uint8_t n3105;
112 uint8_t cv_countdown;
113 uint16_t dl_tbf_ext;
114 uint16_t ul_tbf_ext;
115 uint8_t initial_cs;
116 uint8_t initial_mcs;
117 /* NSVC */
118 uint16_t nsvci[2];
119 uint16_t local_port[2];
120 uint16_t remote_port[2];
121 uint32_t remote_ip[2];
122} __attribute__ ((packed));
123
124struct gsm_pcu_if_act_req {
125 uint8_t activate;
126 uint8_t trx_nr;
127 uint8_t ts_nr;
128 uint8_t spare;
129} __attribute__ ((packed));
130
131struct gsm_pcu_if_time_ind {
132 uint32_t fn;
133} __attribute__ ((packed));
134
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200135struct gsm_pcu_if_pag_req {
136 uint8_t sapi;
137 uint8_t chan_needed;
138 uint8_t identity_lv[9];
139} __attribute__ ((packed));
140
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400141struct gsm_pcu_if {
142 /* context based information */
143 uint8_t msg_type; /* message type */
144 uint8_t bts_nr; /* bts number */
145 uint8_t spare[2];
146
147 union {
148 struct gsm_pcu_if_data data_req;
Andreas Eversberga9be1542012-09-27 09:23:24 +0200149 struct gsm_pcu_if_data data_cnf;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400150 struct gsm_pcu_if_data data_ind;
151 struct gsm_pcu_if_rts_req rts_req;
152 struct gsm_pcu_if_rach_ind rach_ind;
153 struct gsm_pcu_if_info_ind info_ind;
154 struct gsm_pcu_if_act_req act_req;
155 struct gsm_pcu_if_time_ind time_ind;
Andreas Eversberg8389fd02012-07-18 10:06:48 +0200156 struct gsm_pcu_if_pag_req pag_req;
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +0400157 } u;
158} __attribute__ ((packed));
159
160#endif /* _PCUIF_PROTO_H */