MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / asm-ppc / timex.h
blob65192b74ef060315daf60f092bfb282e0233a8c8
1 /*
2 * include/asm-ppc/timex.h
4 * ppc architecture timex specifications
5 */
6 #ifdef __KERNEL__
7 #ifndef _ASMppc_TIMEX_H
8 #define _ASMppc_TIMEX_H
10 #include <linux/config.h>
11 #include <asm/cputable.h>
13 #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
14 #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
15 #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
16 (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
17 << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
19 typedef unsigned long cycles_t;
22 * For the "cycle" counter we use the timebase lower half.
23 * Currently only used on SMP.
26 extern cycles_t cacheflush_time;
28 static inline cycles_t get_cycles(void)
30 cycles_t ret = 0;
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 return ret;
45 #endif
46 #endif /* __KERNEL__ */