Pau Espin Pedrol | aca5320 | 2020-07-16 14:49:36 +0200 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <sys/types.h> |
| 5 | #include <stdbool.h> |
| 6 | |
| 7 | #include <osmocom/core/linuxlist.h> |
| 8 | #include <osmocom/core/msgb.h> |
| 9 | #include <osmocom/core/timer.h> |
| 10 | #include <osmocom/core/bitvec.h> |
| 11 | #include <osmocom/gsm/tlv.h> |
| 12 | |
| 13 | #include <osmocom/abis/e1_input.h> |
| 14 | |
| 15 | #include "osmocom/bsc/gsm_data.h" |
| 16 | |
| 17 | struct gsm_bts; |
| 18 | |
| 19 | #define TRX_NR_TS 8 |
| 20 | |
| 21 | /* One TRX in a BTS */ |
| 22 | struct gsm_bts_trx { |
| 23 | /* list header in bts->trx_list */ |
| 24 | struct llist_head list; |
| 25 | |
| 26 | struct gsm_bts *bts; |
| 27 | /* number of this TRX in the BTS */ |
| 28 | uint8_t nr; |
| 29 | /* human readable name / description */ |
| 30 | char *description; |
| 31 | /* how do we talk RSL with this TRX? */ |
| 32 | struct gsm_e1_subslot rsl_e1_link; |
| 33 | uint8_t rsl_tei; |
| 34 | struct e1inp_sign_link *rsl_link; |
| 35 | |
| 36 | /* Timeout for initiating the RSL connection. */ |
| 37 | struct osmo_timer_list rsl_connect_timeout; |
| 38 | |
| 39 | /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ |
| 40 | struct e1inp_sign_link *oml_link; |
| 41 | |
| 42 | struct gsm_abis_mo mo; |
| 43 | struct tlv_parsed nm_attr; |
| 44 | struct { |
| 45 | struct gsm_abis_mo mo; |
| 46 | } bb_transc; |
| 47 | |
| 48 | uint16_t arfcn; |
| 49 | int nominal_power; /* in dBm */ |
| 50 | unsigned int max_power_red; /* in actual dB */ |
| 51 | |
| 52 | union { |
| 53 | struct { |
| 54 | struct { |
| 55 | struct gsm_abis_mo mo; |
| 56 | } bbsig; |
| 57 | struct { |
| 58 | struct gsm_abis_mo mo; |
| 59 | } pa; |
| 60 | } bs11; |
| 61 | struct { |
| 62 | unsigned int test_state; |
| 63 | uint8_t test_nr; |
| 64 | struct rxlev_stats rxlev_stat; |
| 65 | } ipaccess; |
| 66 | struct { |
| 67 | struct { |
| 68 | struct om2k_mo om2k_mo; |
| 69 | } trxc; |
| 70 | struct { |
| 71 | struct om2k_mo om2k_mo; |
| 72 | } rx; |
| 73 | struct { |
| 74 | struct om2k_mo om2k_mo; |
| 75 | } tx; |
| 76 | } rbs2000; |
| 77 | }; |
| 78 | struct gsm_bts_trx_ts ts[TRX_NR_TS]; |
| 79 | }; |
| 80 | |
| 81 | struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); |
| 82 | char *gsm_trx_name(const struct gsm_bts_trx *trx); |
| 83 | |
| 84 | struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, |
| 85 | int *rc); |
| 86 | |
| 87 | void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason); |
| 88 | bool trx_is_usable(const struct gsm_bts_trx *trx); |
| 89 | |
| 90 | void gsm_trx_all_ts_dispatch(struct gsm_bts_trx *trx, uint32_t ts_ev, void *data); |
| 91 | int trx_count_free_ts(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan); |
| 92 | bool trx_has_valid_pchan_config(const struct gsm_bts_trx *trx); |