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 7f06f1d1fSMark Johnston #ifndef _MACHINE_CLOCK_H_ 8f06f1d1fSMark Johnston #define _MACHINE_CLOCK_H_ 9f06f1d1fSMark Johnston 10f06f1d1fSMark Johnston #ifdef _KERNEL 11f06f1d1fSMark Johnston /* 12f06f1d1fSMark Johnston * i386 to clock driver interface. 13f06f1d1fSMark Johnston * XXX large parts of the driver and its interface are misplaced. 14f06f1d1fSMark Johnston */ 15f06f1d1fSMark Johnston extern int clkintr_pending; 16f06f1d1fSMark Johnston extern u_int i8254_freq; 17f06f1d1fSMark Johnston extern int i8254_max_count; 18f06f1d1fSMark Johnston extern uint64_t tsc_freq; 19f06f1d1fSMark Johnston extern int tsc_is_invariant; 20f06f1d1fSMark Johnston extern int tsc_perf_stat; 21f06f1d1fSMark Johnston #ifdef SMP 22f06f1d1fSMark Johnston extern int smp_tsc; 23f06f1d1fSMark Johnston #endif 24f06f1d1fSMark Johnston 25f06f1d1fSMark Johnston void i8254_init(void); 26f06f1d1fSMark Johnston void i8254_delay(int); 27f06f1d1fSMark Johnston void clock_init(void); 2862d09b46SMark Johnston void lapic_calibrate(void); 29*84369dd5SMark Johnston void tsc_init(void); 30553af8f1SMark Johnston void tsc_calibrate(void); 31f06f1d1fSMark Johnston 32f06f1d1fSMark Johnston /* 33f06f1d1fSMark Johnston * Driver to clock driver interface. 34f06f1d1fSMark Johnston */ 35f06f1d1fSMark Johnston 36f06f1d1fSMark Johnston void startrtclock(void); 37*84369dd5SMark Johnston void start_TSC(void); 38f06f1d1fSMark Johnston void resume_TSC(void); 39f06f1d1fSMark Johnston 40f06f1d1fSMark Johnston #define HAS_TIMER_SPKR 1 41f06f1d1fSMark Johnston int timer_spkr_acquire(void); 42f06f1d1fSMark Johnston int timer_spkr_release(void); 43f06f1d1fSMark Johnston void timer_spkr_setfreq(int freq); 44f06f1d1fSMark Johnston 45f06f1d1fSMark Johnston #endif /* _KERNEL */ 46f06f1d1fSMark Johnston 47f06f1d1fSMark Johnston #endif /* !_MACHINE_CLOCK_H_ */ 48