tx_power: Support controlling BTS with nominal tx pwr < 0dBm

Related: OS#4583
Change-Id: I88d59d47837105d52e2b4dfb819511cd360c50a1
This commit is contained in:
Pau Espin 2020-06-19 17:15:57 +02:00 committed by pespin
parent f3f0638066
commit f23d835831
5 changed files with 12 additions and 9 deletions

View File

@ -196,8 +196,8 @@ void power_trx_change_compl(struct gsm_bts_trx *trx, int p_trxout_cur_mdBm)
/* for now we simply write an error message, but in the future
* we might use the value (again) as part of our math? */
if (p_trxout_cur_mdBm != p_trxout_should_mdBm) {
LOGPTRX(trx, DL1C, LOGL_ERROR, "bts_model notifies us of %u mdBm TRX "
"output power. However, it should be %u mdBm!\n",
LOGPTRX(trx, DL1C, LOGL_ERROR, "bts_model notifies us of %d mdBm TRX "
"output power. However, it should be %d mdBm!\n",
p_trxout_cur_mdBm, p_trxout_should_mdBm);
}

View File

@ -150,13 +150,16 @@ static void l1if_trx_start_power_ramp(struct gsm_bts_trx *trx)
}
/* Sets the nominal power, in dB */
void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, unsigned int nominal_power)
void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, int nominal_power)
{
struct phy_instance *pinst = trx_phy_instance(trx);
bool nom_pwr_changed = trx->nominal_power != nominal_power;
trx->nominal_power = nominal_power;
trx->power_params.trx_p_max_out_mdBm = to_mdB(nominal_power);
/* If we receive ultra-low nominal Tx power (<0dBm), make sure to update where we are */
trx->power_params.p_total_cur_mdBm = OSMO_MIN(trx->power_params.p_total_cur_mdBm,
trx->power_params.trx_p_max_out_mdBm);
/* If TRX is not yet powered, delay ramping until it's ON */
if (!nom_pwr_changed || !pinst->phy_link->u.osmotrx.powered)
@ -168,12 +171,12 @@ void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, unsigned int nominal_po
l1if_trx_start_power_ramp(trx);
}
static void l1if_getnompower_cb(struct trx_l1h *l1h, unsigned int nominal_power, int rc)
static void l1if_getnompower_cb(struct trx_l1h *l1h, int nominal_power, int rc)
{
struct phy_instance *pinst = l1h->phy_inst;
struct gsm_bts_trx *trx = pinst->trx;
LOGPPHI(pinst, DL1C, LOGL_DEBUG, "l1if_getnompower_cb(nominal_power=%u, rc=%d)\n", nominal_power, rc);
LOGPPHI(pinst, DL1C, LOGL_DEBUG, "l1if_getnompower_cb(nominal_power=%d, rc=%d)\n", nominal_power, rc);
l1if_trx_set_nominal_power(trx, nominal_power);
}

View File

@ -114,7 +114,7 @@ struct trx_l1h *trx_l1h_alloc(void *tall_ctx, struct phy_instance *pinst);
int l1if_provision_transceiver_trx(struct trx_l1h *l1h);
int l1if_provision_transceiver(struct gsm_bts *bts);
int l1if_mph_time_ind(struct gsm_bts *bts, uint32_t fn);
void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, unsigned int nominal_power);
void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, int nominal_power);
static inline struct l1sched_trx *trx_l1sched_hdl(struct gsm_bts_trx *trx)
{

View File

@ -554,7 +554,7 @@ static int trx_ctrl_rx_rsp_nomtxpower(struct trx_l1h *l1h, struct trx_ctrl_rsp *
{
trx_if_cmd_getnompower_cb *cb = (trx_if_cmd_getnompower_cb*) rsp->cb;
struct phy_instance *pinst = l1h->phy_inst;
unsigned int nominal_power;
int nominal_power;
if (rsp->status)
LOGPPHI(pinst, DTRX, LOGL_ERROR, "transceiver NOMTXPOWER failed "
@ -563,7 +563,7 @@ static int trx_ctrl_rx_rsp_nomtxpower(struct trx_l1h *l1h, struct trx_ctrl_rsp *
"through VTY cmd 'nominal-tx-power'.\n",
rsp->status);
if (cb) {
sscanf(rsp->params, "%u", &nominal_power);
sscanf(rsp->params, "%d", &nominal_power);
cb(l1h, nominal_power, rsp->status);
}
return 0;

View File

@ -16,7 +16,7 @@ struct trx_ctrl_msg {
typedef void trx_if_cmd_poweronoff_cb(struct trx_l1h *l1h, bool poweronoff, int rc);
typedef void trx_if_cmd_setslot_cb(struct trx_l1h *l1h, uint8_t tn, uint8_t type, int rc);
typedef void trx_if_cmd_getnompower_cb(struct trx_l1h *l1h, unsigned int nominal_power, int rc);
typedef void trx_if_cmd_getnompower_cb(struct trx_l1h *l1h, int nominal_power, int rc);
typedef void trx_if_cmd_setpower_att_cb(struct trx_l1h *l1h, int power_att_db, int rc);
void trx_if_init(struct trx_l1h *l1h);