Revert last change. Bug noticed by Linus.
[linux-2.6/linux-mips.git] / include / asm-m68k / delay.h
blob731dd0b1afdabf9afc3b42eb7b2f79ed9989123f
1 #ifndef _M68K_DELAY_H
2 #define _M68K_DELAY_H
4 /*
5 * Copyright (C) 1994 Hamish Macdonald
7 * Delay routines, using a pre-computed "loops_per_second" value.
8 */
10 extern __inline__ void __delay(unsigned long loops)
12 __asm__ __volatile__ ("1: subql #1,%0; jcc 1b"
13 : "=d" (loops) : "0" (loops));
17 * Use only for very small delays ( < 1 msec). Should probably use a
18 * lookup table, really, as the multiplications take much too long with
19 * short delays. This is a "reasonable" implementation, though (and the
20 * first constant multiplications gets optimized away if the delay is
21 * a constant)
23 extern __inline__ void udelay(unsigned long usecs)
25 unsigned long tmp;
27 usecs *= 4295; /* 2**32 / 1000000 */
28 __asm__ ("mulul %2,%0:%1"
29 : "=d" (usecs), "=d" (tmp)
30 : "d" (usecs), "1" (loops_per_sec));
31 __delay(usecs);
34 extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
36 unsigned long tmp;
38 __asm__ ("mulul %2,%0:%1; divul %3,%0:%1"
39 : "=d" (tmp), "=d" (a)
40 : "d" (b), "d" (c), "1" (a));
41 return a;
44 #endif /* defined(_M68K_DELAY_H) */