aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-10-28 09:42:14 +0100
committerHarald Welte <laforge@gnumonks.org>2013-10-28 10:15:47 +0100
commitb8687024eac87d325056db55ff181da2ded8a310 (patch)
tree59ed9617cbe44be065ce4fa6003f74db9d5b5592
parent501673fcf378a3b519875d6b4b77b1967038af24 (diff)
sysmobts calibration: skip bands not supported by L1
If L1 tells us that a certain band is not supported, then there is no point in even trying to read+load calibration tables from EEPROM or files.
-rw-r--r--src/osmo-bts-sysmo/calib_file.c29
-rw-r--r--src/osmo-bts-sysmo/utils.c16
-rw-r--r--src/osmo-bts-sysmo/utils.h3
3 files changed, 43 insertions, 5 deletions
diff --git a/src/osmo-bts-sysmo/calib_file.c b/src/osmo-bts-sysmo/calib_file.c
index ccfebbd9..7b3e6ac9 100644
--- a/src/osmo-bts-sysmo/calib_file.c
+++ b/src/osmo-bts-sysmo/calib_file.c
@@ -117,6 +117,20 @@ static const unsigned int arrsize_by_band[] = {
[GsmL1_FreqBand_1900] = 299
};
+/* determine next calibration file index based on supported bands */
+static int next_calib_file_idx(uint32_t band_mask, int last_idx)
+{
+ int i;
+
+ for (i = last_idx+1; i < ARRAY_SIZE(calib_files); i++) {
+ int band = band_femto2osmo(calib_files[i].band);
+ if (band < 0)
+ continue;
+ if (band_mask & band);
+ return i;
+ }
+ return -1;
+}
static float read_float(FILE *in)
{
@@ -384,15 +398,15 @@ static int calib_send_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg)
struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
struct calib_send_state *st = &fl1h->st;
- LOGP(DL1C, LOGL_DEBUG, "L1 calibration table %s loaded (src: %s)\n",
+ LOGP(DL1C, LOGL_NOTICE, "L1 calibration table %s loaded (src: %s)\n",
calib_files[st->last_file_idx].fname,
fl1h->calib_path ? "file" : "eeprom");
msgb_free(l1_msg);
- st->last_file_idx++;
-
- if (st->last_file_idx < ARRAY_SIZE(calib_files))
+ st->last_file_idx = next_calib_file_idx(fl1h->hw_info.band_support,
+ st->last_file_idx);
+ if (st->last_file_idx >= 0)
return calib_file_send(fl1h,
&calib_files[st->last_file_idx]);
@@ -409,7 +423,12 @@ int calib_load(struct femtol1_hdl *fl1h)
LOGP(DL1C, LOGL_ERROR, "L1 calibration is not supported on pre 2.4.0 firmware.\n");
return -1;
#else
- return calib_file_send(fl1h, &calib_files[0]);
+ int idx = next_calib_file_idx(fl1h->hw_info.band_support, -1);
+ if (idx < 0) {
+ LOGP(DL1C, LOGL_ERROR, "No band_support?!?\n");
+ return -1;
+ }
+ return calib_file_send(fl1h, &calib_files[idx]);
#endif
}
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index 50898453..0114fd3e 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -29,6 +29,22 @@
#include "femtobts.h"
#include "l1_if.h"
+int band_femto2osmo(GsmL1_FreqBand_t band)
+{
+ switch (band) {
+ case GsmL1_FreqBand_850:
+ return GSM_BAND_850;
+ case GsmL1_FreqBand_900:
+ return GSM_BAND_900;
+ case GsmL1_FreqBand_1800:
+ return GSM_BAND_1800;
+ case GsmL1_FreqBand_1900:
+ return GSM_BAND_1900;
+ default:
+ return -1;
+ }
+}
+
static int band_osmo2femto(struct gsm_bts_trx *trx, enum gsm_band osmo_band)
{
struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h
index df4f0a34..ff41437a 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -2,9 +2,12 @@
#define SYSMOBTS_UTILS_H
#include <stdint.h>
+#include "femtobts.h"
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);