aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-10-05 18:10:09 +0200
committerHarald Welte <laforge@gnumonks.org>2013-10-09 15:38:33 +0200
commit50e63fa9e7e89b4966007d90d29b0e5ba88d988d (patch)
tree07278795aa5b76d96f61d6e6e2fd6da1209e4b75
parent19009f2d7ae805ca8037747934cb9c76f533022c (diff)
sysmobts: Set nominal transmit power depending on sysmoBTS model
This enables the use of up to 5W for each TRX in a sysmoBTS 2050.
-rw-r--r--src/osmo-bts-sysmo/main.c11
-rw-r--r--src/osmo-bts-sysmo/utils.c20
-rw-r--r--src/osmo-bts-sysmo/utils.h2
3 files changed, 32 insertions, 1 deletions
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 15b1f1c0..9e89eb8a 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -48,6 +48,7 @@
#define SYSMOBTS_RF_LOCK_PATH "/var/lock/bts_rf_lock"
+#include "utils.h"
#include "eeprom.h"
#include "l1_if.h"
@@ -63,6 +64,7 @@ static int rt_prio = -1;
int bts_model_init(struct gsm_bts *bts)
{
struct femtol1_hdl *fl1h;
+ int rc;
fl1h = l1if_open(bts->c0);
if (!fl1h) {
@@ -72,7 +74,14 @@ int bts_model_init(struct gsm_bts *bts)
fl1h->dsp_trace_f = dsp_trace;
bts->c0->role_bts.l1h = fl1h;
- bts->c0->nominal_power = 23;
+
+ rc = sysmobts_get_nominal_power(bts->c0);
+ if (rc < 0) {
+ LOGP(DL1C, LOGL_FATAL, "Cannot determine nominal "
+ "ansmit power\n");
+ return -EIO;
+ }
+ bts->c0->nominal_power = sysmobts_get_nominal_power(bts->c0);
bts_model_vty_init(bts);
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index eaa45290..50898453 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -95,3 +95,23 @@ 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(39dBm) per TRX. This could be raiesd to 10W(40dBm)
+ * if the second TRX is not used. */
+ return 37;
+ }
+ return -1;
+}
diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h
index 65706359..df4f0a34 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -7,4 +7,6 @@ struct gsm_bts_trx;
int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn);
+int sysmobts_get_nominal_power(struct gsm_bts_trx *trx);
+
#endif