home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / Include / Linux / delay.h < prev    next >
C/C++ Source or Header  |  2002-04-26  |  1KB  |  44 lines

  1. /* $Id: delay.h,v 1.2 2002/04/26 23:09:04 smilcke Exp $ */
  2.  
  3. #ifndef _LINUX_DELAY_H
  4. #define _LINUX_DELAY_H
  5.  
  6. /*
  7.  * Copyright (C) 1993 Linus Torvalds
  8.  *
  9.  * Delay routines, using a pre-computed "loops_per_second" value.
  10.  */
  11.  
  12. extern unsigned long loops_per_sec;
  13.  
  14. #include <asm/delay.h>
  15.  
  16. /*
  17.  * Using udelay() for intervals greater than a few milliseconds can
  18.  * risk overflow for high loops_per_sec (high bogomips) machines. The
  19.  * mdelay() provides a wrapper to prevent this.  For delays greater
  20.  * than MAX_UDELAY_MS milliseconds, the wrapper is used.  Architecture
  21.  * specific values can be defined in asm-???/delay.h as an override.
  22.  * The 2nd mdelay() definition ensures GCC will optimize away the 
  23.  * while loop for the common cases where n <= MAX_UDELAY_MS  --  Paul G.
  24.  */
  25.  
  26. #ifndef MAX_UDELAY_MS
  27. #define MAX_UDELAY_MS    5
  28. #endif
  29.  
  30. #ifdef TARGET_OS2
  31. #pragma aux iodelay32 parm nomemory [ecx] modify nomemory exact [eax ecx];
  32. void iodelay32(unsigned long);
  33. #define mdelay(n) iodelay32(n*2)
  34.  
  35. #else
  36.  
  37. void iodelay(unsigned long);
  38. #pragma aux iodelay parm nomemory [ecx] modify nomemory exact [eax ecx];
  39. #define mdelay(n) iodelay(n*2)
  40.  
  41. #endif
  42.  
  43. #endif /* defined(_LINUX_DELAY_H) */
  44.