delay.c 523 B

1234567891011121314151617181920212223242526272829303132
  1. #include "linux/delay.h"
  2. #include "asm/param.h"
  3. void __delay(unsigned long time)
  4. {
  5. /* Stolen from the i386 __loop_delay */
  6. int d0;
  7. __asm__ __volatile__(
  8. "\tjmp 1f\n"
  9. ".align 16\n"
  10. "1:\tjmp 2f\n"
  11. ".align 16\n"
  12. "2:\tdecl %0\n\tjns 2b"
  13. :"=&a" (d0)
  14. :"0" (time));
  15. }
  16. void __udelay(unsigned long usecs)
  17. {
  18. int i, n;
  19. n = (loops_per_jiffy * HZ * usecs) / MILLION;
  20. for(i=0;i<n;i++) ;
  21. }
  22. void __const_udelay(unsigned long usecs)
  23. {
  24. int i, n;
  25. n = (loops_per_jiffy * HZ * usecs) / MILLION;
  26. for(i=0;i<n;i++) ;
  27. }