time.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * linux/include/asm-arm/mach/time.h
  3. *
  4. * Copyright (C) 2004 MontaVista Software, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARM_MACH_TIME_H
  11. #define __ASM_ARM_MACH_TIME_H
  12. #include <linux/sysdev.h>
  13. /*
  14. * This is our kernel timer structure.
  15. *
  16. * - init
  17. * Initialise the kernels jiffy timer source, claim interrupt
  18. * using setup_irq. This is called early on during initialisation
  19. * while interrupts are still disabled on the local CPU.
  20. * - suspend
  21. * Suspend the kernel jiffy timer source, if necessary. This
  22. * is called with interrupts disabled, after all normal devices
  23. * have been suspended. If no action is required, set this to
  24. * NULL.
  25. * - resume
  26. * Resume the kernel jiffy timer source, if necessary. This
  27. * is called with interrupts disabled before any normal devices
  28. * are resumed. If no action is required, set this to NULL.
  29. * - offset
  30. * Return the timer offset in microseconds since the last timer
  31. * interrupt. Note: this must take account of any unprocessed
  32. * timer interrupt which may be pending.
  33. */
  34. struct sys_timer {
  35. struct sys_device dev;
  36. void (*init)(void);
  37. void (*suspend)(void);
  38. void (*resume)(void);
  39. unsigned long (*offset)(void);
  40. #ifdef CONFIG_NO_IDLE_HZ
  41. struct dyn_tick_timer *dyn_tick;
  42. #endif
  43. };
  44. #ifdef CONFIG_NO_IDLE_HZ
  45. #define DYN_TICK_ENABLED (1 << 1)
  46. struct dyn_tick_timer {
  47. spinlock_t lock;
  48. unsigned int state; /* Current state */
  49. int (*enable)(void); /* Enables dynamic tick */
  50. int (*disable)(void); /* Disables dynamic tick */
  51. void (*reprogram)(unsigned long); /* Reprograms the timer */
  52. int (*handler)(int, void *, struct pt_regs *);
  53. };
  54. void timer_dyn_reprogram(void);
  55. #else
  56. #define timer_dyn_reprogram() do { } while (0)
  57. #endif
  58. extern struct sys_timer *system_timer;
  59. extern void timer_tick(struct pt_regs *);
  60. /*
  61. * Kernel time keeping support.
  62. */
  63. struct timespec;
  64. extern int (*set_rtc)(void);
  65. extern void save_time_delta(struct timespec *delta, struct timespec *rtc);
  66. extern void restore_time_delta(struct timespec *delta, struct timespec *rtc);
  67. #endif