2018-12-10 21:39:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
2019-01-08 11:58:57 +08:00
|
|
|
* 2018-10-30 SummerGift first version
|
|
|
|
* 2019-01-05 zylx modify dma support
|
2018-12-10 21:39:28 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UART_CONFIG_H__
|
|
|
|
#define __UART_CONFIG_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
2019-01-09 10:10:39 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-12-10 21:39:28 +08:00
|
|
|
#if defined(BSP_USING_UART1)
|
2019-01-08 11:58:57 +08:00
|
|
|
#ifndef UART1_CONFIG
|
|
|
|
#define UART1_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart1", \
|
|
|
|
.Instance = USART1, \
|
|
|
|
.irq_type = USART1_IRQn, \
|
2018-12-10 21:39:28 +08:00
|
|
|
}
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* UART1_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART1 */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
2019-01-08 11:58:57 +08:00
|
|
|
#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-08 11:58:57 +08:00
|
|
|
{ \
|
2019-01-17 13:09:39 +08:00
|
|
|
.Instance = UART1_RX_DMA_INSTANCE, \
|
|
|
|
.channel = UART1_RX_DMA_CHANNEL, \
|
|
|
|
.dma_rcc = UART1_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART1_RX_DMA_IRQ, \
|
2019-01-08 11:58:57 +08:00
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART1_DMA_RX_CONFIG */
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* BSP_UART1_RX_USING_DMA */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
|
|
|
#if defined(BSP_USING_UART2)
|
2019-01-08 11:58:57 +08:00
|
|
|
#ifndef UART2_CONFIG
|
|
|
|
#define UART2_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart2", \
|
|
|
|
.Instance = USART2, \
|
|
|
|
.irq_type = USART2_IRQn, \
|
2018-12-10 21:39:28 +08:00
|
|
|
}
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* UART2_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART2 */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
2019-01-08 11:58:57 +08:00
|
|
|
#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-08 11:58:57 +08:00
|
|
|
{ \
|
2019-01-19 09:15:14 +08:00
|
|
|
.Instance = UART2_RX_DMA_INSTANCE, \
|
|
|
|
.channel = UART2_RX_DMA_CHANNEL, \
|
|
|
|
.dma_rcc = UART2_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART2_RX_DMA_IRQ, \
|
2019-01-08 11:58:57 +08:00
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART2_DMA_RX_CONFIG */
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* BSP_UART2_RX_USING_DMA */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
|
|
|
#if defined(BSP_USING_UART3)
|
2019-01-08 11:58:57 +08:00
|
|
|
#ifndef UART3_CONFIG
|
|
|
|
#define UART3_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart3", \
|
|
|
|
.Instance = USART3, \
|
|
|
|
.irq_type = USART3_IRQn, \
|
2018-12-10 21:39:28 +08:00
|
|
|
}
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* UART3_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART3 */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
2019-01-08 11:58:57 +08:00
|
|
|
#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-08 11:58:57 +08:00
|
|
|
{ \
|
2019-01-19 09:15:14 +08:00
|
|
|
.Instance = UART3_RX_DMA_INSTANCE, \
|
|
|
|
.channel = UART3_RX_DMA_CHANNEL, \
|
|
|
|
.dma_rcc = UART3_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART3_RX_DMA_IRQ, \
|
2019-01-08 11:58:57 +08:00
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART3_DMA_RX_CONFIG */
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* BSP_UART3_RX_USING_DMA */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
|
|
|
#if defined(BSP_USING_UART4)
|
2019-01-08 11:58:57 +08:00
|
|
|
#ifndef UART4_CONFIG
|
|
|
|
#define UART4_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart4", \
|
|
|
|
.Instance = UART4, \
|
|
|
|
.irq_type = UART4_IRQn, \
|
2018-12-10 21:39:28 +08:00
|
|
|
}
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* UART4_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART4 */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
2019-01-08 11:58:57 +08:00
|
|
|
#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-08 11:58:57 +08:00
|
|
|
{ \
|
2019-01-19 09:15:14 +08:00
|
|
|
.Instance = UART4_RX_DMA_INSTANCE, \
|
|
|
|
.channel = UART4_RX_DMA_CHANNEL, \
|
|
|
|
.dma_rcc = UART4_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART4_RX_DMA_IRQ, \
|
2019-01-08 11:58:57 +08:00
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART4_DMA_RX_CONFIG */
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* BSP_UART4_RX_USING_DMA */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
|
|
|
#if defined(BSP_USING_UART5)
|
2019-01-08 11:58:57 +08:00
|
|
|
#ifndef UART5_CONFIG
|
|
|
|
#define UART5_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart5", \
|
|
|
|
.Instance = UART5, \
|
|
|
|
.irq_type = UART5_IRQn, \
|
2018-12-10 21:39:28 +08:00
|
|
|
}
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* UART5_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART5 */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
2019-01-08 11:58:57 +08:00
|
|
|
#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-08 11:58:57 +08:00
|
|
|
{ \
|
2019-01-19 09:15:14 +08:00
|
|
|
.Instance = UART5_RX_DMA_INSTANCE, \
|
|
|
|
.channel = UART5_RX_DMA_CHANNEL, \
|
|
|
|
.dma_rcc = UART5_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART5_RX_DMA_IRQ, \
|
2019-01-08 11:58:57 +08:00
|
|
|
}
|
2019-05-24 20:52:58 +08:00
|
|
|
#endif /* UART5_DMA_RX_CONFIG */
|
2019-01-08 11:58:57 +08:00
|
|
|
#endif /* BSP_UART5_RX_USING_DMA */
|
2018-12-10 21:39:28 +08:00
|
|
|
|
2019-11-26 10:52:00 +08:00
|
|
|
#if defined(BSP_USING_UART6)
|
|
|
|
#ifndef UART6_CONFIG
|
|
|
|
#define UART6_CONFIG \
|
|
|
|
{ \
|
|
|
|
.name = "uart6", \
|
|
|
|
.Instance = USART6, \
|
|
|
|
.irq_type = USART6_IRQn, \
|
|
|
|
}
|
|
|
|
#endif /* UART6_CONFIG */
|
|
|
|
#endif /* BSP_USING_UART6 */
|
|
|
|
|
|
|
|
#if defined(BSP_UART6_RX_USING_DMA)
|
|
|
|
#ifndef UART6_DMA_RX_CONFIG
|
|
|
|
#define UART6_DMA_RX_CONFIG \
|
|
|
|
{ \
|
|
|
|
.Instance = UART6_RX_DMA_INSTANCE, \
|
|
|
|
.channel = UART6_RX_DMA_CHANNEL, \
|
|
|
|
.dma_rcc = UART6_RX_DMA_RCC, \
|
|
|
|
.dma_irq = UART6_RX_DMA_IRQ, \
|
|
|
|
}
|
|
|
|
#endif /* UART6_DMA_RX_CONFIG */
|
|
|
|
#endif /* BSP_UART6_RX_USING_DMA */
|
|
|
|
|
2019-01-09 10:10:39 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-12-10 21:39:28 +08:00
|
|
|
#endif
|