Remove absolute frequency from handler parameters

None of the current handlers really need it and with temperature
compensation enabled it would be necessary to undo the compensation
before passing it to the handlers.
This commit is contained in:
Miroslav Lichvar 2010-04-21 14:26:17 +02:00
parent c386d11765
commit 14d2576924
8 changed files with 13 additions and 29 deletions

10
local.c
View file

@ -403,7 +403,7 @@ LCL_SetAbsoluteFrequency(double afreq_ppm)
/* Dispatch to all handlers */
for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
(ptr->handler)(&raw, &cooked, dfreq, afreq_ppm, 0.0, 0, ptr->anything);
(ptr->handler)(&raw, &cooked, dfreq, 0.0, 0, ptr->anything);
}
current_freq_ppm = afreq_ppm;
@ -432,7 +432,7 @@ LCL_AccumulateDeltaFrequency(double dfreq)
/* Dispatch to all handlers */
for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
(ptr->handler)(&raw, &cooked, dfreq, current_freq_ppm, 0.0, 0, ptr->anything);
(ptr->handler)(&raw, &cooked, dfreq, 0.0, 0, ptr->anything);
}
}
@ -455,7 +455,7 @@ LCL_AccumulateOffset(double offset)
/* Dispatch to all handlers */
for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
(ptr->handler)(&raw, &cooked, 0.0, current_freq_ppm, offset, 0, ptr->anything);
(ptr->handler)(&raw, &cooked, 0.0, offset, 0, ptr->anything);
}
}
@ -478,7 +478,7 @@ LCL_ApplyStepOffset(double offset)
/* Dispatch to all handlers */
for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
(ptr->handler)(&raw, &cooked, 0.0, current_freq_ppm, offset, 1, ptr->anything);
(ptr->handler)(&raw, &cooked, 0.0, offset, 1, ptr->anything);
}
}
@ -515,7 +515,7 @@ LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset)
/* Dispatch to all handlers */
for (ptr = change_list.next; ptr != &change_list; ptr = ptr->next) {
(ptr->handler)(&raw, &cooked, dfreq, current_freq_ppm, doffset, 0, ptr->anything);
(ptr->handler)(&raw, &cooked, dfreq, doffset, 0, ptr->anything);
}

View file

@ -68,10 +68,6 @@ extern void LCL_GetOffsetCorrection(struct timeval *raw, double *correction, dou
dfreq : delta frequency relative to previous value (in terms of
seconds gained by system clock per unit system clock time)
afreq : absolute frequency relative to uncompensated system (in
terms of ppm seconds gained by system clock per unit of the
uncalibrated system clock)
doffset : delta offset applied (positive => make local system fast
by that amount, negative => make it slow by that amount)
@ -83,7 +79,7 @@ extern void LCL_GetOffsetCorrection(struct timeval *raw, double *correction, dou
typedef void (*LCL_ParameterChangeHandler)
(struct timeval *raw, struct timeval *cooked,
double dfreq, double afreq_ppm,
double dfreq,
double doffset, int is_step_change,
void *anything
);

View file

@ -74,7 +74,6 @@ static void
slew_samples(struct timeval *raw,
struct timeval *cooked,
double dfreq,
double afreq,
double doffset,
int is_step_change,
void *not_used);
@ -229,7 +228,6 @@ static void
slew_samples(struct timeval *raw,
struct timeval *cooked,
double dfreq,
double afreq,
double doffset,
int is_step_change,
void *not_used)

View file

@ -66,7 +66,6 @@ static void
slew_sources(struct timeval *raw,
struct timeval *cooked,
double dfreq,
double afreq,
double doffset,
int is_step_change,
void *anything);
@ -308,7 +307,6 @@ static void
slew_sources(struct timeval *raw,
struct timeval *cooked,
double dfreq,
double afreq,
double doffset,
int is_step_change,
void *anything)

View file

@ -92,7 +92,7 @@ static LOG_FileID logfileid;
static int valid_sample_time(RCL_Instance instance, struct timeval *tv);
static int pps_stratum(RCL_Instance instance, struct timeval *tv);
static void poll_timeout(void *arg);
static void slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, double afreq,
static void slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq,
double doffset, int is_step_change, void *anything);
static void add_dispersion(double dispersion, void *anything);
static void log_sample(RCL_Instance instance, struct timeval *sample_time, int filtered, int pulse, double raw_offset, double cooked_offset, double dispersion);
@ -540,7 +540,7 @@ poll_timeout(void *arg)
}
static void
slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq, double afreq,
slew_samples(struct timeval *raw, struct timeval *cooked, double dfreq,
double doffset, int is_step_change, void *anything)
{
int i;

View file

@ -302,20 +302,15 @@ run_regression(int new_sample,
static void
slew_samples
(struct timeval *raw, struct timeval *cooked,
double dfreq, double afreq_ppm,
double dfreq,
double doffset, int is_step_change,
void *anything)
{
int i;
double elapsed;
double new_freq;
double old_freq;
double delta_time;
double old_seconds_fast, old_gain_rate;
new_freq = 1.0e-6 * afreq_ppm;
old_freq = (new_freq - dfreq) / (1.0 + dfreq);
for (i=0; i<n_samples; i++) {
UTI_DiffTimevalsToDouble(&elapsed, cooked, system_times + i);
@ -330,12 +325,12 @@ slew_samples
if (coefs_valid) {
coef_seconds_fast += doffset;
coef_gain_rate = 1.0 - ((1.0 + new_freq) / (1.0 + old_freq)) * (1.0 - coef_gain_rate);
coef_gain_rate = 1.0 - (1.0 + dfreq) * (1.0 - coef_gain_rate);
}
#if 0
LOG(LOGS_INFO, LOGF_RtcLinux, "dfreq=%.8f doffset=%.6f new_freq=%.3f old_freq=%.3f old_fast=%.6f old_rate=%.3f new_fast=%.6f new_rate=%.3f",
dfreq, doffset, 1.0e6*new_freq, 1.0e6*old_freq,
LOG(LOGS_INFO, LOGF_RtcLinux, "dfreq=%.8f doffset=%.6f old_fast=%.6f old_rate=%.3f new_fast=%.6f new_rate=%.3f",
dfreq, doffset,
old_seconds_fast, 1.0e6 * old_gain_rate,
coef_seconds_fast, 1.0e6 * coef_gain_rate);
#endif

View file

@ -120,7 +120,6 @@ static void
handle_slew(struct timeval *raw,
struct timeval *cooked,
double dfreq,
double afreq,
double doffset,
int is_step_change,
void *anything);
@ -498,7 +497,6 @@ static void
handle_slew(struct timeval *raw,
struct timeval *cooked,
double dfreq,
double afreq,
double doffset,
int is_step_change,
void *anything)

View file

@ -128,7 +128,7 @@ static int selected_source_index; /* Which source index is currently
/* Forward prototype */
static void
slew_sources(struct timeval *raw, struct timeval *cooked, double dfreq, double afreq,
slew_sources(struct timeval *raw, struct timeval *cooked, double dfreq,
double doffset, int is_step_change, void *anything);
static void
add_dispersion(double dispersion, void *anything);
@ -798,7 +798,6 @@ static void
slew_sources(struct timeval *raw,
struct timeval *cooked,
double dfreq,
double afreq,
double doffset,
int is_step_change,
void *anything)