sysmobts: Copy more of l1if_rf_clock_info_reset into the CTRL code

The CTRL code should have used/extended the l1_if calibration
code. The sysmobts-mgr code first needs to determine if the
clock adjustment is necessary at all. This is done by first
resetting the counters, then waiting, then asking for the diff
and then applying the correction value. But the reference clock
is only set by the application comand.

Copy more code of l1if_rf_clock_info_reset to set the reference
clock as value. This is leaving some todos inside the code that
will be resolved as part of SYS#835.

Related: SYS#835
This commit is contained in:
Holger Hans Peter Freyther 2014-12-12 19:20:17 +01:00
parent 50131c125e
commit fd425b1484
1 changed files with 17 additions and 0 deletions

View File

@ -121,6 +121,13 @@ static int ctrl_set_clkinfo_cb(struct gsm_bts_trx *trx, struct msgb *resp,
return 0;
}
static int clock_setup_cb(struct gsm_bts_trx *trx, struct msgb *resp,
void *data)
{
msgb_free(resp);
return 0;
}
static int set_clock_info(struct ctrl_cmd *cmd, void *data)
{
struct gsm_bts_trx *trx = cmd->node;
@ -132,6 +139,16 @@ static int set_clock_info(struct ctrl_cmd *cmd, void *data)
/* geneate a deferred control command */
cd = ctrl_cmd_def_make(fl1h, cmd, NULL, 10);
/* Set GPS/PPS as reference */
sysp->id = SuperFemto_PrimId_RfClockSetupReq;
sysp->u.rfClockSetupReq.rfTrx.iClkCor = fl1h->clk_cal; /* !!! use get_clk_cal */
sysp->u.rfClockSetupReq.rfTrx.clkSrc = fl1h->clk_src;
sysp->u.rfClockSetupReq.rfTrxClkCal.clkSrc = SuperFemto_ClkSrcId_GpsPps;
l1if_req_compl(fl1h, msg, clock_setup_cb, NULL);
/* Reset the error counters */
msg = sysp_msgb_alloc();
sysp = msgb_sysprim(msg);
sysp->id = SuperFemto_PrimId_RfClockInfoReq;
sysp->u.rfClockInfoReq.u8RstClkCal = 1;