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
13 #include <linux/config.h>
15 extern __inline__
void
16 __delay(unsigned long loops
)
18 __asm__
__volatile__ (
28 * division by multiplication: you don't have to worry about
31 * Use only for very small delays ( < 1 msec). Should probably use a
32 * lookup table, really, as the multiplications take much too long with
33 * short delays. This is a "reasonable" implementation, though (and the
34 * first constant multiplications gets optimized away if the delay is
37 extern __inline__
void __udelay(unsigned long usecs
, unsigned long lps
)
41 usecs
*= 0x000010c6; /* 2**32 / 1000000 */
42 __asm__("multu\t%2,%3"
43 :"=h" (usecs
), "=l" (lo
)
44 :"r" (usecs
),"r" (lps
));
49 #define __udelay_val cpu_data[smp_processor_id()].udelay_val
51 #define __udelay_val loops_per_sec
54 #define udelay(usecs) __udelay((usecs),__udelay_val)
56 #endif /* _ASM_DELAY_H */