![]() |
|
|||
0001 /***************************************************************************** 0002 * * 0003 * Copyright (c) David L. Mills 1993 * 0004 * * 0005 * Permission to use, copy, modify, and distribute this software and its * 0006 * documentation for any purpose and without fee is hereby granted, provided * 0007 * that the above copyright notice appears in all copies and that both the * 0008 * copyright notice and this permission notice appear in supporting * 0009 * documentation, and that the name University of Delaware not be used in * 0010 * advertising or publicity pertaining to distribution of the software * 0011 * without specific, written prior permission. The University of Delaware * 0012 * makes no representations about the suitability this software for any * 0013 * purpose. It is provided "as is" without express or implied warranty. * 0014 * * 0015 *****************************************************************************/ 0016 0017 /* 0018 * Modification history timex.h 0019 * 0020 * 29 Dec 97 Russell King 0021 * Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h 0022 * for ARM machines 0023 * 0024 * 9 Jan 97 Adrian Sun 0025 * Shifted LATCH define to allow access to alpha machines. 0026 * 0027 * 26 Sep 94 David L. Mills 0028 * Added defines for hybrid phase/frequency-lock loop. 0029 * 0030 * 19 Mar 94 David L. Mills 0031 * Moved defines from kernel routines to header file and added new 0032 * defines for PPS phase-lock loop. 0033 * 0034 * 20 Feb 94 David L. Mills 0035 * Revised status codes and structures for external clock and PPS 0036 * signal discipline. 0037 * 0038 * 28 Nov 93 David L. Mills 0039 * Adjusted parameters to improve stability and increase poll 0040 * interval. 0041 * 0042 * 17 Sep 93 David L. Mills 0043 * Created file $NTP/include/sys/timex.h 0044 * 07 Oct 93 Torsten Duwe 0045 * Derived linux/timex.h 0046 * 1995-08-13 Torsten Duwe 0047 * kernel PLL updated to 1994-12-13 specs (rfc-1589) 0048 * 1997-08-30 Ulrich Windl 0049 * Added new constant NTP_PHASE_LIMIT 0050 * 2004-08-12 Christoph Lameter 0051 * Reworked time interpolation logic 0052 */ 0053 #ifndef _UAPI_LINUX_TIMEX_H 0054 #define _UAPI_LINUX_TIMEX_H 0055 0056 #include <linux/time.h> 0057 0058 #define NTP_API 4 /* NTP API version */ 0059 0060 #ifndef __KERNEL__ 0061 /* 0062 * syscall interface - used (mainly by NTP daemon) 0063 * to discipline kernel clock oscillator 0064 */ 0065 struct timex { 0066 unsigned int modes; /* mode selector */ 0067 __kernel_long_t offset; /* time offset (usec) */ 0068 __kernel_long_t freq; /* frequency offset (scaled ppm) */ 0069 __kernel_long_t maxerror;/* maximum error (usec) */ 0070 __kernel_long_t esterror;/* estimated error (usec) */ 0071 int status; /* clock command/status */ 0072 __kernel_long_t constant;/* pll time constant */ 0073 __kernel_long_t precision;/* clock precision (usec) (read only) */ 0074 __kernel_long_t tolerance;/* clock frequency tolerance (ppm) 0075 * (read only) 0076 */ 0077 struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ 0078 __kernel_long_t tick; /* (modified) usecs between clock ticks */ 0079 0080 __kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */ 0081 __kernel_long_t jitter; /* pps jitter (us) (ro) */ 0082 int shift; /* interval duration (s) (shift) (ro) */ 0083 __kernel_long_t stabil; /* pps stability (scaled ppm) (ro) */ 0084 __kernel_long_t jitcnt; /* jitter limit exceeded (ro) */ 0085 __kernel_long_t calcnt; /* calibration intervals (ro) */ 0086 __kernel_long_t errcnt; /* calibration errors (ro) */ 0087 __kernel_long_t stbcnt; /* stability limit exceeded (ro) */ 0088 0089 int tai; /* TAI offset (ro) */ 0090 0091 int :32; int :32; int :32; int :32; 0092 int :32; int :32; int :32; int :32; 0093 int :32; int :32; int :32; 0094 }; 0095 #endif 0096 0097 struct __kernel_timex_timeval { 0098 __kernel_time64_t tv_sec; 0099 long long tv_usec; 0100 }; 0101 0102 struct __kernel_timex { 0103 unsigned int modes; /* mode selector */ 0104 int :32; /* pad */ 0105 long long offset; /* time offset (usec) */ 0106 long long freq; /* frequency offset (scaled ppm) */ 0107 long long maxerror;/* maximum error (usec) */ 0108 long long esterror;/* estimated error (usec) */ 0109 int status; /* clock command/status */ 0110 int :32; /* pad */ 0111 long long constant;/* pll time constant */ 0112 long long precision;/* clock precision (usec) (read only) */ 0113 long long tolerance;/* clock frequency tolerance (ppm) 0114 * (read only) 0115 */ 0116 struct __kernel_timex_timeval time; /* (read only, except for ADJ_SETOFFSET) */ 0117 long long tick; /* (modified) usecs between clock ticks */ 0118 0119 long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ 0120 long long jitter; /* pps jitter (us) (ro) */ 0121 int shift; /* interval duration (s) (shift) (ro) */ 0122 int :32; /* pad */ 0123 long long stabil; /* pps stability (scaled ppm) (ro) */ 0124 long long jitcnt; /* jitter limit exceeded (ro) */ 0125 long long calcnt; /* calibration intervals (ro) */ 0126 long long errcnt; /* calibration errors (ro) */ 0127 long long stbcnt; /* stability limit exceeded (ro) */ 0128 0129 int tai; /* TAI offset (ro) */ 0130 0131 int :32; int :32; int :32; int :32; 0132 int :32; int :32; int :32; int :32; 0133 int :32; int :32; int :32; 0134 }; 0135 0136 /* 0137 * Mode codes (timex.mode) 0138 */ 0139 #define ADJ_OFFSET 0x0001 /* time offset */ 0140 #define ADJ_FREQUENCY 0x0002 /* frequency offset */ 0141 #define ADJ_MAXERROR 0x0004 /* maximum time error */ 0142 #define ADJ_ESTERROR 0x0008 /* estimated time error */ 0143 #define ADJ_STATUS 0x0010 /* clock status */ 0144 #define ADJ_TIMECONST 0x0020 /* pll time constant */ 0145 #define ADJ_TAI 0x0080 /* set TAI offset */ 0146 #define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ 0147 #define ADJ_MICRO 0x1000 /* select microsecond resolution */ 0148 #define ADJ_NANO 0x2000 /* select nanosecond resolution */ 0149 #define ADJ_TICK 0x4000 /* tick value */ 0150 0151 #ifndef __KERNEL__ 0152 #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 0153 #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ 0154 #endif 0155 0156 /* NTP userland likes the MOD_ prefix better */ 0157 #define MOD_OFFSET ADJ_OFFSET 0158 #define MOD_FREQUENCY ADJ_FREQUENCY 0159 #define MOD_MAXERROR ADJ_MAXERROR 0160 #define MOD_ESTERROR ADJ_ESTERROR 0161 #define MOD_STATUS ADJ_STATUS 0162 #define MOD_TIMECONST ADJ_TIMECONST 0163 #define MOD_TAI ADJ_TAI 0164 #define MOD_MICRO ADJ_MICRO 0165 #define MOD_NANO ADJ_NANO 0166 0167 0168 /* 0169 * Status codes (timex.status) 0170 */ 0171 #define STA_PLL 0x0001 /* enable PLL updates (rw) */ 0172 #define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ 0173 #define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ 0174 #define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ 0175 0176 #define STA_INS 0x0010 /* insert leap (rw) */ 0177 #define STA_DEL 0x0020 /* delete leap (rw) */ 0178 #define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ 0179 #define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ 0180 0181 #define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ 0182 #define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ 0183 #define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ 0184 #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ 0185 0186 #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ 0187 #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ 0188 #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ 0189 #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ 0190 0191 /* read-only bits */ 0192 #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ 0193 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) 0194 0195 /* 0196 * Clock states (time_state) 0197 */ 0198 #define TIME_OK 0 /* clock synchronized, no leap second */ 0199 #define TIME_INS 1 /* insert leap second */ 0200 #define TIME_DEL 2 /* delete leap second */ 0201 #define TIME_OOP 3 /* leap second in progress */ 0202 #define TIME_WAIT 4 /* leap second has occurred */ 0203 #define TIME_ERROR 5 /* clock not synchronized */ 0204 #define TIME_BAD TIME_ERROR /* bw compat */ 0205 0206 0207 #endif /* _UAPI_LINUX_TIMEX_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |