Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 1 | #ifndef _PCUIF_PROTO_H |
| 2 | #define _PCUIF_PROTO_H |
| 3 | |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 4 | #include <osmocom/gsm/l1sap.h> |
Alexander Couzens | 9b5c960 | 2020-07-28 13:47:18 +0200 | [diff] [blame] | 5 | #include <arpa/inet.h> |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 6 | |
Pau Espin Pedrol | c4178e5 | 2017-08-08 15:03:50 +0200 | [diff] [blame] | 7 | #define PCU_SOCK_DEFAULT "/tmp/pcu_bts" |
| 8 | |
Vadim Yanitskiy | 8e2bd1e | 2020-07-21 00:54:42 +0700 | [diff] [blame] | 9 | #define PCU_IF_VERSION 0x0a |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 10 | #define TXT_MAX_LEN 128 |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 11 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 12 | /* msg_type */ |
| 13 | #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ |
Andreas Eversberg | a9be154 | 2012-09-27 09:23:24 +0200 | [diff] [blame] | 14 | #define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */ |
Alexander Couzens | d2a219e | 2018-02-28 02:56:12 +0100 | [diff] [blame] | 15 | #define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */ |
Harald Welte | 3447c4a | 2017-07-11 00:06:38 +0200 | [diff] [blame] | 16 | #define PCU_IF_MSG_SUSP_REQ 0x03 /* BTS forwards GPRS SUSP REQ to PCU */ |
Oliver Smith | cfb6321 | 2019-09-05 17:13:33 +0200 | [diff] [blame] | 17 | #define PCU_IF_MSG_APP_INFO_REQ 0x04 /* BTS asks PCU to transmit APP INFO via PACCH */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 18 | #define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */ |
Alexander Couzens | 8343b4a | 2018-02-28 03:03:49 +0100 | [diff] [blame] | 19 | #define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 20 | #define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 21 | #define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */ |
| 22 | #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 23 | #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ |
Vadim Yanitskiy | 94dc6a8 | 2021-06-20 21:00:40 +0200 | [diff] [blame] | 24 | #define PCU_IF_MSG_INTERF_IND 0x53 /* interference report */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 25 | #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 26 | #define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ |
Pau Espin Pedrol | 8c29236 | 2021-06-23 17:47:59 +0200 | [diff] [blame^] | 27 | #define PCU_IF_MSG_CONTAINER 0x80 /* Transparent container message */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 28 | |
| 29 | /* sapi */ |
| 30 | #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 31 | #define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */ |
| 32 | #define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 33 | #define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */ |
| 34 | #define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */ |
| 35 | #define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */ |
| 36 | #define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */ |
Alexander Couzens | 8343b4a | 2018-02-28 03:03:49 +0100 | [diff] [blame] | 37 | #define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 38 | |
| 39 | /* flags */ |
| 40 | #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */ |
| 41 | #define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */ |
| 42 | #define PCU_IF_FLAG_CS1 (1 << 16) |
| 43 | #define PCU_IF_FLAG_CS2 (1 << 17) |
| 44 | #define PCU_IF_FLAG_CS3 (1 << 18) |
| 45 | #define PCU_IF_FLAG_CS4 (1 << 19) |
| 46 | #define PCU_IF_FLAG_MCS1 (1 << 20) |
| 47 | #define PCU_IF_FLAG_MCS2 (1 << 21) |
| 48 | #define PCU_IF_FLAG_MCS3 (1 << 22) |
| 49 | #define PCU_IF_FLAG_MCS4 (1 << 23) |
| 50 | #define PCU_IF_FLAG_MCS5 (1 << 24) |
| 51 | #define PCU_IF_FLAG_MCS6 (1 << 25) |
| 52 | #define PCU_IF_FLAG_MCS7 (1 << 26) |
| 53 | #define PCU_IF_FLAG_MCS8 (1 << 27) |
| 54 | #define PCU_IF_FLAG_MCS9 (1 << 28) |
| 55 | |
Alexander Couzens | 9b5c960 | 2020-07-28 13:47:18 +0200 | [diff] [blame] | 56 | /* NSVC address type */ |
| 57 | #define PCU_IF_ADDR_TYPE_UNSPEC 0x00 /* No address - empty entry */ |
| 58 | #define PCU_IF_ADDR_TYPE_IPV4 0x04 /* IPv4 address */ |
| 59 | #define PCU_IF_ADDR_TYPE_IPV6 0x29 /* IPv6 address */ |
| 60 | |
Alexander Couzens | 5bece2a | 2020-10-12 02:27:22 +0200 | [diff] [blame] | 61 | #define PCU_IF_NUM_NSVC 2 |
| 62 | |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 63 | enum gsm_pcu_if_text_type { |
| 64 | PCU_VERSION, |
| 65 | PCU_OML_ALERT, |
| 66 | }; |
| 67 | |
| 68 | struct gsm_pcu_if_txt_ind { |
| 69 | uint8_t type; /* gsm_pcu_if_text_type */ |
| 70 | char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ |
| 71 | } __attribute__ ((packed)); |
| 72 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 73 | struct gsm_pcu_if_data { |
| 74 | uint8_t sapi; |
| 75 | uint8_t len; |
| 76 | uint8_t data[162]; |
| 77 | uint32_t fn; |
| 78 | uint16_t arfcn; |
| 79 | uint8_t trx_nr; |
| 80 | uint8_t ts_nr; |
| 81 | uint8_t block_nr; |
Andreas Eversberg | 570b44b | 2013-03-16 16:15:01 +0100 | [diff] [blame] | 82 | int8_t rssi; |
Alexander Couzens | d2a219e | 2018-02-28 02:56:12 +0100 | [diff] [blame] | 83 | uint16_t ber10k; /* !< \brief BER in units of 0.01% */ |
| 84 | int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ |
| 85 | int16_t lqual_cb; /* !< \brief Link quality in centiBel */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 86 | } __attribute__ ((packed)); |
| 87 | |
Alexander Couzens | 8343b4a | 2018-02-28 03:03:49 +0100 | [diff] [blame] | 88 | /* data confirmation with direct tlli (instead of raw mac block with tlli) */ |
| 89 | struct gsm_pcu_if_data_cnf_dt { |
| 90 | uint8_t sapi; |
| 91 | uint32_t tlli; |
| 92 | uint32_t fn; |
| 93 | uint16_t arfcn; |
| 94 | uint8_t trx_nr; |
| 95 | uint8_t ts_nr; |
| 96 | uint8_t block_nr; |
| 97 | int8_t rssi; |
| 98 | uint16_t ber10k; /* !< \brief BER in units of 0.01% */ |
| 99 | int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ |
| 100 | int16_t lqual_cb; /* !< \brief Link quality in centiBel */ |
| 101 | } __attribute__ ((packed)); |
| 102 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 103 | struct gsm_pcu_if_rts_req { |
| 104 | uint8_t sapi; |
| 105 | uint8_t spare[3]; |
| 106 | uint32_t fn; |
| 107 | uint16_t arfcn; |
| 108 | uint8_t trx_nr; |
| 109 | uint8_t ts_nr; |
| 110 | uint8_t block_nr; |
| 111 | } __attribute__ ((packed)); |
| 112 | |
| 113 | struct gsm_pcu_if_rach_ind { |
| 114 | uint8_t sapi; |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 115 | uint16_t ra; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 116 | int16_t qta; |
| 117 | uint32_t fn; |
| 118 | uint16_t arfcn; |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 119 | uint8_t is_11bit; |
| 120 | uint8_t burst_type; |
Vadim Yanitskiy | 17954da | 2019-10-05 23:21:33 +0700 | [diff] [blame] | 121 | uint8_t trx_nr; |
| 122 | uint8_t ts_nr; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 123 | } __attribute__ ((packed)); |
| 124 | |
Vadim Yanitskiy | 8e2bd1e | 2020-07-21 00:54:42 +0700 | [diff] [blame] | 125 | struct gsm_pcu_if_info_ts { |
| 126 | uint8_t tsc; |
| 127 | uint8_t h; |
| 128 | uint8_t hsn; |
| 129 | uint8_t maio; |
| 130 | uint8_t ma_bit_len; |
| 131 | uint8_t ma[8]; |
| 132 | } __attribute__ ((packed)); |
| 133 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 134 | struct gsm_pcu_if_info_trx { |
| 135 | uint16_t arfcn; |
Vadim Yanitskiy | 8e2bd1e | 2020-07-21 00:54:42 +0700 | [diff] [blame] | 136 | uint8_t pdch_mask; /* PDCH timeslot mask */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 137 | uint8_t spare; |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 138 | uint32_t hlayer1; |
Vadim Yanitskiy | 8e2bd1e | 2020-07-21 00:54:42 +0700 | [diff] [blame] | 139 | struct gsm_pcu_if_info_ts ts[8]; /* timeslots per TRX */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 140 | } __attribute__ ((packed)); |
| 141 | |
| 142 | struct gsm_pcu_if_info_ind { |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 143 | uint32_t version; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 144 | uint32_t flags; |
| 145 | struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 146 | uint8_t bsic; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 147 | /* RAI */ |
Neels Hofmeyr | bdc55fa | 2018-02-21 00:39:07 +0100 | [diff] [blame] | 148 | uint16_t mcc, mnc; |
| 149 | uint8_t mnc_3_digits; |
| 150 | uint16_t lac, rac; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 151 | /* NSE */ |
| 152 | uint16_t nsei; |
| 153 | uint8_t nse_timer[7]; |
| 154 | uint8_t cell_timer[11]; |
Alexander Couzens | d2a219e | 2018-02-28 02:56:12 +0100 | [diff] [blame] | 155 | /* cell */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 156 | uint16_t cell_id; |
| 157 | uint16_t repeat_time; |
| 158 | uint8_t repeat_count; |
| 159 | uint16_t bvci; |
| 160 | uint8_t t3142; |
| 161 | uint8_t t3169; |
| 162 | uint8_t t3191; |
| 163 | uint8_t t3193_10ms; |
| 164 | uint8_t t3195; |
| 165 | uint8_t n3101; |
| 166 | uint8_t n3103; |
| 167 | uint8_t n3105; |
| 168 | uint8_t cv_countdown; |
| 169 | uint16_t dl_tbf_ext; |
| 170 | uint16_t ul_tbf_ext; |
| 171 | uint8_t initial_cs; |
| 172 | uint8_t initial_mcs; |
| 173 | /* NSVC */ |
Alexander Couzens | 5bece2a | 2020-10-12 02:27:22 +0200 | [diff] [blame] | 174 | uint16_t nsvci[PCU_IF_NUM_NSVC]; |
| 175 | uint16_t local_port[PCU_IF_NUM_NSVC]; |
| 176 | uint16_t remote_port[PCU_IF_NUM_NSVC]; |
| 177 | uint8_t address_type[PCU_IF_NUM_NSVC]; |
Alexander Couzens | 9b5c960 | 2020-07-28 13:47:18 +0200 | [diff] [blame] | 178 | union { |
| 179 | struct in_addr v4; |
| 180 | struct in6_addr v6; |
Alexander Couzens | 5bece2a | 2020-10-12 02:27:22 +0200 | [diff] [blame] | 181 | } remote_ip[PCU_IF_NUM_NSVC]; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 182 | } __attribute__ ((packed)); |
| 183 | |
| 184 | struct gsm_pcu_if_act_req { |
| 185 | uint8_t activate; |
| 186 | uint8_t trx_nr; |
| 187 | uint8_t ts_nr; |
| 188 | uint8_t spare; |
| 189 | } __attribute__ ((packed)); |
| 190 | |
| 191 | struct gsm_pcu_if_time_ind { |
| 192 | uint32_t fn; |
| 193 | } __attribute__ ((packed)); |
| 194 | |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 195 | struct gsm_pcu_if_pag_req { |
| 196 | uint8_t sapi; |
| 197 | uint8_t chan_needed; |
| 198 | uint8_t identity_lv[9]; |
| 199 | } __attribute__ ((packed)); |
| 200 | |
Oliver Smith | cfb6321 | 2019-09-05 17:13:33 +0200 | [diff] [blame] | 201 | /* BTS tells PCU to [once] send given application data via PACCH to all UE with active TBF */ |
| 202 | struct gsm_pcu_if_app_info_req { |
| 203 | uint8_t application_type; /* 4bit field, see TS 44.060 11.2.47 */ |
| 204 | uint8_t len; /* length of data */ |
| 205 | uint8_t data[162]; /* random size choice; ETWS needs 56 bytes */ |
| 206 | } __attribute__ ((packed)); |
| 207 | |
Harald Welte | 3447c4a | 2017-07-11 00:06:38 +0200 | [diff] [blame] | 208 | /* BTS tells PCU about a GPRS SUSPENSION REQUEST received on DCCH */ |
| 209 | struct gsm_pcu_if_susp_req { |
| 210 | uint32_t tlli; |
| 211 | uint8_t ra_id[6]; |
| 212 | uint8_t cause; |
| 213 | } __attribute__ ((packed)); |
| 214 | |
Vadim Yanitskiy | 94dc6a8 | 2021-06-20 21:00:40 +0200 | [diff] [blame] | 215 | /* Interference measurements on PDCH timeslots */ |
| 216 | struct gsm_pcu_if_interf_ind { |
| 217 | uint8_t trx_nr; |
| 218 | uint8_t spare[3]; |
| 219 | uint32_t fn; |
| 220 | uint8_t interf[8]; |
| 221 | } __attribute__ ((packed)); |
| 222 | |
Pau Espin Pedrol | 8c29236 | 2021-06-23 17:47:59 +0200 | [diff] [blame^] | 223 | /* Contains messages transmitted BSC<->PCU, potentially forwarded by BTS via IPA/PCU */ |
| 224 | struct gsm_pcu_if_container { |
| 225 | uint8_t msg_type; |
| 226 | uint8_t spare; |
| 227 | uint16_t length; /* network byte order */ |
| 228 | uint8_t data[0]; |
| 229 | } __attribute__ ((packed)); |
| 230 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 231 | struct gsm_pcu_if { |
| 232 | /* context based information */ |
| 233 | uint8_t msg_type; /* message type */ |
| 234 | uint8_t bts_nr; /* bts number */ |
| 235 | uint8_t spare[2]; |
| 236 | |
| 237 | union { |
| 238 | struct gsm_pcu_if_data data_req; |
Andreas Eversberg | a9be154 | 2012-09-27 09:23:24 +0200 | [diff] [blame] | 239 | struct gsm_pcu_if_data data_cnf; |
Alexander Couzens | 8343b4a | 2018-02-28 03:03:49 +0100 | [diff] [blame] | 240 | struct gsm_pcu_if_data_cnf_dt data_cnf_dt; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 241 | struct gsm_pcu_if_data data_ind; |
Harald Welte | 3447c4a | 2017-07-11 00:06:38 +0200 | [diff] [blame] | 242 | struct gsm_pcu_if_susp_req susp_req; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 243 | struct gsm_pcu_if_rts_req rts_req; |
| 244 | struct gsm_pcu_if_rach_ind rach_ind; |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 245 | struct gsm_pcu_if_txt_ind txt_ind; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 246 | struct gsm_pcu_if_info_ind info_ind; |
| 247 | struct gsm_pcu_if_act_req act_req; |
| 248 | struct gsm_pcu_if_time_ind time_ind; |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 249 | struct gsm_pcu_if_pag_req pag_req; |
Oliver Smith | cfb6321 | 2019-09-05 17:13:33 +0200 | [diff] [blame] | 250 | struct gsm_pcu_if_app_info_req app_info_req; |
Vadim Yanitskiy | 94dc6a8 | 2021-06-20 21:00:40 +0200 | [diff] [blame] | 251 | struct gsm_pcu_if_interf_ind interf_ind; |
Pau Espin Pedrol | 8c29236 | 2021-06-23 17:47:59 +0200 | [diff] [blame^] | 252 | struct gsm_pcu_if_container container; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 253 | } u; |
| 254 | } __attribute__ ((packed)); |
| 255 | |
| 256 | #endif /* _PCUIF_PROTO_H */ |