timex.h 841 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef _ASM_CRIS_ARCH_TIMEX_H
  2. #define _ASM_CRIS_ARCH_TIMEX_H
  3. #include <asm/arch/hwregs/reg_map.h>
  4. #include <asm/arch/hwregs/reg_rdwr.h>
  5. #include <asm/arch/hwregs/timer_defs.h>
  6. /*
  7. * The clock runs at 100MHz, we divide it by 1000000. If you change anything
  8. * here you must check time.c as well.
  9. */
  10. #define CLOCK_TICK_RATE 100000000 /* Underlying frequency of the HZ timer */
  11. /* The timer0 values gives 10 ns resolution but interrupts at HZ. */
  12. #define TIMER0_FREQ (CLOCK_TICK_RATE)
  13. #define TIMER0_DIV (TIMER0_FREQ/(HZ))
  14. /* Convert the value in step of 10 ns to 1us without overflow: */
  15. #define GET_JIFFIES_USEC() \
  16. ( (TIMER0_DIV - REG_RD(timer, regi_timer, r_tmr0_data)) /100 )
  17. extern unsigned long get_ns_in_jiffie(void);
  18. static inline unsigned long get_us_in_jiffie_highres(void)
  19. {
  20. return get_ns_in_jiffie() / 1000;
  21. }
  22. #endif