Don't reset kernel frequency on start without drift file
This commit is contained in:
parent
a5f63180fc
commit
2b7e4d645f
4 changed files with 26 additions and 15 deletions
|
@ -141,6 +141,7 @@ REF_Initialise(void)
|
|||
our_frequency_ppm = file_freq_ppm;
|
||||
our_skew = 1.0e-6 * file_skew_ppm;
|
||||
LOG(LOGS_INFO, LOGF_Reference, "Frequency %.3f +- %.3f ppm read from %s", file_freq_ppm, file_skew_ppm, drift_file);
|
||||
LCL_SetAbsoluteFrequency(our_frequency_ppm);
|
||||
} else {
|
||||
LOG(LOGS_WARN, LOGF_Reference, "Could not parse valid frequency and skew from driftfile %s",
|
||||
drift_file);
|
||||
|
@ -155,7 +156,12 @@ REF_Initialise(void)
|
|||
drift_file_age = 0.0;
|
||||
}
|
||||
|
||||
LCL_SetAbsoluteFrequency(our_frequency_ppm);
|
||||
if (our_frequency_ppm == 0.0) {
|
||||
our_frequency_ppm = LCL_ReadAbsoluteFrequency();
|
||||
if (our_frequency_ppm != 0.0) {
|
||||
LOG(LOGS_INFO, LOGF_Reference, "Initial frequency %.3f ppm", our_frequency_ppm);
|
||||
}
|
||||
}
|
||||
|
||||
logfileid = CNF_GetLogTracking() ? LOG_FileOpen("tracking",
|
||||
" Date (UTC) Time IP Address St Freq ppm Skew ppm Offset")
|
||||
|
|
28
sys_linux.c
28
sys_linux.c
|
@ -720,15 +720,17 @@ read_frequency(void)
|
|||
double tick_term;
|
||||
double unscaled_freq;
|
||||
double freq_term;
|
||||
long tick;
|
||||
|
||||
if (TMX_GetFrequency(&unscaled_freq) < 0) {
|
||||
if (TMX_GetFrequency(&unscaled_freq, &tick) < 0) {
|
||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
||||
}
|
||||
|
||||
/* Use current_tick here rather than txc.tick, otherwise we're
|
||||
thrown off course when doing a fast slew (in which case, txc.tick
|
||||
is nowhere near the nominal value) */
|
||||
tick_term = dhz * (double)(nominal_tick - current_tick);
|
||||
if (fast_slewing) {
|
||||
tick -= slewing_tick - current_tick;
|
||||
}
|
||||
|
||||
tick_term = dhz * (double)(nominal_tick - tick);
|
||||
freq_term = unscaled_freq / freq_scale;
|
||||
|
||||
#if 0
|
||||
|
@ -1043,19 +1045,13 @@ void
|
|||
SYS_Linux_Initialise(void)
|
||||
{
|
||||
long offset;
|
||||
double freq;
|
||||
|
||||
offset_register = 0.0;
|
||||
fast_slewing = 0;
|
||||
|
||||
get_version_specific_details();
|
||||
|
||||
current_tick = nominal_tick;
|
||||
current_total_tick = 1.0 / dhz;
|
||||
|
||||
lcl_RegisterSystemDrivers(read_frequency, set_frequency,
|
||||
accrue_offset, apply_step_offset,
|
||||
get_offset_correction, set_leap);
|
||||
|
||||
offset = 0;
|
||||
if (TMX_ApplyOffset(&offset) < 0) {
|
||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
||||
|
@ -1072,6 +1068,14 @@ SYS_Linux_Initialise(void)
|
|||
}
|
||||
|
||||
TMX_SetSync(CNF_GetRTCSync());
|
||||
|
||||
/* Read current kernel frequency */
|
||||
TMX_GetFrequency(&freq, ¤t_tick);
|
||||
current_total_tick = (current_tick + freq / freq_scale / dhz) / 1.0e6;
|
||||
|
||||
lcl_RegisterSystemDrivers(read_frequency, set_frequency,
|
||||
accrue_offset, apply_step_offset,
|
||||
get_offset_correction, set_leap);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
|
|
@ -86,13 +86,14 @@ TMX_SetFrequency(double *freq, long tick)
|
|||
}
|
||||
|
||||
int
|
||||
TMX_GetFrequency(double *freq)
|
||||
TMX_GetFrequency(double *freq, long *tick)
|
||||
{
|
||||
struct timex txc;
|
||||
int result;
|
||||
txc.modes = 0; /* pure read */
|
||||
result = adjtimex(&txc);
|
||||
*freq = txc.freq / (double)(1 << SHIFT_USEC);
|
||||
*tick = txc.tick;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ struct tmx_params {
|
|||
int TMX_SetTick(long tick);
|
||||
int TMX_ApplyOffset(long *offset);
|
||||
int TMX_SetFrequency(double *freq, long tick);
|
||||
int TMX_GetFrequency(double *freq);
|
||||
int TMX_GetFrequency(double *freq, long *tick);
|
||||
int TMX_GetOffsetLeft(long *offset);
|
||||
int TMX_ReadCurrentParams(struct tmx_params *params);
|
||||
int TMX_SetLeap(int leap);
|
||||
|
|
Loading…
Reference in a new issue