2424extern "C" {
2525#endif
2626
27- #ifdef BSP_USING_UART1
28- cy_stc_sysint_t UART1_SCB_IRQ_cfg = {
27+ #if defined( BSP_USING_UART1 ) || defined( BSP_USING_UART1_DMA_TX )
28+ static cy_stc_sysint_t UART1_SCB_IRQ_cfg = {
2929 .intrSrc = (IRQn_Type )scb_1_interrupt_IRQn ,
3030 .intrPriority = (7u ),
3131};
3232#endif
33+ #ifdef BSP_USING_UART1_DMA_TX
34+ static cy_stc_sysint_t UART1_TX_DMA_SCB_IRQ_cfg = {
35+ .intrSrc = (IRQn_Type )cpuss_interrupts_dw0_x_IRQn ,
36+ .intrPriority = (6u ),
37+ };
38+ #endif
3339
34- #ifdef BSP_USING_UART2
35- cy_stc_sysint_t UART2_SCB_IRQ_cfg = {
40+ #if defined( BSP_USING_UART2 ) || defined( BSP_USING_UART2_DMA_TX )
41+ static cy_stc_sysint_t UART2_SCB_IRQ_cfg = {
3642 .intrSrc = (IRQn_Type )scb_2_interrupt_IRQn ,
3743 .intrPriority = (7u ),
3844};
3945#endif
46+ #ifdef BSP_USING_UART2_DMA_TX
47+ static cy_stc_sysint_t UART2_TX_DMA_SCB_IRQ_cfg = {
48+ .intrSrc = (IRQn_Type )cpuss_interrupts_dw0_1_IRQn ,
49+ .intrPriority = (6u ),
50+ };
51+ #endif
4052
41- #ifdef BSP_USING_UART5
42- cy_stc_sysint_t UART5_SCB_IRQ_cfg = {
53+ #if defined( BSP_USING_UART5 ) || defined( BSP_USING_UART5_DMA_TX )
54+ static cy_stc_sysint_t UART5_SCB_IRQ_cfg = {
4355 .intrSrc = (IRQn_Type )scb_5_interrupt_IRQn ,
4456 .intrPriority = (7u ),
4557};
4658#endif
59+ #ifdef BSP_USING_UART5_DMA_TX
60+ static cy_stc_sysint_t UART5_TX_DMA_SCB_IRQ_cfg = {
61+ .intrSrc = (IRQn_Type )cpuss_interrupts_dw0_2_IRQn ,
62+ .intrPriority = (6u ),
63+ };
64+ #endif
4765
48- /* UART1 */
4966#if defined(BSP_USING_UART1 )
67+
68+ #ifdef BSP_USING_UART1_DMA_TX
69+ #define UART1_DMA_TX_CONFIG \
70+ .tx_dma_descriptor_config = &CYBSP_UART1_TX_DMA_Descriptor_0_config, \
71+ .tx_dma_channel_config = &CYBSP_UART1_TX_DMA_channelConfig, \
72+ .tx_dma_int_cfg = &UART1_TX_DMA_SCB_IRQ_cfg, \
73+ .tx_dma_isr = uart1_dma_tx_isr_callback, \
74+ .tx_dma_irq = cpuss_interrupts_dw0_x_IRQn, \
75+ .tx_dma_channel = CYBSP_UART1_TX_DMA_CHANNEL, \
76+ .tx_dma_hw = CYBSP_UART1_TX_DMA_HW,
77+ #else
78+ #define UART1_DMA_TX_CONFIG
79+ #endif
80+
5081 #ifndef UART1_CONFIG
5182 #define UART1_CONFIG \
5283 { \
53- .name = "uart1", \
84+ .name = "serial1", \
5485 .usart_x = SCB1, \
5586 .intrSrc = scb_1_interrupt_IRQn, \
5687 .uart_config = &CYBSP_UART1_config, \
5788 .hal_uart_configurator = &CYBSP_UART1_hal_config, \
58- .userIsr = uart_isr_callback(uart1), \
89+ .userIsr = uart1_isr_callback, \
5990 .UART_SCB_IRQ_cfg = &UART1_SCB_IRQ_cfg, \
91+ UART1_DMA_TX_CONFIG \
6092 }
6193 #endif
94+
6295void uart1_isr_callback (void );
96+ #ifdef BSP_USING_UART1_DMA_TX
97+ void uart1_dma_tx_isr_callback (void );
98+ #endif
99+
63100#endif /* BSP_USING_UART1 */
64101
65- /* UART2 */
102+ /* ----------------------------------------------------------------
103+ * UART2
104+ * ---------------------------------------------------------------- */
66105#if defined(BSP_USING_UART2 )
106+
107+ #ifdef BSP_USING_UART2_DMA_TX
108+ #define UART2_DMA_TX_CONFIG \
109+ .tx_dma_descriptor_config = &CYBSP_UART2_TX_DMA_Descriptor_0_config, \
110+ .tx_dma_channel_config = &CYBSP_UART2_TX_DMA_channelConfig, \
111+ .tx_dma_int_cfg = &UART2_TX_DMA_SCB_IRQ_cfg, \
112+ .tx_dma_isr = uart2_dma_tx_isr_callback, \
113+ .tx_dma_irq = cpuss_interrupts_dw0_1_IRQn, \
114+ .tx_dma_channel = CYBSP_UART2_TX_DMA_CHANNEL, \
115+ .tx_dma_hw = CYBSP_UART2_TX_DMA_HW,
116+ #else
117+ #define UART2_DMA_TX_CONFIG
118+ #endif
119+
67120 #ifndef UART2_CONFIG
68121 #define UART2_CONFIG \
69122 { \
@@ -72,15 +125,37 @@ void uart1_isr_callback(void);
72125 .intrSrc = scb_2_interrupt_IRQn, \
73126 .uart_config = &CYBSP_DEBUG_UART_config, \
74127 .hal_uart_configurator = &CYBSP_DEBUG_UART_hal_config, \
75- .userIsr = uart_isr_callback(uart2), \
128+ .userIsr = uart2_isr_callback, \
76129 .UART_SCB_IRQ_cfg = &UART2_SCB_IRQ_cfg, \
130+ UART2_DMA_TX_CONFIG \
77131 }
78132 #endif
133+
79134void uart2_isr_callback (void );
135+ #ifdef BSP_USING_UART2_DMA_TX
136+ void uart2_dma_tx_isr_callback (void );
137+ #endif
138+
80139#endif /* BSP_USING_UART2 */
81140
82- /* UART5 */
141+ /* ----------------------------------------------------------------
142+ * UART5
143+ * ---------------------------------------------------------------- */
83144#if defined(BSP_USING_UART5 )
145+
146+ #ifdef BSP_USING_UART5_DMA_TX
147+ #define UART5_DMA_TX_CONFIG \
148+ .tx_dma_descriptor_config = &CYBSP_UART5_TX_DMA_Descriptor_0_config, \
149+ .tx_dma_channel_config = &CYBSP_UART5_TX_DMA_channelConfig, \
150+ .tx_dma_int_cfg = &UART5_TX_DMA_SCB_IRQ_cfg, \
151+ .tx_dma_isr = uart5_dma_tx_isr_callback, \
152+ .tx_dma_irq = cpuss_interrupts_dw0_2_IRQn, \
153+ .tx_dma_channel = CYBSP_UART5_TX_DMA_CHANNEL, \
154+ .tx_dma_hw = CYBSP_UART5_TX_DMA_HW,
155+ #else
156+ #define UART5_DMA_TX_CONFIG
157+ #endif
158+
84159 #ifndef UART5_CONFIG
85160 #define UART5_CONFIG \
86161 { \
@@ -89,15 +164,21 @@ void uart2_isr_callback(void);
89164 .intrSrc = scb_5_interrupt_IRQn, \
90165 .uart_config = &CYBSP_UART5_config, \
91166 .hal_uart_configurator = &CYBSP_UART5_hal_config, \
92- .userIsr = uart_isr_callback(uart5), \
167+ .userIsr = uart5_isr_callback, \
93168 .UART_SCB_IRQ_cfg = &UART5_SCB_IRQ_cfg, \
169+ UART5_DMA_TX_CONFIG \
94170 }
95171 #endif
172+
96173void uart5_isr_callback (void );
174+ #ifdef BSP_USING_UART5_DMA_TX
175+ void uart5_dma_tx_isr_callback (void );
176+ #endif
177+
97178#endif /* BSP_USING_UART5 */
98179
99180#ifdef __cplusplus
100181}
101182#endif
102183
103- #endif
184+ #endif /* __UART_CONFIG_H__ */
0 commit comments