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 | |
| 6 | #define PCU_IF_VERSION 0x07 |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 7 | #define TXT_MAX_LEN 128 |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 8 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 9 | /* msg_type */ |
| 10 | #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ |
Andreas Eversberg | a9be154 | 2012-09-27 09:23:24 +0200 | [diff] [blame] | 11 | #define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 12 | #define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 13 | #define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */ |
| 14 | #define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 15 | #define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */ |
| 16 | #define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 17 | #define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */ |
| 18 | #define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */ |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 19 | #define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 20 | |
| 21 | /* sapi */ |
| 22 | #define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 23 | #define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */ |
| 24 | #define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 25 | #define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */ |
| 26 | #define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */ |
| 27 | #define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */ |
| 28 | #define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */ |
| 29 | |
| 30 | /* flags */ |
| 31 | #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */ |
| 32 | #define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */ |
| 33 | #define PCU_IF_FLAG_CS1 (1 << 16) |
| 34 | #define PCU_IF_FLAG_CS2 (1 << 17) |
| 35 | #define PCU_IF_FLAG_CS3 (1 << 18) |
| 36 | #define PCU_IF_FLAG_CS4 (1 << 19) |
| 37 | #define PCU_IF_FLAG_MCS1 (1 << 20) |
| 38 | #define PCU_IF_FLAG_MCS2 (1 << 21) |
| 39 | #define PCU_IF_FLAG_MCS3 (1 << 22) |
| 40 | #define PCU_IF_FLAG_MCS4 (1 << 23) |
| 41 | #define PCU_IF_FLAG_MCS5 (1 << 24) |
| 42 | #define PCU_IF_FLAG_MCS6 (1 << 25) |
| 43 | #define PCU_IF_FLAG_MCS7 (1 << 26) |
| 44 | #define PCU_IF_FLAG_MCS8 (1 << 27) |
| 45 | #define PCU_IF_FLAG_MCS9 (1 << 28) |
| 46 | |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 47 | enum gsm_pcu_if_text_type { |
| 48 | PCU_VERSION, |
| 49 | PCU_OML_ALERT, |
| 50 | }; |
| 51 | |
| 52 | struct gsm_pcu_if_txt_ind { |
| 53 | uint8_t type; /* gsm_pcu_if_text_type */ |
| 54 | char text[TXT_MAX_LEN]; /* Text to be transmitted to BTS */ |
| 55 | } __attribute__ ((packed)); |
| 56 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 57 | struct gsm_pcu_if_data { |
| 58 | uint8_t sapi; |
| 59 | uint8_t len; |
| 60 | uint8_t data[162]; |
| 61 | uint32_t fn; |
| 62 | uint16_t arfcn; |
| 63 | uint8_t trx_nr; |
| 64 | uint8_t ts_nr; |
| 65 | uint8_t block_nr; |
Andreas Eversberg | 570b44b | 2013-03-16 16:15:01 +0100 | [diff] [blame] | 66 | int8_t rssi; |
Max | cbf9a72 | 2016-07-28 14:54:13 +0200 | [diff] [blame] | 67 | uint16_t ber10k; /*!< \brief BER in units of 0.01% */ |
| 68 | int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ |
| 69 | int16_t lqual_cb; /* !< \brief Link quality in centiBel */ |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 70 | } __attribute__ ((packed)); |
| 71 | |
| 72 | struct gsm_pcu_if_rts_req { |
| 73 | uint8_t sapi; |
| 74 | uint8_t spare[3]; |
| 75 | uint32_t fn; |
| 76 | uint16_t arfcn; |
| 77 | uint8_t trx_nr; |
| 78 | uint8_t ts_nr; |
| 79 | uint8_t block_nr; |
| 80 | } __attribute__ ((packed)); |
| 81 | |
| 82 | struct gsm_pcu_if_rach_ind { |
| 83 | uint8_t sapi; |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 84 | uint16_t ra; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 85 | int16_t qta; |
| 86 | uint32_t fn; |
| 87 | uint16_t arfcn; |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 88 | uint8_t is_11bit; |
| 89 | uint8_t burst_type; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 90 | } __attribute__ ((packed)); |
| 91 | |
| 92 | struct gsm_pcu_if_info_trx { |
| 93 | uint16_t arfcn; |
| 94 | uint8_t pdch_mask; /* PDCH channels per TS */ |
| 95 | uint8_t spare; |
| 96 | uint8_t tsc[8]; /* TSC per channel */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 97 | uint32_t hlayer1; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 98 | } __attribute__ ((packed)); |
| 99 | |
| 100 | struct gsm_pcu_if_info_ind { |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 101 | uint32_t version; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 102 | uint32_t flags; |
| 103 | struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */ |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 104 | uint8_t bsic; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 105 | /* RAI */ |
| 106 | uint16_t mcc, mnc, lac, rac; |
| 107 | /* NSE */ |
| 108 | uint16_t nsei; |
| 109 | uint8_t nse_timer[7]; |
| 110 | uint8_t cell_timer[11]; |
| 111 | /* cell */ |
| 112 | uint16_t cell_id; |
| 113 | uint16_t repeat_time; |
| 114 | uint8_t repeat_count; |
| 115 | uint16_t bvci; |
| 116 | uint8_t t3142; |
| 117 | uint8_t t3169; |
| 118 | uint8_t t3191; |
| 119 | uint8_t t3193_10ms; |
| 120 | uint8_t t3195; |
| 121 | uint8_t n3101; |
| 122 | uint8_t n3103; |
| 123 | uint8_t n3105; |
| 124 | uint8_t cv_countdown; |
| 125 | uint16_t dl_tbf_ext; |
| 126 | uint16_t ul_tbf_ext; |
| 127 | uint8_t initial_cs; |
| 128 | uint8_t initial_mcs; |
| 129 | /* NSVC */ |
| 130 | uint16_t nsvci[2]; |
| 131 | uint16_t local_port[2]; |
| 132 | uint16_t remote_port[2]; |
| 133 | uint32_t remote_ip[2]; |
| 134 | } __attribute__ ((packed)); |
| 135 | |
| 136 | struct gsm_pcu_if_act_req { |
| 137 | uint8_t activate; |
| 138 | uint8_t trx_nr; |
| 139 | uint8_t ts_nr; |
| 140 | uint8_t spare; |
| 141 | } __attribute__ ((packed)); |
| 142 | |
| 143 | struct gsm_pcu_if_time_ind { |
| 144 | uint32_t fn; |
| 145 | } __attribute__ ((packed)); |
| 146 | |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 147 | struct gsm_pcu_if_pag_req { |
| 148 | uint8_t sapi; |
| 149 | uint8_t chan_needed; |
| 150 | uint8_t identity_lv[9]; |
| 151 | } __attribute__ ((packed)); |
| 152 | |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 153 | struct gsm_pcu_if { |
| 154 | /* context based information */ |
| 155 | uint8_t msg_type; /* message type */ |
| 156 | uint8_t bts_nr; /* bts number */ |
| 157 | uint8_t spare[2]; |
| 158 | |
| 159 | union { |
| 160 | struct gsm_pcu_if_data data_req; |
Andreas Eversberg | a9be154 | 2012-09-27 09:23:24 +0200 | [diff] [blame] | 161 | struct gsm_pcu_if_data data_cnf; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 162 | struct gsm_pcu_if_data data_ind; |
| 163 | struct gsm_pcu_if_rts_req rts_req; |
| 164 | struct gsm_pcu_if_rach_ind rach_ind; |
Max | 0a8fae8 | 2017-03-08 18:53:30 +0100 | [diff] [blame] | 165 | struct gsm_pcu_if_txt_ind txt_ind; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 166 | struct gsm_pcu_if_info_ind info_ind; |
| 167 | struct gsm_pcu_if_act_req act_req; |
| 168 | struct gsm_pcu_if_time_ind time_ind; |
Andreas Eversberg | 8389fd0 | 2012-07-18 10:06:48 +0200 | [diff] [blame] | 169 | struct gsm_pcu_if_pag_req pag_req; |
Ivan Kluchnikov | ef7f28c | 2012-07-12 14:49:15 +0400 | [diff] [blame] | 170 | } u; |
| 171 | } __attribute__ ((packed)); |
| 172 | |
| 173 | #endif /* _PCUIF_PROTO_H */ |