zynq.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Debugging macro include header
  3. *
  4. * Copyright (C) 2011 Xilinx
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #define UART_CR_OFFSET 0x00 /* Control Register [8:0] */
  16. #define UART_SR_OFFSET 0x2C /* Channel Status [11:0] */
  17. #define UART_FIFO_OFFSET 0x30 /* FIFO [15:0] or [7:0] */
  18. #define UART_SR_TXFULL 0x00000010 /* TX FIFO full */
  19. #define UART_SR_TXEMPTY 0x00000008 /* TX FIFO empty */
  20. #define UART0_PHYS 0xE0000000
  21. #define UART0_VIRT 0xF0800000
  22. #define UART1_PHYS 0xE0001000
  23. #define UART1_VIRT 0xF0801000
  24. #if IS_ENABLED(CONFIG_DEBUG_ZYNQ_UART1)
  25. # define LL_UART_PADDR UART1_PHYS
  26. # define LL_UART_VADDR UART1_VIRT
  27. #else
  28. # define LL_UART_PADDR UART0_PHYS
  29. # define LL_UART_VADDR UART0_VIRT
  30. #endif
  31. .macro addruart, rp, rv, tmp
  32. ldr \rp, =LL_UART_PADDR @ physical
  33. ldr \rv, =LL_UART_VADDR @ virtual
  34. .endm
  35. .macro senduart,rd,rx
  36. strb \rd, [\rx, #UART_FIFO_OFFSET] @ TXDATA
  37. .endm
  38. .macro waituart,rd,rx
  39. 1001: ldr \rd, [\rx, #UART_SR_OFFSET]
  40. ARM_BE8( rev \rd, \rd )
  41. tst \rd, #UART_SR_TXEMPTY
  42. beq 1001b
  43. .endm
  44. .macro busyuart,rd,rx
  45. 1002: ldr \rd, [\rx, #UART_SR_OFFSET] @ get status register
  46. ARM_BE8( rev \rd, \rd )
  47. tst \rd, #UART_SR_TXFULL @
  48. bne 1002b @ wait if FIFO is full
  49. .endm