Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
delay.h
Go to the documentation of this file.
1 #ifndef _ASM_IA64_DELAY_H
2 #define _ASM_IA64_DELAY_H
3 
4 /*
5  * Delay routines using a pre-computed "cycles/usec" value.
6  *
7  * Copyright (C) 1998, 1999 Hewlett-Packard Co
8  * David Mosberger-Tang <[email protected]>
9  * Copyright (C) 1999 VA Linux Systems
10  * Copyright (C) 1999 Walt Drummond <[email protected]>
11  * Copyright (C) 1999 Asit Mallick <[email protected]>
12  * Copyright (C) 1999 Don Dugger <[email protected]>
13  */
14 
15 #include <linux/kernel.h>
16 #include <linux/sched.h>
17 #include <linux/compiler.h>
18 
19 #include <asm/intrinsics.h>
20 #include <asm/processor.h>
21 
22 static __inline__ void
23 ia64_set_itm (unsigned long val)
24 {
26  ia64_srlz_d();
27 }
28 
29 static __inline__ unsigned long
30 ia64_get_itm (void)
31 {
32  unsigned long result;
33 
34  result = ia64_getreg(_IA64_REG_CR_ITM);
35  ia64_srlz_d();
36  return result;
37 }
38 
39 static __inline__ void
40 ia64_set_itv (unsigned long val)
41 {
43  ia64_srlz_d();
44 }
45 
46 static __inline__ unsigned long
47 ia64_get_itv (void)
48 {
50 }
51 
52 static __inline__ void
53 ia64_set_itc (unsigned long val)
54 {
56  ia64_srlz_d();
57 }
58 
59 static __inline__ unsigned long
60 ia64_get_itc (void)
61 {
62  unsigned long result;
63 
64  result = ia64_getreg(_IA64_REG_AR_ITC);
65  ia64_barrier();
66 #ifdef CONFIG_ITANIUM
67  while (unlikely((__s32) result == -1)) {
68  result = ia64_getreg(_IA64_REG_AR_ITC);
69  ia64_barrier();
70  }
71 #endif
72  return result;
73 }
74 
75 extern void ia64_delay_loop (unsigned long loops);
76 
77 static __inline__ void
78 __delay (unsigned long loops)
79 {
80  if (unlikely(loops < 1))
81  return;
82 
83  ia64_delay_loop (loops - 1);
84 }
85 
86 extern void udelay (unsigned long usecs);
87 
88 #endif /* _ASM_IA64_DELAY_H */