timer.h 1.9 KB

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