renesas-scif.S 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Renesas SCIF(A) debugging macro include header
  3. *
  4. * Based on r8a7790.S
  5. *
  6. * Copyright (C) 2012-2013 Renesas Electronics Corporation
  7. * Copyright (C) 1994-1999 Russell King
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #define SCIF_PHYS CONFIG_DEBUG_UART_PHYS
  14. #define SCIF_VIRT ((SCIF_PHYS & 0x00ffffff) | 0xfd000000)
  15. #if CONFIG_DEBUG_UART_PHYS < 0xe6e00000
  16. /* SCIFA */
  17. #define FTDR 0x20
  18. #define FSR 0x14
  19. #else
  20. /* SCIF */
  21. #define FTDR 0x0c
  22. #define FSR 0x10
  23. #endif
  24. #define TDFE (1 << 5)
  25. #define TEND (1 << 6)
  26. .macro addruart, rp, rv, tmp
  27. ldr \rp, =SCIF_PHYS
  28. ldr \rv, =SCIF_VIRT
  29. .endm
  30. .macro waituart, rd, rx
  31. 1001: ldrh \rd, [\rx, #FSR]
  32. tst \rd, #TDFE
  33. beq 1001b
  34. .endm
  35. .macro senduart, rd, rx
  36. strb \rd, [\rx, #FTDR]
  37. ldrh \rd, [\rx, #FSR]
  38. bic \rd, \rd, #TEND
  39. strh \rd, [\rx, #FSR]
  40. .endm
  41. .macro busyuart, rd, rx
  42. 1001: ldrh \rd, [\rx, #FSR]
  43. tst \rd, #TEND
  44. beq 1001b
  45. .endm