[PATCH] ARM: Fix VFP to use do_div()
[linux-2.6/verdex.git] / include / asm-ia64 / delay.h
blob57182d6f2b9a10c3f3f9f288d1e6f4613a9121bd
1 #ifndef _ASM_IA64_DELAY_H
2 #define _ASM_IA64_DELAY_H
4 /*
5 * Delay routines using a pre-computed "cycles/usec" value.
7 * Copyright (C) 1998, 1999 Hewlett-Packard Co
8 * David Mosberger-Tang <davidm@hpl.hp.com>
9 * Copyright (C) 1999 VA Linux Systems
10 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
11 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
12 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
15 #include <linux/config.h>
16 #include <linux/kernel.h>
17 #include <linux/sched.h>
18 #include <linux/compiler.h>
20 #include <asm/intrinsics.h>
21 #include <asm/processor.h>
23 static __inline__ void
24 ia64_set_itm (unsigned long val)
26 ia64_setreg(_IA64_REG_CR_ITM, val);
27 ia64_srlz_d();
30 static __inline__ unsigned long
31 ia64_get_itm (void)
33 unsigned long result;
35 result = ia64_getreg(_IA64_REG_CR_ITM);
36 ia64_srlz_d();
37 return result;
40 static __inline__ void
41 ia64_set_itv (unsigned long val)
43 ia64_setreg(_IA64_REG_CR_ITV, val);
44 ia64_srlz_d();
47 static __inline__ unsigned long
48 ia64_get_itv (void)
50 return ia64_getreg(_IA64_REG_CR_ITV);
53 static __inline__ void
54 ia64_set_itc (unsigned long val)
56 ia64_setreg(_IA64_REG_AR_ITC, val);
57 ia64_srlz_d();
60 static __inline__ unsigned long
61 ia64_get_itc (void)
63 unsigned long result;
65 result = ia64_getreg(_IA64_REG_AR_ITC);
66 ia64_barrier();
67 #ifdef CONFIG_ITANIUM
68 while (unlikely((__s32) result == -1)) {
69 result = ia64_getreg(_IA64_REG_AR_ITC);
70 ia64_barrier();
72 #endif
73 return result;
76 extern void ia64_delay_loop (unsigned long loops);
78 static __inline__ void
79 __delay (unsigned long loops)
81 if (unlikely(loops < 1))
82 return;
84 ia64_delay_loop (loops - 1);
87 static __inline__ void
88 udelay (unsigned long usecs)
90 unsigned long start = ia64_get_itc();
91 unsigned long cycles = usecs*local_cpu_data->cyc_per_usec;
93 while (ia64_get_itc() - start < cycles)
94 cpu_relax();
97 #endif /* _ASM_IA64_DELAY_H */