Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 1 | #ifndef _GSM_DATA_SHAREDH |
| 2 | #define _GSM_DATA_SHAREDH |
| 3 | |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 4 | #include <regex.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 5 | #include <stdbool.h> |
| 6 | #include <stdint.h> |
| 7 | |
| 8 | #include <osmocom/core/timer.h> |
| 9 | #include <osmocom/core/bitvec.h> |
| 10 | #include <osmocom/core/statistics.h> |
| 11 | #include <osmocom/core/utils.h> |
| 12 | #include <osmocom/gsm/gsm_utils.h> |
| 13 | #include <osmocom/gsm/tlv.h> |
| 14 | #include <osmocom/gsm/rxlev_stat.h> |
| 15 | #include <osmocom/gsm/sysinfo.h> |
Harald Welte | 7ff4f0e | 2013-03-07 18:38:09 +0000 | [diff] [blame] | 16 | #include <osmocom/gsm/meas_rep.h> |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 17 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 18 | #include <osmocom/gsm/protocol/gsm_08_58.h> |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 19 | #include <osmocom/gsm/protocol/gsm_12_21.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 20 | |
Harald Welte | 0eae613 | 2011-08-24 13:52:07 +0200 | [diff] [blame] | 21 | #include <osmocom/abis/e1_input.h> |
| 22 | |
Holger Hans Peter Freyther | 0e0a09c | 2012-12-20 19:03:18 +0100 | [diff] [blame] | 23 | #ifndef ROLE_BSC |
| 24 | #include <osmocom/gsm/lapdm.h> |
| 25 | #endif |
| 26 | |
Neels Hofmeyr | ac1f143 | 2016-05-10 13:30:17 +0200 | [diff] [blame] | 27 | #include <openbsc/common_cs.h> |
| 28 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 29 | /* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018 Table 10.5.2.33b.1: |
| 30 | 4-bit index is used (2#1111 = 10#15) */ |
Max | 9b97b00 | 2017-06-02 10:58:26 +0200 | [diff] [blame] | 31 | #define SI2Q_MAX_NUM 16 |
| 32 | /* length in bits (for single SI2quater message) */ |
| 33 | #define SI2Q_MAX_LEN 160 |
| 34 | #define SI2Q_MIN_LEN 18 |
| 35 | |
Holger Hans Peter Freyther | 8ec4952 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 36 | struct osmo_bsc_data; |
| 37 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 38 | struct osmo_bsc_sccp_con; |
| 39 | struct gsm_sms_queue; |
| 40 | |
| 41 | /* RRLP mode of operation */ |
| 42 | enum rrlp_mode { |
| 43 | RRLP_MODE_NONE, |
| 44 | RRLP_MODE_MS_BASED, |
| 45 | RRLP_MODE_MS_PREF, |
| 46 | RRLP_MODE_ASS_PREF, |
| 47 | }; |
| 48 | |
| 49 | /* Channel Request reason */ |
| 50 | enum gsm_chreq_reason_t { |
| 51 | GSM_CHREQ_REASON_EMERG, |
| 52 | GSM_CHREQ_REASON_PAG, |
| 53 | GSM_CHREQ_REASON_CALL, |
| 54 | GSM_CHREQ_REASON_LOCATION_UPD, |
| 55 | GSM_CHREQ_REASON_OTHER, |
Alexander Couzens | 1136811 | 2016-11-28 23:26:50 +0100 | [diff] [blame] | 56 | GSM_CHREQ_REASON_PDCH, |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 57 | }; |
| 58 | |
Max | 582e4f6 | 2016-10-18 16:19:33 +0200 | [diff] [blame] | 59 | /* lchans 0..3 are SDCCH in combined channel configuration, |
| 60 | use 4 as magic number for BCCH hack - see osmo-bts-../oml.c:opstart_compl() */ |
| 61 | #define CCCH_LCHAN 4 |
| 62 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 63 | #define TRX_NR_TS 8 |
| 64 | #define TS_MAX_LCHAN 8 |
| 65 | |
| 66 | #define HARDCODED_ARFCN 123 |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 67 | #define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */ |
| 68 | |
| 69 | /* for multi-drop config */ |
| 70 | #define HARDCODED_BTS0_TS 1 |
| 71 | #define HARDCODED_BTS1_TS 6 |
| 72 | #define HARDCODED_BTS2_TS 11 |
| 73 | |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 74 | #define MAX_VERSION_LENGTH 64 |
| 75 | |
Max | 7b62d54 | 2017-05-09 15:19:15 +0200 | [diff] [blame] | 76 | #define MAX_BTS_FEATURES 128 |
| 77 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 78 | enum gsm_hooks { |
| 79 | GSM_HOOK_NM_SWLOAD, |
| 80 | GSM_HOOK_RR_PAGING, |
| 81 | GSM_HOOK_RR_SECURITY, |
| 82 | }; |
| 83 | |
| 84 | enum gsm_paging_event { |
| 85 | GSM_PAGING_SUCCEEDED, |
| 86 | GSM_PAGING_EXPIRED, |
| 87 | GSM_PAGING_OOM, |
| 88 | GSM_PAGING_BUSY, |
| 89 | }; |
| 90 | |
| 91 | enum bts_gprs_mode { |
| 92 | BTS_GPRS_NONE = 0, |
| 93 | BTS_GPRS_GPRS = 1, |
| 94 | BTS_GPRS_EGPRS = 2, |
| 95 | }; |
| 96 | |
| 97 | struct gsm_lchan; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 98 | struct gsm_mncc; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 99 | struct osmo_rtp_socket; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 100 | struct rtp_socket; |
| 101 | struct bsc_api; |
| 102 | |
| 103 | /* Network Management State */ |
| 104 | struct gsm_nm_state { |
| 105 | uint8_t operational; |
| 106 | uint8_t administrative; |
| 107 | uint8_t availability; |
| 108 | }; |
| 109 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 110 | struct gsm_abis_mo { |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 111 | uint8_t obj_class; |
Holger Hans Peter Freyther | 49976f4 | 2013-11-05 16:06:17 +0100 | [diff] [blame] | 112 | uint8_t procedure_pending; |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 113 | struct abis_om_obj_inst obj_inst; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 114 | const char *name; |
| 115 | struct gsm_nm_state nm_state; |
| 116 | struct tlv_parsed *nm_attr; |
Harald Welte | 32bc116 | 2011-06-06 18:58:48 +0200 | [diff] [blame] | 117 | struct gsm_bts *bts; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 118 | }; |
| 119 | |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 120 | /* Ericsson OM2000 Managed Object */ |
| 121 | struct abis_om2k_mo { |
| 122 | uint8_t class; |
| 123 | uint8_t bts; |
| 124 | uint8_t assoc_so; |
| 125 | uint8_t inst; |
| 126 | } __attribute__ ((packed)); |
| 127 | |
| 128 | struct om2k_mo { |
| 129 | struct abis_om2k_mo addr; |
| 130 | struct osmo_fsm_inst *fsm; |
| 131 | }; |
| 132 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 133 | #define A38_XOR_MIN_KEY_LEN 12 |
| 134 | #define A38_XOR_MAX_KEY_LEN 16 |
| 135 | #define A38_COMP128_KEY_LEN 16 |
| 136 | #define RSL_ENC_ALG_A5(x) (x+1) |
Max | 27c3e76 | 2016-04-20 15:57:12 +0200 | [diff] [blame] | 137 | #define MAX_EARFCN_LIST 32 |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 138 | |
| 139 | /* is the data link established? who established it? */ |
| 140 | #define LCHAN_SAPI_UNUSED 0 |
| 141 | #define LCHAN_SAPI_MS 1 |
| 142 | #define LCHAN_SAPI_NET 2 |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 143 | #define LCHAN_SAPI_REL 3 |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 144 | |
| 145 | /* state of a logical channel */ |
| 146 | enum gsm_lchan_state { |
| 147 | LCHAN_S_NONE, /* channel is not active */ |
Holger Hans Peter Freyther | ded0268 | 2012-01-15 00:02:17 +0100 | [diff] [blame] | 148 | LCHAN_S_ACT_REQ, /* channel activation requested */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 149 | LCHAN_S_ACTIVE, /* channel is active and operational */ |
| 150 | LCHAN_S_REL_REQ, /* channel release has been requested */ |
| 151 | LCHAN_S_REL_ERR, /* channel is in an error state */ |
Holger Hans Peter Freyther | 638da51 | 2012-12-06 19:25:06 +0100 | [diff] [blame] | 152 | LCHAN_S_BROKEN, /* channel is somehow unusable */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 153 | LCHAN_S_INACTIVE, /* channel is set inactive */ |
| 154 | }; |
| 155 | |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 156 | /* BTS ONLY */ |
| 157 | #define MAX_NUM_UL_MEAS 104 |
| 158 | #define LC_UL_M_F_L1_VALID (1 << 0) |
| 159 | #define LC_UL_M_F_RES_VALID (1 << 1) |
| 160 | |
| 161 | struct bts_ul_meas { |
| 162 | /* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */ |
| 163 | uint16_t ber10k; |
| 164 | /* timing advance offset (in quarter bits) */ |
| 165 | int16_t ta_offs_qbits; |
| 166 | /* C/I ratio in dB */ |
| 167 | float c_i; |
| 168 | /* flags */ |
| 169 | uint8_t is_sub:1; |
| 170 | /* RSSI in dBm * -1 */ |
| 171 | uint8_t inv_rssi; |
| 172 | }; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 173 | |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 174 | struct bts_codec_conf { |
| 175 | uint8_t hr; |
| 176 | uint8_t efr; |
| 177 | uint8_t amr; |
| 178 | }; |
| 179 | |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 180 | struct amr_mode { |
| 181 | uint8_t mode; |
Holger Hans Peter Freyther | 615ed46 | 2015-09-24 11:30:58 +0200 | [diff] [blame] | 182 | uint8_t threshold; |
| 183 | uint8_t hysteresis; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 184 | }; |
Holger Hans Peter Freyther | 615ed46 | 2015-09-24 11:30:58 +0200 | [diff] [blame] | 185 | |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 186 | struct amr_multirate_conf { |
| 187 | uint8_t gsm48_ie[2]; |
Holger Hans Peter Freyther | 615ed46 | 2015-09-24 11:30:58 +0200 | [diff] [blame] | 188 | struct amr_mode ms_mode[4]; |
| 189 | struct amr_mode bts_mode[4]; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 190 | uint8_t num_modes; |
| 191 | }; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 192 | /* /BTS ONLY */ |
| 193 | |
Harald Welte | e422798 | 2012-08-24 15:33:56 +0200 | [diff] [blame] | 194 | enum lchan_csd_mode { |
| 195 | LCHAN_CSD_M_NT, |
| 196 | LCHAN_CSD_M_T_1200_75, |
| 197 | LCHAN_CSD_M_T_600, |
| 198 | LCHAN_CSD_M_T_1200, |
| 199 | LCHAN_CSD_M_T_2400, |
| 200 | LCHAN_CSD_M_T_9600, |
| 201 | LCHAN_CSD_M_T_14400, |
| 202 | LCHAN_CSD_M_T_29000, |
| 203 | LCHAN_CSD_M_T_32000, |
| 204 | }; |
| 205 | |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 206 | /* State of the SAPIs in the lchan */ |
| 207 | enum lchan_sapi_state { |
| 208 | LCHAN_SAPI_S_NONE, |
| 209 | LCHAN_SAPI_S_REQ, |
| 210 | LCHAN_SAPI_S_ASSIGNED, |
| 211 | LCHAN_SAPI_S_REL, |
| 212 | LCHAN_SAPI_S_ERROR, |
| 213 | }; |
| 214 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 215 | struct gsm_lchan { |
| 216 | /* The TS that we're part of */ |
| 217 | struct gsm_bts_trx_ts *ts; |
| 218 | /* The logical subslot number in the TS */ |
| 219 | uint8_t nr; |
| 220 | /* The logical channel type */ |
| 221 | enum gsm_chan_t type; |
| 222 | /* RSL channel mode */ |
| 223 | enum rsl_cmod_spd rsl_cmode; |
| 224 | /* If TCH, traffic channel mode */ |
| 225 | enum gsm48_chan_mode tch_mode; |
Harald Welte | e422798 | 2012-08-24 15:33:56 +0200 | [diff] [blame] | 226 | enum lchan_csd_mode csd_mode; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 227 | /* State */ |
| 228 | enum gsm_lchan_state state; |
Holger Hans Peter Freyther | 454140e | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 229 | const char *broken_reason; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 230 | /* Power levels for MS and BTS */ |
| 231 | uint8_t bs_power; |
| 232 | uint8_t ms_power; |
| 233 | /* Encryption information */ |
Neels Hofmeyr | ac1f143 | 2016-05-10 13:30:17 +0200 | [diff] [blame] | 234 | struct gsm_encr encr; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 235 | |
| 236 | /* AMR bits */ |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 237 | uint8_t mr_ms_lv[7]; |
| 238 | uint8_t mr_bts_lv[7]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 239 | |
| 240 | /* Established data link layer services */ |
| 241 | uint8_t sapis[8]; |
Holger Hans Peter Freyther | b9b828b | 2013-01-01 19:20:28 +0100 | [diff] [blame] | 242 | int sacch_deact; |
Holger Hans Peter Freyther | dfcfe65 | 2011-12-27 20:49:53 +0100 | [diff] [blame] | 243 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 244 | struct { |
| 245 | uint32_t bound_ip; |
| 246 | uint32_t connect_ip; |
| 247 | uint16_t bound_port; |
| 248 | uint16_t connect_port; |
| 249 | uint16_t conn_id; |
| 250 | uint8_t rtp_payload; |
| 251 | uint8_t rtp_payload2; |
| 252 | uint8_t speech_mode; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 253 | #ifdef ROLE_BSC |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 254 | struct rtp_socket *rtp_socket; |
Philipp Maier | 4b60d07 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 255 | |
| 256 | /* info we need to postpone the AoIP |
| 257 | * assignment completed message */ |
| 258 | struct { |
| 259 | uint8_t rr_cause; |
| 260 | uint8_t chosen_channel; |
| 261 | uint8_t encr_alg_id; |
| 262 | uint8_t speech_mode; |
| 263 | bool valid; |
| 264 | } ass_compl; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 265 | #else |
| 266 | struct osmo_rtp_socket *rtp_socket; |
| 267 | #endif |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 268 | } abis_ip; |
| 269 | |
Harald Welte | 2c1ae47 | 2011-06-26 14:13:37 +0200 | [diff] [blame] | 270 | uint8_t rqd_ta; |
| 271 | |
Harald Welte | c696cc2 | 2015-12-05 16:19:21 +0100 | [diff] [blame] | 272 | char *name; |
| 273 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 274 | #ifdef ROLE_BSC |
| 275 | struct osmo_timer_list T3101; |
Holger Hans Peter Freyther | b348939 | 2011-12-28 16:21:05 +0100 | [diff] [blame] | 276 | struct osmo_timer_list T3109; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 277 | struct osmo_timer_list T3111; |
| 278 | struct osmo_timer_list error_timer; |
Harald Welte | e8bd9e8 | 2011-08-10 23:26:33 +0200 | [diff] [blame] | 279 | struct osmo_timer_list act_timer; |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 280 | struct osmo_timer_list rel_work; |
Holger Hans Peter Freyther | 638da51 | 2012-12-06 19:25:06 +0100 | [diff] [blame] | 281 | uint8_t error_cause; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 282 | |
| 283 | /* table of neighbor cell measurements */ |
| 284 | struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; |
| 285 | |
| 286 | /* cache of last measurement reports on this lchan */ |
| 287 | struct gsm_meas_rep meas_rep[6]; |
| 288 | int meas_rep_idx; |
| 289 | |
| 290 | /* GSM Random Access data */ |
| 291 | struct gsm48_req_ref *rqd_ref; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 292 | |
| 293 | struct gsm_subscriber_connection *conn; |
Andreas Eversberg | 9df268e | 2013-10-11 13:32:30 +0200 | [diff] [blame] | 294 | |
| 295 | struct { |
| 296 | /* channel activation type and handover ref */ |
| 297 | uint8_t act_type; |
| 298 | uint8_t ho_ref; |
Neels Hofmeyr | b91e600 | 2016-07-23 19:45:15 +0200 | [diff] [blame] | 299 | struct gsm48_req_ref *rqd_ref; |
| 300 | uint8_t rqd_ta; |
Neels Hofmeyr | 6e999b7 | 2016-07-23 21:00:51 +0200 | [diff] [blame] | 301 | } dyn; |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 302 | #else |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 303 | /* Number of different GsmL1_Sapi_t used in osmo_bts_sysmo is 23. |
| 304 | * Currently we don't share these headers so this is a magic number. */ |
Holger Hans Peter Freyther | 30156e1 | 2013-04-05 18:41:45 +0200 | [diff] [blame] | 305 | struct llist_head sapi_cmds; |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 306 | uint8_t sapis_dl[23]; |
| 307 | uint8_t sapis_ul[23]; |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 308 | struct lapdm_channel lapdm_ch; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 309 | struct llist_head dl_tch_queue; |
Harald Welte | 2c1ae47 | 2011-06-26 14:13:37 +0200 | [diff] [blame] | 310 | struct { |
| 311 | /* bitmask of all SI that are present/valid in si_buf */ |
| 312 | uint32_t valid; |
| 313 | uint32_t last; |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 314 | /* buffers where we put the pre-computed SI: |
| 315 | SI2Q_MAX_NUM is the max number of SI2quater messages (see 3GPP TS 44.018) */ |
| 316 | sysinfo_buf_t buf[_MAX_SYSINFO_TYPE][SI2Q_MAX_NUM]; |
Harald Welte | 2c1ae47 | 2011-06-26 14:13:37 +0200 | [diff] [blame] | 317 | } si; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 318 | struct { |
| 319 | uint8_t flags; |
| 320 | /* RSL measurment result number, 0 at lchan_act */ |
| 321 | uint8_t res_nr; |
| 322 | /* current Tx power level of the BTS */ |
| 323 | uint8_t bts_tx_pwr; |
| 324 | /* number of measurements stored in array below */ |
| 325 | uint8_t num_ul_meas; |
| 326 | struct bts_ul_meas uplink[MAX_NUM_UL_MEAS]; |
| 327 | /* last L1 header from the MS */ |
| 328 | uint8_t l1_info[2]; |
Harald Welte | 7ff4f0e | 2013-03-07 18:38:09 +0000 | [diff] [blame] | 329 | struct gsm_meas_rep_unidir ul_res; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 330 | } meas; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 331 | struct { |
| 332 | struct amr_multirate_conf amr_mr; |
Harald Welte | 4329099 | 2011-09-07 12:41:38 +0200 | [diff] [blame] | 333 | struct { |
Max | 1e646f0 | 2016-10-05 17:29:02 +0200 | [diff] [blame] | 334 | struct osmo_fsm_inst *dl_amr_fsm; |
Max | 1b76a03 | 2016-10-25 20:22:16 +0200 | [diff] [blame] | 335 | /* TCH cache */ |
Max | 1e646f0 | 2016-10-05 17:29:02 +0200 | [diff] [blame] | 336 | uint8_t cache[20]; |
Max | 1b76a03 | 2016-10-25 20:22:16 +0200 | [diff] [blame] | 337 | /* FACCH cache */ |
| 338 | uint8_t facch[GSM_MACBLOCK_LEN]; |
Harald Welte | 4329099 | 2011-09-07 12:41:38 +0200 | [diff] [blame] | 339 | uint8_t len; |
Max | f5fe31d | 2016-06-10 14:09:07 +0200 | [diff] [blame] | 340 | uint32_t fn; |
| 341 | bool is_update; |
Max | 1e646f0 | 2016-10-05 17:29:02 +0200 | [diff] [blame] | 342 | /* set for each SID frame to detect talkspurt for codecs |
| 343 | without explicit ONSET event */ |
| 344 | bool ul_sid; |
| 345 | /* indicates if DTXd was active during DL measurement |
| 346 | period */ |
| 347 | bool dl_active; |
| 348 | } dtx; |
Holger Hans Peter Freyther | 922ef5d | 2014-07-24 21:05:32 +0200 | [diff] [blame] | 349 | uint8_t last_cmr; |
Max | d7df7ae | 2016-06-03 12:06:26 +0200 | [diff] [blame] | 350 | uint32_t last_fn; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 351 | } tch; |
Max | abf53d8 | 2017-01-25 16:19:20 +0100 | [diff] [blame] | 352 | |
| 353 | /* 3GPP TS 48.058 § 9.3.37: [0; 255] ok, -1 means invalid*/ |
| 354 | int16_t ms_t_offs; |
| 355 | /* 3GPP TS 45.010 § 1.2 round trip propagation delay (in symbols) or -1 */ |
| 356 | int16_t p_offs; |
| 357 | |
Harald Welte | 5d52c97 | 2012-04-08 20:23:28 +0200 | [diff] [blame] | 358 | /* BTS-side ciphering state (rx only, bi-directional, ...) */ |
| 359 | uint8_t ciph_state; |
Holger Hans Peter Freyther | 2c6b59c | 2014-08-09 09:43:53 +0200 | [diff] [blame] | 360 | uint8_t ciph_ns; |
Harald Welte | 46cb851 | 2012-04-19 23:13:35 +0200 | [diff] [blame] | 361 | uint8_t loopback; |
Harald Welte | 704cb86 | 2012-06-16 14:57:08 +0800 | [diff] [blame] | 362 | struct { |
| 363 | uint8_t active; |
| 364 | uint8_t ref; |
| 365 | /* T3105: PHYS INF retransmission */ |
| 366 | struct osmo_timer_list t3105; |
| 367 | /* counts up to Ny1 */ |
| 368 | unsigned int phys_info_count; |
| 369 | } ho; |
Andreas Eversberg | 1af682a | 2013-02-20 16:06:20 +0100 | [diff] [blame] | 370 | /* S counter for link loss */ |
| 371 | int s; |
Holger Hans Peter Freyther | fc7a75f | 2013-10-25 18:58:30 +0200 | [diff] [blame] | 372 | /* Kind of the release/activation. E.g. RSL or PCU */ |
| 373 | int rel_act_kind; |
Max | ec74465 | 2016-05-18 16:42:16 +0200 | [diff] [blame] | 374 | /* RTP header Marker bit to indicate beginning of speech after pause */ |
| 375 | bool rtp_tx_marker; |
Holger Hans Peter Freyther | f6f86b0 | 2015-02-05 22:25:03 +0100 | [diff] [blame] | 376 | /* power handling */ |
| 377 | struct { |
| 378 | uint8_t current; |
| 379 | uint8_t fixed; |
| 380 | } ms_power_ctrl; |
Minh-Quang Nguyen | f188623 | 2017-01-18 16:49:00 +0100 | [diff] [blame] | 381 | |
| 382 | struct msgb *pending_rel_ind_msg; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 383 | #endif |
| 384 | }; |
| 385 | |
Neels Hofmeyr | 2ebacce | 2016-06-14 14:08:35 +0200 | [diff] [blame] | 386 | enum { |
| 387 | TS_F_PDCH_ACTIVE = 0x1000, |
| 388 | TS_F_PDCH_ACT_PENDING = 0x2000, |
| 389 | TS_F_PDCH_DEACT_PENDING = 0x4000, |
| 390 | TS_F_PDCH_PENDING_MASK = 0x6000 /*< |
| 391 | TS_F_PDCH_ACT_PENDING | TS_F_PDCH_DEACT_PENDING */ |
| 392 | } gsm_bts_trx_ts_flags; |
| 393 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 394 | /* One Timeslot in a TRX */ |
| 395 | struct gsm_bts_trx_ts { |
| 396 | struct gsm_bts_trx *trx; |
| 397 | /* number of this timeslot at the TRX */ |
| 398 | uint8_t nr; |
| 399 | |
| 400 | enum gsm_phys_chan_config pchan; |
| 401 | |
Neels Hofmeyr | c165876 | 2016-07-23 16:14:06 +0200 | [diff] [blame] | 402 | struct { |
| 403 | enum gsm_phys_chan_config pchan_is; |
| 404 | enum gsm_phys_chan_config pchan_want; |
| 405 | struct msgb *pending_chan_activ; |
| 406 | } dyn; |
| 407 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 408 | unsigned int flags; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 409 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 410 | struct tlv_parsed nm_attr; |
| 411 | uint8_t nm_chan_comb; |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 412 | int tsc; /* -1 == use BTS TSC */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 413 | |
| 414 | struct { |
| 415 | /* Parameters below are configured by VTY */ |
| 416 | int enabled; |
| 417 | uint8_t maio; |
| 418 | uint8_t hsn; |
| 419 | struct bitvec arfcns; |
| 420 | uint8_t arfcns_data[1024/8]; |
| 421 | /* This is the pre-computed MA for channel assignments */ |
| 422 | struct bitvec ma; |
| 423 | uint8_t ma_len; /* part of ma_data that is used */ |
| 424 | uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */ |
| 425 | } hopping; |
| 426 | |
| 427 | /* To which E1 subslot are we connected */ |
| 428 | struct gsm_e1_subslot e1_link; |
| 429 | |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 430 | union { |
| 431 | struct { |
| 432 | struct om2k_mo om2k_mo; |
| 433 | } rbs2000; |
| 434 | }; |
| 435 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 436 | struct gsm_lchan lchan[TS_MAX_LCHAN]; |
| 437 | }; |
| 438 | |
| 439 | /* One TRX in a BTS */ |
| 440 | struct gsm_bts_trx { |
| 441 | /* list header in bts->trx_list */ |
| 442 | struct llist_head list; |
| 443 | |
| 444 | struct gsm_bts *bts; |
| 445 | /* number of this TRX in the BTS */ |
| 446 | uint8_t nr; |
| 447 | /* human readable name / description */ |
| 448 | char *description; |
| 449 | /* how do we talk RSL with this TRX? */ |
| 450 | struct gsm_e1_subslot rsl_e1_link; |
| 451 | uint8_t rsl_tei; |
| 452 | struct e1inp_sign_link *rsl_link; |
Holger Hans Peter Freyther | caa98d5 | 2013-10-06 15:52:14 +0200 | [diff] [blame] | 453 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 454 | /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ |
| 455 | struct e1inp_sign_link *oml_link; |
| 456 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 457 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 458 | struct tlv_parsed nm_attr; |
| 459 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 460 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 461 | } bb_transc; |
| 462 | |
| 463 | uint16_t arfcn; |
| 464 | int nominal_power; /* in dBm */ |
| 465 | unsigned int max_power_red; /* in actual dB */ |
Holger Hans Peter Freyther | 9b62580 | 2014-07-30 18:20:51 +0200 | [diff] [blame] | 466 | |
| 467 | #ifndef ROLE_BSC |
Harald Welte | 101c5c2 | 2014-08-22 16:12:03 +0200 | [diff] [blame] | 468 | struct trx_power_params power_params; |
Holger Hans Peter Freyther | f6f86b0 | 2015-02-05 22:25:03 +0100 | [diff] [blame] | 469 | int ms_power_control; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 470 | |
Harald Welte | d134cc7 | 2011-06-07 00:12:53 +0200 | [diff] [blame] | 471 | struct { |
| 472 | void *l1h; |
| 473 | } role_bts; |
Holger Hans Peter Freyther | 9b62580 | 2014-07-30 18:20:51 +0200 | [diff] [blame] | 474 | #endif |
Harald Welte | d134cc7 | 2011-06-07 00:12:53 +0200 | [diff] [blame] | 475 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 476 | union { |
| 477 | struct { |
| 478 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 479 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 480 | } bbsig; |
| 481 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 482 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 483 | } pa; |
| 484 | } bs11; |
| 485 | struct { |
| 486 | unsigned int test_state; |
| 487 | uint8_t test_nr; |
| 488 | struct rxlev_stats rxlev_stat; |
| 489 | } ipaccess; |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 490 | struct { |
| 491 | struct { |
| 492 | struct om2k_mo om2k_mo; |
| 493 | } trxc; |
| 494 | struct { |
| 495 | struct om2k_mo om2k_mo; |
| 496 | } rx; |
| 497 | struct { |
| 498 | struct om2k_mo om2k_mo; |
| 499 | } tx; |
| 500 | } rbs2000; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 501 | }; |
| 502 | struct gsm_bts_trx_ts ts[TRX_NR_TS]; |
| 503 | }; |
| 504 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 505 | #define GSM_BTS_SI2Q(bts, i) (struct gsm48_system_information_type_2quater *)((bts)->si_buf[SYSINFO_TYPE_2quater][i]) |
Max | 9b97b00 | 2017-06-02 10:58:26 +0200 | [diff] [blame] | 506 | #define GSM_BTS_HAS_SI(bts, i) ((bts)->si_valid & (1 << i)) |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 507 | #define GSM_BTS_SI(bts, i) (void *)((bts)->si_buf[i][0]) |
| 508 | #define GSM_LCHAN_SI(lchan, i) (void *)((lchan)->si.buf[i][0]) |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 509 | |
| 510 | enum gsm_bts_type { |
| 511 | GSM_BTS_TYPE_UNKNOWN, |
| 512 | GSM_BTS_TYPE_BS11, |
| 513 | GSM_BTS_TYPE_NANOBTS, |
| 514 | GSM_BTS_TYPE_RBS2000, |
Dieter Spaar | 1664602 | 2011-07-28 00:01:50 +0200 | [diff] [blame] | 515 | GSM_BTS_TYPE_NOKIA_SITE, |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 516 | GSM_BTS_TYPE_OSMOBTS, |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 517 | _NUM_GSM_BTS_TYPE |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 518 | }; |
| 519 | |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 520 | enum gsm_bts_type_variant { |
| 521 | BTS_UNKNOWN, |
| 522 | BTS_OSMO_LITECELL15, |
| 523 | BTS_OSMO_OCTPHY, |
| 524 | BTS_OSMO_SYSMO, |
| 525 | BTS_OSMO_TRX, |
| 526 | _NUM_BTS_VARIANT |
| 527 | }; |
| 528 | |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 529 | /* Used by OML layer for BTS Attribute reporting */ |
| 530 | enum bts_attribute { |
| 531 | BTS_TYPE_VARIANT, |
| 532 | BTS_SUB_MODEL, |
Max | 33e1357 | 2017-05-29 11:48:29 +0200 | [diff] [blame] | 533 | TRX_PHY_VERSION, |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 534 | }; |
| 535 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 536 | struct vty; |
| 537 | |
| 538 | struct gsm_bts_model { |
| 539 | struct llist_head list; |
| 540 | |
| 541 | enum gsm_bts_type type; |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 542 | enum gsm_bts_type_variant variant; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 543 | const char *name; |
| 544 | |
| 545 | bool started; |
| 546 | int (*start)(struct gsm_network *net); |
| 547 | int (*oml_rcvmsg)(struct msgb *msg); |
| 548 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 549 | void (*e1line_bind_ops)(struct e1inp_line *line); |
| 550 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 551 | void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts); |
| 552 | void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx); |
| 553 | void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts); |
| 554 | |
| 555 | struct tlv_definition nm_att_tlvdef; |
| 556 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 557 | /* features of a given BTS model set via gsm_bts_model_register() locally */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 558 | struct bitvec features; |
Max | 7b62d54 | 2017-05-09 15:19:15 +0200 | [diff] [blame] | 559 | uint8_t _features_data[MAX_BTS_FEATURES/8]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 560 | }; |
| 561 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 562 | /* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility |
| 563 | with BTS compiled against earlier version of this header */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 564 | enum gsm_bts_features { |
| 565 | BTS_FEAT_HSCSD, |
| 566 | BTS_FEAT_GPRS, |
| 567 | BTS_FEAT_EGPRS, |
| 568 | BTS_FEAT_ECSD, |
| 569 | BTS_FEAT_HOPPING, |
Harald Welte | 903aaea | 2014-01-19 17:10:50 +0100 | [diff] [blame] | 570 | BTS_FEAT_MULTI_TSC, |
Max | 1ebf23b | 2017-05-10 12:21:17 +0200 | [diff] [blame] | 571 | BTS_FEAT_OML_ALERTS, |
| 572 | BTS_FEAT_AGCH_PCH_PROP, |
| 573 | BTS_FEAT_CBCH, |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 574 | _NUM_BTS_FEAT |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 575 | }; |
| 576 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 577 | extern const struct value_string gsm_bts_features_descs[]; |
| 578 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 579 | /* |
| 580 | * This keeps track of the paging status of one BTS. It |
| 581 | * includes a number of pending requests, a back pointer |
| 582 | * to the gsm_bts, a timer and some more state. |
| 583 | */ |
| 584 | struct gsm_bts_paging_state { |
| 585 | /* pending requests */ |
| 586 | struct llist_head pending_requests; |
| 587 | struct gsm_bts *bts; |
| 588 | |
| 589 | struct osmo_timer_list work_timer; |
| 590 | struct osmo_timer_list credit_timer; |
| 591 | |
| 592 | /* free chans needed */ |
| 593 | int free_chans_need; |
| 594 | |
| 595 | /* load */ |
| 596 | uint16_t available_slots; |
| 597 | }; |
| 598 | |
| 599 | struct gsm_envabtse { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 600 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 601 | }; |
| 602 | |
| 603 | struct gsm_bts_gprs_nsvc { |
| 604 | struct gsm_bts *bts; |
| 605 | /* data read via VTY config file, to configure the BTS |
| 606 | * via OML from BSC */ |
| 607 | int id; |
| 608 | uint16_t nsvci; |
| 609 | uint16_t local_port; /* on the BTS */ |
| 610 | uint16_t remote_port; /* on the SGSN */ |
| 611 | uint32_t remote_ip; /* on the SGSN */ |
| 612 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 613 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 614 | }; |
| 615 | |
Harald Welte | 019f913 | 2012-06-28 08:43:14 +0200 | [diff] [blame] | 616 | enum gprs_rlc_par { |
| 617 | RLC_T3142, |
| 618 | RLC_T3169, |
| 619 | RLC_T3191, |
| 620 | RLC_T3193, |
| 621 | RLC_T3195, |
| 622 | RLC_N3101, |
| 623 | RLC_N3103, |
| 624 | RLC_N3105, |
| 625 | CV_COUNTDOWN, |
| 626 | T_DL_TBF_EXT, /* ms */ |
| 627 | T_UL_TBF_EXT, /* ms */ |
| 628 | _NUM_RLC_PAR |
| 629 | }; |
| 630 | |
| 631 | enum gprs_cs { |
| 632 | GPRS_CS1, |
| 633 | GPRS_CS2, |
| 634 | GPRS_CS3, |
| 635 | GPRS_CS4, |
| 636 | GPRS_MCS1, |
| 637 | GPRS_MCS2, |
| 638 | GPRS_MCS3, |
| 639 | GPRS_MCS4, |
| 640 | GPRS_MCS5, |
| 641 | GPRS_MCS6, |
| 642 | GPRS_MCS7, |
| 643 | GPRS_MCS8, |
| 644 | GPRS_MCS9, |
| 645 | _NUM_GRPS_CS |
| 646 | }; |
| 647 | |
| 648 | struct gprs_rlc_cfg { |
| 649 | uint16_t parameter[_NUM_RLC_PAR]; |
| 650 | struct { |
| 651 | uint16_t repeat_time; /* ms */ |
| 652 | uint8_t repeat_count; |
| 653 | } paging; |
| 654 | uint32_t cs_mask; /* bitmask of gprs_cs */ |
| 655 | uint8_t initial_cs; |
| 656 | uint8_t initial_mcs; |
| 657 | }; |
| 658 | |
| 659 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 660 | enum neigh_list_manual_mode { |
| 661 | NL_MODE_AUTOMATIC = 0, |
| 662 | NL_MODE_MANUAL = 1, |
| 663 | NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */ |
| 664 | }; |
| 665 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 666 | enum bts_loc_fix { |
| 667 | BTS_LOC_FIX_INVALID = 0, |
| 668 | BTS_LOC_FIX_2D = 1, |
| 669 | BTS_LOC_FIX_3D = 2, |
| 670 | }; |
| 671 | |
Daniel Willmann | 7d10983 | 2012-05-14 18:43:23 +0200 | [diff] [blame] | 672 | extern const struct value_string bts_loc_fix_names[]; |
| 673 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 674 | struct bts_location { |
| 675 | struct llist_head list; |
| 676 | time_t tstamp; |
| 677 | enum bts_loc_fix valid; |
| 678 | double lat; |
| 679 | double lon; |
| 680 | double height; |
| 681 | }; |
| 682 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 683 | /* One BTS */ |
| 684 | struct gsm_bts { |
| 685 | /* list header in net->bts_list */ |
| 686 | struct llist_head list; |
| 687 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 688 | /* Geographical location of the BTS */ |
| 689 | struct llist_head loc_list; |
| 690 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 691 | /* number of ths BTS in network */ |
| 692 | uint8_t nr; |
| 693 | /* human readable name / description */ |
| 694 | char *description; |
| 695 | /* Cell Identity */ |
| 696 | uint16_t cell_identity; |
| 697 | /* location area code of this BTS */ |
| 698 | uint16_t location_area_code; |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 699 | /* Base Station Identification Code (BSIC), lower 3 bits is BCC, |
| 700 | * which is used as TSC for the CCCH */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 701 | uint8_t bsic; |
| 702 | /* type of BTS */ |
| 703 | enum gsm_bts_type type; |
Max | 6d8e519 | 2017-04-11 18:23:47 +0200 | [diff] [blame] | 704 | enum gsm_bts_type_variant variant; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 705 | struct gsm_bts_model *model; |
| 706 | enum gsm_band band; |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 707 | char version[MAX_VERSION_LENGTH]; |
Max | 1ebf23b | 2017-05-10 12:21:17 +0200 | [diff] [blame] | 708 | char sub_model[MAX_VERSION_LENGTH]; |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 709 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 710 | /* features of a given BTS set/reported via OML */ |
| 711 | struct bitvec features; |
| 712 | uint8_t _features_data[MAX_BTS_FEATURES/8]; |
| 713 | |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 714 | /* Connected PCU version (if any) */ |
| 715 | char pcu_version[MAX_VERSION_LENGTH]; |
| 716 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 717 | /* maximum Tx power that the MS is permitted to use in this cell */ |
| 718 | int ms_max_power; |
| 719 | |
| 720 | /* how do we talk OML with this TRX? */ |
| 721 | struct gsm_e1_subslot oml_e1_link; |
| 722 | uint8_t oml_tei; |
| 723 | struct e1inp_sign_link *oml_link; |
| 724 | |
| 725 | /* Abis network management O&M handle */ |
| 726 | struct abis_nm_h *nmh; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 727 | |
| 728 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 729 | |
| 730 | /* number of this BTS on given E1 link */ |
| 731 | uint8_t bts_nr; |
| 732 | |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 733 | /* DTX features of this BTS */ |
| 734 | enum gsm48_dtx_mode dtxu; |
| 735 | bool dtxd; |
| 736 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 737 | /* paging state and control */ |
| 738 | struct gsm_bts_paging_state paging; |
| 739 | |
| 740 | /* CCCH is on C0 */ |
| 741 | struct gsm_bts_trx *c0; |
| 742 | |
| 743 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 744 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 745 | } site_mgr; |
| 746 | |
| 747 | /* bitmask of all SI that are present/valid in si_buf */ |
| 748 | uint32_t si_valid; |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 749 | /* 3GPP TS 44.018 Table 10.5.2.33b.1 INDEX and COUNT for SI2quater */ |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 750 | uint8_t si2q_index; /* distinguish individual SI2quater messages */ |
| 751 | uint8_t si2q_count; /* si2q_index for the last (highest indexed) individual SI2quater message */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 752 | /* buffers where we put the pre-computed SI */ |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 753 | sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE][SI2Q_MAX_NUM]; |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 754 | /* offsets used while generating SI2quater */ |
| 755 | size_t e_offset; |
| 756 | size_t u_offset; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 757 | |
| 758 | /* ip.accesss Unit ID's have Site/BTS/TRX layout */ |
| 759 | union { |
| 760 | struct { |
| 761 | uint16_t site_id; |
| 762 | uint16_t bts_id; |
| 763 | uint32_t flags; |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 764 | uint32_t rsl_ip; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 765 | } ip_access; |
| 766 | struct { |
| 767 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 768 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 769 | } cclk; |
| 770 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 771 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 772 | } rack; |
| 773 | struct gsm_envabtse envabtse[4]; |
| 774 | } bs11; |
| 775 | struct { |
| 776 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 777 | struct om2k_mo om2k_mo; |
| 778 | struct gsm_abis_mo mo; |
| 779 | struct llist_head conn_groups; |
| 780 | } cf; |
| 781 | struct { |
| 782 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 783 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 784 | struct llist_head conn_groups; |
| 785 | } is; |
| 786 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 787 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 788 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 789 | struct llist_head conn_groups; |
| 790 | } con; |
| 791 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 792 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 793 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 794 | } dp; |
| 795 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 796 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 797 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 798 | } tf; |
Harald Welte | ce49258 | 2016-11-15 22:59:24 +0100 | [diff] [blame] | 799 | uint32_t use_superchannel:1; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 800 | } rbs2000; |
| 801 | struct { |
Harald Welte | c8755af | 2011-07-28 00:22:17 +0200 | [diff] [blame] | 802 | uint8_t bts_type; |
Holger Hans Peter Freyther | 3e60348 | 2012-03-02 14:14:33 +0100 | [diff] [blame] | 803 | unsigned int configured:1, |
| 804 | skip_reset:1, |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 805 | no_loc_rel_cnf:1, |
Sipos Csaba | 56e1766 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 806 | bts_reset_timer_cnf, |
Holger Hans Peter Freyther | 3e60348 | 2012-03-02 14:14:33 +0100 | [diff] [blame] | 807 | did_reset:1, |
| 808 | wait_reset:1; |
Harald Welte | c8755af | 2011-07-28 00:22:17 +0200 | [diff] [blame] | 809 | struct osmo_timer_list reset_timer; |
| 810 | } nokia; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 811 | }; |
| 812 | |
| 813 | /* Not entirely sure how ip.access specific this is */ |
| 814 | struct { |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 815 | uint8_t supports_egprs_11bit_rach; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 816 | enum bts_gprs_mode mode; |
| 817 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 818 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 819 | uint16_t nsei; |
| 820 | uint8_t timer[7]; |
| 821 | } nse; |
| 822 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 823 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 824 | uint16_t bvci; |
| 825 | uint8_t timer[11]; |
Harald Welte | 019f913 | 2012-06-28 08:43:14 +0200 | [diff] [blame] | 826 | struct gprs_rlc_cfg rlc_cfg; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 827 | } cell; |
| 828 | struct gsm_bts_gprs_nsvc nsvc[2]; |
| 829 | uint8_t rac; |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 830 | uint8_t net_ctrl_ord; |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 831 | bool ctrl_ack_type_use_block; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 832 | } gprs; |
| 833 | |
| 834 | /* RACH NM values */ |
| 835 | int rach_b_thresh; |
| 836 | int rach_ldavg_slots; |
| 837 | |
| 838 | /* transceivers */ |
| 839 | int num_trx; |
| 840 | struct llist_head trx_list; |
| 841 | |
Holger Hans Peter Freyther | b92a538 | 2014-11-21 10:00:39 +0100 | [diff] [blame] | 842 | /* SI related items */ |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 843 | int force_combined_si; |
Holger Hans Peter Freyther | b92a538 | 2014-11-21 10:00:39 +0100 | [diff] [blame] | 844 | int bcch_change_mark; |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 845 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 846 | #ifdef ROLE_BSC |
| 847 | /* Abis NM queue */ |
| 848 | struct llist_head abis_queue; |
| 849 | int abis_nm_pend; |
| 850 | |
| 851 | struct gsm_network *network; |
| 852 | |
| 853 | /* should the channel allocator allocate channels from high TRX to TRX0, |
| 854 | * rather than starting from TRX0 and go upwards? */ |
| 855 | int chan_alloc_reverse; |
| 856 | |
| 857 | enum neigh_list_manual_mode neigh_list_manual_mode; |
| 858 | /* parameters from which we build SYSTEM INFORMATION */ |
| 859 | struct { |
| 860 | struct gsm48_rach_control rach_control; |
| 861 | uint8_t ncc_permitted; |
| 862 | struct gsm48_cell_sel_par cell_sel_par; |
| 863 | struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */ |
| 864 | struct gsm48_cell_options cell_options; |
| 865 | struct gsm48_control_channel_descr chan_desc; |
| 866 | struct bitvec neigh_list; |
| 867 | struct bitvec cell_alloc; |
| 868 | struct bitvec si5_neigh_list; |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 869 | struct osmo_earfcn_si2q si2quater_neigh_list; |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 870 | size_t uarfcn_length; /* index for uarfcn and scramble lists */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 871 | struct { |
| 872 | /* bitmask large enough for all possible ARFCN's */ |
| 873 | uint8_t neigh_list[1024/8]; |
| 874 | uint8_t cell_alloc[1024/8]; |
| 875 | /* If the user wants a different neighbor list in SI5 than in SI2 */ |
| 876 | uint8_t si5_neigh_list[1024/8]; |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 877 | uint8_t meas_bw_list[MAX_EARFCN_LIST]; |
| 878 | uint16_t earfcn_list[MAX_EARFCN_LIST]; |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 879 | uint16_t uarfcn_list[MAX_EARFCN_LIST]; |
| 880 | uint16_t scramble_list[MAX_EARFCN_LIST]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 881 | } data; |
| 882 | } si_common; |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 883 | bool early_classmark_allowed; |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 884 | /* for testing only: Have an infinitely long radio link timeout */ |
| 885 | bool infinite_radio_link_timeout; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 886 | |
| 887 | /* do we use static (user-defined) system information messages? (bitmask) */ |
| 888 | uint32_t si_mode_static; |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 889 | |
| 890 | /* exclude the BTS from the global RF Lock handling */ |
| 891 | int excl_from_rf_lock; |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 892 | |
| 893 | /* supported codecs beside FR */ |
| 894 | struct bts_codec_conf codec; |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 895 | |
| 896 | /* BTS dependencies bit field */ |
| 897 | uint32_t depends_on[256/(8*4)]; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 898 | |
| 899 | /* full and half rate multirate config */ |
| 900 | struct amr_multirate_conf mr_full; |
| 901 | struct amr_multirate_conf mr_half; |
| 902 | |
Philipp Maier | b4999b6 | 2016-10-26 15:19:41 +0200 | [diff] [blame] | 903 | /* PCU socket state */ |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 904 | char *pcu_sock_path; |
Philipp Maier | b4999b6 | 2016-10-26 15:19:41 +0200 | [diff] [blame] | 905 | struct pcu_sock_state *pcu_state; |
| 906 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 907 | #endif /* ROLE_BSC */ |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 908 | void *role; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 909 | }; |
| 910 | |
| 911 | |
Alexander Chemeris | ff4cb11 | 2017-07-11 01:42:41 +0630 | [diff] [blame] | 912 | struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num); |
Harald Welte | 1449c9f | 2014-08-24 09:50:10 +0200 | [diff] [blame] | 913 | struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 914 | |
Harald Welte | 1449c9f | 2014-08-24 09:50:10 +0200 | [diff] [blame] | 915 | struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 916 | struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 917 | |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 918 | enum gsm_bts_type str2btstype(const char *arg); |
| 919 | const char *btstype2str(enum gsm_bts_type type); |
| 920 | |
| 921 | enum bts_attribute str2btsattr(const char *s); |
| 922 | const char *btsatttr2str(enum bts_attribute v); |
| 923 | |
| 924 | enum gsm_bts_type_variant str2btsvariant(const char *arg); |
| 925 | const char *btsvariant2str(enum gsm_bts_type_variant v); |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 926 | |
Philipp Maier | 6f483d3 | 2017-02-24 15:18:08 +0100 | [diff] [blame] | 927 | extern const struct value_string gsm_chreq_descs[]; |
Neels Hofmeyr | 17a6bab | 2016-07-23 16:14:06 +0200 | [diff] [blame] | 928 | const struct value_string gsm_pchant_names[13]; |
| 929 | const struct value_string gsm_pchant_descs[13]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 930 | const char *gsm_pchan_name(enum gsm_phys_chan_config c); |
| 931 | enum gsm_phys_chan_config gsm_pchan_parse(const char *name); |
| 932 | const char *gsm_lchant_name(enum gsm_chan_t c); |
| 933 | const char *gsm_chreq_name(enum gsm_chreq_reason_t c); |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 934 | char *gsm_trx_name(const struct gsm_bts_trx *trx); |
| 935 | char *gsm_ts_name(const struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 34b8b5b | 2016-07-16 23:59:32 +0200 | [diff] [blame] | 936 | char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts); |
Harald Welte | c696cc2 | 2015-12-05 16:19:21 +0100 | [diff] [blame] | 937 | char *gsm_lchan_name_compute(const struct gsm_lchan *lchan); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 938 | const char *gsm_lchans_name(enum gsm_lchan_state s); |
| 939 | |
Harald Welte | c696cc2 | 2015-12-05 16:19:21 +0100 | [diff] [blame] | 940 | static inline char *gsm_lchan_name(const struct gsm_lchan *lchan) |
| 941 | { |
| 942 | return lchan->name; |
| 943 | } |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 944 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 945 | static inline int gsm_bts_set_feature(struct gsm_bts *bts, enum gsm_bts_features feat) |
| 946 | { |
| 947 | OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); |
| 948 | return bitvec_set_bit_pos(&bts->features, feat, 1); |
| 949 | } |
| 950 | |
| 951 | static inline bool gsm_bts_has_feature(const struct gsm_bts *bts, enum gsm_bts_features feat) |
| 952 | { |
| 953 | OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); |
| 954 | return bitvec_get_bit_pos(&bts->features, feat); |
| 955 | } |
| 956 | |
Harald Welte | b784998 | 2011-06-29 16:49:03 +0200 | [diff] [blame] | 957 | void gsm_abis_mo_reset(struct gsm_abis_mo *mo); |
| 958 | |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 959 | struct gsm_abis_mo * |
| 960 | gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 961 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 962 | |
| 963 | struct gsm_nm_state * |
| 964 | gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 965 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 966 | void * |
| 967 | gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 968 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 969 | |
Harald Welte | b784998 | 2011-06-29 16:49:03 +0200 | [diff] [blame] | 970 | /* reset the state of all MO in the BTS */ |
| 971 | void gsm_bts_mo_reset(struct gsm_bts *bts); |
| 972 | |
Neels Hofmeyr | d384110 | 2016-07-18 23:43:44 +0200 | [diff] [blame] | 973 | uint8_t gsm_pchan2chan_nr(enum gsm_phys_chan_config pchan, |
| 974 | uint8_t ts_nr, uint8_t lchan_nr); |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 975 | uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan); |
Neels Hofmeyr | d384110 | 2016-07-18 23:43:44 +0200 | [diff] [blame] | 976 | uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan, |
| 977 | enum gsm_phys_chan_config as_pchan); |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 978 | |
Harald Welte | 142d12d | 2014-12-29 17:47:08 +0100 | [diff] [blame] | 979 | /* return the gsm_lchan for the CBCH (if it exists at all) */ |
| 980 | struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts); |
| 981 | |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 982 | /* |
| 983 | * help with parsing regexps |
| 984 | */ |
| 985 | int gsm_parse_reg(void *ctx, regex_t *reg, char **str, |
| 986 | int argc, const char **argv) __attribute__ ((warn_unused_result)); |
| 987 | |
Harald Welte | 1fe2412 | 2014-01-19 17:18:21 +0100 | [diff] [blame] | 988 | static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts) |
| 989 | { |
| 990 | if (ts->tsc != -1) |
| 991 | return ts->tsc; |
| 992 | else |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 993 | return ts->trx->bts->bsic & 7; |
Harald Welte | 1fe2412 | 2014-01-19 17:18:21 +0100 | [diff] [blame] | 994 | } |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 995 | |
Neels Hofmeyr | 7458572 | 2016-07-23 17:38:22 +0200 | [diff] [blame] | 996 | struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, |
| 997 | int *rc); |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 998 | |
Neels Hofmeyr | ec16c16 | 2016-10-17 01:03:53 +0200 | [diff] [blame] | 999 | enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 76a0ad7 | 2016-07-29 18:12:06 +0200 | [diff] [blame] | 1000 | uint8_t ts_subslots(struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 255dbfe | 2016-09-25 15:07:01 +0200 | [diff] [blame] | 1001 | bool ts_is_tch(struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 76a0ad7 | 2016-07-29 18:12:06 +0200 | [diff] [blame] | 1002 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 1003 | #endif |