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/+/18589 )
Change subject: bts-trx: Use TRXC cmd NOMTXPOWER to retrieve nominal tx power from osmo-trx
......................................................................
bts-trx: Use TRXC cmd NOMTXPOWER to retrieve nominal tx power from osmo-trx
Change-Id: I682211f3d664c21f923ca4a530e0464ca383b6d9
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/main.c
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_if.h
M src/osmo-bts-trx/trx_vty.c
6 files changed, 53 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/89/18589/1
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 3f61564..9cdbd6c 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -147,6 +147,16 @@
trx->power_params.trx_p_max_out_mdBm = to_mdB(nominal_power);
}
+static void l1if_getnompower_cb(struct trx_l1h *l1h, unsigned 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);
+
+ l1if_trx_set_nominal_power(trx, nominal_power);
+}
+
static void l1if_setslot_cb(struct trx_l1h *l1h, uint8_t tn, uint8_t type, int rc)
{
struct phy_instance *pinst = l1h->phy_inst;
@@ -242,6 +252,13 @@
if (!l1h->config.arfcn_sent) {
trx_if_cmd_rxtune(l1h, l1h->config.arfcn);
trx_if_cmd_txtune(l1h, l1h->config.arfcn);
+ /* After TXTUNE is sent to TRX, get the tx nominal power
+ * (which may vary precisly on band/arfcn. Avoid sending
+ * it if we are forced by VTY to use a specific nominal
+ * power (because TRX may not support the command or
+ * provide broken values) */
+ if (!l1h->config.nominal_power_set_by_vty)
+ trx_if_cmd_getnompower(l1h, l1if_getnompower_cb);
l1h->config.arfcn_sent = 1;
}
if (!l1h->config.tsc_sent) {
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index b5262a8..b1ffcd9 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -74,6 +74,7 @@
int rxgain_sent;
int forced_max_power_red; /* -1 if not forced by VTY config (default) */
+ bool nominal_power_set_by_vty; /* whether noinal trx power was enforced/retreived from VTY config "nominal-tx-power" */
int maxdly_valid;
int maxdly;
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 33577d5..9784077 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -104,10 +104,9 @@
bts->variant = BTS_OSMO_TRX;
bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
- /* The nominal value is later overwritten through VTY cmd
- * 'nominal-tx-power' if present.
- * FIXME: In the future, we want osmo-trx to provide us with this info
- * through TRXC. */
+ /* The nominal value for each TRX is later overwritten through VTY cmd
+ * 'nominal-tx-power' if present, otherwise through TRXC cmd NOMTXPOWER.
+ */
bts->c0->nominal_power = 23;
gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
@@ -127,6 +126,9 @@
int bts_model_trx_init(struct gsm_bts_trx *trx)
{
+ /* The nominal value for each TRX is later overwritten through VTY cmd
+ * 'nominal-tx-power' if present, otherwise through TRXC cmd NOMTXPOWER.
+ */
l1if_trx_set_nominal_power(trx, 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 03bf9aa..a837d1b 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -301,6 +301,12 @@
return trx_ctrl_cmd(l1h, 0, "SETRXGAIN", "%d", db);
}
+/*! Send "NOMTXPOWER" command to TRX */
+int trx_if_cmd_getnompower(struct trx_l1h *l1h, trx_if_cmd_getnompower_cb *cb)
+{
+ return trx_ctrl_cmd_cb(l1h, 1, cb, "NOMTXPOWER", "");
+}
+
/*! Send "SETPOWER" command to TRX */
int trx_if_cmd_setpower_att(struct trx_l1h *l1h, int power_att_db, trx_if_cmd_setpower_att_cb *cb)
{
@@ -543,6 +549,22 @@
return 0;
}
+static int trx_ctrl_rx_rsp_nomtxpower(struct trx_l1h *l1h, struct trx_ctrl_rsp *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;
+
+ if (rsp->status)
+ LOGPPHI(pinst, DTRX, LOGL_ERROR, "transceiver NOMTXPOWER failed with status %d\n",
+ rsp->status);
+ if (cb) {
+ sscanf(rsp->params, "%u", &nominal_power);
+ cb(l1h, nominal_power, rsp->status);
+ }
+ return 0;
+}
+
static int trx_ctrl_rx_rsp_setpower(struct trx_l1h *l1h, struct trx_ctrl_rsp *rsp)
{
trx_if_cmd_setpower_att_cb *cb = (trx_if_cmd_setpower_att_cb*) rsp->cb;
@@ -577,6 +599,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, "NOMTXPOWER") == 0) {
+ return trx_ctrl_rx_rsp_nomtxpower(l1h, rsp);
} else if (strcmp(tcm->cmd, "SETPOWER") == 0) {
return trx_ctrl_rx_rsp_setpower(l1h, rsp);
}
diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h
index 300be92..34335f8 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_getnompower_cb(struct trx_l1h *l1h, unsigned 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);
@@ -23,6 +24,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_getnompower(struct trx_l1h *l1h, trx_if_cmd_getnompower_cb *cb);
int trx_if_cmd_setpower_att(struct trx_l1h *l1h, int power_att_db, trx_if_cmd_setpower_att_cb *cb);
int trx_if_cmd_setmaxdly(struct trx_l1h *l1h, int dly);
int trx_if_cmd_setmaxdlynb(struct trx_l1h *l1h, int dly);
diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c
index 06591a1..366c434 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -165,9 +165,12 @@
"Nominal transmit output power level in dBm\n")
{
struct gsm_bts_trx *trx = vty->index;
+ struct phy_instance *pinst = trx_phy_instance(trx);
+ struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
int val = atoi(argv[0]);
l1if_trx_set_nominal_power(trx, val);
+ l1h->config.nominal_power_set_by_vty = val ? true : false;
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/18589
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I682211f3d664c21f923ca4a530e0464ca383b6d9
Gerrit-Change-Number: 18589
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/20200529/bdd6bdef/attachment.htm>