diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-06-19 17:15:57 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2020-06-27 14:23:06 +0000 |
commit | f23d83583139f58b78ad4f57f2eab629e1dd3a1e (patch) | |
tree | b6a9c3e031d8e0c18077ecd77e4c49dc19574e5a | |
parent | f3f0638066331adb19a1d32f8a6d01dcbac14c1b (diff) |
tx_power: Support controlling BTS with nominal tx pwr < 0dBm
Related: OS#4583
Change-Id: I88d59d47837105d52e2b4dfb819511cd360c50a1
-rw-r--r-- | src/common/tx_power.c | 4 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.c | 9 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.h | 2 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_if.c | 4 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_if.h | 2 |
5 files changed, 12 insertions, 9 deletions
diff --git a/src/common/tx_power.c b/src/common/tx_power.c index 68cc0e34..8292d9f5 100644 --- a/src/common/tx_power.c +++ b/src/common/tx_power.c @@ -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); } diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 22b590a5..638a674a 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -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); } diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h index 5f51acbe..3fda726f 100644 --- a/src/osmo-bts-trx/l1_if.h +++ b/src/osmo-bts-trx/l1_if.h @@ -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) { diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 58f74553..75086068 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -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; diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h index 16b6c767..b2fc326c 100644 --- a/src/osmo-bts-trx/trx_if.h +++ b/src/osmo-bts-trx/trx_if.h @@ -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); |