1 #ifndef _ASM_IA64_DELAY_H
2 #define _ASM_IA64_DELAY_H
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/kernel.h>
16 #include <linux/sched.h>
17 #include <linux/compiler.h>
19 #include <asm/intrinsics.h>
20 #include <asm/processor.h>
22 static __inline__ void
23 ia64_set_itm (unsigned long val)
25 ia64_setreg(_IA64_REG_CR_ITM, val);
29 static __inline__ unsigned long
34 result = ia64_getreg(_IA64_REG_CR_ITM);
39 static __inline__ void
40 ia64_set_itv (unsigned long val)
42 ia64_setreg(_IA64_REG_CR_ITV, val);
46 static __inline__ unsigned long
49 return ia64_getreg(_IA64_REG_CR_ITV);
52 static __inline__ void
53 ia64_set_itc (unsigned long val)
55 ia64_setreg(_IA64_REG_AR_ITC, val);
59 static __inline__ unsigned long
64 result = ia64_getreg(_IA64_REG_AR_ITC);
67 while (unlikely((__s32) result == -1)) {
68 result = ia64_getreg(_IA64_REG_AR_ITC);
75 extern void ia64_delay_loop (unsigned long loops);
77 static __inline__ void
78 __delay (unsigned long loops)
80 if (unlikely(loops < 1))
83 ia64_delay_loop (loops - 1);
86 extern void udelay (unsigned long usecs);
88 #endif /* _ASM_IA64_DELAY_H */