delay_32.h 868 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * delay.h: Linux delay routines on the Sparc.
  3. *
  4. * Copyright (C) 1994 David S. Miller ([email protected]).
  5. */
  6. #ifndef __SPARC_DELAY_H
  7. #define __SPARC_DELAY_H
  8. #include <asm/cpudata.h>
  9. static inline void __delay(unsigned long loops)
  10. {
  11. __asm__ __volatile__("cmp %0, 0\n\t"
  12. "1: bne 1b\n\t"
  13. "subcc %0, 1, %0\n" :
  14. "=&r" (loops) :
  15. "0" (loops) :
  16. "cc");
  17. }
  18. /* This is too messy with inline asm on the Sparc. */
  19. void __udelay(unsigned long usecs, unsigned long lpj);
  20. void __ndelay(unsigned long nsecs, unsigned long lpj);
  21. #ifdef CONFIG_SMP
  22. #define __udelay_val cpu_data(smp_processor_id()).udelay_val
  23. #else /* SMP */
  24. #define __udelay_val loops_per_jiffy
  25. #endif /* SMP */
  26. #define udelay(__usecs) __udelay(__usecs, __udelay_val)
  27. #define ndelay(__nsecs) __ndelay(__nsecs, __udelay_val)
  28. #endif /* defined(__SPARC_DELAY_H) */