diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-04-19 20:19:21 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-04-19 20:19:21 +0200 |
commit | bcd08888f9efbfa7c3e401ac0fbbb339059ff4b1 (patch) | |
tree | 5f85882705982324b3e796d1abb365a3e5ca023b | |
parent | 9aa6d9496b4e0791c104ae711f0ccb7af7776e85 (diff) |
add VTY command to manually alter transmit power
this allows for quick manual tx power changes from the VTY, particularly
useful in type approval or other measurements.
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.h | 1 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/oml.c | 17 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/sysmobts_vty.c | 17 |
3 files changed, 34 insertions, 1 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h index 18ea0e0..1053a1d 100644 --- a/src/osmo-bts-sysmo/l1_if.h +++ b/src/osmo-bts-sysmo/l1_if.h @@ -66,6 +66,7 @@ int l1if_close(struct femtol1_hdl *hdl); int l1if_reset(struct femtol1_hdl *hdl); int l1if_activate_rf(struct femtol1_hdl *hdl, int on); int l1if_set_trace_flags(struct femtol1_hdl *hdl, uint32_t flags); +int l1if_set_txpower(struct femtol1_hdl *fl1h, float tx_power); struct msgb *l1p_msgb_alloc(void); struct msgb *sysp_msgb_alloc(void); diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index 8552887..403a8e4 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -762,8 +762,10 @@ static int chmod_modif_compl_cb(struct msgb *l1_msg, void *data) &cc->cfgParams.setLogChParams.logChParams, cc->cfgParams.setLogChParams.sapi); break; - case GsmL1_ConfigParamId_SetNbTsc: case GsmL1_ConfigParamId_SetTxPowerLevel: + LOGPC(DL1C, LOGL_INFO, "setTxPower %f dBm\n", + cc->cfgParams.setTxPowerLevel.fTxPowerLevel); + break; case GsmL1_ConfigParamId_SetCipheringParams: switch (lchan->ciph_state) { case LCHAN_CIPH_RX_REQ: @@ -779,6 +781,7 @@ static int chmod_modif_compl_cb(struct msgb *l1_msg, void *data) break; } break; + case GsmL1_ConfigParamId_SetNbTsc: default: LOGPC(DL1C, LOGL_INFO, "\n"); break; @@ -827,6 +830,18 @@ static int tx_confreq_logchpar(struct gsm_lchan *lchan, uint8_t direction) return l1if_req_compl(fl1h, msg, 0, chmod_modif_compl_cb, lchan); } +int l1if_set_txpower(struct femtol1_hdl *fl1h, float tx_power) +{ + struct msgb *msg = l1p_msgb_alloc(); + GsmL1_MphConfigReq_t *conf_req; + + conf_req = prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphConfigReq, fl1h); + conf_req->cfgParamId = GsmL1_ConfigParamId_SetTxPowerLevel; + conf_req->cfgParams.setTxPowerLevel.fTxPowerLevel = tx_power; + + return l1if_req_compl(fl1h, msg, 0, NULL, NULL); +} + const enum GsmL1_CipherId_t rsl2l1_ciph[] = { [0] = GsmL1_CipherId_A50, [1] = GsmL1_CipherId_A50, diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c index 927d2c9..c1bcfa7 100644 --- a/src/osmo-bts-sysmo/sysmobts_vty.c +++ b/src/osmo-bts-sysmo/sysmobts_vty.c @@ -328,6 +328,22 @@ DEFUN(activate_lchan, activate_lchan_cmd, return CMD_SUCCESS; } +DEFUN(set_tx_power, set_tx_power_cmd, + "trx <0-0> tx-power <-110-23>", + TRX_STR + "Set transmit power (override BSC)\n" + "Transmit power in dBm\n") +{ + int trx_nr = atoi(argv[0]); + int power = atoi(argv[1]); + struct gsm_bts_trx *trx = gsm_bts_trx_num(vty_bts, trx_nr); + struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); + + l1if_set_txpower(fl1h, (float) power); + + return CMD_SUCCESS; +} + void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts) { } @@ -363,6 +379,7 @@ int bts_model_vty_init(struct gsm_bts *bts) install_element_ve(&no_dsp_trace_f_cmd); install_element(ENABLE_NODE, &activate_lchan_cmd); + install_element(ENABLE_NODE, &set_tx_power_cmd); install_element(TRX_NODE, &cfg_trx_clkcal_cmd); install_element(TRX_NODE, &cfg_trx_clkcal_def_cmd); |