aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-02-07 19:49:14 +0100
committerDaniel Willmann <daniel@totalueberwachung.de>2017-02-14 17:44:45 +0100
commitaf0ed4ee1417d165a530dcfc319143c4989c1444 (patch)
tree33471ff0ed326e0706d4fe85b030e7a12a7c9fe9
parent2112a7c333f984e8c03c3f675babf71943370f27 (diff)
sysmobts: fully support trx_power_params
The simplistic approach of sysmobts_get_nominal_power() is insufficient to cope for devices that have an internal PA. The Actual transceiver board is driven to a certain level (0..23 dBm typically), and the external PA must be handled independent of that. Increasing the return value of sysmobts_get_nominal_power() would result in the sysmoBTS mainboard attempting to reach a higher power, which is wrong. This change affects sysmoBTS 1020 and 1100. It causes power-ramping to be used by default. For 1002 and 2050, no behavior change is expected. Change-Id: Ieff75d5becaa80a2097b6e744c75c2d16259c9a4
-rw-r--r--src/osmo-bts-sysmo/l1_if.c3
-rw-r--r--src/osmo-bts-sysmo/main.c48
-rw-r--r--src/osmo-bts-sysmo/sysmobts_vty.c2
-rw-r--r--src/osmo-bts-sysmo/utils.c26
-rw-r--r--src/osmo-bts-sysmo/utils.h2
5 files changed, 49 insertions, 32 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 0159607a..dc97802b 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -51,6 +51,7 @@
#include <osmo-bts/handover.h>
#include <osmo-bts/cbch.h>
#include <osmo-bts/bts_model.h>
+#include <osmo-bts/tx_power.h>
#include <sysmocom/femtobts/superfemto.h>
#include <sysmocom/femtobts/gsml1prim.h>
@@ -1200,7 +1201,7 @@ int l1if_activate_rf(struct femtol1_hdl *hdl, int on)
LOGP(DL1C, LOGL_INFO, "Using external attenuator.\n");
sysp->u.activateRfReq.rfTrx.u8UseExtAtten = 1;
sysp->u.activateRfReq.rfTrx.fMaxTxPower =
- sysmobts_get_nominal_power(trx);
+ (float) get_p_trxout_target_mdBm(trx, 0) / 1000;
}
#endif /* 2.2.0 */
#if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(3,8,1)
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 1150310c..cb8d5a65 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -47,6 +47,7 @@
#include <osmo-bts/bts_model.h>
#include <osmo-bts/pcu_if.h>
#include <osmo-bts/control_if.h>
+#include <osmo-bts/tx_power.h>
#define SYSMOBTS_RF_LOCK_PATH "/var/lock/bts_rf_lock"
@@ -63,10 +64,46 @@ static int daemonize = 0;
static unsigned int dsp_trace = 0x71c00020;
static int rt_prio = -1;
+
+static void set_power_param(struct trx_power_params *out,
+ int trx_p_max_out_dBm,
+ int int_pa_nominal_gain_dB)
+{
+ out->trx_p_max_out_mdBm = to_mdB(trx_p_max_out_dBm);
+ out->pa.nominal_gain_mdB = to_mdB(int_pa_nominal_gain_dB);
+}
+
+static void fill_trx_power_params(struct gsm_bts_trx *trx,
+ struct femtol1_hdl *fl1h)
+{
+ switch (fl1h->hw_info.model_nr) {
+ case 1020:
+ set_power_param(&trx->power_params, 23, 10);
+ break;
+ case 1100:
+ set_power_param(&trx->power_params, 23, 17);
+ break;
+ case 2050:
+ set_power_param(&trx->power_params, 37, 0);
+ break;
+ default:
+ LOGP(DL1C, LOGL_NOTICE, "Unknown/Unsupported "
+ "sysmoBTS Model Number %u\n",
+ fl1h->hw_info.model_nr);
+ /* fall-through */
+ case 0xffff:
+ /* sysmoBTS 1002 without any setting in EEPROM */
+ LOGP(DL1C, LOGL_NOTICE, "Assuming 1002 for sysmoBTS "
+ "Model number %u\n", fl1h->hw_info.model_nr);
+ case 1002:
+ set_power_param(&trx->power_params, 23, 0);
+ }
+}
+
int bts_model_init(struct gsm_bts *bts)
{
struct femtol1_hdl *fl1h;
- int rc;
+ int rc, i;
fl1h = l1if_open(bts->c0);
if (!fl1h) {
@@ -77,7 +114,14 @@ int bts_model_init(struct gsm_bts *bts)
bts->c0->role_bts.l1h = fl1h;
- rc = sysmobts_get_nominal_power(bts->c0);
+
+ /* Set power params for each trx */
+ for (i = 0; i < bts->num_trx; i++) {
+ struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, i);
+ fill_trx_power_params(trx, fl1h);
+ }
+
+ rc = get_p_max_out_mdBm(bts->c0);
if (rc < 0) {
LOGP(DL1C, LOGL_NOTICE, "Cannot determine nominal "
"transmit power. Assuming 23dBm.\n");
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c
index 8b617d78..2d1b57de 100644
--- a/src/osmo-bts-sysmo/sysmobts_vty.c
+++ b/src/osmo-bts-sysmo/sysmobts_vty.c
@@ -546,7 +546,7 @@ void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx)
VTY_NEWLINE);
vty_out(vty, " min-qual-norm %.0f%s", fl1h->min_qual_norm * 10.0f,
VTY_NEWLINE);
- if (trx->nominal_power != sysmobts_get_nominal_power(trx))
+ if (trx->nominal_power != get_p_max_out_mdBm(trx))
vty_out(vty, " nominal-tx-power %d%s", trx->nominal_power,
VTY_NEWLINE);
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index a636ae15..be6051a8 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -112,29 +112,3 @@ int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn)
/* give up */
return -1;
}
-
-int sysmobts_get_nominal_power(struct gsm_bts_trx *trx)
-{
- struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
-
- switch (fl1h->hw_info.model_nr) {
- case 0:
- case 0xffff:
- /* old units have empty flash where the model number is
- * stored in later units */
- case 1002:
- /* 200mW (23 dBm) nominal power */
- return 23;
- case 2050:
- /* 5W(37dBm) per TRX. This could be raiesd to 10W(40dBm)
- * if the second TRX is not used. */
- return 37;
- default:
- LOGP(DL1C, LOGL_ERROR, "Model number %u/0x%x not known.\n",
- fl1h->hw_info.model_nr, fl1h->hw_info.model_nr);
- break;
- }
- return -1;
-}
-
-
diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h
index 58e3324f..45908d50 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -9,6 +9,4 @@ struct gsm_bts_trx;
int band_femto2osmo(GsmL1_FreqBand_t band);
int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn);
-
-int sysmobts_get_nominal_power(struct gsm_bts_trx *trx);
#endif