5 * Copyright (C) 1994 Hamish Macdonald
7 * Delay routines, using a pre-computed "loops_per_second" value.
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
23 extern __inline__
void udelay(unsigned long usecs
)
27 usecs
*= 4295; /* 2**32 / 1000000 */
28 __asm__ ("mulul %2,%0:%1"
29 : "=d" (usecs
), "=d" (tmp
)
30 : "d" (usecs
), "1" (loops_per_sec
));
34 extern __inline__
unsigned long muldiv(unsigned long a
, unsigned long b
, unsigned long c
)
38 __asm__ ("mulul %2,%0:%1; divul %3,%0:%1"
39 : "=d" (tmp
), "=d" (a
)
40 : "d" (b
), "d" (c
), "1" (a
));
44 #endif /* defined(_M68K_DELAY_H) */