aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-01 10:26:05 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-04 17:38:15 +0200
commit270cf418fc64ad77b179f75394c5dc34c95f4388 (patch)
tree94d925b81f7593ce90e5d50e729545a7d474bc73
parenteebdfb8e6f626f1f5e08353dab78cbe6d2ed1f5f (diff)
sysmobts: Read the mac and determine fixup only once during start
-rw-r--r--src/osmo-bts-sysmo/calib_file.c32
-rw-r--r--src/osmo-bts-sysmo/l1_if.h8
2 files changed, 32 insertions, 8 deletions
diff --git a/src/osmo-bts-sysmo/calib_file.c b/src/osmo-bts-sysmo/calib_file.c
index 2cb497da..a81deae0 100644
--- a/src/osmo-bts-sysmo/calib_file.c
+++ b/src/osmo-bts-sysmo/calib_file.c
@@ -143,21 +143,22 @@ static const float delta_by_band[Num_GsmL1_FreqBand] = {
extern const uint8_t fixup_macs[95][6];
-static void calib_fixup_rx(struct femtol1_hdl *fl1h, SuperFemto_Prim_t *prim)
+
+static void determine_fixup(struct femtol1_hdl *fl1h)
{
-#if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(2,4,0)
- SuperFemto_SetRxCalibTblReq_t *rx = &prim->u.setRxCalibTblReq;
uint8_t macaddr[6];
int rc, i;
- int fixup_needed = 0;
rc = eeprom_ReadEthAddr(macaddr);
if (rc != EEPROM_SUCCESS) {
LOGP(DL1C, LOGL_ERROR,
- "Unable to read Ethenet MAC from EEPROM\n");
+ "Unable to read Ethenet MAC from EEPROM\n");
return;
}
+ /* assume no fixup is needed */
+ fl1h->fixup_needed = FIXUP_NOT_NEEDED;
+
if (fl1h->hw_info.dsp_version[0] < 3 ||
(fl1h->hw_info.dsp_version[0] == 3 &&
fl1h->hw_info.dsp_version[1] < 3)) {
@@ -168,16 +169,31 @@ static void calib_fixup_rx(struct femtol1_hdl *fl1h, SuperFemto_Prim_t *prim)
for (i = 0; i < sizeof(fixup_macs)/6; i++) {
if (!memcmp(fixup_macs[i], macaddr, 6)) {
- fixup_needed = 1;
+ fl1h->fixup_needed = FIXUP_NEEDED;
break;
}
}
LOGP(DL1C, LOGL_NOTICE, "MAC Address is %02x:%02x:%02x:%02x:%02x:%02x -> %s\n",
macaddr[0], macaddr[1], macaddr[2], macaddr[3],
- macaddr[4], macaddr[5], fixup_needed ? "FIXUP" : "NO FIXUP");
+ macaddr[4], macaddr[5],
+ fl1h->fixup_needed == FIXUP_NEEDED ? "FIXUP" : "NO FIXUP");
+}
+
+static int fixup_needed(struct femtol1_hdl *fl1h)
+{
+ if (fl1h->fixup_needed == FIXUP_UNITILIAZED)
+ determine_fixup(fl1h);
+
+ return fl1h->fixup_needed == FIXUP_NEEDED;
+}
+
+static void calib_fixup_rx(struct femtol1_hdl *fl1h, SuperFemto_Prim_t *prim)
+{
+#if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(2,4,0)
+ SuperFemto_SetRxCalibTblReq_t *rx = &prim->u.setRxCalibTblReq;
- if (fixup_needed)
+ if (fixup_needed(fl1h))
rx->fExtRxGain += delta_by_band[rx->freqBand];
#endif
}
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
index cf4f4835..7947ea2c 100644
--- a/src/osmo-bts-sysmo/l1_if.h
+++ b/src/osmo-bts-sysmo/l1_if.h
@@ -32,6 +32,12 @@ struct calib_send_state {
int last_file_idx;
};
+enum {
+ FIXUP_UNITILIAZED,
+ FIXUP_NEEDED,
+ FIXUP_NOT_NEEDED,
+};
+
struct femtol1_hdl {
struct gsm_time gsm_time;
uint32_t hLayer1; /* handle to the L1 instance in the DSP */
@@ -61,6 +67,8 @@ struct femtol1_hdl {
uint32_t band_support; /* bitmask of GSM_BAND_* */
} hw_info;
+ int fixup_needed;
+
struct calib_send_state st;
};