diff options
Diffstat (limited to 'include/osmo-bts/gsm_data.h')
-rw-r--r-- | include/osmo-bts/gsm_data.h | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index fdd5ba34..b9e0e887 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -161,10 +161,65 @@ struct gsm_rep_facch { uint32_t fn; }; -/* Depending on the context (MS or BS power control), fields 'current' and 'max' - * reflect either the MS power level (magic numbers), or BS Power reduction level - * (attenuation, in dB). Field 'avg100_rxlev_dbm' is always in dBm. */ +/* MS/BS Power related measurement averaging algo */ +enum gsm_power_ctrl_meas_avg_algo { + GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE = 0x00, + GSM_PWR_CTRL_MEAS_AVG_ALGO_UNWEIGHTED = 0x01, + GSM_PWR_CTRL_MEAS_AVG_ALGO_WEIGHTED = 0x02, + GSM_PWR_CTRL_MEAS_AVG_ALGO_MOD_MEDIAN = 0x03, + /* EWMA is an Osmocom specific algo */ + GSM_PWR_CTRL_MEAS_AVG_ALGO_OSMO_EWMA = 0x04, +}; + +/* MS/BS Power related measurement parameters */ +struct gsm_power_ctrl_meas_params { + /* Thresholds (see 3GPP TS 45.008, section A.3.2.1) */ + uint8_t lower_thresh; /* lower (decreasing) direction */ + uint8_t upper_thresh; /* upper (increasing) direction */ + + /* Threshold Comparators for lower (decreasing) direction */ + uint8_t lower_cmp_p; /* P1 for RxLev, P3 for RxQual */ + uint8_t lower_cmp_n; /* N1 for RxLev, N3 for RxQual */ + /* Threshold Comparators for upper (increasing) direction */ + uint8_t upper_cmp_p; /* P2 for RxLev, P4 for RxQual */ + uint8_t upper_cmp_n; /* N2 for RxLev, N4 for RxQual */ + + /* Hreqave and Hreqt (see 3GPP TS 45.008, Annex A) */ + uint8_t h_reqave; + uint8_t h_reqt; + + /* AVG algorithm and its specific parameters */ + enum gsm_power_ctrl_meas_avg_algo algo; + union { + /* Exponentially Weighted Moving Average */ + struct { + /* Smoothing factor: higher the value - less smoothing */ + uint8_t alpha; /* 1 .. 99 (in %) */ + } ewma; + }; +}; + +/* MS/BS Power Control parameters */ +struct gsm_power_ctrl_params { + /* Power change step size (maximum) */ + uint8_t inc_step_size_db; /* increasing direction */ + uint8_t red_step_size_db; /* reducing direction */ + + /* Measurement averaging parameters for RxLev & RxQual */ + struct gsm_power_ctrl_meas_params rxqual_meas; + struct gsm_power_ctrl_meas_params rxlev_meas; +}; + +/* Default MS/BS Power Control parameters */ +extern const struct gsm_power_ctrl_params power_ctrl_params_def; + struct lchan_power_ctrl_state { + /* Dynamic Power Control parameters (NULL in static mode) */ + const struct gsm_power_ctrl_params *dpc_params; + + /* Depending on the context (MS or BS power control), fields 'current' and 'max' + * reflect either the MS power level (magic numbers), or BS Power reduction level + * (attenuation, in dB). */ uint8_t current; uint8_t max; bool fixed; @@ -319,10 +374,14 @@ struct gsm_lchan { /* RTP header Marker bit to indicate beginning of speech after pause */ bool rtp_tx_marker; - /* MS/BS power control */ + /* MS/BS power control state */ struct lchan_power_ctrl_state ms_power_ctrl; struct lchan_power_ctrl_state bs_power_ctrl; + /* MS/BS Dynamic Power Control parameters */ + struct gsm_power_ctrl_params ms_dpc_params; + struct gsm_power_ctrl_params bs_dpc_params; + struct msgb *pending_rel_ind_msg; /* ECU (Error Concealment Unit) state */ |