1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef _LINUX_TIMEX_H
13 #define _LINUX_TIMEX_H
14 
15 #include <linux/compiler.h>
16 #include <linux/time.h>
17 
18 #include <asm/param.h>
19 
20 #define SHIFT_KG 6
21 #define SHIFT_KF 16
22 #define SHIFT_KH 2
23 #define MAXTC 6
24 
25 #define SHIFT_SCALE 22
26 #define SHIFT_UPDATE (SHIFT_KG + MAXTC)
27 #define SHIFT_USEC 16
28 #define FINENSEC (1L << (SHIFT_SCALE - 10))
29 
30 #define MAXPHASE 512000L
31 #define MAXFREQ (512L << SHIFT_USEC)
32 #define MINSEC 16L
33 #define MAXSEC 1200L
34 #define NTP_PHASE_LIMIT (MAXPHASE << 5)
35 
36 struct timex {
37  unsigned int modes;
38  long offset;
39  long freq;
40  long maxerror;
41  long esterror;
42  int status;
43  long constant;
44  long precision;
45  long tolerance;
46  struct timeval time;
47  long tick;
48 
49  long ppsfreq;
50  long jitter;
51  int shift;
52  long stabil;
53  long jitcnt;
54  long calcnt;
55  long errcnt;
56  long stbcnt;
57 
58  int :32; int :32; int :32; int :32;
59  int :32; int :32; int :32; int :32;
60  int :32; int :32; int :32; int :32;
61 };
62 
63 #define ADJ_OFFSET 0x0001
64 #define ADJ_FREQUENCY 0x0002
65 #define ADJ_MAXERROR 0x0004
66 #define ADJ_ESTERROR 0x0008
67 #define ADJ_STATUS 0x0010
68 #define ADJ_TIMECONST 0x0020
69 #define ADJ_TICK 0x4000
70 #define ADJ_OFFSET_SINGLESHOT 0x8001
71 
72 #define MOD_OFFSET ADJ_OFFSET
73 #define MOD_FREQUENCY ADJ_FREQUENCY
74 #define MOD_MAXERROR ADJ_MAXERROR
75 #define MOD_ESTERROR ADJ_ESTERROR
76 #define MOD_STATUS ADJ_STATUS
77 #define MOD_TIMECONST ADJ_TIMECONST
78 #define MOD_CLKB ADJ_TICK
79 #define MOD_CLKA ADJ_OFFSET_SINGLESHOT
80 
81 #define STA_PLL 0x0001
82 #define STA_PPSFREQ 0x0002
83 #define STA_PPSTIME 0x0004
84 #define STA_FLL 0x0008
85 
86 #define STA_INS 0x0010
87 #define STA_DEL 0x0020
88 #define STA_UNSYNC 0x0040
89 #define STA_FREQHOLD 0x0080
90 
91 #define STA_PPSSIGNAL 0x0100
92 #define STA_PPSJITTER 0x0200
93 #define STA_PPSWANDER 0x0400
94 #define STA_PPSERROR 0x0800
95 
96 #define STA_CLOCKERR 0x1000
97 
98 #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER |   STA_PPSERROR | STA_CLOCKERR)
99 
100 #define TIME_OK 0
101 #define TIME_INS 1
102 #define TIME_DEL 2
103 #define TIME_OOP 3
104 #define TIME_WAIT 4
105 #define TIME_ERROR 5
106 #define TIME_BAD TIME_ERROR
107 
108 #endif
109