xref: /dragonfly/sys/platform/pc64/include/clock.h (revision 73b5ca6b)
1 /*
2  * Kernel interface to machine-dependent clock driver.
3  * Garrett Wollman, September 1994.
4  * This file is in the public domain.
5  *
6  * $FreeBSD: src/sys/i386/include/clock.h,v 1.38.2.1 2002/11/02 04:41:50 iwasaki Exp $
7  */
8 
9 #ifndef _MACHINE_CLOCK_H_
10 #define	_MACHINE_CLOCK_H_
11 
12 #ifndef _SYS_TYPES_H_
13 #include <sys/types.h>
14 #endif
15 
16 #ifdef _KERNEL
17 
18 #ifndef _SYS_SYSTIMER_H_
19 #include <sys/systimer.h>
20 #endif
21 
22 typedef struct TOTALDELAY {
23 	int		us;
24 	int		started;
25 	sysclock_t	last_clock;
26 } TOTALDELAY;
27 
28 #endif
29 
30 typedef uint64_t tsc_uclock_t;
31 typedef int64_t	tsc_sclock_t;
32 
33 #ifdef _KERNEL
34 
35 /*
36  * x86 to clock driver interface.
37  * XXX large parts of the driver and its interface are misplaced.
38  */
39 extern int	adjkerntz;
40 extern int	disable_rtc_set;
41 extern int	tsc_present;
42 extern int	tsc_invariant;
43 extern int	tsc_mpsync;
44 extern int	wall_cmos_clock;
45 extern tsc_uclock_t tsc_frequency;
46 extern tsc_uclock_t tsc_oneus_approx;	/* do not use for fine calc, min 1 */
47 
48 /*
49  * Driver to clock driver interface.
50  */
51 
52 int	CHECKTIMEOUT(TOTALDELAY *);
53 int	rtcin (int val);
54 int	acquire_timer2 (int mode);
55 int	release_timer2 (void);
56 int	sysbeep (int pitch, int period);
57 void	timer_restore (void);
58 
59 /*
60  * Allow registering timecounter initialization code.
61  */
62 typedef struct timecounter_init {
63 	char *name;
64 	void (*configure)(void);
65 } timecounter_init_t;
66 
67 #define TIMECOUNTER_INIT(name, config)			\
68 	static struct timecounter_init name##_timer = {	\
69 		#name, config				\
70 	};						\
71 	DATA_SET(timecounter_init_set, name##_timer);
72 
73 #endif /* _KERNEL */
74 
75 #endif /* !_MACHINE_CLOCK_H_ */
76