sys: add sync status setting to generic and Linux driver

Set the adjtimex status, esterror and maxerror fields to the values
provided by the reference module.
This commit is contained in:
Miroslav Lichvar
2014-12-09 17:31:10 +01:00
parent 2645e632a8
commit 02cbe5e1ad
5 changed files with 54 additions and 17 deletions

View File

@@ -68,19 +68,11 @@ TMX_SetFrequency(double *freq, long tick)
{
struct timex txc;
txc.modes = ADJ_TICK | ADJ_FREQUENCY | ADJ_STATUS;
txc.modes = ADJ_TICK | ADJ_FREQUENCY;
txc.freq = (long)(*freq * (double)(1 << SHIFT_USEC));
*freq = txc.freq / (double)(1 << SHIFT_USEC);
txc.tick = tick;
txc.status = status;
if (!(status & STA_UNSYNC)) {
/* maxerror has to be reset periodically to prevent kernel
from enabling UNSYNC flag */
txc.modes |= ADJ_MAXERROR;
txc.maxerror = 0;
}
return adjtimex(&txc);
}
@@ -161,7 +153,7 @@ TMX_SetLeap(int leap)
return adjtimex(&txc);
}
int TMX_SetSync(int sync)
int TMX_SetSync(int sync, double est_error, double max_error)
{
struct timex txc;
@@ -171,8 +163,10 @@ int TMX_SetSync(int sync)
status |= STA_UNSYNC;
}
txc.modes = ADJ_STATUS;
txc.modes = ADJ_STATUS | ADJ_ESTERROR | ADJ_MAXERROR;
txc.status = status;
txc.esterror = est_error * 1.0e6;
txc.maxerror = max_error * 1.0e6;
return adjtimex(&txc);
}