mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
[Bsp] stm32f107 spi drv : dma add irq
This commit is contained in:
1 parent
82359e09f0
commit
fe16f91cf1
2 files changed
+234
-71
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -8,19 +8,41 @@
|
||||
|
||||
#include "board.h"
|
||||
|
||||
//#define SPI_USE_DMA
|
||||
#if defined(SPI1_USING_DMA) || defined(SPI2_USING_DMA) || defined(SPI3_USING_DMA)
|
||||
#define SPI_USE_DMA
|
||||
#endif /*defined(SPI1_USING_DMA) || defined(SPI2_USING_DMA) || defined(SPI3_USING_DMA)*/
|
||||
|
||||
struct stm32_spi_bus
|
||||
{
|
||||
struct rt_spi_bus parent;
|
||||
SPI_TypeDef * SPI;
|
||||
#ifdef SPI_USE_DMA
|
||||
|
||||
#define SPI_DMA_RX_DONE 0x01
|
||||
#define SPI_DMA_TX_DONE 0x02
|
||||
#define SPI_DMA_COMPLETE (SPI_DMA_RX_DONE | SPI_DMA_TX_DONE)
|
||||
|
||||
struct stm32_spi_dma_private
|
||||
{
|
||||
DMA_Channel_TypeDef * DMA_Channel_TX;
|
||||
DMA_Channel_TypeDef * DMA_Channel_RX;
|
||||
uint32_t DMA_Channel_TX_FLAG_TC;
|
||||
uint32_t DMA_Channel_TX_FLAG_TE;
|
||||
uint32_t DMA_Channel_RX_FLAG_TC;
|
||||
uint32_t DMA_Channel_RX_FLAG_TE;
|
||||
uint8_t tx_irq_ch;
|
||||
uint8_t rx_irq_ch;
|
||||
uint32_t tx_gl_flag;
|
||||
uint32_t rx_gl_flag;
|
||||
};
|
||||
struct stm32_spi_dma
|
||||
{
|
||||
const struct stm32_spi_dma_private *priv_data;
|
||||
struct rt_event event;
|
||||
};
|
||||
#endif /*SPI_USE_DMA*/
|
||||
struct stm32_spi_bus
|
||||
{
|
||||
struct rt_spi_bus parent;
|
||||
SPI_TypeDef * SPI;
|
||||
#ifdef SPI_USE_DMA
|
||||
struct stm32_spi_dma *dma;
|
||||
#endif /* SPI_USE_DMA */
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user