stm32/usbuart: DMA stream handling is not STM32F4 specific
This commit is contained in:
parent
1330288271
commit
a83700d1cf
|
@ -31,7 +31,7 @@
|
|||
#include "general.h"
|
||||
#include "cdcacm.h"
|
||||
|
||||
#ifdef STM32F4
|
||||
#ifdef DMA_STREAM0
|
||||
#define dma_channel_reset(dma, channel) dma_stream_reset(dma, channel)
|
||||
#define dma_enable_channel(dma, channel) dma_enable_stream(dma, channel)
|
||||
#define dma_disable_channel(dma, channel) dma_disable_stream(dma, channel)
|
||||
|
@ -125,7 +125,7 @@ void usbuart_init(void)
|
|||
dma_set_memory_size(USBUSART_DMA_BUS, USBUSART_DMA_TX_CHAN, DMA_MSIZE_8BIT);
|
||||
dma_set_priority(USBUSART_DMA_BUS, USBUSART_DMA_TX_CHAN, DMA_PL_HIGH);
|
||||
dma_enable_transfer_complete_interrupt(USBUSART_DMA_BUS, USBUSART_DMA_TX_CHAN);
|
||||
#ifdef STM32F4
|
||||
#ifdef DMA_STREAM0
|
||||
dma_set_transfer_mode(USBUSART_DMA_BUS, USBUSART_DMA_TX_CHAN, DMA_SxCR_DIR_MEM_TO_PERIPHERAL);
|
||||
dma_channel_select(USBUSART_DMA_BUS, USBUSART_DMA_TX_CHAN, USBUSART_DMA_TRG);
|
||||
dma_set_dma_flow_control(USBUSART_DMA_BUS, USBUSART_DMA_TX_CHAN);
|
||||
|
@ -146,7 +146,7 @@ void usbuart_init(void)
|
|||
dma_set_priority(USBUSART_DMA_BUS, USBUSART_DMA_RX_CHAN, DMA_PL_HIGH);
|
||||
dma_enable_half_transfer_interrupt(USBUSART_DMA_BUS, USBUSART_DMA_RX_CHAN);
|
||||
dma_enable_transfer_complete_interrupt(USBUSART_DMA_BUS, USBUSART_DMA_RX_CHAN);
|
||||
#ifdef STM32F4
|
||||
#ifdef DMA_STREAM0
|
||||
dma_set_transfer_mode(USBUSART_DMA_BUS, USBUSART_DMA_RX_CHAN, DMA_SxCR_DIR_PERIPHERAL_TO_MEM);
|
||||
dma_channel_select(USBUSART_DMA_BUS, USBUSART_DMA_RX_CHAN, USBUSART_DMA_TRG);
|
||||
dma_set_dma_flow_control(USBUSART_DMA_BUS, USBUSART_DMA_RX_CHAN);
|
||||
|
|
Loading…
Reference in New Issue