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 | |
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')
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.c | 80 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.h | 1 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/oml.c | 3 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/sysmobts_vty.c | 11 |
4 files changed, 7 insertions, 88 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; -} diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h index d057c37d..d258f43b 100644 --- a/src/osmo-bts-sysmo/l1_if.h +++ b/src/osmo-bts-sysmo/l1_if.h @@ -46,7 +46,6 @@ struct femtol1_hdl { uint32_t dsp_trace_f; uint8_t clk_use_eeprom; int clk_cal; - int ul_power_target; uint8_t clk_src; float min_qual_rach; float min_qual_norm; diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index c5810898..4c9ac497 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -324,6 +324,7 @@ static const uint8_t trx_rqd_attr[] = { NM_ATT_RF_MAXPOWR_R }; static int trx_init(struct gsm_bts_trx *trx) { struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); + struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts); struct msgb *msg; GsmL1_MphInitReq_t *mi_req; GsmL1_DeviceParam_t *dev_par; @@ -352,7 +353,7 @@ static int trx_init(struct gsm_bts_trx *trx) dev_par->u16BcchArfcn = trx->bts->c0->arfcn; dev_par->u8NbTsc = trx->bts->bsic & 7; dev_par->fRxPowerLevel = trx_ms_pwr_ctrl_is_osmo(trx) - ? 0.0 : fl1h->ul_power_target; + ? 0.0 : btsb->ul_power_target; dev_par->fTxPowerLevel = 0.0; LOGP(DL1C, LOGL_NOTICE, "Init TRX (ARFCN %u, TSC %u, RxPower % 2f dBm, " diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c index cad29f5a..3c1dafa4 100644 --- a/src/osmo-bts-sysmo/sysmobts_vty.c +++ b/src/osmo-bts-sysmo/sysmobts_vty.c @@ -175,15 +175,15 @@ DEFUN(cfg_trx_cal_path, cfg_trx_cal_path_cmd, return CMD_SUCCESS; } -DEFUN(cfg_trx_ul_power_target, cfg_trx_ul_power_target_cmd, +DEFUN_DEPRECATED(cfg_trx_ul_power_target, cfg_trx_ul_power_target_cmd, "uplink-power-target <-110-0>", - "Set the nominal target Rx Level for uplink power control loop\n" + "Obsolete alias for bts uplink-power-target\n" "Target uplink Rx level in dBm\n") { struct gsm_bts_trx *trx = vty->index; - struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); + struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts); - fl1h->ul_power_target = atoi(argv[0]); + btsb->ul_power_target = atoi(argv[0]); return CMD_SUCCESS; } @@ -484,8 +484,6 @@ void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx) vty_out(vty, " clock-source %s%s", get_value_string(femtobts_clksrc_names, fl1h->clk_src), VTY_NEWLINE); - vty_out(vty, " uplink-power-target %d%s", fl1h->ul_power_target, - VTY_NEWLINE); vty_out(vty, " min-qual-rach %.0f%s", fl1h->min_qual_rach * 10.0f, VTY_NEWLINE); vty_out(vty, " min-qual-norm %.0f%s", fl1h->min_qual_norm * 10.0f, @@ -536,7 +534,6 @@ int bts_model_vty_init(struct gsm_bts *bts) install_element(TRX_NODE, &cfg_trx_clkcal_def_cmd); install_element(TRX_NODE, &cfg_trx_clksrc_cmd); install_element(TRX_NODE, &cfg_trx_cal_path_cmd); - install_element(TRX_NODE, &cfg_trx_ul_power_target_cmd); install_element(TRX_NODE, &cfg_trx_min_qual_rach_cmd); install_element(TRX_NODE, &cfg_trx_min_qual_norm_cmd); install_element(TRX_NODE, &cfg_trx_nominal_power_cmd); |