File: /usr/src/linux/include/asm-parisc/delay.h
1 #ifndef _PARISC_DELAY_H
2 #define _PARISC_DELAY_H
3
4 #include <asm/system.h> /* for mfctl() */
5 #include <asm/processor.h> /* for boot_cpu_data */
6
7
8 /*
9 * Copyright (C) 1993 Linus Torvalds
10 *
11 * Delay routines
12 */
13
14 extern unsigned long loops_per_sec;
15
16 static __inline__ void __delay(unsigned long loops) {
17 asm volatile(
18 " .balignl 64,0x34000034
19 addib,UV -1,%0,.
20 nop"
21 : "=r" (loops) : "0" (loops));
22 }
23
24 static __inline__ void __cr16_delay(unsigned long clocks) {
25 unsigned long start;
26
27 /*
28 * Note: Due to unsigned math, cr16 rollovers shouldn't be
29 * a problem here. However, on 32 bit, we need to make sure
30 * we don't pass in too big a value. The current default
31 * value of MAX_UDELAY_MS should help prevent this.
32 */
33
34 start = mfctl(16);
35 while ((mfctl(16) - start) < clocks)
36 ;
37 }
38
39 static __inline__ void __udelay(unsigned long usecs) {
40 __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL));
41 }
42
43 #define udelay(n) __udelay(n)
44
45 #endif /* defined(_PARISC_DELAY_H) */
46