diff options
author | Harald Welte <laforge@gnumonks.org> | 2015-09-06 12:33:16 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-09-22 16:39:05 +0200 |
commit | 819b50e1a7b506a0a394cc71a795f0a9ce4083c1 (patch) | |
tree | 290806d3a1bc7f64a0e7a8e1cc5b48bfd6578164 /src/osmo-bts-sysmo/l1_if.c | |
parent | f449842053d333f6f9f41d3123262e8e05375acb (diff) |
move MS power control handling from sysmobts to common part
MS uplink power control is required in pretty much any BTS, and we
cannot assume that they PHY / L1 will always take care of it by
itself. So the correspondign code is moved to common/power_control.c
and called from the generic part of L1SAP.
The corresponding VTY paramter has been moved from the sysmobts-specific
trx VTY node to the common BTS VTY node.
Diffstat (limited to 'src/osmo-bts-sysmo/l1_if.c')
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.c | 80 |
1 files changed, 1 insertions, 79 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index e4e5d204..e2ad500f 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -868,18 +868,6 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i data_ind->msgUnitParam.u8Size)); dump_meas_res(LOGL_DEBUG, &data_ind->measParam); - switch (data_ind->sapi) { - case GsmL1_Sapi_Sacch: - /* - * Handle power control - */ - l1if_ms_pwr_ctrl(lchan, fl1->ul_power_target, - data_ind->msgUnitParam.u8Buffer[0] & 0x1f, - data_ind->measParam.fRssi); - - break; - } - /* check for TCH */ if (data_ind->sapi == GsmL1_Sapi_TchF || data_ind->sapi == GsmL1_Sapi_TchH) { @@ -905,6 +893,7 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i l1sap = msgb_l1sap_prim(l1p_msg); osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_PH_DATA, PRIM_OP_INDICATION, l1p_msg); + l1sap->u.data.rssi = data_ind->measParam.fRssi; l1sap->u.data.link_id = link_id; l1sap->u.data.chan_nr = chan_nr; l1sap->u.data.fn = fn; @@ -1515,7 +1504,6 @@ struct femtol1_hdl *l1if_open(void *priv) fl1h->priv = priv; fl1h->clk_cal = 0; fl1h->clk_use_eeprom = 1; - fl1h->ul_power_target = -75; /* dBm default */ fl1h->min_qual_rach = MIN_QUAL_RACH; fl1h->min_qual_norm = MIN_QUAL_NORM; get_hwinfo_eeprom(fl1h); @@ -1675,69 +1663,3 @@ int l1if_rf_clock_info_correct(struct femtol1_hdl *fl1h) } #endif - -/* - * Check if manual power control is needed - * Check if fixed power was selected - * Check if the MS is already using our level if not - * the value is bogus.. - * TODO: Add a timeout.. e.g. if the ms is not capable of reaching - * the value we have set. - */ -inline int l1if_ms_pwr_ctrl(struct gsm_lchan *lchan, const int ul_power_target, - const uint8_t ms_power, const float rxLevel) -{ - float rx; - int cur_dBm, new_dBm, new_pwr; - const enum gsm_band band = lchan->ts->trx->bts->band; - - if (!trx_ms_pwr_ctrl_is_osmo(lchan->ts->trx)) - return 0; - if (lchan->ms_power_ctrl.fixed) - return 0; - - /* The phone hasn't reached the power level yet */ - if (lchan->ms_power_ctrl.current != ms_power) - return 0; - - /* - * What is the difference between what we want and received? - * Ignore a margin that is within the range of measurement - * and MS output issues. - */ - rx = ul_power_target - rxLevel; - if (rx >= 0 && rx < 1.5f) - return 0; - if (rx < 0 && rx > -1.5f) - return 0; - - /* We don't really care about the truncation of int + float */ - cur_dBm = ms_pwr_dbm(band, ms_power); - new_dBm = cur_dBm + rx; - - /* Clamp negative values and do it depending on the band */ - if (new_dBm < 0) - new_dBm = 0; - - switch (band) { - case GSM_BAND_1800: - /* If MS_TX_PWR_MAX_CCH is set the values 29, - * 30, 31 are not used. Avoid specifying a dBm - * that would lead to these power levels. The - * phone might not be able to reach them. */ - if (new_dBm > 30) - new_dBm = 30; - break; - default: - break; - } - - new_pwr = ms_pwr_ctl_lvl(band, new_dBm); - if (lchan->ms_power_ctrl.current != new_pwr) { - lchan->ms_power_ctrl.current = new_pwr; - bts_model_adjst_ms_pwr(lchan); - return 1; - } - - return 0; -} |