| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #ifndef __FU68XX_5_DMA_H__
- #define __FU68XX_5_DMA_H__
- #include <FU68xx_5_MCU.h>
- // DMA管道参数表
- #define DMA_PIPE (DMACFG2 | DMACFG1 | DMACFG0)
- #define UART1_XDATA (0x00)
- #define XDATA_UART1 (DMACFG0)
- #define I2C_XDATA (DMACFG1)
- #define XDATA_I2C (DMACFG0 | DMACFG1)
- #define SPI_XDATA (DMACFG2)
- #define XDATA_SPI (DMACFG2 | DMACFG0)
- #define UART2_XDATA (DMACFG2 | DMACFG1)
- #define XDATA_UART2 (DMACFG2 | DMACFG1 | DMACFG0)
- // DMA中断控制
- #define DMA_IE_EN DMAIE
- #define DMA_IE_DIS 0x00
- // DMA传输顺序
- #define DMA_FHSB ENDIAN
- #define DMA_FLSB 0x00
- // DMA状态
- #define DMA_BSY (DMABSY)
- #define DMA_IRQ (DMAIF)
- // DMA中断优先级配置
- #define DMA_IRQ_L1 (0)
- #define DMA_IRQ_L2 (PDMA0)
- #define DMA_IRQ_L3 (PDMA1)
- #define DMA_IRQ_L4 (PDMA0 | PDMA1)
- // DMA操作函数
- #define Wait_DMA(a) while (ReadBit(*(&DMA0_CR0 + a), DMABSY))
- #define Switch_DMA(a) SetBit(*(&DMA0_CR0 + a), DMAEN | DMABSY)
- // DMA配置函数
- void Set_IRQ_DMA(uint8_t DMA_IRQ_Priority);
- void Conf_DMA(uint8_t DMAx, uint8_t DMAPipe, uint16_t DMAAddr, uint8_t DMALen);
- void Set_DMA_Pipe(uint8_t DMAx,uint8_t DMAPipe);
- void Start_DMA(uint8_t DMAx);
- bool Get_DMA_Status(uint8_t DMAx,uint8_t DMAStatus);
- void Set_DMA_Data_Package(uint8_t DMAx, uint16_t ulAddr, uint8_t cLen);
- #endif
|