diff options
Diffstat (limited to 'include/osmo-bts/scheduler.h')
-rw-r--r-- | include/osmo-bts/scheduler.h | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index 80a260fe..aea55959 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -5,13 +5,6 @@ #include <osmo-bts/gsm_data.h> -/* Whether a logical channel must be activated automatically */ -#define TRX_CHAN_FLAG_AUTO_ACTIVE (1 << 0) - -/* FIXME: we should actually activate 'auto-active' channels */ -#define TRX_CHAN_IS_ACTIVE(state, chan) \ - (trx_chan_desc[chan].flags & TRX_CHAN_FLAG_AUTO_ACTIVE || (state)->active) - #define TRX_GMSK_NB_TSC(br) \ _sched_train_seq_gmsk_nb[(br)->tsc_set][(br)->tsc] @@ -80,6 +73,7 @@ enum trx_mod_type { /* A set of measurements belonging to one Uplink burst */ struct l1sched_meas_set { + uint32_t fn; /* TDMA frame number */ int16_t toa256; /* Timing of Arrival (1/256 of a symbol) */ int16_t ci_cb; /* Carrier-to-Interference (cB) */ float rssi; /* RSSI (dBm) */ @@ -96,13 +90,12 @@ struct l1sched_chan_state { bool active; /* Channel is active */ ubit_t *dl_bursts; /* burst buffer for TX */ enum trx_mod_type dl_mod_type; /* Downlink modulation type */ + uint8_t dl_mask; /* mask of transmitted bursts */ sbit_t *ul_bursts; /* burst buffer for RX */ - sbit_t *ul_bursts_prev;/* previous burst buffer for RX (repeated SACCH) */ uint32_t ul_first_fn; /* fn of first burst */ - uint8_t ul_mask; /* mask of received bursts */ + uint32_t ul_mask; /* mask of received bursts */ /* loss detection */ - uint8_t lost_frames; /* how many L2 frames were lost */ uint32_t last_tdma_fn; /* last processed TDMA frame number */ uint32_t proc_tdma_fs; /* how many TDMA frames were processed */ uint32_t lost_tdma_fs; /* how many TDMA frames were lost */ @@ -113,20 +106,19 @@ struct l1sched_chan_state { /* AMR */ uint8_t codec[4]; /* 4 possible codecs for amr */ int codecs; /* number of possible codecs */ - float ber_sum; /* sum of bit error rates */ - int ber_num; /* number of bit error rates */ + int lqual_cb_sum; /* sum of link quality samples (in cB) */ + int lqual_cb_num; /* number of link quality samples */ uint8_t ul_ft; /* current uplink FT index */ uint8_t dl_ft; /* current downlink FT index */ uint8_t ul_cmr; /* current uplink CMR index */ uint8_t dl_cmr; /* current downlink CMR index */ - uint8_t amr_loop; /* if AMR loop is enabled */ uint8_t amr_last_dtx; /* last received dtx frame type */ /* TCH/H */ uint8_t dl_ongoing_facch; /* FACCH/H on downlink */ uint8_t ul_ongoing_facch; /* FACCH/H on uplink */ - struct l1sched_meas_set meas_avg_facch; /* measurement results for last FACCH */ - uint16_t ber10k_facch; /* bit error rate for last FACCH */ + + uint8_t dl_facch_bursts; /* number of remaining DL FACCH bursts */ /* encryption */ int ul_encr_algo; /* A5/x encry algo downlink */ @@ -139,7 +131,7 @@ struct l1sched_chan_state { /* Uplink measurements */ struct { /* Active channel measurements (simple ring buffer) */ - struct l1sched_meas_set buf[8]; /* up to 8 entries */ + struct l1sched_meas_set buf[24]; /* up to 24 (BUFMAX) entries */ unsigned int current; /* current position */ /* Interference measurements */ @@ -193,6 +185,12 @@ int trx_sched_set_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config pch /*! \brief set all matching logical channels active/inactive */ int trx_sched_set_lchan(struct gsm_lchan *lchan, uint8_t chan_nr, uint8_t link_id, bool active); +/*! \brief set uplink access on given logical channels active/inactive */ +int trx_sched_set_ul_access(struct gsm_lchan *lchan, uint8_t chan_nr, bool active); + +/*! \brief set all logical channels of BCCH/CCCH active/inactive */ +int trx_sched_set_bcch_ccch(struct gsm_lchan *lchan, bool active); + /*! \brief set mode of all matching logical channels to given mode(s) */ int trx_sched_set_mode(struct gsm_bts_trx_ts *ts, uint8_t chan_nr, uint8_t rsl_cmode, uint8_t tch_mode, int codecs, uint8_t codec0, uint8_t codec1, @@ -231,7 +229,7 @@ struct trx_sched_multiframe { int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn); /*! Determine if given frame number contains SACCH (true) or other (false) burst */ -bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool uplink); +bool trx_sched_is_sacch_fn(const struct gsm_bts_trx_ts *ts, uint32_t fn, bool uplink); extern const struct trx_sched_multiframe trx_sched_multiframes[]; #define TRX_BI_F_NOPE_IND (1 << 0) @@ -241,6 +239,7 @@ extern const struct trx_sched_multiframe trx_sched_multiframes[]; #define TRX_BI_F_TRX_NUM (1 << 4) #define TRX_BI_F_BATCH_IND (1 << 5) #define TRX_BI_F_SHADOW_IND (1 << 6) +#define TRX_BI_F_ACCESS_BURST (1 << 7) /*! UL burst indication with the corresponding meta info */ struct trx_ul_burst_ind { @@ -272,6 +271,8 @@ struct trx_ul_burst_ind { size_t burst_len; }; +#define TRX_BR_F_FACCH (1 << 0) + /*! DL burst request with the corresponding meta info */ struct trx_dl_burst_req { uint8_t flags; /*!< see TRX_BR_F_* */ @@ -302,18 +303,24 @@ int trx_sched_ul_burst(struct l1sched_ts *l1ts, struct trx_ul_burst_ind *bi); /* Averaging mode for trx_sched_meas_avg() */ enum sched_meas_avg_mode { - /* last 4 bursts (default for xCCH, TCH/H, PTCCH and PDTCH) */ - SCHED_MEAS_AVG_M_QUAD, + /* first 22 of last 24 bursts (for TCH/F14.4, TCH/F9.6, TCH/F4.8) */ + SCHED_MEAS_AVG_M_S24N22, + /* last 22 bursts (for TCH/H4.8, TCH/H2.4) */ + SCHED_MEAS_AVG_M_S22N22, + /* last 4 bursts (default for xCCH, PTCCH and PDTCH) */ + SCHED_MEAS_AVG_M_S4N4, /* last 8 bursts (default for TCH/F and FACCH/F) */ - SCHED_MEAS_AVG_M_OCTO, + SCHED_MEAS_AVG_M_S8N8, + /* first 4 of last 6 bursts (default for TCH/H) */ + SCHED_MEAS_AVG_M_S6N4, /* last 6 bursts (default for FACCH/H) */ - SCHED_MEAS_AVG_M_SIX, + SCHED_MEAS_AVG_M_S6N6, /* first 4 of last 8 bursts */ - SCHED_MEAS_AVG_M8_FIRST_QUAD, + SCHED_MEAS_AVG_M_S8N4, /* first 2 of last 6 bursts */ - SCHED_MEAS_AVG_M6_FIRST_TWO, + SCHED_MEAS_AVG_M_S6N2, /* middle 2 of last 6 bursts */ - SCHED_MEAS_AVG_M6_MIDDLE_TWO, + SCHED_MEAS_AVG_M_S4N2, }; void trx_sched_meas_push(struct l1sched_chan_state *chan_state, @@ -321,3 +328,5 @@ void trx_sched_meas_push(struct l1sched_chan_state *chan_state, void trx_sched_meas_avg(const struct l1sched_chan_state *chan_state, struct l1sched_meas_set *avg, enum sched_meas_avg_mode mode); +uint32_t trx_sched_lookup_fn(const struct l1sched_chan_state *chan_state, + const unsigned int shift); |