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