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

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