sysmobts: Embed the calib state in the femtol1_hdl and use hdl->priv
This commit is contained in:
parent
b6942ffeb9
commit
64c5e3a19c
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <osmocom/core/utils.h>
|
#include <osmocom/core/utils.h>
|
||||||
|
|
||||||
|
#include <osmo-bts/gsm_data.h>
|
||||||
#include <osmo-bts/logging.h>
|
#include <osmo-bts/logging.h>
|
||||||
|
|
||||||
#include <sysmocom/femtobts/superfemto.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 */
|
/* 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);
|
static int calib_send_compl_cb(struct msgb *l1_msg, void *data);
|
||||||
|
|
||||||
/* send the calibration table for a single specified file */
|
/* send the calibration table for a single specified file */
|
||||||
static int calib_file_send(struct femtol1_hdl *fl1h,
|
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;
|
struct msgb *msg;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -222,13 +217,15 @@ static int calib_file_send(struct femtol1_hdl *fl1h,
|
||||||
return rc;
|
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 */
|
/* completion callback after every SetCalibTbl is confirmed */
|
||||||
static int calib_send_compl_cb(struct msgb *l1_msg, void *data)
|
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",
|
LOGP(DL1C, LOGL_DEBUG, "L1 calibration table %s loaded\n",
|
||||||
calib_files[st->last_file_idx].fname);
|
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++;
|
st->last_file_idx++;
|
||||||
|
|
||||||
if (st->last_file_idx < ARRAY_SIZE(calib_files))
|
if (st->last_file_idx < ARRAY_SIZE(calib_files))
|
||||||
return calib_file_send(st->fl1h,
|
return calib_file_send(fl1h,
|
||||||
&calib_files[st->last_file_idx], st);
|
&calib_files[st->last_file_idx]);
|
||||||
|
|
||||||
LOGP(DL1C, LOGL_INFO, "L1 calibration table loading complete!\n");
|
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)
|
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)
|
#if SUPERFEMTO_API_VERSION < SUPERFEMTO_API(2,4,0)
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
return calib_file_send(fl1h, &calib_files[0], &st);
|
return calib_file_send(fl1h, &calib_files[0]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@ enum {
|
||||||
_NUM_MQ_WRITE
|
_NUM_MQ_WRITE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct calib_send_state {
|
||||||
|
const char *path;
|
||||||
|
int last_file_idx;
|
||||||
|
};
|
||||||
|
|
||||||
struct femtol1_hdl {
|
struct femtol1_hdl {
|
||||||
struct gsm_time gsm_time;
|
struct gsm_time gsm_time;
|
||||||
uint32_t hLayer1; /* handle to the L1 instance in the DSP */
|
uint32_t hLayer1; /* handle to the L1 instance in the DSP */
|
||||||
|
@ -53,6 +58,8 @@ struct femtol1_hdl {
|
||||||
uint8_t fpga_version[3];
|
uint8_t fpga_version[3];
|
||||||
uint32_t band_support; /* bitmask of GSM_BAND_* */
|
uint32_t band_support; /* bitmask of GSM_BAND_* */
|
||||||
} hw_info;
|
} hw_info;
|
||||||
|
|
||||||
|
struct calib_send_state st;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h)
|
#define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h)
|
||||||
|
|
Loading…
Reference in New Issue