This source file includes following definitions.
- __delay
- udelay
- muldiv
1 #ifndef __SPARC_DELAY_H
2 #define __SPARC_DELAY_H
3
4 extern unsigned long loops_per_sec;
5
6
7
8
9
10
11
12
13 extern __inline__ void __delay(unsigned int loops)
14 {
15 __asm__ __volatile__("\n1:\tcmp %0, 0\n\t"
16 "bne,a 1b\n\t"
17 "sub %0, 1, %0\n": "=&r" (loops) : "0" (loops));
18 }
19
20
21
22 extern __inline__ void udelay(unsigned int usecs)
23 {
24 usecs *= 0x000010c6;
25
26 __asm__("sethi %hi(_loops_per_sec), %o1\n\t"
27 "ld [%o1 + %lo(_loops_per_sec)], %o1\n\t"
28 "call ___delay\n\t"
29 "umul %o1, %o0, %o0\n\t");
30 }
31
32
33
34 extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
35 {
36 return ((a*b)/c);
37 }
38
39 #endif
40