aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-10-05 17:16:20 +0200
committerHarald Welte <laforge@gnumonks.org>2013-10-05 17:16:20 +0200
commit143de750131f9df43cd900a65ee73e9dbbce333e (patch)
tree96a5f2f82a508f24c1a3d3a7737aebb582fcdd4d
parent0b0e12a09cc67e3a35c30308c46fad0f153d6ad4 (diff)
Do not attempt to initialize L1 with a band unsupported by hardwarelaforge/bands-eeprom
If the EEPROM tells us that a given unit doesn't support a given band, we shouldn't try to use it, even if the BSC tells us to use an ARFCN in such an unsupported band. The reason is simple: The given BTS unit might have band specific filter / duplexer / PA.
-rw-r--r--src/osmo-bts-sysmo/oml.c2
-rw-r--r--src/osmo-bts-sysmo/utils.c26
-rw-r--r--src/osmo-bts-sysmo/utils.h4
3 files changed, 21 insertions, 11 deletions
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index faef025..bd73f64 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -277,7 +277,7 @@ static int trx_init(struct gsm_bts_trx *trx)
//return oml_mo_opstart_nack(&trx->mo, NM_NACK_CANT_PERFORM);
}
- femto_band = sysmobts_select_femto_band(trx->bts, trx->arfcn);
+ femto_band = sysmobts_select_femto_band(trx, trx->arfcn);
if (femto_band < 0) {
LOGP(DL1C, LOGL_ERROR, "Unsupported GSM band %s\n",
gsm_band_name(trx->bts->band));
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index d3ee872..eaa4529 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -1,7 +1,7 @@
/*
* Helper utilities that are used in OML
*
- * (C) 2011 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2011-2013 by Harald Welte <laforge@gnumonks.org>
* (C) 2013 by Holger Hans Peter Freyther
*
* All Rights Reserved
@@ -24,11 +24,20 @@
#include "utils.h"
#include <osmo-bts/bts.h>
+#include <osmo-bts/gsm_data.h>
#include "femtobts.h"
+#include "l1_if.h"
-static int band_osmo2femto(enum gsm_band osmo_band)
+static int band_osmo2femto(struct gsm_bts_trx *trx, enum gsm_band osmo_band)
{
+ struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
+
+ /* check if the TRX hardware actually supports the given band */
+ if (!(fl1h->hw_info.band_support & osmo_band))
+ return -1;
+
+ /* if yes, convert from osmcoom style band definition to L1 band */
switch (osmo_band) {
case GSM_BAND_850:
return GsmL1_FreqBand_850;
@@ -50,13 +59,14 @@ static int band_osmo2femto(enum gsm_band osmo_band)
* modifying the BTS configuration is a bit annoying. The auto-band
* configuration allows to ease with this transition.
*/
-int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn)
+int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn)
{
enum gsm_band band;
+ struct gsm_bts *bts = trx->bts;
struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
if (!btsb->auto_band)
- return band_osmo2femto(bts->band);
+ return band_osmo2femto(trx, bts->band);
/*
* We need to check what will happen now.
@@ -65,11 +75,11 @@ int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn)
/* if we are already on the right band return */
if (band == bts->band)
- return band_osmo2femto(bts->band);
+ return band_osmo2femto(trx, bts->band);
/* Check if it is GSM1800/GSM1900 */
if (band == GSM_BAND_1800 && bts->band == GSM_BAND_1900)
- return band_osmo2femto(bts->band);
+ return band_osmo2femto(trx, bts->band);
/*
* Now to the actual autobauding. We just want DCS/DCS and
@@ -78,9 +88,9 @@ int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn)
if ((band == GSM_BAND_900 && bts->band == GSM_BAND_1800)
|| (band == GSM_BAND_1800 && bts->band == GSM_BAND_900)
|| (band == GSM_BAND_850 && bts->band == GSM_BAND_1900))
- return band_osmo2femto(band);
+ return band_osmo2femto(trx, band);
if (band == GSM_BAND_1800 && bts->band == GSM_BAND_850)
- return band_osmo2femto(GSM_BAND_1900);
+ return band_osmo2femto(trx, GSM_BAND_1900);
/* give up */
return -1;
diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h
index 4574e22..6570635 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -3,8 +3,8 @@
#include <stdint.h>
-struct gsm_bts;
+struct gsm_bts_trx;
-int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn);
+int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn);
#endif