xref: /dragonfly/sys/platform/pc64/include/clock.h (revision 0066c2fb)
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  * $DragonFly: src/sys/platform/pc32/include/clock.h,v 1.9 2008/05/10 17:24:08 dillon Exp $
8  */
9 
10 #ifndef _MACHINE_CLOCK_H_
11 #define	_MACHINE_CLOCK_H_
12 
13 #ifndef _SYS_TYPES_H_
14 #include <sys/types.h>
15 #endif
16 
17 #ifdef _KERNEL
18 
19 #ifndef _SYS_SYSTIMER_H_
20 #include <sys/systimer.h>
21 #endif
22 
23 typedef struct TOTALDELAY {
24 	int		us;
25 	int		started;
26 	sysclock_t	last_clock;
27 } TOTALDELAY;
28 
29 #endif
30 
31 typedef uint64_t tsc_uclock_t;
32 typedef int64_t	tsc_sclock_t;
33 
34 #ifdef _KERNEL
35 
36 /*
37  * i386 to clock driver interface.
38  * XXX large parts of the driver and its interface are misplaced.
39  */
40 extern int	adjkerntz;
41 extern int	disable_rtc_set;
42 extern u_int	timer_freq;
43 extern int	timer0_max_count;
44 extern int	tsc_present;
45 extern int	tsc_invariant;
46 extern int	tsc_mpsync;
47 extern int	tsc_is_broken;
48 extern int	wall_cmos_clock;
49 extern tsc_uclock_t tsc_frequency;
50 extern tsc_uclock_t tsc_oneus_approx;	/* do not use for fine calc, min 1 */
51 
52 /*
53  * Driver to clock driver interface.
54  */
55 
56 int	CHECKTIMEOUT(TOTALDELAY *);
57 int	rtcin (int val);
58 int	acquire_timer2 (int mode);
59 int	release_timer2 (void);
60 int	sysbeep (int pitch, int period);
61 void	timer_restore (void);
62 
63 #endif /* _KERNEL */
64 
65 #endif /* !_MACHINE_CLOCK_H_ */
66