1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/sched.h>
14#include <asm/param.h>
15
16
17
18
19
20
21
22
23
24void __delay(unsigned long loops)
25{
26 long long dummy;
27 __asm__ __volatile__("gettr tr0, %1\n\t"
28 "pta $+4, tr0\n\t"
29 "addi %0, -1, %0\n\t"
30 "bne %0, r63, tr0\n\t"
31 "ptabs %1, tr0\n\t":"=r"(loops),
32 "=r"(dummy)
33 :"0"(loops));
34}
35
36void __const_udelay(unsigned long xloops)
37{
38 __delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy));
39}
40
41void __udelay(unsigned long usecs)
42{
43 __const_udelay(usecs * 0x000010c6);
44}
45
46void __ndelay(unsigned long nsecs)
47{
48 __const_udelay(nsecs * 0x00000005);
49}
50