aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/delay.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/delay.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/delay.h')
-rw-r--r--include/linux/delay.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/linux/delay.h b/include/linux/delay.h
new file mode 100644
index 000000000000..acb74865b973
--- /dev/null
+++ b/include/linux/delay.h
@@ -0,0 +1,50 @@
1#ifndef _LINUX_DELAY_H
2#define _LINUX_DELAY_H
3
4/*
5 * Copyright (C) 1993 Linus Torvalds
6 *
7 * Delay routines, using a pre-computed "loops_per_jiffy" value.
8 */
9
10extern unsigned long loops_per_jiffy;
11
12#include <asm/delay.h>
13
14/*
15 * Using udelay() for intervals greater than a few milliseconds can
16 * risk overflow for high loops_per_jiffy (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.
22 */
23
24#ifndef MAX_UDELAY_MS
25#define MAX_UDELAY_MS 5
26#endif
27
28#ifdef notdef
29#define mdelay(n) (\
30 {unsigned long __ms=(n); while (__ms--) udelay(1000);})
31#else
32#define mdelay(n) (\
33 (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
34 ({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
35#endif
36
37#ifndef ndelay
38#define ndelay(x) udelay(((x)+999)/1000)
39#endif
40
41void calibrate_delay(void);
42void msleep(unsigned int msecs);
43unsigned long msleep_interruptible(unsigned int msecs);
44
45static inline void ssleep(unsigned int seconds)
46{
47 msleep(seconds * 1000);
48}
49
50#endif /* defined(_LINUX_DELAY_H) */