debug-macro.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. str \rd, [\rx, #0x0C]
  31. #endif
  32. .endm
  33. .macro waituart, rd, rx
  34. #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
  35. @ check for TX_EMT in UARTDM_SR
  36. ldr \rd, [\rx, #0x08]
  37. tst \rd, #0x08
  38. bne 1002f
  39. @ wait for TXREADY in UARTDM_ISR
  40. 1001: ldr \rd, [\rx, #0x14]
  41. tst \rd, #0x80
  42. beq 1001b
  43. 1002:
  44. @ Clear TX_READY by writing to the UARTDM_CR register
  45. mov \rd, #0x300
  46. str \rd, [\rx, #0x10]
  47. @ Write 0x1 to NCF register
  48. mov \rd, #0x1
  49. str \rd, [\rx, #0x40]
  50. @ UARTDM reg. Read to induce delay
  51. ldr \rd, [\rx, #0x08]
  52. #else
  53. @ wait for TX_READY
  54. 1001: ldr \rd, [\rx, #0x08]
  55. tst \rd, #0x04
  56. beq 1001b
  57. #endif
  58. .endm
  59. .macro busyuart, rd, rx
  60. .endm