home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / asm-powerpc / timex.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  776 b   |  49 lines

  1. #ifndef _ASM_POWERPC_TIMEX_H
  2. #define _ASM_POWERPC_TIMEX_H
  3.  
  4. #ifdef __KERNEL__
  5.  
  6. /*
  7.  * PowerPC architecture timex specifications
  8.  */
  9.  
  10. #include <asm/cputable.h>
  11.  
  12. #define CLOCK_TICK_RATE    1024000 /* Underlying HZ */
  13.  
  14. typedef unsigned long cycles_t;
  15.  
  16. static inline cycles_t get_cycles(void)
  17. {
  18.     cycles_t ret;
  19.  
  20. #ifdef __powerpc64__
  21.  
  22.     __asm__ __volatile__("mftb %0" : "=r" (ret) : );
  23.  
  24. #else
  25.     /*
  26.      * For the "cycle" counter we use the timebase lower half.
  27.      * Currently only used on SMP.
  28.      */
  29.  
  30.     ret = 0;
  31.  
  32.     __asm__ __volatile__(
  33.         "98:    mftb %0\n"
  34.         "99:\n"
  35.         ".section __ftr_fixup,\"a\"\n"
  36.         "    .long %1\n"
  37.         "    .long 0\n"
  38.         "    .long 98b\n"
  39.         "    .long 99b\n"
  40.         ".previous"
  41.         : "=r" (ret) : "i" (CPU_FTR_601));
  42. #endif
  43.  
  44.     return ret;
  45. }
  46.  
  47. #endif    /* __KERNEL__ */
  48. #endif    /* _ASM_POWERPC_TIMEX_H */
  49.