| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 |
- /*
- * Copyright (c) 2006-2023, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2018-10-30 SummerGift first version
- * 2019-01-03 zylx modify dma support
- * 2026-04-13 wdfk-prog Unify DMA config descriptors
- */
- #ifndef __UART_CONFIG_H__
- #define __UART_CONFIG_H__
- #include <rtthread.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #if defined(BSP_USING_UART1)
- #ifndef UART1_CONFIG
- #define UART1_CONFIG \
- { \
- .name = "uart1", \
- .Instance = USART1, \
- .irq_type = USART1_IRQn, \
- }
- #endif /* UART1_CONFIG */
- #if defined(BSP_UART1_RX_USING_DMA)
- #ifndef UART1_RX_DMA_PRIORITY
- #define UART1_RX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART1_RX_DMA_PRIORITY */
- #ifndef UART1_RX_DMA_PREEMPT_PRIORITY
- #define UART1_RX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART1_RX_DMA_PREEMPT_PRIORITY */
- #ifndef UART1_RX_DMA_SUB_PRIORITY
- #define UART1_RX_DMA_SUB_PRIORITY 0
- #endif /* UART1_RX_DMA_SUB_PRIORITY */
- #ifndef UART1_DMA_RX_CONFIG
- #define UART1_DMA_RX_CONFIG \
- STM32_DMA_RX_BYTE_CIRCULAR_CONFIG_INIT_EX( \
- UART1_RX_DMA_INSTANCE, \
- UART1_RX_DMA_RCC, \
- UART1_RX_DMA_IRQ, \
- 0U, \
- UART1_RX_DMA_CHANNEL, \
- UART1_RX_DMA_PRIORITY, \
- UART1_RX_DMA_PREEMPT_PRIORITY, \
- UART1_RX_DMA_SUB_PRIORITY)
- #endif /* UART1_DMA_RX_CONFIG */
- #endif /* BSP_UART1_RX_USING_DMA */
- #if defined(BSP_UART1_TX_USING_DMA)
- #ifndef UART1_TX_DMA_PRIORITY
- #define UART1_TX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART1_TX_DMA_PRIORITY */
- #ifndef UART1_TX_DMA_PREEMPT_PRIORITY
- #define UART1_TX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART1_TX_DMA_PREEMPT_PRIORITY */
- #ifndef UART1_TX_DMA_SUB_PRIORITY
- #define UART1_TX_DMA_SUB_PRIORITY 0
- #endif /* UART1_TX_DMA_SUB_PRIORITY */
- #ifndef UART1_DMA_TX_CONFIG
- #define UART1_DMA_TX_CONFIG \
- STM32_DMA_TX_BYTE_CONFIG_INIT_EX( \
- UART1_TX_DMA_INSTANCE, \
- UART1_TX_DMA_RCC, \
- UART1_TX_DMA_IRQ, \
- 0U, \
- UART1_TX_DMA_CHANNEL, \
- UART1_TX_DMA_PRIORITY, \
- UART1_TX_DMA_PREEMPT_PRIORITY, \
- UART1_TX_DMA_SUB_PRIORITY)
- #endif /* UART1_DMA_TX_CONFIG */
- #endif /* BSP_UART1_TX_USING_DMA */
- #endif /* BSP_USING_UART1 */
- #if defined(BSP_USING_UART2)
- #ifndef UART2_CONFIG
- #define UART2_CONFIG \
- { \
- .name = "uart2", \
- .Instance = USART2, \
- .irq_type = USART2_IRQn, \
- }
- #endif /* UART2_CONFIG */
- #if defined(BSP_UART2_RX_USING_DMA)
- #ifndef UART2_RX_DMA_PRIORITY
- #define UART2_RX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART2_RX_DMA_PRIORITY */
- #ifndef UART2_RX_DMA_PREEMPT_PRIORITY
- #define UART2_RX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART2_RX_DMA_PREEMPT_PRIORITY */
- #ifndef UART2_RX_DMA_SUB_PRIORITY
- #define UART2_RX_DMA_SUB_PRIORITY 0
- #endif /* UART2_RX_DMA_SUB_PRIORITY */
- #ifndef UART2_DMA_RX_CONFIG
- #define UART2_DMA_RX_CONFIG \
- STM32_DMA_RX_BYTE_CIRCULAR_CONFIG_INIT_EX( \
- UART2_RX_DMA_INSTANCE, \
- UART2_RX_DMA_RCC, \
- UART2_RX_DMA_IRQ, \
- 0U, \
- UART2_RX_DMA_CHANNEL, \
- UART2_RX_DMA_PRIORITY, \
- UART2_RX_DMA_PREEMPT_PRIORITY, \
- UART2_RX_DMA_SUB_PRIORITY)
- #endif /* UART2_DMA_RX_CONFIG */
- #endif /* BSP_UART2_RX_USING_DMA */
- #if defined(BSP_UART2_TX_USING_DMA)
- #ifndef UART2_TX_DMA_PRIORITY
- #define UART2_TX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART2_TX_DMA_PRIORITY */
- #ifndef UART2_TX_DMA_PREEMPT_PRIORITY
- #define UART2_TX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART2_TX_DMA_PREEMPT_PRIORITY */
- #ifndef UART2_TX_DMA_SUB_PRIORITY
- #define UART2_TX_DMA_SUB_PRIORITY 0
- #endif /* UART2_TX_DMA_SUB_PRIORITY */
- #ifndef UART2_DMA_TX_CONFIG
- #define UART2_DMA_TX_CONFIG \
- STM32_DMA_TX_BYTE_CONFIG_INIT_EX( \
- UART2_TX_DMA_INSTANCE, \
- UART2_TX_DMA_RCC, \
- UART2_TX_DMA_IRQ, \
- 0U, \
- UART2_TX_DMA_CHANNEL, \
- UART2_TX_DMA_PRIORITY, \
- UART2_TX_DMA_PREEMPT_PRIORITY, \
- UART2_TX_DMA_SUB_PRIORITY)
- #endif /* UART2_DMA_TX_CONFIG */
- #endif /* BSP_UART2_TX_USING_DMA */
- #endif /* BSP_USING_UART2 */
- #if defined(BSP_USING_UART3)
- #ifndef UART3_CONFIG
- #define UART3_CONFIG \
- { \
- .name = "uart3", \
- .Instance = USART3, \
- .irq_type = USART3_IRQn, \
- }
- #endif /* UART3_CONFIG */
- #if defined(BSP_UART3_RX_USING_DMA)
- #ifndef UART3_RX_DMA_PRIORITY
- #define UART3_RX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART3_RX_DMA_PRIORITY */
- #ifndef UART3_RX_DMA_PREEMPT_PRIORITY
- #define UART3_RX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART3_RX_DMA_PREEMPT_PRIORITY */
- #ifndef UART3_RX_DMA_SUB_PRIORITY
- #define UART3_RX_DMA_SUB_PRIORITY 0
- #endif /* UART3_RX_DMA_SUB_PRIORITY */
- #ifndef UART3_DMA_RX_CONFIG
- #define UART3_DMA_RX_CONFIG \
- STM32_DMA_RX_BYTE_CIRCULAR_CONFIG_INIT_EX( \
- UART3_RX_DMA_INSTANCE, \
- UART3_RX_DMA_RCC, \
- UART3_RX_DMA_IRQ, \
- 0U, \
- UART3_RX_DMA_CHANNEL, \
- UART3_RX_DMA_PRIORITY, \
- UART3_RX_DMA_PREEMPT_PRIORITY, \
- UART3_RX_DMA_SUB_PRIORITY)
- #endif /* UART3_DMA_RX_CONFIG */
- #endif /* BSP_UART3_RX_USING_DMA */
- #if defined(BSP_UART3_TX_USING_DMA)
- #ifndef UART3_TX_DMA_PRIORITY
- #define UART3_TX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART3_TX_DMA_PRIORITY */
- #ifndef UART3_TX_DMA_PREEMPT_PRIORITY
- #define UART3_TX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART3_TX_DMA_PREEMPT_PRIORITY */
- #ifndef UART3_TX_DMA_SUB_PRIORITY
- #define UART3_TX_DMA_SUB_PRIORITY 0
- #endif /* UART3_TX_DMA_SUB_PRIORITY */
- #ifndef UART3_DMA_TX_CONFIG
- #define UART3_DMA_TX_CONFIG \
- STM32_DMA_TX_BYTE_CONFIG_INIT_EX( \
- UART3_TX_DMA_INSTANCE, \
- UART3_TX_DMA_RCC, \
- UART3_TX_DMA_IRQ, \
- 0U, \
- UART3_TX_DMA_CHANNEL, \
- UART3_TX_DMA_PRIORITY, \
- UART3_TX_DMA_PREEMPT_PRIORITY, \
- UART3_TX_DMA_SUB_PRIORITY)
- #endif /* UART3_DMA_TX_CONFIG */
- #endif /* BSP_UART3_TX_USING_DMA */
- #endif /* BSP_USING_UART3 */
- #if defined(BSP_USING_UART4)
- #ifndef UART4_CONFIG
- #define UART4_CONFIG \
- { \
- .name = "uart4", \
- .Instance = UART4, \
- .irq_type = UART4_IRQn, \
- }
- #endif /* UART4_CONFIG */
- #if defined(BSP_UART4_RX_USING_DMA)
- #ifndef UART4_RX_DMA_PRIORITY
- #define UART4_RX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART4_RX_DMA_PRIORITY */
- #ifndef UART4_RX_DMA_PREEMPT_PRIORITY
- #define UART4_RX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART4_RX_DMA_PREEMPT_PRIORITY */
- #ifndef UART4_RX_DMA_SUB_PRIORITY
- #define UART4_RX_DMA_SUB_PRIORITY 0
- #endif /* UART4_RX_DMA_SUB_PRIORITY */
- #ifndef UART4_DMA_RX_CONFIG
- #define UART4_DMA_RX_CONFIG \
- STM32_DMA_RX_BYTE_CIRCULAR_CONFIG_INIT_EX( \
- UART4_RX_DMA_INSTANCE, \
- UART4_RX_DMA_RCC, \
- UART4_RX_DMA_IRQ, \
- 0U, \
- UART4_RX_DMA_CHANNEL, \
- UART4_RX_DMA_PRIORITY, \
- UART4_RX_DMA_PREEMPT_PRIORITY, \
- UART4_RX_DMA_SUB_PRIORITY)
- #endif /* UART4_DMA_RX_CONFIG */
- #endif /* BSP_UART4_RX_USING_DMA */
- #if defined(BSP_UART4_TX_USING_DMA)
- #ifndef UART4_TX_DMA_PRIORITY
- #define UART4_TX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART4_TX_DMA_PRIORITY */
- #ifndef UART4_TX_DMA_PREEMPT_PRIORITY
- #define UART4_TX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART4_TX_DMA_PREEMPT_PRIORITY */
- #ifndef UART4_TX_DMA_SUB_PRIORITY
- #define UART4_TX_DMA_SUB_PRIORITY 0
- #endif /* UART4_TX_DMA_SUB_PRIORITY */
- #ifndef UART4_DMA_TX_CONFIG
- #define UART4_DMA_TX_CONFIG \
- STM32_DMA_TX_BYTE_CONFIG_INIT_EX( \
- UART4_TX_DMA_INSTANCE, \
- UART4_TX_DMA_RCC, \
- UART4_TX_DMA_IRQ, \
- 0U, \
- UART4_TX_DMA_CHANNEL, \
- UART4_TX_DMA_PRIORITY, \
- UART4_TX_DMA_PREEMPT_PRIORITY, \
- UART4_TX_DMA_SUB_PRIORITY)
- #endif /* UART4_DMA_TX_CONFIG */
- #endif /* BSP_UART4_TX_USING_DMA */
- #endif /* BSP_USING_UART4 */
- #if defined(BSP_USING_UART5)
- #ifndef UART5_CONFIG
- #define UART5_CONFIG \
- { \
- .name = "uart5", \
- .Instance = UART5, \
- .irq_type = UART5_IRQn, \
- }
- #endif /* UART5_CONFIG */
- #if defined(BSP_UART5_RX_USING_DMA)
- #ifndef UART5_RX_DMA_PRIORITY
- #define UART5_RX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART5_RX_DMA_PRIORITY */
- #ifndef UART5_RX_DMA_PREEMPT_PRIORITY
- #define UART5_RX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART5_RX_DMA_PREEMPT_PRIORITY */
- #ifndef UART5_RX_DMA_SUB_PRIORITY
- #define UART5_RX_DMA_SUB_PRIORITY 0
- #endif /* UART5_RX_DMA_SUB_PRIORITY */
- #ifndef UART5_DMA_RX_CONFIG
- #define UART5_DMA_RX_CONFIG \
- STM32_DMA_RX_BYTE_CIRCULAR_CONFIG_INIT_EX( \
- UART5_RX_DMA_INSTANCE, \
- UART5_RX_DMA_RCC, \
- UART5_RX_DMA_IRQ, \
- 0U, \
- UART5_RX_DMA_CHANNEL, \
- UART5_RX_DMA_PRIORITY, \
- UART5_RX_DMA_PREEMPT_PRIORITY, \
- UART5_RX_DMA_SUB_PRIORITY)
- #endif /* UART5_DMA_RX_CONFIG */
- #endif /* BSP_UART5_RX_USING_DMA */
- #if defined(BSP_UART5_TX_USING_DMA)
- #ifndef UART5_TX_DMA_PRIORITY
- #define UART5_TX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART5_TX_DMA_PRIORITY */
- #ifndef UART5_TX_DMA_PREEMPT_PRIORITY
- #define UART5_TX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART5_TX_DMA_PREEMPT_PRIORITY */
- #ifndef UART5_TX_DMA_SUB_PRIORITY
- #define UART5_TX_DMA_SUB_PRIORITY 0
- #endif /* UART5_TX_DMA_SUB_PRIORITY */
- #ifndef UART5_DMA_TX_CONFIG
- #define UART5_DMA_TX_CONFIG \
- STM32_DMA_TX_BYTE_CONFIG_INIT_EX( \
- UART5_TX_DMA_INSTANCE, \
- UART5_TX_DMA_RCC, \
- UART5_TX_DMA_IRQ, \
- 0U, \
- UART5_TX_DMA_CHANNEL, \
- UART5_TX_DMA_PRIORITY, \
- UART5_TX_DMA_PREEMPT_PRIORITY, \
- UART5_TX_DMA_SUB_PRIORITY)
- #endif /* UART5_DMA_TX_CONFIG */
- #endif /* BSP_UART5_TX_USING_DMA */
- #endif /* BSP_USING_UART5 */
- #if defined(BSP_USING_UART6)
- #ifndef UART6_CONFIG
- #define UART6_CONFIG \
- { \
- .name = "uart6", \
- .Instance = USART6, \
- .irq_type = USART6_IRQn, \
- }
- #endif /* UART6_CONFIG */
- #if defined(BSP_UART6_RX_USING_DMA)
- #ifndef UART6_RX_DMA_PRIORITY
- #define UART6_RX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART6_RX_DMA_PRIORITY */
- #ifndef UART6_RX_DMA_PREEMPT_PRIORITY
- #define UART6_RX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART6_RX_DMA_PREEMPT_PRIORITY */
- #ifndef UART6_RX_DMA_SUB_PRIORITY
- #define UART6_RX_DMA_SUB_PRIORITY 0
- #endif /* UART6_RX_DMA_SUB_PRIORITY */
- #ifndef UART6_DMA_RX_CONFIG
- #define UART6_DMA_RX_CONFIG \
- STM32_DMA_RX_BYTE_CIRCULAR_CONFIG_INIT_EX( \
- UART6_RX_DMA_INSTANCE, \
- UART6_RX_DMA_RCC, \
- UART6_RX_DMA_IRQ, \
- 0U, \
- UART6_RX_DMA_CHANNEL, \
- UART6_RX_DMA_PRIORITY, \
- UART6_RX_DMA_PREEMPT_PRIORITY, \
- UART6_RX_DMA_SUB_PRIORITY)
- #endif /* UART6_DMA_RX_CONFIG */
- #endif /* BSP_UART6_RX_USING_DMA */
- #if defined(BSP_UART6_TX_USING_DMA)
- #ifndef UART6_TX_DMA_PRIORITY
- #define UART6_TX_DMA_PRIORITY DMA_PRIORITY_MEDIUM
- #endif /* UART6_TX_DMA_PRIORITY */
- #ifndef UART6_TX_DMA_PREEMPT_PRIORITY
- #define UART6_TX_DMA_PREEMPT_PRIORITY 0
- #endif /* UART6_TX_DMA_PREEMPT_PRIORITY */
- #ifndef UART6_TX_DMA_SUB_PRIORITY
- #define UART6_TX_DMA_SUB_PRIORITY 0
- #endif /* UART6_TX_DMA_SUB_PRIORITY */
- #ifndef UART6_DMA_TX_CONFIG
- #define UART6_DMA_TX_CONFIG \
- STM32_DMA_TX_BYTE_CONFIG_INIT_EX( \
- UART6_TX_DMA_INSTANCE, \
- UART6_TX_DMA_RCC, \
- UART6_TX_DMA_IRQ, \
- 0U, \
- UART6_TX_DMA_CHANNEL, \
- UART6_TX_DMA_PRIORITY, \
- UART6_TX_DMA_PREEMPT_PRIORITY, \
- UART6_TX_DMA_SUB_PRIORITY)
- #endif /* UART6_DMA_TX_CONFIG */
- #endif /* BSP_UART6_TX_USING_DMA */
- #endif /* BSP_USING_UART6 */
- #ifdef __cplusplus
- }
- #endif
- #endif
|