1 /*
2 * Mach Operating System
3 * Copyright (c) 1993,1992 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: clock_status.h,v $
29 * Revision 2.2 93/11/17 16:30:42 dbg
30 * Renamed to device/clock_status.h.
31 * [93/06/02 dbg]
32 *
33 * 64 bit cleanup.
34 * [93/02/19 dbg]
35 *
36 * Moved kernel definitions to kern/clock.h. Generalized
37 * clockres_request_t to clock_resolution_t, to return
38 * skew for devices with odd clock frequencies.
39 *
40 * Created
41 * [92/07/12 savage]
42 *
43 */
44
45 /*
46 * Exported clock device abstraction.
47 */
48 #ifndef _DEVICE_CLOCK_STATUS_H_
49 #define _DEVICE_CLOCK_STATUS_H_
50
51 #include <mach/time_spec.h>
52 #include <device/device_types.h>
53
54 /*
55 * A clock exports three items of status:
56 * current time
57 * resolution
58 * correction factor
59 */
60
61 /*
62 * Time is measured as a time_spec.
63 */
64 #define CLOCK_TIME 1
65 #define CLOCK_TIME_COUNT (sizeof(time_spec_t) / sizeof(int))
66
67 /*
68 * Resolution is defined as the resolution of
69 * the clock, and an allowable skew from that resolution.
70 */
71 struct clock_resolution {
72 int resolution; /* in nsecs */
73 int skew; /* in nsecs */
74 };
75 #define CLOCK_RESOLUTION_COUNT \
76 (sizeof(clock_resolution_data_t) / sizeof(int))
77
78 #define CLOCK_RESOLUTION 2
79
80 typedef struct clock_resolution clock_resolution_data_t;
81 typedef struct clock_resolution *clock_resolution_t;
82
83 /*
84 * The clock correction factor is an increment
85 * to be added to the clock time every clock
86 * tick (every 'clock_resolution' nanoseconds),
87 * and the number of clock ticks over which it
88 * should be added.
89 */
90 struct clock_correction {
91 int delta; /* correction, in nanoseconds */
92 int count; /* number of clock periods over
93 which correction is applied */
94 };
95 #define CLOCK_CORRECTION_COUNT \
96 (sizeof(clock_correction_data_t) / sizeof(int))
97
98 #define CLOCK_CORRECTION 3
99
100 typedef struct clock_correction clock_correction_data_t;
101 typedef struct clock_correction *clock_correction_t;
102
103 #endif /* _DEVICE_CLOCK_STATUS_H_ */
104
105
106
107
108
109
110
111
Cache object: 77e8cb0affd8eb99f3cf06475a5da6f7
|