This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/18488 ) Change subject: WIP: bts-trx: Implement power ramping on power on ...................................................................... WIP: bts-trx: Implement power ramping on power on TODO: figure out wheter we send here makes sense, because i think osmo-trx actually expectes "Power Attenuation". TODO2: find some way to overwrite hardcoded nominal value for TRXs in bts_model_init: """ /* FIXME: this needs to be overridden with the real hardrware * value */ bts->c0->nominal_power = 23; """ Change-Id: Ia7c353e4c199e0fc3bcab55c45a4abda2c66d2c1 --- M src/osmo-bts-trx/l1_if.c M src/osmo-bts-trx/main.c M src/osmo-bts-trx/trx_if.c M src/osmo-bts-trx/trx_if.h 4 files changed, 38 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/88/18488/1 diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index b28c894..c4b0915 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -179,6 +179,8 @@ if (rc == 0 && pinst->phy_link->state != PHY_LINK_CONNECTED) { trx_sched_clock_started(pinst->trx->bts); phy_link_state_set(pinst->phy_link, PHY_LINK_CONNECTED); + /* Begin to ramp up the power */ + power_ramp_start(pinst->trx, get_p_target_mdBm(pinst->trx, 0), 0); } else if (rc != 0 && pinst->phy_link->state != PHY_LINK_SHUTDOWN) { trx_sched_clock_stopped(pinst->trx->bts); phy_link_state_set(pinst->phy_link, PHY_LINK_SHUTDOWN); @@ -186,6 +188,16 @@ } } +static void l1if_setpower_cb(struct trx_l1h *l1h, int power_db, int rc) +{ + struct phy_instance *pinst = l1h->phy_inst; + + LOGPPHI(pinst, DL1C, LOGL_DEBUG, "l1if_setpower_cb(power_db=%d)", power_db); + + l1h->config.power_sent = 0; + power_trx_change_compl(pinst->trx, power_db * 1000); +} + /* * transceiver provisioning */ @@ -252,7 +264,7 @@ l1h->config.rxgain_sent = 1; } if (l1h->config.power_valid && !l1h->config.power_sent) { - trx_if_cmd_setpower(l1h, l1h->config.power); + trx_if_cmd_setpower(l1h, l1h->config.power, l1if_setpower_cb); l1h->config.power_sent = 1; } if (l1h->config.maxdly_valid && !l1h->config.maxdly_sent) { @@ -420,7 +432,7 @@ } if (l1h->config.power_oml) { - l1h->config.power = trx->max_power_red; + l1h->config.power = power_ramp_initial_power_mdBm(trx); l1h->config.power_valid = 1; l1h->config.power_sent = 0; l1if_provision_transceiver_trx(l1h); @@ -804,9 +816,9 @@ int bts_model_change_power(struct gsm_bts_trx *trx, int p_trxout_mdBm) { -#warning "implement bts_model_change_power\n" - LOGP(DL1C, LOGL_NOTICE, "Setting TRX output power not supported!\n"); - return 0; + struct phy_instance *pinst = trx_phy_instance(trx); + struct trx_l1h *l1h = pinst->u.osmotrx.hdl; + return trx_if_cmd_setpower(l1h, p_trxout_mdBm / 1000, l1if_setpower_cb); } int bts_model_ts_disconnect(struct gsm_bts_trx_ts *ts) diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c index ab0472e..8f89051 100644 --- a/src/osmo-bts-trx/main.c +++ b/src/osmo-bts-trx/main.c @@ -125,6 +125,7 @@ int bts_model_trx_init(struct gsm_bts_trx *trx) { + trx->power_params.trx_p_max_out_mdBm = to_mdB(trx->bts->c0->nominal_power); return 0; } diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index f717a0c..aee9e08 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -302,9 +302,9 @@ } /*! Send "SETPOWER" command to TRX */ -int trx_if_cmd_setpower(struct trx_l1h *l1h, int db) +int trx_if_cmd_setpower(struct trx_l1h *l1h, int power_db, trx_if_cmd_setpower_cb *cb) { - return trx_ctrl_cmd(l1h, 0, "SETPOWER", "%d", db); + return trx_ctrl_cmd(l1h, 0, "SETPOWER", "%d", power_db); } /*! Send "SETMAXDLY" command to TRX, i.e. maximum delay for RACH bursts */ @@ -543,6 +543,20 @@ return 0; } +static int trx_ctrl_rx_rsp_setpower(struct trx_l1h *l1h, struct trx_ctrl_rsp *rsp) +{ + trx_if_cmd_setpower_cb *cb = (trx_if_cmd_setpower_cb*) rsp->cb; + int power; + + if (!cb) + return 0; + + sscanf(rsp->params, "%d", &power); + if (cb) + cb(l1h, power, rsp->status); + return 0; +} + /* -EINVAL: unrecoverable error, exit BTS * N > 0: try sending originating command again after N seconds * 0: Done with response, get originating command out from send queue @@ -561,6 +575,8 @@ * so that's why we should use tcm instead of rsp. */ } else if (strcmp(tcm->cmd, "SETFORMAT") == 0) { return trx_ctrl_rx_rsp_setformat(l1h, rsp); + } else if (strcmp(tcm->cmd, "SETPOWER") == 0) { + return trx_ctrl_rx_rsp_setpower(l1h, rsp); } if (rsp->status) { diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h index fd0077d..44f73c4 100644 --- a/src/osmo-bts-trx/trx_if.h +++ b/src/osmo-bts-trx/trx_if.h @@ -15,6 +15,7 @@ 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_setpower_cb(struct trx_l1h *l1h, int power_db, int rc); void trx_if_init(struct trx_l1h *l1h); int trx_if_cmd_poweroff(struct trx_l1h *l1h, trx_if_cmd_poweronoff_cb *cb); @@ -22,7 +23,7 @@ int trx_if_cmd_settsc(struct trx_l1h *l1h, uint8_t tsc); int trx_if_cmd_setbsic(struct trx_l1h *l1h, uint8_t bsic); int trx_if_cmd_setrxgain(struct trx_l1h *l1h, int db); -int trx_if_cmd_setpower(struct trx_l1h *l1h, int db); +int trx_if_cmd_setpower(struct trx_l1h *l1h, int power_db, trx_if_cmd_setpower_cb *cb); int trx_if_cmd_setmaxdly(struct trx_l1h *l1h, int dly); int trx_if_cmd_setmaxdlynb(struct trx_l1h *l1h, int dly); int trx_if_cmd_setslot(struct trx_l1h *l1h, uint8_t tn, uint8_t type, trx_if_cmd_setslot_cb *cb); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/18488 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ia7c353e4c199e0fc3bcab55c45a4abda2c66d2c1 Gerrit-Change-Number: 18488 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200526/fa2ec357/attachment.htm>