fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/21444 )

Change subject: power_control: generalize and rename lchan_ul_pf_ewma()
......................................................................

power_control: generalize and rename lchan_ul_pf_ewma()

This way EWMA based filtering logic can be used not only for
MS Power Control, but also for BS Power Control.

Change-Id: I16c2e1b997f2b8af44d47809420293f072335bbd
Related: SYS#4918
---
M src/common/power_control.c
1 file changed, 9 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/common/power_control.c b/src/common/power_control.c
index a20ce55..9d17c89 100644
--- a/src/common/power_control.c
+++ b/src/common/power_control.c
@@ -74,12 +74,12 @@
  *   
https://en.wikipedia.org/wiki/Low-pass_filter#Simple_infinite_impulse_response_filter
  *   https://tomroelandts.com/articles/low-pass-single-pole-iir-filter
  */
-static int8_t lchan_ul_pf_ewma(const struct gsm_bts *bts,
-                              struct gsm_lchan *lchan,
-                              const int8_t Pwr)
+static int8_t do_pf_ewma(const struct bts_power_ctrl_params *params,
+                        struct lchan_power_ctrl_state *state,
+                        const int8_t Pwr)
 {
-       const uint8_t A = bts->ul_power_ctrl.pf.ewma.alpha;
-       int *Avg100 = &lchan->ms_power_ctrl.avg100_rxlev_dbm;
+       const uint8_t A = params->pf.ewma.alpha;
+       int *Avg100 = &state->avg100_rxlev_dbm;

        /* We don't have 'Avg[n - 1]' if this is the first run */
        if (*Avg100 == 0) {
@@ -108,6 +108,9 @@
        int8_t ms_dbm, new_dbm, current_dbm, bsc_max_dbm;
        int8_t avg_ul_rssi_dbm;

+       const struct bts_power_ctrl_params *params = &bts->ul_power_ctrl;
+       struct lchan_power_ctrl_state *state = &lchan->ms_power_ctrl;
+
        if (!trx_ms_pwr_ctrl_is_osmo(trx))
                return 0;
        if (lchan->ms_power_ctrl.fixed)
@@ -131,7 +134,7 @@
        /* Filter UL RSSI to reduce unnecessary Tx power oscillations */
        switch (bts->ul_power_ctrl.pf_algo) {
        case BTS_PF_ALGO_EWMA:
-               avg_ul_rssi_dbm = lchan_ul_pf_ewma(bts, lchan, ul_rssi_dbm);
+               avg_ul_rssi_dbm = do_pf_ewma(params, state, ul_rssi_dbm);
                break;
        case BTS_PF_ALGO_NONE:
        default:

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/21444
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I16c2e1b997f2b8af44d47809420293f072335bbd
Gerrit-Change-Number: 21444
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to