root/include/linux/delay.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __delay
  2. udelay

   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_second" value.
   8  */
   9 
  10 extern unsigned long loops_per_sec;
  11 
  12 extern __inline__ void __delay(int loops)
     /* [previous][next][first][last][top][bottom][index][help] */
  13 {
  14         __asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax");
  15 }
  16 
  17 /*
  18  * division by multiplication: you don't have to worry about
  19  * loss of precision.
  20  *
  21  * Use only for very small delays ( < 1 msec).  Should probably use a
  22  * lookup table, really, as the multiplications take much too long with
  23  * short delays.  This is a "reasonable" implementation, though (and the
  24  * first constant multiplications gets optimized away if the delay is
  25  * a constant)
  26  */
  27 extern __inline__ void udelay(unsigned long usecs)
     /* [previous][next][first][last][top][bottom][index][help] */
  28 {
  29         usecs *= 0x000010c6;            /* 2**32 / 1000000 */
  30         __asm__("mull %0"
  31                 :"=d" (usecs)
  32                 :"a" (usecs),"0" (loops_per_sec)
  33                 :"ax");
  34         __delay(usecs);
  35 }
  36 
  37 #endif

/* [previous][next][first][last][top][bottom][index][help] */