timex.h 691 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * include/asm-ppc/timex.h
  3. *
  4. * ppc architecture timex specifications
  5. */
  6. #ifdef __KERNEL__
  7. #ifndef _ASMppc_TIMEX_H
  8. #define _ASMppc_TIMEX_H
  9. #include <linux/config.h>
  10. #include <asm/cputable.h>
  11. #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
  12. typedef unsigned long cycles_t;
  13. /*
  14. * For the "cycle" counter we use the timebase lower half.
  15. * Currently only used on SMP.
  16. */
  17. static inline cycles_t get_cycles(void)
  18. {
  19. cycles_t ret = 0;
  20. __asm__ __volatile__(
  21. "98: mftb %0\n"
  22. "99:\n"
  23. ".section __ftr_fixup,\"a\"\n"
  24. " .long %1\n"
  25. " .long 0\n"
  26. " .long 98b\n"
  27. " .long 99b\n"
  28. ".previous"
  29. : "=r" (ret) : "i" (CPU_FTR_601));
  30. return ret;
  31. }
  32. #endif
  33. #endif /* __KERNEL__ */