debug-macro.S 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* arch/arm/mach-sa1100/include/mach/debug-macro.S
  2. *
  3. * Debugging macro include header
  4. *
  5. * Copyright (C) 1994-1999 Russell King
  6. * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <mach/hardware.h>
  14. .macro addruart, rp, rv
  15. mrc p15, 0, \rp, c1, c0
  16. tst \rp, #1 @ MMU enabled?
  17. moveq \rp, #0x80000000 @ physical base address
  18. movne \rp, #0xf8000000 @ virtual address
  19. @ We probe for the active serial port here, coherently with
  20. @ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h.
  21. @ We assume r1 can be clobbered.
  22. @ see if Ser3 is active
  23. add \rp, \rp, #0x00050000
  24. ldr \rv, [\rp, #UTCR3]
  25. tst \rv, #UTCR3_TXE
  26. @ if Ser3 is inactive, then try Ser1
  27. addeq \rp, \rp, #(0x00010000 - 0x00050000)
  28. ldreq \rv, [\rp, #UTCR3]
  29. tsteq \rv, #UTCR3_TXE
  30. @ if Ser1 is inactive, then try Ser2
  31. addeq \rp, \rp, #(0x00030000 - 0x00010000)
  32. ldreq \rv, [\rp, #UTCR3]
  33. tsteq \rv, #UTCR3_TXE
  34. @ clear top bits, and generate both phys and virt addresses
  35. lsl \rp, \rp, #8
  36. lsr \rp, \rp, #8
  37. orr \rv, \rp, #0xf8000000 @ virtual
  38. orr \rp, \rp, #0x80000000 @ physical
  39. .endm
  40. .macro senduart,rd,rx
  41. str \rd, [\rx, #UTDR]
  42. .endm
  43. .macro waituart,rd,rx
  44. 1001: ldr \rd, [\rx, #UTSR1]
  45. tst \rd, #UTSR1_TNF
  46. beq 1001b
  47. .endm
  48. .macro busyuart,rd,rx
  49. 1001: ldr \rd, [\rx, #UTSR1]
  50. tst \rd, #UTSR1_TBY
  51. bne 1001b
  52. .endm