uart_config.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. #if defined(BSP_USING_UART0)
  67. #ifndef UART0_CONFIG
  68. #define UART0_CONFIG \
  69. { \
  70. .name = "uart0", \
  71. .tx_pin = P0_3, \
  72. .rx_pin = P0_2, \
  73. .usart_x = SCB0, \
  74. .intrSrc = scb_0_interrupt_IRQn, \
  75. .userIsr = uart_isr_callback(uart0), \
  76. .UART_SCB_IRQ_cfg = &UART0_SCB_IRQ_cfg, \
  77. }
  78. void uart0_isr_callback(void);
  79. #endif /* UART0_CONFIG */
  80. #endif /* BSP_USING_UART0 */
  81. #if defined(BSP_USING_UART1)
  82. #ifndef UART1_CONFIG
  83. #define UART1_CONFIG \
  84. { \
  85. .name = "uart1", \
  86. .tx_pin = P10_1, \
  87. .rx_pin = P10_0, \
  88. .usart_x = SCB1, \
  89. .intrSrc = scb_1_interrupt_IRQn, \
  90. .userIsr = uart_isr_callback(uart1), \
  91. .UART_SCB_IRQ_cfg = &UART1_SCB_IRQ_cfg, \
  92. }
  93. void uart1_isr_callback(void);
  94. #endif /* UART1_CONFIG */
  95. #endif /* BSP_USING_UART1 */
  96. #if defined(BSP_USING_UART2)
  97. #ifndef UART2_CONFIG
  98. #if defined(SOC_CY8C6244LQI_S4D92)
  99. #define UART2_CONFIG \
  100. { \
  101. .name = "uart2", \
  102. .tx_pin = P3_1, \
  103. .rx_pin = P3_0, \
  104. .usart_x = SCB2, \
  105. .intrSrc = scb_2_interrupt_IRQn, \
  106. .userIsr = uart_isr_callback(uart2), \
  107. .UART_SCB_IRQ_cfg = &UART2_SCB_IRQ_cfg, \
  108. }
  109. #else
  110. #define UART2_CONFIG \
  111. { \
  112. .name = "uart2", \
  113. .tx_pin = P9_1, \
  114. .rx_pin = P9_0, \
  115. .usart_x = SCB2, \
  116. .intrSrc = scb_2_interrupt_IRQn, \
  117. .userIsr = uart_isr_callback(uart2), \
  118. .UART_SCB_IRQ_cfg = &UART2_SCB_IRQ_cfg, \
  119. }
  120. #endif /* SOC_CY8C6244LQI_S4D92 */
  121. void uart2_isr_callback(void);
  122. #endif /* UART2_CONFIG */
  123. #endif /* BSP_USING_UART2 */
  124. #if defined(BSP_USING_UART3)
  125. #ifndef UART3_CONFIG
  126. #define UART3_CONFIG \
  127. { \
  128. .name = "uart3", \
  129. .tx_pin = P6_1, \
  130. .rx_pin = P6_0, \
  131. .usart_x = SCB3, \
  132. .intrSrc = scb_3_interrupt_IRQn, \
  133. .userIsr = uart_isr_callback(uart3), \
  134. .UART_SCB_IRQ_cfg = &UART3_SCB_IRQ_cfg, \
  135. }
  136. void uart3_isr_callback(void);
  137. #endif /* UART3_CONFIG */
  138. #endif /* BSP_USING_UART3 */
  139. #if defined(BSP_USING_UART4)
  140. #ifndef UART4_CONFIG
  141. #define UART4_CONFIG \
  142. { \
  143. .name = "uart4", \
  144. .tx_pin = P7_1, \
  145. .rx_pin = P7_0, \
  146. .usart_x = SCB4, \
  147. .intrSrc = scb_4_interrupt_IRQn, \
  148. .userIsr = uart_isr_callback(uart4), \
  149. .UART_SCB_IRQ_cfg = &UART4_SCB_IRQ_cfg, \
  150. }
  151. void uart4_isr_callback(void);
  152. #endif /* UART4_CONFIG */
  153. #endif /* BSP_USING_UART4 */
  154. #if defined(BSP_USING_UART5)
  155. #ifndef UART5_CONFIG
  156. #define UART5_CONFIG \
  157. { \
  158. .name = "uart5", \
  159. .tx_pin = P5_1, \
  160. .rx_pin = P5_0, \
  161. .usart_x = SCB5, \
  162. .intrSrc = scb_5_interrupt_IRQn, \
  163. .userIsr = uart_isr_callback(uart5), \
  164. .UART_SCB_IRQ_cfg = &UART5_SCB_IRQ_cfg, \
  165. }
  166. void uart5_isr_callback(void);
  167. #endif /* UART5_CONFIG */
  168. #endif /* BSP_USING_UART5 */
  169. #ifdef __cplusplus
  170. }
  171. #endif
  172. #endif