2019-01-22 15:07:51 +08:00
|
|
|
/*
|
2021-03-08 22:40:39 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2019-01-22 15:07:51 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2018-10-30 zylx first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UART_CONFIG_H__
|
|
|
|
#define __UART_CONFIG_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
#if defined(BSP_USING_LPUART1)
|
|
|
|
#ifndef LPUART1_CONFIG
|
|
|
|
#define LPUART1_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "lpuart1", \
|
|
|
|
.Instance = LPUART1, \
|
|
|
|
.irq_type = USART3_4_LPUART1_IRQn, \
|
|
|
|
}
|
2019-02-15 16:44:51 +08:00
|
|
|
#define LPUART1_IRQHandler USART3_4_LPUART1_IRQHandler
|
2019-01-22 15:07:51 +08:00
|
|
|
#endif /* LPUART1_CONFIG */
|
|
|
|
#if defined(BSP_LPUART1_RX_USING_DMA)
|
|
|
|
#ifndef LPUART1_DMA_CONFIG
|
|
|
|
#define LPUART1_DMA_CONFIG \
|
|
|
|
{ \
|
2019-02-15 16:44:51 +08:00
|
|
|
.Instance = LPUART1_RX_DMA_INSTANCE, \
|
|
|
|
.request = LPUART1_RX_DMA_REQUEST, \
|
|
|
|
.dma_rcc = LPUART1_RX_DMA_RCC, \
|
|
|
|
.dma_irq = LPUART1_RX_DMA_IRQ, \
|
2019-01-22 15:07:51 +08:00
|
|
|
}
|
|
|
|
#endif /* LPUART1_DMA_CONFIG */
|
|
|
|
#endif /* BSP_LPUART1_RX_USING_DMA */
|
|
|
|
#endif /* BSP_USING_LPUART1 */
|
|
|
|
|
|
|
|
#if defined(BSP_USING_UART1)
|
|
|
|
#ifndef UART1_CONFIG
|
|
|
|
#define UART1_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart1", \
|
|
|
|
.Instance = USART1, \
|
|
|
|
.irq_type = USART1_IRQn, \
|
|
|
|
}
|
|
|
|
#endif /* UART1_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART1 */
|
|
|
|
|
|
|
|
#if defined(BSP_UART1_RX_USING_DMA)
|
2019-05-24 20:52:58 +08:00
|
|
|
#ifndef UART1_DMA_RX_CONFIG
|
|
|
|
#define UART1_DMA_RX_CONFIG \
|
2019-01-22 15:07:51 +08:00
|
|
|
{ \
|
|
|
|
.Instance = UART1_RX_DMA_INSTANCE, \
|
2019-02-15 16:44:51 +08:00
|
|
|
.request = UART1_RX_DMA_REQUEST, \
|
2019-01-22 15:07:51 +08:00
|
|
|
.dma_rcc = UART1_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART1_RX_DMA_IRQ, \
|
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART1_DMA_RX_CONFIG */
|
2019-01-22 15:07:51 +08:00
|
|
|
#endif /* BSP_UART1_RX_USING_DMA */
|
|
|
|
|
|
|
|
#if defined(BSP_USING_UART2)
|
|
|
|
#ifndef UART2_CONFIG
|
|
|
|
#define UART2_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart2", \
|
|
|
|
.Instance = USART2, \
|
|
|
|
.irq_type = USART2_IRQn, \
|
|
|
|
}
|
|
|
|
#endif /* UART2_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART2 */
|
|
|
|
|
|
|
|
#if defined(BSP_UART2_RX_USING_DMA)
|
2019-05-24 20:52:58 +08:00
|
|
|
#ifndef UART2_DMA_RX_CONFIG
|
|
|
|
#define UART2_DMA_RX_CONFIG \
|
2019-01-22 15:07:51 +08:00
|
|
|
{ \
|
|
|
|
.Instance = UART2_RX_DMA_INSTANCE, \
|
2019-02-15 16:44:51 +08:00
|
|
|
.request = UART2_RX_DMA_REQUEST, \
|
2019-01-22 15:07:51 +08:00
|
|
|
.dma_rcc = UART2_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART2_RX_DMA_IRQ, \
|
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART2_DMA_RX_CONFIG */
|
2019-01-22 15:07:51 +08:00
|
|
|
#endif /* BSP_UART2_RX_USING_DMA */
|
|
|
|
|
|
|
|
#if defined(BSP_USING_UART3)
|
|
|
|
#ifndef UART3_CONFIG
|
|
|
|
#ifndef SOC_SERIES_STM32G0
|
|
|
|
#define UART3_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart3", \
|
|
|
|
.Instance = USART3, \
|
|
|
|
.irq_type = USART3_IRQn, \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define UART3_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart3", \
|
|
|
|
.Instance = USART3, \
|
|
|
|
.irq_type = USART3_4_LPUART1_IRQn, \
|
|
|
|
}
|
|
|
|
#endif /* SOC_SERIES_STM32G0 */
|
|
|
|
#endif /* UART3_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART3 */
|
|
|
|
|
|
|
|
#if defined(BSP_UART3_RX_USING_DMA)
|
2019-05-24 20:52:58 +08:00
|
|
|
#ifndef UART3_DMA_RX_CONFIG
|
|
|
|
#define UART3_DMA_RX_CONFIG \
|
2019-01-22 15:07:51 +08:00
|
|
|
{ \
|
|
|
|
.Instance = UART3_RX_DMA_INSTANCE, \
|
2019-02-15 16:44:51 +08:00
|
|
|
.request = UART3_RX_DMA_REQUEST, \
|
2019-01-22 15:07:51 +08:00
|
|
|
.dma_rcc = UART3_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART3_RX_DMA_IRQ, \
|
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART3_DMA_RX_CONFIG */
|
2019-01-22 15:07:51 +08:00
|
|
|
#endif /* BSP_UART3_RX_USING_DMA */
|
|
|
|
|
|
|
|
#if defined(BSP_USING_UART4)
|
|
|
|
#ifndef UART4_CONFIG
|
|
|
|
#ifndef SOC_SERIES_STM32G0
|
|
|
|
#define UART4_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart4", \
|
|
|
|
.Instance = UART4, \
|
|
|
|
.irq_type = UART4_IRQn, \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define UART4_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart4", \
|
|
|
|
.Instance = USART4, \
|
|
|
|
.irq_type = USART3_4_LPUART1_IRQn, \
|
|
|
|
}
|
|
|
|
#endif /* UART4_CONFIG */
|
|
|
|
#endif /* SOC_SERIES_STM32G0 */
|
|
|
|
#endif /* BSP_USING_UART4 */
|
|
|
|
|
|
|
|
#if defined(BSP_UART4_RX_USING_DMA)
|
2019-05-24 20:52:58 +08:00
|
|
|
#ifndef UART4_DMA_RX_CONFIG
|
|
|
|
#define UART4_DMA_RX_CONFIG \
|
2019-01-22 15:07:51 +08:00
|
|
|
{ \
|
|
|
|
.Instance = UART4_RX_DMA_INSTANCE, \
|
2019-02-15 16:44:51 +08:00
|
|
|
.request = UART4_RX_DMA_REQUEST, \
|
2019-01-22 15:07:51 +08:00
|
|
|
.dma_rcc = UART4_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART4_RX_DMA_IRQ, \
|
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART4_DMA_RX_CONFIG */
|
2019-01-22 15:07:51 +08:00
|
|
|
#endif /* BSP_UART4_RX_USING_DMA */
|
|
|
|
|
|
|
|
#if defined(BSP_USING_UART5)
|
|
|
|
#ifndef UART5_CONFIG
|
|
|
|
#define UART5_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart5", \
|
|
|
|
.Instance = UART5, \
|
|
|
|
.irq_type = UART5_IRQn, \
|
|
|
|
}
|
|
|
|
#endif /* UART5_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART5 */
|
|
|
|
|
|
|
|
#if defined(BSP_UART5_RX_USING_DMA)
|
2019-05-24 20:52:58 +08:00
|
|
|
#ifndef UART5_DMA_RX_CONFIG
|
|
|
|
#define UART5_DMA_RX_CONFIG \
|
2019-01-22 15:07:51 +08:00
|
|
|
{ \
|
|
|
|
.Instance = DMA_NOT_AVAILABLE, \
|
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART5_DMA_RX_CONFIG */
|
2019-01-22 15:07:51 +08:00
|
|
|
#endif /* BSP_UART5_RX_USING_DMA */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __UART_CONFIG_H__ */
|