增加F1系列的uart的dma支持。

This commit is contained in:
zhouchuanfu 2019-05-04 18:44:36 +08:00
parent d52a412f4c
commit b844496ac9
2 changed files with 88 additions and 16 deletions

View File

@ -25,6 +25,11 @@ extern "C" {
#define SPI1_RX_DMA_RCC RCC_AHBENR_DMA1EN #define SPI1_RX_DMA_RCC RCC_AHBENR_DMA1EN
#define SPI1_RX_DMA_INSTANCE DMA1_Channel2 #define SPI1_RX_DMA_INSTANCE DMA1_Channel2
#define SPI1_RX_DMA_IRQ DMA1_Channel2_IRQn #define SPI1_RX_DMA_IRQ DMA1_Channel2_IRQn
#elif defined(BSP_UART3_TX_USING_DMA) && !defined(UART3_TX_DMA_INSTANCE)
#define UART3_DMA_TX_IRQHandler DMA1_Channel2_IRQHandler
#define UART3_TX_DMA_RCC RCC_AHBENR_DMA1EN
#define UART3_TX_DMA_INSTANCE DMA1_Channel2
#define UART3_TX_DMA_IRQ DMA1_Channel2_IRQn
#endif #endif
/* DMA1 channel3 */ /* DMA1 channel3 */
@ -46,6 +51,11 @@ extern "C" {
#define SPI2_RX_DMA_RCC RCC_AHBENR_DMA1EN #define SPI2_RX_DMA_RCC RCC_AHBENR_DMA1EN
#define SPI2_RX_DMA_INSTANCE DMA1_Channel4 #define SPI2_RX_DMA_INSTANCE DMA1_Channel4
#define SPI2_RX_DMA_IRQ DMA1_Channel4_IRQn #define SPI2_RX_DMA_IRQ DMA1_Channel4_IRQn
#elif defined(BSP_UART1_TX_USING_DMA) && !defined(UART1_TX_DMA_INSTANCE)
#define UART1_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler
#define UART1_TX_DMA_RCC RCC_AHBENR_DMA1EN
#define UART1_TX_DMA_INSTANCE DMA1_Channel4
#define UART1_TX_DMA_IRQ DMA1_Channel4_IRQn
#endif #endif
/* DMA1 channel5 */ /* DMA1 channel5 */
@ -71,6 +81,12 @@ extern "C" {
#endif #endif
/* DMA1 channel7 */ /* DMA1 channel7 */
#if defined(BSP_UART2_TX_USING_DMA) && !defined(UART2_TX_DMA_INSTANCE)
#define UART2_DMA_TX_IRQHandler DMA1_Channel7_IRQHandler
#define UART2_TX_DMA_RCC RCC_AHBENR_DMA1EN
#define UART2_TX_DMA_INSTANCE DMA1_Channel7
#define UART2_TX_DMA_IRQ DMA1_Channel7_IRQn
#endif
/* DMA2 channel1 */ /* DMA2 channel1 */
#if defined(BSP_SPI3_RX_USING_DMA) && !defined(SPI3_RX_DMA_INSTANCE) #if defined(BSP_SPI3_RX_USING_DMA) && !defined(SPI3_RX_DMA_INSTANCE)
@ -89,8 +105,20 @@ extern "C" {
#endif #endif
/* DMA2 channel3 */ /* DMA2 channel3 */
#if defined(BSP_UART4_RX_USING_DMA) && !defined(UART4_RX_DMA_INSTANCE)
#define UART4_DMA_RX_IRQHandler DMA2_Channel3_IRQHandler
#define UART4_RX_DMA_RCC RCC_AHBENR_DMA2EN
#define UART4_RX_DMA_INSTANCE DMA2_Channel3
#define UART4_RX_DMA_IRQ DMA2_Channel3_IRQn
#endif
/* DMA2 channel4 */ /* DMA2 channel4 */
/* DMA2 channel5 */ /* DMA2 channel5 */
#if defined(BSP_UART4_TX_USING_DMA) && !defined(UART4_TX_DMA_INSTANCE)
#define UART4_DMA_TX_IRQHandler DMA2_Channel4_5_IRQHandler
#define UART4_TX_DMA_RCC RCC_AHBENR_DMA2EN
#define UART4_TX_DMA_INSTANCE DMA2_Channel5
#define UART4_TX_DMA_IRQ DMA2_Channel4_5_IRQn
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -28,19 +28,30 @@ extern "C" {
.irq_type = USART1_IRQn, \ .irq_type = USART1_IRQn, \
} }
#endif /* UART1_CONFIG */ #endif /* UART1_CONFIG */
#endif /* BSP_USING_UART1 */
#if defined(BSP_UART1_RX_USING_DMA) #if defined(BSP_UART1_RX_USING_DMA)
#ifndef UART1_DMA_CONFIG #ifndef UART1_DMA_RX_CONFIG
#define UART1_DMA_CONFIG \ #define UART1_DMA_RX_CONFIG \
{ \ { \
.Instance = UART1_RX_DMA_INSTANCE, \ .Instance = UART1_RX_DMA_INSTANCE, \
.dma_rcc = UART1_RX_DMA_RCC, \ .dma_rcc = UART1_RX_DMA_RCC, \
.dma_irq = UART1_RX_DMA_IRQ, \ .dma_irq = UART1_RX_DMA_IRQ, \
} }
#endif /* UART1_DMA_CONFIG */ #endif /* UART1_DMA_RX_CONFIG */
#endif /* BSP_UART1_RX_USING_DMA */ #endif /* BSP_UART1_RX_USING_DMA */
#if defined(BSP_UART1_TX_USING_DMA)
#ifndef UART1_DMA_TX_CONFIG
#define UART1_DMA_TX_CONFIG \
{ \
.Instance = UART1_TX_DMA_INSTANCE, \
.dma_rcc = UART1_TX_DMA_RCC, \
.dma_irq = UART1_TX_DMA_IRQ, \
}
#endif /* UART1_DMA_TX_CONFIG */
#endif /* BSP_UART1_TX_USING_DMA */
#endif /* BSP_USING_UART1 */
#if defined(BSP_USING_UART2) #if defined(BSP_USING_UART2)
#ifndef UART2_CONFIG #ifndef UART2_CONFIG
#define UART2_CONFIG \ #define UART2_CONFIG \
@ -50,19 +61,30 @@ extern "C" {
.irq_type = USART2_IRQn, \ .irq_type = USART2_IRQn, \
} }
#endif /* UART2_CONFIG */ #endif /* UART2_CONFIG */
#endif /* BSP_USING_UART2 */
#if defined(BSP_UART2_RX_USING_DMA) #if defined(BSP_UART2_RX_USING_DMA)
#ifndef UART2_DMA_CONFIG #ifndef UART2_DMA_RX_CONFIG
#define UART2_DMA_CONFIG \ #define UART2_DMA_RX_CONFIG \
{ \ { \
.Instance = UART2_RX_DMA_INSTANCE, \ .Instance = UART2_RX_DMA_INSTANCE, \
.dma_rcc = UART2_RX_DMA_RCC, \ .dma_rcc = UART2_RX_DMA_RCC, \
.dma_irq = UART2_RX_DMA_IRQ, \ .dma_irq = UART2_RX_DMA_IRQ, \
} }
#endif /* UART2_DMA_CONFIG */ #endif /* UART2_DMA_RX_CONFIG */
#endif /* BSP_UART2_RX_USING_DMA */ #endif /* BSP_UART2_RX_USING_DMA */
#if defined(BSP_UART2_TX_USING_DMA)
#ifndef UART2_DMA_TX_CONFIG
#define UART2_DMA_TX_CONFIG \
{ \
.Instance = UART2_TX_DMA_INSTANCE, \
.dma_rcc = UART2_TX_DMA_RCC, \
.dma_irq = UART2_TX_DMA_IRQ, \
}
#endif /* UART2_DMA_TX_CONFIG */
#endif /* BSP_UART2_TX_USING_DMA */
#endif /* BSP_USING_UART2 */
#if defined(BSP_USING_UART3) #if defined(BSP_USING_UART3)
#ifndef UART3_CONFIG #ifndef UART3_CONFIG
#define UART3_CONFIG \ #define UART3_CONFIG \
@ -72,19 +94,30 @@ extern "C" {
.irq_type = USART3_IRQn, \ .irq_type = USART3_IRQn, \
} }
#endif /* UART3_CONFIG */ #endif /* UART3_CONFIG */
#endif /* BSP_USING_UART3 */
#if defined(BSP_UART3_RX_USING_DMA) #if defined(BSP_UART3_RX_USING_DMA)
#ifndef UART3_DMA_CONFIG #ifndef UART3_DMA_RX_CONFIG
#define UART3_DMA_CONFIG \ #define UART3_DMA_RX_CONFIG \
{ \ { \
.Instance = UART3_RX_DMA_INSTANCE, \ .Instance = UART3_RX_DMA_INSTANCE, \
.dma_rcc = UART3_RX_DMA_RCC, \ .dma_rcc = UART3_RX_DMA_RCC, \
.dma_irq = UART3_RX_DMA_IRQ, \ .dma_irq = UART3_RX_DMA_IRQ, \
} }
#endif /* UART3_DMA_CONFIG */ #endif /* UART3_DMA_RX_CONFIG */
#endif /* BSP_UART3_RX_USING_DMA */ #endif /* BSP_UART3_RX_USING_DMA */
#if defined(BSP_UART3_TX_USING_DMA)
#ifndef UART3_DMA_TX_CONFIG
#define UART3_DMA_TX_CONFIG \
{ \
.Instance = UART3_TX_DMA_INSTANCE, \
.dma_rcc = UART3_TX_DMA_RCC, \
.dma_irq = UART3_TX_DMA_IRQ, \
}
#endif /* UART3_DMA_TX_CONFIG */
#endif /* BSP_UART3_TX_USING_DMA */
#endif /* BSP_USING_UART3 */
#if defined(BSP_USING_UART4) #if defined(BSP_USING_UART4)
#ifndef UART4_CONFIG #ifndef UART4_CONFIG
#define UART4_CONFIG \ #define UART4_CONFIG \
@ -94,19 +127,30 @@ extern "C" {
.irq_type = UART4_IRQn, \ .irq_type = UART4_IRQn, \
} }
#endif /* UART4_CONFIG */ #endif /* UART4_CONFIG */
#endif /* BSP_USING_UART4 */
#if defined(BSP_UART4_RX_USING_DMA) #if defined(BSP_UART4_RX_USING_DMA)
#ifndef UART4_DMA_CONFIG #ifndef UART4_DMA_RX_CONFIG
#define UART4_DMA_CONFIG \ #define UART4_DMA_RX_CONFIG \
{ \ { \
.Instance = UART4_RX_DMA_INSTANCE, \ .Instance = UART4_RX_DMA_INSTANCE, \
.dma_rcc = UART4_RX_DMA_RCC, \ .dma_rcc = UART4_RX_DMA_RCC, \
.dma_irq = UART4_RX_DMA_IRQ, \ .dma_irq = UART4_RX_DMA_IRQ, \
} }
#endif /* UART4_DMA_CONFIG */ #endif /* UART4_DMA_RX_CONFIG */
#endif /* BSP_UART4_RX_USING_DMA */ #endif /* BSP_UART4_RX_USING_DMA */
#if defined(BSP_UART4_TX_USING_DMA)
#ifndef UART4_DMA_TX_CONFIG
#define UART4_DMA_TX_CONFIG \
{ \
.Instance = UART4_TX_DMA_INSTANCE, \
.dma_rcc = UART4_TX_DMA_RCC, \
.dma_irq = UART4_TX_DMA_IRQ, \
}
#endif /* UART4_DMA_TX_CONFIG */
#endif /* BSP_UART4_TX_USING_DMA */
#endif /* BSP_USING_UART4 */
#if defined(BSP_USING_UART5) #if defined(BSP_USING_UART5)
#ifndef UART5_CONFIG #ifndef UART5_CONFIG
#define UART5_CONFIG \ #define UART5_CONFIG \