delay-loop.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * linux/arch/arm/lib/delay.S
  3. *
  4. * Copyright (C) 1995, 1996 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/linkage.h>
  11. #include <asm/assembler.h>
  12. #include <asm/delay.h>
  13. .text
  14. .LC0: .word loops_per_jiffy
  15. .LC1: .word UDELAY_MULT
  16. /*
  17. * r0 <= 2000
  18. * HZ <= 1000
  19. */
  20. ENTRY(__loop_udelay)
  21. ldr r2, .LC1
  22. mul r0, r2, r0
  23. ENTRY(__loop_const_udelay) @ 0 <= r0 <= 0x7fffff06
  24. ldr r2, .LC0
  25. ldr r2, [r2]
  26. umull r1, r0, r2, r0
  27. adds r1, r1, #0xffffffff
  28. adcs r0, r0, r0
  29. reteq lr
  30. /*
  31. * loops = r0 * HZ * loops_per_jiffy / 1000000
  32. */
  33. .align 3
  34. @ Delay routine
  35. ENTRY(__loop_delay)
  36. subs r0, r0, #1
  37. #if 0
  38. retls lr
  39. subs r0, r0, #1
  40. retls lr
  41. subs r0, r0, #1
  42. retls lr
  43. subs r0, r0, #1
  44. retls lr
  45. subs r0, r0, #1
  46. retls lr
  47. subs r0, r0, #1
  48. retls lr
  49. subs r0, r0, #1
  50. retls lr
  51. subs r0, r0, #1
  52. #endif
  53. bhi __loop_delay
  54. ret lr
  55. ENDPROC(__loop_udelay)
  56. ENDPROC(__loop_const_udelay)
  57. ENDPROC(__loop_delay)