at91.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (C) 2003-2005 SAN People
  3. *
  4. * Debugging macro include header
  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. */
  11. #define AT91_DBGU_SR (0x14) /* Status Register */
  12. #define AT91_DBGU_THR (0x1c) /* Transmitter Holding Register */
  13. #define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */
  14. #define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */
  15. .macro addruart, rp, rv, tmp
  16. ldr \rp, =CONFIG_DEBUG_UART_PHYS @ System peripherals (phys address)
  17. ldr \rv, =CONFIG_DEBUG_UART_VIRT @ System peripherals (virt address)
  18. .endm
  19. .macro senduart,rd,rx
  20. strb \rd, [\rx, #(AT91_DBGU_THR)] @ Write to Transmitter Holding Register
  21. .endm
  22. .macro waituart,rd,rx
  23. 1001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register
  24. tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit
  25. beq 1001b
  26. .endm
  27. .macro busyuart,rd,rx
  28. 1001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register
  29. tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete
  30. beq 1001b
  31. .endm