blob: dcf1e07db08a7802629cfe39fb433fc4e02af68d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASMi386_TIMER_H
2#define _ASMi386_TIMER_H
3#include <linux/init.h>
4
5/**
6 * struct timer_ops - used to define a timer source
7 *
8 * @name: name of the timer.
9 * @init: Probes and initializes the timer. Takes clock= override
10 * string as an argument. Returns 0 on success, anything else
11 * on failure.
12 * @mark_offset: called by the timer interrupt.
13 * @get_offset: called by gettimeofday(). Returns the number of microseconds
14 * since the last timer interupt.
15 * @monotonic_clock: returns the number of nanoseconds since the init of the
16 * timer.
17 * @delay: delays this many clock cycles.
18 */
19struct timer_opts {
20 char* name;
21 void (*mark_offset)(void);
22 unsigned long (*get_offset)(void);
23 unsigned long long (*monotonic_clock)(void);
24 void (*delay)(unsigned long);
Venkatesh Pallipadi8a9e1b02005-06-23 00:08:13 -070025 unsigned long (*read_timer)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070026};
27
28struct init_timer_opts {
29 int (*init)(char *override);
30 struct timer_opts *opts;
31};
32
33#define TICK_SIZE (tick_nsec / 1000)
34
35extern struct timer_opts* __init select_timer(void);
36extern void clock_fallback(void);
37void setup_pit_timer(void);
38
39/* Modifiers for buggy PIT handling */
40
41extern int pit_latch_buggy;
42
43extern struct timer_opts *cur_timer;
44extern int timer_ack;
45
46/* list of externed timers */
47extern struct timer_opts timer_none;
48extern struct timer_opts timer_pit;
49extern struct init_timer_opts timer_pit_init;
50extern struct init_timer_opts timer_tsc_init;
51#ifdef CONFIG_X86_CYCLONE_TIMER
52extern struct init_timer_opts timer_cyclone_init;
53#endif
54
55extern unsigned long calibrate_tsc(void);
Venkatesh Pallipadi8a9e1b02005-06-23 00:08:13 -070056extern unsigned long read_timer_tsc(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057extern void init_cpu_khz(void);
Dave Jonesc5d28fb2005-05-31 19:03:46 -070058extern int recalibrate_cpu_khz(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059#ifdef CONFIG_HPET_TIMER
60extern struct init_timer_opts timer_hpet_init;
61extern unsigned long calibrate_tsc_hpet(unsigned long *tsc_hpet_quotient_ptr);
62#endif
63
64#ifdef CONFIG_X86_PM_TIMER
65extern struct init_timer_opts timer_pmtmr_init;
66#endif
67#endif