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