1#ifndef _CRIS_DELAY_H
2#define _CRIS_DELAY_H
3
4
5
6
7
8
9
10#include <linux/config.h>
11#include <linux/linkage.h>
12
13#ifdef CONFIG_SMP
14#include <asm/smp.h>
15#endif
16
17extern void __do_delay(void);
18
19extern __inline__ void __delay(int loops)
20{
21 __asm__ __volatile__ (
22 "move.d %0,$r9\n\t"
23 "beq 2f\n\t"
24 "subq 1,$r9\n\t"
25 "1:\n\t"
26 "bne 1b\n\t"
27 "subq 1,$r9\n"
28 "2:"
29 : : "g" (loops) : "r9");
30}
31
32
33
34
35extern unsigned long loops_per_usec;
36
37extern __inline__ void udelay(unsigned long usecs)
38{
39 __delay(usecs * loops_per_usec);
40}
41
42
43
44extern __inline__ void ndelay(unsigned long nsecs)
45{
46 __delay(1 + nsecs * loops_per_usec / 1024);
47}
48
49#endif
50
51
52
53