debug-macro.S 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. *
  3. * Copyright (C) 2007 Google, Inc.
  4. * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  5. * Author: Brian Swetland <swetland@google.com>
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #include <mach/hardware.h>
  18. #include <mach/msm_iomap.h>
  19. .macro addruart, rp, rv, tmp
  20. #ifdef MSM_DEBUG_UART_PHYS
  21. ldr \rp, =MSM_DEBUG_UART_PHYS
  22. ldr \rv, =MSM_DEBUG_UART_BASE
  23. #endif
  24. .endm
  25. .macro senduart, rd, rx
  26. #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
  27. @ Write the 1 character to UARTDM_TF
  28. str \rd, [\rx, #0x70]
  29. #else
  30. teq \rx, #0
  31. strne \rd, [\rx, #0x0C]
  32. #endif
  33. .endm
  34. .macro waituart, rd, rx
  35. #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
  36. @ check for TX_EMT in UARTDM_SR
  37. ldr \rd, [\rx, #0x08]
  38. tst \rd, #0x08
  39. bne 1002f
  40. @ wait for TXREADY in UARTDM_ISR
  41. 1001: ldr \rd, [\rx, #0x14]
  42. tst \rd, #0x80
  43. beq 1001b
  44. 1002:
  45. @ Clear TX_READY by writing to the UARTDM_CR register
  46. mov \rd, #0x300
  47. str \rd, [\rx, #0x10]
  48. @ Write 0x1 to NCF register
  49. mov \rd, #0x1
  50. str \rd, [\rx, #0x40]
  51. @ UARTDM reg. Read to induce delay
  52. ldr \rd, [\rx, #0x08]
  53. #else
  54. @ wait for TX_READY
  55. 1001: ldr \rd, [\rx, #0x08]
  56. tst \rd, #0x04
  57. beq 1001b
  58. #endif
  59. .endm
  60. .macro busyuart, rd, rx
  61. .endm