xref: /freebsd/sys/x86/include/clock.h (revision 553af8f1ec71d397b5b4fd5876622b9269936e63)
1f06f1d1fSMark Johnston /*-
2f06f1d1fSMark Johnston  * Kernel interface to machine-dependent clock driver.
3f06f1d1fSMark Johnston  * Garrett Wollman, September 1994.
4f06f1d1fSMark Johnston  * This file is in the public domain.
5f06f1d1fSMark Johnston  *
6f06f1d1fSMark Johnston  * $FreeBSD$
7f06f1d1fSMark Johnston  */
8f06f1d1fSMark Johnston 
9f06f1d1fSMark Johnston #ifndef _MACHINE_CLOCK_H_
10f06f1d1fSMark Johnston #define	_MACHINE_CLOCK_H_
11f06f1d1fSMark Johnston 
12f06f1d1fSMark Johnston #ifdef _KERNEL
13f06f1d1fSMark Johnston /*
14f06f1d1fSMark Johnston  * i386 to clock driver interface.
15f06f1d1fSMark Johnston  * XXX large parts of the driver and its interface are misplaced.
16f06f1d1fSMark Johnston  */
17f06f1d1fSMark Johnston extern int	clkintr_pending;
18f06f1d1fSMark Johnston extern u_int	i8254_freq;
19f06f1d1fSMark Johnston extern int	i8254_max_count;
20f06f1d1fSMark Johnston extern uint64_t	tsc_freq;
21f06f1d1fSMark Johnston extern int	tsc_is_invariant;
22f06f1d1fSMark Johnston extern int	tsc_perf_stat;
23f06f1d1fSMark Johnston #ifdef SMP
24f06f1d1fSMark Johnston extern int	smp_tsc;
25f06f1d1fSMark Johnston #endif
26f06f1d1fSMark Johnston 
27f06f1d1fSMark Johnston void	i8254_init(void);
28f06f1d1fSMark Johnston void	i8254_delay(int);
29f06f1d1fSMark Johnston void	clock_init(void);
3062d09b46SMark Johnston void	lapic_calibrate(void);
31*553af8f1SMark Johnston void	tsc_calibrate(void);
32f06f1d1fSMark Johnston 
33f06f1d1fSMark Johnston /*
34f06f1d1fSMark Johnston  * Driver to clock driver interface.
35f06f1d1fSMark Johnston  */
36f06f1d1fSMark Johnston 
37f06f1d1fSMark Johnston void	startrtclock(void);
38f06f1d1fSMark Johnston void	init_TSC(void);
39f06f1d1fSMark Johnston void	resume_TSC(void);
40f06f1d1fSMark Johnston 
41f06f1d1fSMark Johnston #define	HAS_TIMER_SPKR 1
42f06f1d1fSMark Johnston int	timer_spkr_acquire(void);
43f06f1d1fSMark Johnston int	timer_spkr_release(void);
44f06f1d1fSMark Johnston void	timer_spkr_setfreq(int freq);
45f06f1d1fSMark Johnston 
46f06f1d1fSMark Johnston #endif /* _KERNEL */
47f06f1d1fSMark Johnston 
48f06f1d1fSMark Johnston #endif /* !_MACHINE_CLOCK_H_ */
49