more debug output
[linux-2.4.git] / include / asm-cris / delay.h
1 #ifndef _CRIS_DELAY_H
2 #define _CRIS_DELAY_H
3
4 /*
5  * Copyright (C) 1998, 1999, 2000, 2001 Axis Communications AB
6  *
7  * Delay routines, using a pre-computed "loops_per_second" value.
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
17 extern void __do_delay(void);   /* Special register call calling convention */
18
19 extern __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 /* Use only for very small delays ( < 1 msec).  */
34
35 extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */
36
37 extern __inline__ void udelay(unsigned long usecs)
38 {
39         __delay(usecs * loops_per_usec);
40 }
41
42 /* ETRAX 100 is really too slow to sleep for nanosecs. */
43 /* Divide with 1024 to avoid a real division that would take >1 us... */
44 extern __inline__ void ndelay(unsigned long nsecs)
45 {
46         __delay(1 + nsecs * loops_per_usec / 1024);
47 }
48
49 #endif /* defined(_CRIS_DELAY_H) */
50
51
52