File: /usr/src/linux/include/asm-cris/delay.h
1 /* $Id: delay.h,v 1.5 2001/06/28 04:59:25 hp Exp $ */
2
3 #ifndef _CRIS_DELAY_H
4 #define _CRIS_DELAY_H
5
6 /*
7 * Copyright (C) 1998, 1999, 2000, 2001 Axis Communications AB
8 *
9 * Delay routines, using a pre-computed "loops_per_second" value.
10 */
11
12 #include <linux/config.h>
13 #include <linux/linkage.h>
14
15 #ifdef CONFIG_SMP
16 #include <asm/smp.h>
17 #endif
18
19 extern void __do_delay(void); /* Special register call calling convention */
20
21 extern __inline__ void __delay(int loops)
22 {
23 __asm__ __volatile__ (
24 "move.d %0,r9\n\t"
25 "beq 2f\n\t"
26 "subq 1,r9\n\t"
27 "1:\n\t"
28 "bne 1b\n\t"
29 "subq 1,r9\n"
30 "2:"
31 : : "g" (loops) : "r9");
32 }
33
34
35 /* Use only for very small delays ( < 1 msec). */
36
37 extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */
38
39 extern __inline__ void udelay(unsigned long usecs)
40 {
41 __delay(usecs * loops_per_usec);
42 }
43
44 #endif /* defined(_CRIS_DELAY_H) */
45
46
47
48