diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-01-21 14:02:34 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-02-27 09:07:17 +0100 |
commit | 64c5e3a19c94c29331414da30e9d8eca81a70fce (patch) | |
tree | fbafdb2d1afaa2258f238f9d7f0953aff3cd06f8 | |
parent | b6942ffeb9c5b742ca111a8c2b49a98e102da2fe (diff) |
sysmobts: Embed the calib state in the femtol1_hdl and use hdl->priv
-rw-r--r-- | src/osmo-bts-sysmo/calib_file.c | 26 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.h | 7 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src/osmo-bts-sysmo/calib_file.c b/src/osmo-bts-sysmo/calib_file.c index 081444f..9dba4cd 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 } diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h index 8d01551..60e21e2 100644 --- a/src/osmo-bts-sysmo/l1_if.h +++ b/src/osmo-bts-sysmo/l1_if.h @@ -27,6 +27,11 @@ enum { _NUM_MQ_WRITE }; +struct calib_send_state { + const char *path; + int last_file_idx; +}; + struct femtol1_hdl { struct gsm_time gsm_time; uint32_t hLayer1; /* handle to the L1 instance in the DSP */ @@ -53,6 +58,8 @@ struct femtol1_hdl { uint8_t fpga_version[3]; uint32_t band_support; /* bitmask of GSM_BAND_* */ } hw_info; + + struct calib_send_state st; }; #define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h) |