diff options
author | Harald Welte <laforge@gnumonks.org> | 2013-10-05 17:16:20 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2013-10-09 15:38:33 +0200 |
commit | 19009f2d7ae805ca8037747934cb9c76f533022c (patch) | |
tree | 7bae070de4768a0cf24b0869870cadd0422a8e6c /src/osmo-bts-sysmo/utils.c | |
parent | de0ca823f10650328b40db9bf0ce3a287c004b27 (diff) |
Do not attempt to initialize L1 with a band unsupported by hardware
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.
Diffstat (limited to 'src/osmo-bts-sysmo/utils.c')
-rw-r--r-- | src/osmo-bts-sysmo/utils.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c index d3ee872c..eaa45290 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; |