meson.S 878 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (C) 2014 Carlo Caione
  3. * Carlo Caione <carlo@caione.org>
  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 MESON_AO_UART_WFIFO 0x0
  10. #define MESON_AO_UART_STATUS 0xc
  11. #define MESON_AO_UART_TX_FIFO_EMPTY (1 << 22)
  12. #define MESON_AO_UART_TX_FIFO_FULL (1 << 21)
  13. .macro addruart, rp, rv, tmp
  14. ldr \rp, =(CONFIG_DEBUG_UART_PHYS) @ physical
  15. ldr \rv, =(CONFIG_DEBUG_UART_VIRT) @ virtual
  16. .endm
  17. .macro senduart,rd,rx
  18. str \rd, [\rx, #MESON_AO_UART_WFIFO]
  19. .endm
  20. .macro busyuart,rd,rx
  21. 1002: ldr \rd, [\rx, #MESON_AO_UART_STATUS]
  22. tst \rd, #MESON_AO_UART_TX_FIFO_EMPTY
  23. beq 1002b
  24. .endm
  25. .macro waituart,rd,rx
  26. 1001: ldr \rd, [\rx, #MESON_AO_UART_STATUS]
  27. tst \rd, #MESON_AO_UART_TX_FIFO_FULL
  28. bne 1001b
  29. .endm