uart_config.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * Copyright (c) 2006-2023, 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. {
  17. #endif
  18. #ifdef BSP_USING_UART0
  19. /* UART0 device driver structure */
  20. cy_stc_sysint_t UART0_SCB_IRQ_cfg =
  21. {
  22. .intrSrc = (IRQn_Type)scb_0_interrupt_IRQn,
  23. .intrPriority = (7u),
  24. };
  25. #endif
  26. #ifdef BSP_USING_UART1
  27. /* UART1 device driver structure */
  28. cy_stc_sysint_t UART1_SCB_IRQ_cfg =
  29. {
  30. .intrSrc = (IRQn_Type)scb_1_interrupt_IRQn,
  31. .intrPriority = (7u),
  32. };
  33. #endif
  34. #ifdef BSP_USING_UART2
  35. /* UART2 device driver structure */
  36. cy_stc_sysint_t UART2_SCB_IRQ_cfg =
  37. {
  38. .intrSrc = (IRQn_Type)scb_2_interrupt_IRQn,
  39. .intrPriority = (7u),
  40. };
  41. #endif
  42. #ifdef BSP_USING_UART3
  43. /* UART3 device driver structure */
  44. cy_stc_sysint_t UART3_SCB_IRQ_cfg =
  45. {
  46. .intrSrc = (IRQn_Type)scb_3_interrupt_IRQn,
  47. .intrPriority = (7u),
  48. };
  49. #endif
  50. #ifdef BSP_USING_UART4
  51. /* UART4 device driver structure */
  52. cy_stc_sysint_t UART4_SCB_IRQ_cfg =
  53. {
  54. .intrSrc = (IRQn_Type)scb_4_interrupt_IRQn,
  55. .intrPriority = (7u),
  56. };
  57. #endif
  58. #ifdef BSP_USING_UART5
  59. /* UART5 device driver structure */
  60. cy_stc_sysint_t UART5_SCB_IRQ_cfg =
  61. {
  62. .intrSrc = (IRQn_Type)scb_5_interrupt_IRQn,
  63. .intrPriority = (7u),
  64. };
  65. #endif
  66. #ifdef BSP_USING_UART6
  67. /* UART6 device driver structure */
  68. cy_stc_sysint_t UART6_SCB_IRQ_cfg =
  69. {
  70. .intrSrc = (IRQn_Type)scb_6_interrupt_IRQn,
  71. .intrPriority = (7u),
  72. };
  73. #endif
  74. #if defined(BSP_USING_UART0)
  75. #ifndef UART0_CONFIG
  76. #define UART0_CONFIG \
  77. { \
  78. .name = "uart0", \
  79. .tx_pin = P0_3, \
  80. .rx_pin = P0_2, \
  81. .usart_x = SCB0, \
  82. .intrSrc = scb_0_interrupt_IRQn, \
  83. .userIsr = uart_isr_callback(uart0), \
  84. .UART_SCB_IRQ_cfg = &UART0_SCB_IRQ_cfg, \
  85. }
  86. void uart0_isr_callback(void);
  87. #endif /* UART0_CONFIG */
  88. #endif /* BSP_USING_UART0 */
  89. #if defined(BSP_USING_UART1)
  90. #ifndef UART1_CONFIG
  91. #define UART1_CONFIG \
  92. { \
  93. .name = "uart1", \
  94. .tx_pin = P10_1, \
  95. .rx_pin = P10_0, \
  96. .usart_x = SCB1, \
  97. .intrSrc = scb_1_interrupt_IRQn, \
  98. .userIsr = uart_isr_callback(uart1), \
  99. .UART_SCB_IRQ_cfg = &UART1_SCB_IRQ_cfg, \
  100. }
  101. void uart1_isr_callback(void);
  102. #endif /* UART1_CONFIG */
  103. #endif /* BSP_USING_UART1 */
  104. #if defined(BSP_USING_UART2)
  105. #ifndef UART2_CONFIG
  106. #if defined(SOC_CY8C6244LQI_S4D92)
  107. #define UART2_CONFIG \
  108. { \
  109. .name = "uart2", \
  110. .tx_pin = P3_1, \
  111. .rx_pin = P3_0, \
  112. .usart_x = SCB2, \
  113. .intrSrc = scb_2_interrupt_IRQn, \
  114. .userIsr = uart_isr_callback(uart2), \
  115. .UART_SCB_IRQ_cfg = &UART2_SCB_IRQ_cfg, \
  116. }
  117. #else
  118. #define UART2_CONFIG \
  119. { \
  120. .name = "uart2", \
  121. .tx_pin = P9_1, \
  122. .rx_pin = P9_0, \
  123. .usart_x = SCB2, \
  124. .intrSrc = scb_2_interrupt_IRQn, \
  125. .userIsr = uart_isr_callback(uart2), \
  126. .UART_SCB_IRQ_cfg = &UART2_SCB_IRQ_cfg, \
  127. }
  128. #endif /* SOC_CY8C6244LQI_S4D92 */
  129. void uart2_isr_callback(void);
  130. #endif /* UART2_CONFIG */
  131. #endif /* BSP_USING_UART2 */
  132. #if defined(BSP_USING_UART3)
  133. #ifndef UART3_CONFIG
  134. #define UART3_CONFIG \
  135. { \
  136. .name = "uart3", \
  137. .tx_pin = P6_1, \
  138. .rx_pin = P6_0, \
  139. .usart_x = SCB3, \
  140. .intrSrc = scb_3_interrupt_IRQn, \
  141. .userIsr = uart_isr_callback(uart3), \
  142. .UART_SCB_IRQ_cfg = &UART3_SCB_IRQ_cfg, \
  143. }
  144. void uart3_isr_callback(void);
  145. #endif /* UART3_CONFIG */
  146. #endif /* BSP_USING_UART3 */
  147. #if defined(BSP_USING_UART4)
  148. #ifndef UART4_CONFIG
  149. #define UART4_CONFIG \
  150. { \
  151. .name = "uart4", \
  152. .tx_pin = P7_1, \
  153. .rx_pin = P7_0, \
  154. .usart_x = SCB4, \
  155. .intrSrc = scb_4_interrupt_IRQn, \
  156. .userIsr = uart_isr_callback(uart4), \
  157. .UART_SCB_IRQ_cfg = &UART4_SCB_IRQ_cfg, \
  158. }
  159. void uart4_isr_callback(void);
  160. #endif /* UART4_CONFIG */
  161. #endif /* BSP_USING_UART4 */
  162. #if defined(BSP_USING_UART5)
  163. #ifndef UART5_CONFIG
  164. #define UART5_CONFIG \
  165. { \
  166. .name = "uart5", \
  167. .tx_pin = P5_1, \
  168. .rx_pin = P5_0, \
  169. .usart_x = SCB5, \
  170. .intrSrc = scb_5_interrupt_IRQn, \
  171. .userIsr = uart_isr_callback(uart5), \
  172. .UART_SCB_IRQ_cfg = &UART5_SCB_IRQ_cfg, \
  173. }
  174. void uart5_isr_callback(void);
  175. #endif /* UART5_CONFIG */
  176. #endif /* BSP_USING_UART5 */
  177. #if defined(BSP_USING_UART6)
  178. #ifndef UART6_CONFIG
  179. #define UART6_CONFIG \
  180. { \
  181. .name = "uart6", \
  182. .tx_pin = P6_5, \
  183. .rx_pin = P6_4, \
  184. .usart_x = SCB6, \
  185. .intrSrc = scb_6_interrupt_IRQn, \
  186. .userIsr = uart_isr_callback(uart6), \
  187. .UART_SCB_IRQ_cfg = &UART6_SCB_IRQ_cfg, \
  188. }
  189. void uart6_isr_callback(void);
  190. #endif /* UART6_CONFIG */
  191. #endif /* BSP_USING_UART6 */
  192. #ifdef __cplusplus
  193. }
  194. #endif
  195. #endif