root/include/asm-sparc/delay.h

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

INCLUDED FROM


DEFINITIONS

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

   1 #ifndef __SPARC_DELAY_H
   2 #define __SPARC_DELAY_H
   3 
   4 extern unsigned long loops_per_sec;
   5 
   6 /*
   7  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu).
   8  *
   9  * Delay quick inlined code using 'loops_per_second' which is
  10  * calculated in calibrate_delay() in main.c (ie. BogoMIPS :-)
  11  */
  12 
  13 extern __inline__ void __delay(unsigned int loops)
     /* [previous][next][first][last][top][bottom][index][help] */
  14 {
  15   __asm__ __volatile__("\n1:\tcmp %0, 0\n\t"
  16                        "bne,a 1b\n\t"
  17                        "sub %0, 1, %0\n": "=&r" (loops) : "0" (loops));
  18 }
  19 
  20 /* udelay(usecs) is used for very short delays up to 1 millisecond. */
  21 
  22 extern __inline__ void udelay(unsigned int usecs)
     /* [previous][next][first][last][top][bottom][index][help] */
  23 {
  24   usecs *= 0x000010c6;         /* Sparc is 32-bit just like ix86 */
  25 
  26   __delay(loops_per_sec*usecs);
  27 
  28 }
  29 
  30 /* calibrate_delay() wants this... */
  31 
  32 extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
     /* [previous][next][first][last][top][bottom][index][help] */
  33 {
  34         return ((a*b)/c);
  35 }
  36 
  37 #endif /* defined(__SPARC_DELAY_H) */
  38 

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