aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/calib_file.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-21 14:02:34 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-02-27 09:07:17 +0100
commit64c5e3a19c94c29331414da30e9d8eca81a70fce (patch)
treefbafdb2d1afaa2258f238f9d7f0953aff3cd06f8 /src/osmo-bts-sysmo/calib_file.c
parentb6942ffeb9c5b742ca111a8c2b49a98e102da2fe (diff)
sysmobts: Embed the calib state in the femtol1_hdl and use hdl->priv
Diffstat (limited to 'src/osmo-bts-sysmo/calib_file.c')
-rw-r--r--src/osmo-bts-sysmo/calib_file.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/osmo-bts-sysmo/calib_file.c b/src/osmo-bts-sysmo/calib_file.c
index 081444fa..9dba4cdc 100644
--- a/src/osmo-bts-sysmo/calib_file.c
+++ b/src/osmo-bts-sysmo/calib_file.c
@@ -27,6 +27,7 @@
#include <osmocom/core/utils.h>
+#include <osmo-bts/gsm_data.h>
#include <osmo-bts/logging.h>
#include <sysmocom/femtobts/superfemto.h>
@@ -199,17 +200,11 @@ int calib_file_read(const char *path, const struct calib_file_desc *desc,
/* iteratively download the calibration data into the L1 */
-struct calib_send_state {
- struct femtol1_hdl *fl1h;
- const char *path;
- int last_file_idx;
-};
-
static int calib_send_compl_cb(struct msgb *l1_msg, void *data);
/* send the calibration table for a single specified file */
static int calib_file_send(struct femtol1_hdl *fl1h,
- const struct calib_file_desc *desc, void *state)
+ const struct calib_file_desc *desc)
{
struct msgb *msg;
int rc;
@@ -222,13 +217,15 @@ static int calib_file_send(struct femtol1_hdl *fl1h,
return rc;
}
- return l1if_req_compl(fl1h, msg, 1, calib_send_compl_cb, state);
+ return l1if_req_compl(fl1h, msg, 1, calib_send_compl_cb, fl1h->priv);
}
/* completion callback after every SetCalibTbl is confirmed */
static int calib_send_compl_cb(struct msgb *l1_msg, void *data)
{
- struct calib_send_state *st = data;
+ struct gsm_bts_trx *trx = data;
+ struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
+ struct calib_send_state *st = &fl1h->st;
LOGP(DL1C, LOGL_DEBUG, "L1 calibration table %s loaded\n",
calib_files[st->last_file_idx].fname);
@@ -236,8 +233,8 @@ static int calib_send_compl_cb(struct msgb *l1_msg, void *data)
st->last_file_idx++;
if (st->last_file_idx < ARRAY_SIZE(calib_files))
- return calib_file_send(st->fl1h,
- &calib_files[st->last_file_idx], st);
+ return calib_file_send(fl1h,
+ &calib_files[st->last_file_idx]);
LOGP(DL1C, LOGL_INFO, "L1 calibration table loading complete!\n");
@@ -247,15 +244,10 @@ static int calib_send_compl_cb(struct msgb *l1_msg, void *data)
int calib_load(struct femtol1_hdl *fl1h)
{
- static struct calib_send_state st;
-
- memset(&st, 0, sizeof(st));
- st.fl1h = fl1h;
-
#if SUPERFEMTO_API_VERSION < SUPERFEMTO_API(2,4,0)
return -1;
#else
- return calib_file_send(fl1h, &calib_files[0], &st);
+ return calib_file_send(fl1h, &calib_files[0]);
#endif
}