uart_config.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-07-08 Rbb666 first version
  9. */
  10. #ifndef __UART_CONFIG_H__
  11. #define __UART_CONFIG_H__
  12. #include <rtthread.h>
  13. #include "board.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #ifdef BSP_USING_UART0
  18. /* UART0 device driver structure */
  19. cy_stc_sysint_t UART0_SCB_IRQ_cfg =
  20. {
  21. .intrSrc = (IRQn_Type) scb_0_interrupt_IRQn,
  22. .intrPriority = (7u),
  23. };
  24. #endif
  25. #ifdef BSP_USING_UART1
  26. /* UART1 device driver structure */
  27. cy_stc_sysint_t UART1_SCB_IRQ_cfg =
  28. {
  29. .intrSrc = (IRQn_Type) scb_1_interrupt_IRQn,
  30. .intrPriority = (7u),
  31. };
  32. #endif
  33. #ifdef BSP_USING_UART2
  34. /* UART2 device driver structure */
  35. cy_stc_sysint_t UART2_SCB_IRQ_cfg =
  36. {
  37. .intrSrc = (IRQn_Type) scb_2_interrupt_IRQn,
  38. .intrPriority = (7u),
  39. };
  40. #endif
  41. #ifdef BSP_USING_UART3
  42. /* UART3 device driver structure */
  43. cy_stc_sysint_t UART3_SCB_IRQ_cfg =
  44. {
  45. .intrSrc = (IRQn_Type) scb_3_interrupt_IRQn,
  46. .intrPriority = (7u),
  47. };
  48. #endif
  49. #ifdef BSP_USING_UART4
  50. /* UART4 device driver structure */
  51. cy_stc_sysint_t UART4_SCB_IRQ_cfg =
  52. {
  53. .intrSrc = (IRQn_Type) scb_4_interrupt_IRQn,
  54. .intrPriority = (7u),
  55. };
  56. #endif
  57. #ifdef BSP_USING_UART5
  58. /* UART5 device driver structure */
  59. cy_stc_sysint_t UART5_SCB_IRQ_cfg =
  60. {
  61. .intrSrc = (IRQn_Type) scb_5_interrupt_IRQn,
  62. .intrPriority = (7u),
  63. };
  64. #endif
  65. #if defined(BSP_USING_UART0)
  66. #ifndef UART0_CONFIG
  67. #define UART0_CONFIG \
  68. { \
  69. .name = "uart0", \
  70. .tx_pin = P0_3, \
  71. .rx_pin = P0_2, \
  72. .usart_x = SCB0, \
  73. .intrSrc = scb_0_interrupt_IRQn, \
  74. .userIsr = uart_isr_callback(uart0) \
  75. .UART_SCB_IRQ_cfg = &UART0_SCB_IRQ_cfg, \
  76. }
  77. void uart0_isr_callback(void);
  78. #endif /* UART0_CONFIG */
  79. #endif /* BSP_USING_UART0 */
  80. #if defined(BSP_USING_UART1)
  81. #ifndef UART1_CONFIG
  82. #define UART1_CONFIG \
  83. { \
  84. .name = "uart1", \
  85. .tx_pin = P10_1, \
  86. .rx_pin = P10_0, \
  87. .usart_x = SCB1, \
  88. .intrSrc = scb_1_interrupt_IRQn, \
  89. .userIsr = uart_isr_callback(uart1) \
  90. .UART_SCB_IRQ_cfg = &UART1_SCB_IRQ_cfg, \
  91. }
  92. void uart1_isr_callback(void);
  93. #endif /* UART1_CONFIG */
  94. #endif /* BSP_USING_UART1 */
  95. #if defined(BSP_USING_UART2)
  96. #ifndef UART2_CONFIG
  97. #define UART2_CONFIG \
  98. { \
  99. .name = "uart2", \
  100. .tx_pin = P9_1, \
  101. .rx_pin = P9_0, \
  102. .usart_x = SCB2, \
  103. .intrSrc = scb_2_interrupt_IRQn, \
  104. .userIsr = uart_isr_callback(uart2), \
  105. .UART_SCB_IRQ_cfg = &UART2_SCB_IRQ_cfg, \
  106. }
  107. void uart2_isr_callback(void);
  108. #endif /* UART2_CONFIG */
  109. #endif /* BSP_USING_UART2 */
  110. #if defined(BSP_USING_UART3)
  111. #ifndef UART3_CONFIG
  112. #define UART3_CONFIG \
  113. { \
  114. .name = "uart3", \
  115. .tx_pin = P6_1, \
  116. .rx_pin = P6_0, \
  117. .usart_x = SCB3, \
  118. .intrSrc = scb_3_interrupt_IRQn, \
  119. .userIsr = uart_isr_callback(uart3), \
  120. .UART_SCB_IRQ_cfg = &UART3_SCB_IRQ_cfg, \
  121. }
  122. void uart3_isr_callback(void);
  123. #endif /* UART3_CONFIG */
  124. #endif /* BSP_USING_UART3 */
  125. #if defined(BSP_USING_UART4)
  126. #ifndef UART4_CONFIG
  127. #define UART4_CONFIG \
  128. { \
  129. .name = "uart4", \
  130. .tx_pin = P7_1, \
  131. .rx_pin = P7_0, \
  132. .usart_x = SCB4, \
  133. .intrSrc = scb_4_interrupt_IRQn, \
  134. .userIsr = uart_isr_callback(uart4), \
  135. .UART_SCB_IRQ_cfg = &UART4_SCB_IRQ_cfg, \
  136. }
  137. void uart4_isr_callback(void);
  138. #endif /* UART4_CONFIG */
  139. #endif /* BSP_USING_UART4 */
  140. #if defined(BSP_USING_UART5)
  141. #ifndef UART5_CONFIG
  142. #define UART5_CONFIG \
  143. { \
  144. .name = "uart5", \
  145. .tx_pin = P5_1, \
  146. .rx_pin = P5_0, \
  147. .usart_x = SCB5, \
  148. .intrSrc = scb_5_interrupt_IRQn, \
  149. .userIsr = uart_isr_callback(uart5), \
  150. .UART_SCB_IRQ_cfg = &UART5_SCB_IRQ_cfg, \
  151. }
  152. void uart5_isr_callback(void);
  153. #endif /* UART5_CONFIG */
  154. #endif /* BSP_USING_UART5 */
  155. #ifdef __cplusplus
  156. }
  157. #endif
  158. #endif