refclock: Fix poll counting for refclocks that do polling and event driven timekeeping
The RTC refclock support both modes of timekeeping (depending on hardware capabilities). As the driver data is const there is a poll callback even in interrupt mode. So only count poll calls that return non-zero and count provided timestamps in the respective functions if they are not called from the driver's poll routine.
This commit is contained in:
parent
ef16020488
commit
28c9e66f5b
1 changed files with 6 additions and 2 deletions
|
@ -64,6 +64,7 @@ struct RCL_Instance_Record {
|
||||||
int driver_poll;
|
int driver_poll;
|
||||||
int driver_polled;
|
int driver_polled;
|
||||||
int poll;
|
int poll;
|
||||||
|
int inpoll;
|
||||||
int leap_status;
|
int leap_status;
|
||||||
int local;
|
int local;
|
||||||
int pps_forced;
|
int pps_forced;
|
||||||
|
@ -177,6 +178,7 @@ RCL_AddRefclock(RefclockParameters *params)
|
||||||
inst->driver_parameter_length = 0;
|
inst->driver_parameter_length = 0;
|
||||||
inst->driver_poll = params->driver_poll;
|
inst->driver_poll = params->driver_poll;
|
||||||
inst->poll = params->poll;
|
inst->poll = params->poll;
|
||||||
|
inst->inpoll = 0;
|
||||||
inst->driver_polled = 0;
|
inst->driver_polled = 0;
|
||||||
inst->leap_status = LEAP_Normal;
|
inst->leap_status = LEAP_Normal;
|
||||||
inst->local = params->local;
|
inst->local = params->local;
|
||||||
|
@ -505,7 +507,7 @@ RCL_AddSample(RCL_Instance instance, struct timespec *sample_time,
|
||||||
log_sample(instance, &cooked_time, 0, 0, raw_offset, offset, dispersion);
|
log_sample(instance, &cooked_time, 0, 0, raw_offset, offset, dispersion);
|
||||||
|
|
||||||
/* for logging purposes */
|
/* for logging purposes */
|
||||||
if (!instance->driver->poll)
|
if (!instance->inpoll)
|
||||||
instance->driver_polled++;
|
instance->driver_polled++;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -662,7 +664,7 @@ RCL_AddCookedPulse(RCL_Instance instance, struct timespec *cooked_time,
|
||||||
offset, dispersion);
|
offset, dispersion);
|
||||||
|
|
||||||
/* for logging purposes */
|
/* for logging purposes */
|
||||||
if (!instance->driver->poll)
|
if (!instance->inpoll)
|
||||||
instance->driver_polled++;
|
instance->driver_polled++;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -788,7 +790,9 @@ poll_timeout(void *arg)
|
||||||
|
|
||||||
if (inst->driver->poll) {
|
if (inst->driver->poll) {
|
||||||
poll = inst->driver_poll;
|
poll = inst->driver_poll;
|
||||||
|
inst->inpoll = 1;
|
||||||
inst->driver->poll(inst);
|
inst->driver->poll(inst);
|
||||||
|
inst->inpoll = 0;
|
||||||
inst->driver_polled++;
|
inst->driver_polled++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue