sti.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * arch/arm/include/debug/sti.S
  3. *
  4. * Debugging macro include header
  5. * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #define STIH41X_COMMS_BASE 0xfed00000
  12. #define STIH41X_ASC2_BASE (STIH41X_COMMS_BASE+0x32000)
  13. #define STIH41X_SBC_LPM_BASE 0xfe400000
  14. #define STIH41X_SBC_COMMS_BASE (STIH41X_SBC_LPM_BASE + 0x100000)
  15. #define STIH41X_SBC_ASC1_BASE (STIH41X_SBC_COMMS_BASE + 0x31000)
  16. #define VIRT_ADDRESS(x) (x - 0x1000000)
  17. #if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2)
  18. #define DEBUG_LL_UART_BASE STIH41X_ASC2_BASE
  19. #endif
  20. #if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
  21. #define DEBUG_LL_UART_BASE STIH41X_SBC_ASC1_BASE
  22. #endif
  23. #ifndef DEBUG_LL_UART_BASE
  24. #error "DEBUG UART is not Configured"
  25. #endif
  26. #define ASC_TX_BUF_OFF 0x04
  27. #define ASC_CTRL_OFF 0x0c
  28. #define ASC_STA_OFF 0x14
  29. #define ASC_STA_TX_FULL (1<<9)
  30. #define ASC_STA_TX_EMPTY (1<<1)
  31. .macro addruart, rp, rv, tmp
  32. ldr \rp, =DEBUG_LL_UART_BASE @ physical base
  33. ldr \rv, =VIRT_ADDRESS(DEBUG_LL_UART_BASE) @ virt base
  34. .endm
  35. .macro senduart,rd,rx
  36. strb \rd, [\rx, #ASC_TX_BUF_OFF]
  37. .endm
  38. .macro waituart,rd,rx
  39. 1001: ldr \rd, [\rx, #ASC_STA_OFF]
  40. tst \rd, #ASC_STA_TX_FULL
  41. bne 1001b
  42. .endm
  43. .macro busyuart,rd,rx
  44. 1001: ldr \rd, [\rx, #ASC_STA_OFF]
  45. tst \rd, #ASC_STA_TX_EMPTY
  46. beq 1001b
  47. .endm