hwclock: add parameters for minimum/maximum number of samples

Allocate the arrays which hold the samples dynamically and limit the
number of dropped samples to not fall below the minimum.
This commit is contained in:
Miroslav Lichvar
2018-08-08 13:22:30 +02:00
parent 159bd73f76
commit c0717a27f6
5 changed files with 33 additions and 17 deletions

View File

@@ -80,7 +80,7 @@ static int phc_initialise(RCL_Instance instance)
s = RCL_GetDriverOption(instance, "channel");
phc->channel = s ? atoi(s) : 0;
rising_edge = RCL_GetDriverOption(instance, "clear") ? 0 : 1;
phc->clock = HCL_CreateInstance(UTI_Log2ToDouble(RCL_GetDriverPoll(instance)));
phc->clock = HCL_CreateInstance(0, 16, UTI_Log2ToDouble(RCL_GetDriverPoll(instance)));
if (!SYS_Linux_SetPHCExtTimestamping(phc->fd, phc->pin, phc->channel,
rising_edge, !rising_edge, 1))