5 * Copyright (C) 1993 Linus Torvalds
7 * Delay routines, using a pre-computed "loops_per_second" value.
10 extern unsigned long loops_per_sec
;
12 #include <asm/delay.h>
15 * Using udelay() for intervals greater than a few milliseconds can
16 * risk overflow for high loops_per_sec (high bogomips) machines. The
17 * mdelay() provides a wrapper to prevent this. For delays greater
18 * than MAX_UDELAY_MS milliseconds, the wrapper is used. Architecture
19 * specific values can be defined in asm-???/delay.h as an override.
20 * The 2nd mdelay() definition ensures GCC will optimize away the
21 * while loop for the common cases where n <= MAX_UDELAY_MS -- Paul G.
25 #define MAX_UDELAY_MS 5
30 {unsigned long msec=(n); while (msec--) udelay(1000);})
33 (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
34 ({unsigned long msec=(n); while (msec--) udelay(1000);}))
37 #endif /* defined(_LINUX_DELAY_H) */