sys: remove TMX_ReadCurrentParams

This commit is contained in:
Miroslav Lichvar 2014-12-09 17:50:37 +01:00
parent 02cbe5e1ad
commit eadabfe890
3 changed files with 6 additions and 88 deletions

View file

@ -288,17 +288,18 @@ get_version_specific_details(void)
{
int major, minor, patch;
int shift_hz;
struct tmx_params tmx_params;
long tick;
double freq;
struct utsname uts;
if (!get_hz_and_shift_hz(&hz, &shift_hz)) {
TMX_ReadCurrentParams(&tmx_params);
if (TMX_GetFrequency(&freq, &tick) < 0)
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
guess_hz_and_shift_hz(tmx_params.tick, &hz, &shift_hz);
guess_hz_and_shift_hz(tick, &hz, &shift_hz);
if (!shift_hz) {
LOG_FATAL(LOGF_SysLinux, "Can't determine hz (txc.tick=%ld txc.freq=%ld (%.8f) txc.offset=%ld)",
tmx_params.tick, tmx_params.freq, tmx_params.dfreq, tmx_params.offset);
LOG_FATAL(LOGF_SysLinux, "Can't determine hz from tick %ld", tick);
}
}

View file

@ -89,51 +89,6 @@ TMX_GetFrequency(double *freq, long *tick)
return result;
}
int
TMX_ReadCurrentParams(struct tmx_params *params)
{
struct timex txc;
int result;
txc.modes = 0; /* pure read */
result = adjtimex(&txc);
params->tick = txc.tick;
params->offset = txc.offset;
params->freq = txc.freq;
params->dfreq = txc.freq / (double)(1 << SHIFT_USEC);
params->maxerror = txc.maxerror;
params->esterror = txc.esterror;
params->sta_pll = !!(txc.status & STA_PLL);
params->sta_ppsfreq = !!(txc.status & STA_PPSFREQ);
params->sta_ppstime = !!(txc.status & STA_PPSTIME);
params->sta_fll = !!(txc.status & STA_FLL);
params->sta_ins = !!(txc.status & STA_INS);
params->sta_del = !!(txc.status & STA_DEL);
params->sta_unsync = !!(txc.status & STA_UNSYNC);
params->sta_freqhold = !!(txc.status & STA_FREQHOLD);
params->sta_ppssignal = !!(txc.status & STA_PPSSIGNAL);
params->sta_ppsjitter = !!(txc.status & STA_PPSJITTER);
params->sta_ppswander = !!(txc.status & STA_PPSWANDER);
params->sta_ppserror = !!(txc.status & STA_PPSERROR);
params->sta_clockerr = !!(txc.status & STA_CLOCKERR);
params->constant = txc.constant;
params->precision = txc.precision;
params->tolerance = txc.tolerance;
params->ppsfreq = txc.ppsfreq;
params->jitter = txc.jitter;
params->shift = txc.shift;
params->stabil = txc.stabil;
params->jitcnt = txc.jitcnt;
params->calcnt = txc.calcnt;
params->errcnt = txc.errcnt;
params->stbcnt = txc.stbcnt;
return result;
}
int
TMX_SetLeap(int leap)
{

View file

@ -27,47 +27,9 @@
#ifndef GOT_WRAP_ADJTIMEX_H
#define GOT_WRAP_ADJTIMEX_H
/* Cut-down version of struct timex */
struct tmx_params {
long tick;
long offset;
long freq;
double dfreq;
long maxerror;
long esterror;
unsigned sta_pll:1;
unsigned sta_ppsfreq:1;
unsigned sta_ppstime:1;
unsigned sta_fll:1;
unsigned sta_ins:1;
unsigned sta_del:1;
unsigned sta_unsync:1;
unsigned sta_freqhold:1;
unsigned sta_ppssignal:1;
unsigned sta_ppsjitter:1;
unsigned sta_ppswander:1;
unsigned sta_ppserror:1;
unsigned sta_clockerr:1;
int status;
long constant;
long precision;
long tolerance;
long ppsfreq;
long jitter;
int shift;
long stabil;
long jitcnt;
long calcnt;
long errcnt;
long stbcnt;
};
int TMX_ResetOffset(void);
int TMX_SetFrequency(double *freq, long tick);
int TMX_GetFrequency(double *freq, long *tick);
int TMX_ReadCurrentParams(struct tmx_params *params);
int TMX_SetLeap(int leap);
int TMX_SetSync(int sync, double est_error, double max_error);
int TMX_TestStepOffset(void);