1 /* $Id: delay.h,v 1.2 1999/01/04 16:09:20 ralf Exp $
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * Copyright (C) 1994 by Waldorf Electronics
8 * Copyright (C) 1995 - 1998 by Ralf Baechle
10 #ifndef __ASM_MIPS_DELAY_H
11 #define __ASM_MIPS_DELAY_H
13 extern __inline__
void __delay(int loops
)
15 __asm__
__volatile__ (
25 * division by multiplication: you don't have to worry about
28 * Use only for very small delays ( < 1 msec). Should probably use a
29 * lookup table, really, as the multiplications take much too long with
30 * short delays. This is a "reasonable" implementation, though (and the
31 * first constant multiplications gets optimized away if the delay is
34 extern __inline__
void __udelay(unsigned long usecs
, unsigned long lps
)
36 usecs
*= 0x000010c6; /* 2**32 / 1000000 */
37 __asm__("multu\t%0,%2\n\t"
40 :"0" (usecs
),"r" (lps
));
45 #define __udelay_val cpu_data[smp_processor_id()].udelay_val
47 #define __udelay_val loops_per_sec
50 #define udelay(usecs) __udelay((usecs),__udelay_val)
52 #endif /* __ASM_MIPS_DELAY_H */