delay.c 510 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright 2003 PathScale, Inc.
  3. * Copied from arch/x86_64
  4. *
  5. * Licensed under the GPL
  6. */
  7. #include <linux/module.h>
  8. #include <linux/delay.h>
  9. #include <asm/processor.h>
  10. #include <asm/param.h>
  11. void __delay(unsigned long loops)
  12. {
  13. unsigned long i;
  14. for(i = 0; i < loops; i++)
  15. cpu_relax();
  16. }
  17. void __udelay(unsigned long usecs)
  18. {
  19. unsigned long i, n;
  20. n = (loops_per_jiffy * HZ * usecs) / MILLION;
  21. for(i=0;i<n;i++)
  22. cpu_relax();
  23. }
  24. EXPORT_SYMBOL(__udelay);