timer.h 846 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef __ASM_SH_TIMER_H
  2. #define __ASM_SH_TIMER_H
  3. #include <linux/sysdev.h>
  4. #include <asm/cpu/timer.h>
  5. struct sys_timer_ops {
  6. int (*init)(void);
  7. int (*start)(void);
  8. int (*stop)(void);
  9. unsigned long (*get_offset)(void);
  10. unsigned long (*get_frequency)(void);
  11. };
  12. struct sys_timer {
  13. const char *name;
  14. struct sys_device dev;
  15. struct sys_timer_ops *ops;
  16. };
  17. #define TICK_SIZE (tick_nsec / 1000)
  18. extern struct sys_timer tmu_timer;
  19. extern struct sys_timer *sys_timer;
  20. static inline unsigned long get_timer_offset(void)
  21. {
  22. return sys_timer->ops->get_offset();
  23. }
  24. static inline unsigned long get_timer_frequency(void)
  25. {
  26. return sys_timer->ops->get_frequency();
  27. }
  28. /* arch/sh/kernel/timers/timer.c */
  29. struct sys_timer *get_sys_timer(void);
  30. /* arch/sh/kernel/time.c */
  31. void handle_timer_tick(struct pt_regs *);
  32. #endif /* __ASM_SH_TIMER_H */