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   __asm__("sethi %hi(_loops_per_sec), %o1\n\t"
  27           "ld [%o1 + %lo(_loops_per_sec)], %o1\n\t"
  28           "call ___delay\n\t"
  29           "umul %o1, %o0, %o0\n\t");
  30 }
  31 
  32 /* calibrate_delay() wants this... */
  33 
  34 extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
     /* [previous][next][first][last][top][bottom][index][help] */
  35 {
  36         return ((a*b)/c);
  37 }
  38 
  39 #endif /* defined(__SPARC_DELAY_H) */
  40 

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