Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

linux/delay.h

Go to the documentation of this file.
00001 #ifndef _LINUX_DELAY_H
00002 #define _LINUX_DELAY_H
00003 
00004 /*
00005  * Copyright (C) 1993 Linus Torvalds
00006  *
00007  * Delay routines, using a pre-computed "loops_per_jiffy" value.
00008  */
00009 
00010 extern unsigned long loops_per_jiffy;
00011 
00012 #include <asm/delay.h>
00013 
00014 /*
00015  * Using udelay() for intervals greater than a few milliseconds can
00016  * risk overflow for high loops_per_sec (high bogomips) machines. The
00017  * mdelay() provides a wrapper to prevent this.  For delays greater
00018  * than MAX_UDELAY_MS milliseconds, the wrapper is used.  Architecture
00019  * specific values can be defined in asm-???/delay.h as an override.
00020  * The 2nd mdelay() definition ensures GCC will optimize away the 
00021  * while loop for the common cases where n <= MAX_UDELAY_MS  --  Paul G.
00022  */
00023 
00024 #ifndef MAX_UDELAY_MS
00025 #define MAX_UDELAY_MS   5
00026 #endif
00027 
00028 #ifdef notdef
00029 #define mdelay(n) (\
00030         {unsigned long msec=(n); while (msec--) udelay(1000);})
00031 #else
00032 #define mdelay(n) (\
00033         (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
00034         ({unsigned long msec=(n); while (msec--) udelay(1000);}))
00035 #endif
00036 
00037 #endif /* defined(_LINUX_DELAY_H) */