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

   1 /* $Id: delay.h,v 1.7 1995/11/25 02:31:32 davem Exp $
   2  * delay.h: Linux delay routines on the Sparc.
   3  *
   4  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu).
   5  */
   6 
   7 #ifndef __SPARC_DELAY_H
   8 #define __SPARC_DELAY_H
   9 
  10 extern __inline__ void __delay(unsigned long loops)
     /* [previous][next][first][last][top][bottom][index][help] */
  11 {
  12         __asm__ __volatile__("cmp %0, 0\n\t"
  13                              "1: bne 1b\n\t"
  14                              "subcc %0, 1, %0\n" :
  15                              "=&r" (loops) :
  16                              "0" (loops));
  17 }
  18 
  19 /* udelay(usecs) is used for very short delays up to 1 millisecond. On
  20  * the Sparc (both sun4c and sun4m) we have a free running usec counter
  21  * available to us already.
  22  */
  23 extern volatile unsigned int *master_l10_counter;
  24 
  25 extern __inline__ void udelay(unsigned int usecs)
     /* [previous][next][first][last][top][bottom][index][help] */
  26 {
  27         unsigned int ccnt;
  28 
  29         if(!master_l10_counter)
  30                 return;
  31         ccnt=*master_l10_counter;
  32         for(usecs+=1; usecs; usecs--, ccnt=*master_l10_counter)
  33                 while(*master_l10_counter == ccnt)
  34                         __asm__("": : :"memory");
  35 }
  36 
  37 /* calibrate_delay() wants this... */
  38 #define muldiv(a, b, c)    (((a)*(b))/(c))
  39 
  40 #endif /* defined(__SPARC_DELAY_H) */
  41 

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