efm32.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (C) 2013 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #define UARTn_CMD 0x000c
  10. #define UARTn_CMD_TXEN 0x0004
  11. #define UARTn_STATUS 0x0010
  12. #define UARTn_STATUS_TXC 0x0020
  13. #define UARTn_STATUS_TXBL 0x0040
  14. #define UARTn_TXDATA 0x0034
  15. .macro addruart, rx, tmp, tmp2
  16. ldr \rx, =(CONFIG_DEBUG_UART_PHYS)
  17. /*
  18. * enable TX. The driver might disable it to save energy. We
  19. * don't care about disabling at the end as during debug power
  20. * consumption isn't that important.
  21. */
  22. ldr \tmp, =(UARTn_CMD_TXEN)
  23. str \tmp, [\rx, #UARTn_CMD]
  24. .endm
  25. .macro senduart,rd,rx
  26. strb \rd, [\rx, #UARTn_TXDATA]
  27. .endm
  28. .macro waituart,rd,rx
  29. 1001: ldr \rd, [\rx, #UARTn_STATUS]
  30. tst \rd, #UARTn_STATUS_TXBL
  31. beq 1001b
  32. .endm
  33. .macro busyuart,rd,rx
  34. 1001: ldr \rd, [\rx, UARTn_STATUS]
  35. tst \rd, #UARTn_STATUS_TXC
  36. bne 1001b
  37. .endm