28#define DMAC_CHANNEL_NUMBER (3)
29#define DMA_INVLID_CHANNEL (~0ul)
37#define DMAC_TransferType_Mem2Mem (0)
38#define DMAC_TransferType_Mem2Per (1)
39#define DMAC_TransferType_Per2Mem (2)
40#define DMAC_TransferType_Per2Per (3)
44#define DMAC_FlowControl_DMA (0)
45#define DMAC_FlowControl_Peripheral (1)
51#define DMAC_BurstLen_1 (0)
52#define DMAC_BurstLen_4 (1)
53#define DMAC_BurstLen_8 (2)
54#define DMAC_BurstLen_16 (3)
55#define DMAC_BurstLen_32 (4)
56#define DMAC_BurstLen_64 (5)
57#define DMAC_BurstLen_128 (6)
58#define DMAC_BurstLen_256 (7)
65#define DMAC_AddrChange_Increment (0)
66#define DMAC_AddrChange_Decrement (1)
67#define DMAC_AddrChange_NoChange (2)
74#define DMAC_DataWidth_8 (0)
75#define DMAC_DataWidth_16 (1)
76#define DMAC_DataWidth_32 (2)
77#define DMAC_DataWidth_64 (3)
78#define DMAC_DataWidth_128 (4)
79#define DMAC_DataWidth_256 (5)
87#define DMAC_Peripheral_I2C0_Tx (0)
88#define DMAC_Peripheral_I2C0_Rx (1)
89#define DMAC_Peripheral_SPI0_Tx (2)
90#define DMAC_Peripheral_SPI0_Rx (3)
91#define DMAC_Peripheral_UART0_Tx (4)
92#define DMAC_Peripheral_UART0_Rx (5)
93#define DMAC_Peripheral_IIS_Tx (6)
94#define DMAC_Peripheral_IIS_Rx (7)
95#define DMAC_Peripheral_SPI1_Tx (8)
96#define DMAC_Peripheral_SPI1_Rx (9)
97#define DMAC_Peripheral_UART1_Tx (10)
98#define DMAC_Peripheral_UART1_Rx (11)
99#define DMAC_Peripheral_ADC (12)
106#define DMAC_HandshakePolarity_Low (1)
107#define DMAC_HandshakePolarity_High (0)
114#define DMAC_Handshake_Default (1)
115#define DMAC_Handshake_Software (1)
116#define DMAC_Handshake_Hardware (0)
119#define DMAC_LockLevel_Tfr_Complete (0)
120#define DMAC_LockLevel_Block_Complete (1)
121#define DMAC_LockLevel_Transaction_Complete (2)
126#define DMAC_ChannelPriority_0 (0)
127#define DMAC_ChannelPriority_1 (1)
128#define DMAC_ChannelPriority_2 (2)
129#define DMAC_ChannelPriority_3 (3)
130#define DMAC_ChannelPriority_4 (4)
131#define DMAC_ChannelPriority_5 (5)
132#define DMAC_ChannelPriority_6 (6)
133#define DMAC_ChannelPriority_7 (7)
136#define DMAC_CHANNELALL_MASK (~((~0ul)<<DMAC_CHANNEL_NUMBER))
141#define DMAC_FLAG_INDEX_TFR (0<<1)
142#define DMAC_FLAG_INDEX_BLK (1<<1)
143#define DMAC_FLAG_INDEX_SRCTFR (2<<1)
144#define DMAC_FLAG_INDEX_DSTTFR (3<<1)
145#define DMAC_FLAG_INDEX_ERR (4<<1)
153#define DMAC_FLAG_MASK_TFR (1ul<<(DMAC_FLAG_INDEX_TFR >>1))
154#define DMAC_FLAG_MASK_BLK (1ul<<(DMAC_FLAG_INDEX_BLK >>1))
155#define DMAC_FLAG_MASK_SRCTFR (1ul<<(DMAC_FLAG_INDEX_SRCTFR>>1))
156#define DMAC_FLAG_MASK_DSTTFR (1ul<<(DMAC_FLAG_INDEX_DSTTFR>>1))
157#define DMAC_FLAG_MASK_ERR (1ul<<(DMAC_FLAG_INDEX_ERR >>1))
158#define DMAC_FLAG_MASK_ALL (0x1Ful)
287#define DMAC_ChannelMask(idx) (1ul<<(idx))
303 return (dma->STATUS_INT_L & FlgMsk ? 1 : 0);
314 return ((__IO uint32_t*)(&dma->RAW_TFR_L))[FlgIdx]&(0x1<<ChIdx) ? 1 : 0;
324__STATIC_INLINE uint32_t
DMAC_IntFlag(DMA_T* dma,uint32_t ChIdx,uint32_t FlgIdx)
326 return ((__IO uint32_t*)(&dma->STATUS_TFR_L))[FlgIdx]&(0x1<<ChIdx) ? 1 : 0;
338 return ((__IO uint32_t*)(&dma->MSK_TFR_L))[FlgIdx]&(0x1<<ChIdx) ? 1 : 0;
350 ((__IO uint32_t*)(&dma->CLEAR_TFR_L))[FlgIdx]= (0x1<<ChIdx);
__STATIC_INLINE uint32_t DMAC_IsChannelValid(DMA_T *dma, uint32_t ChIdx)
Adjust dma channel is busy or not.
Definition: pan_dmac.h:278
__STATIC_INLINE uint32_t DMAC_CombinedIntStatus(DMA_T *dma, uint32_t FlgMsk)
Adjust interrupt occured or not.
Definition: pan_dmac.h:301
void DMAC_ReleaseChannel(DMA_T *dma, uint32_t ChIdx)
Release dma channel.
void DMAC_SetIntFlagMsk(DMA_T *dma, uint32_t ChIdx, uint32_t FlgIdx)
Mask interrupt,interrupt is useless.
void DMAC_SetChannelConfig(DMA_T *dma, uint32_t ChIdx, DMAC_ChannelConfigTypeDef *Config)
Set dma channel config,include control register and config register.
void DMAC_DeInit(DMA_T *dma)
Disable dma & mask all dma interrupt.
uint32_t DMAC_AcquireChannel(DMA_T *dma)
Acquire dma free channel.
void DMAC_Init(DMA_T *dma)
Enable dma.
struct DMAC_ChannelConfigTypeDef DMAC_ChannelConfigTypeDef
Structure with dma channel detail config.
void DMAC_StopChannel(DMA_T *dma, uint32_t ChIdx)
Stop dma channel.
__STATIC_INLINE uint32_t DMAC_IntFlagMsk(DMA_T *dma, uint32_t ChIdx, uint32_t FlgIdx)
Adjust interrupt mask set or not.
Definition: pan_dmac.h:336
__STATIC_INLINE uint32_t DMAC_StatusFlag(DMA_T *dma, uint32_t ChIdx, uint32_t FlgIdx)
Adjust interrupt raw flag set or not.
Definition: pan_dmac.h:312
__STATIC_INLINE uint32_t DMAC_IntFlag(DMA_T *dma, uint32_t ChIdx, uint32_t FlgIdx)
Adjust interrupt event occured or not after masking.
Definition: pan_dmac.h:324
void DMAC_StartChannel(DMA_T *dma, uint32_t ChIdx, void *Src, void *Dst, uint32_t Len)
Start dma channel to transmit.
void DMAC_GetChannelConfig(DMA_T *dma, uint32_t ChIdx, DMAC_ChannelConfigTypeDef *Config)
Get dma channel config,include control register and config register.
struct __DMAC_ChannelConfigTypeDef __DMAC_ChannelConfigTypeDef
Structure with dma channel config feature.
__STATIC_INLINE void DMAC_ClrIntFlag(DMA_T *dma, uint32_t ChIdx, uint32_t FlgIdx)
Adjust interrupt mask cleared or not.
Definition: pan_dmac.h:348
#define DMAC_CHANNEL_NUMBER
Definition: pan_dmac.h:28
void DMAC_ClrIntFlagMsk(DMA_T *dma, uint32_t ChIdx, uint32_t FlgIdx)
Clear interrupt mask to make sure intterupt enable.
Structure with dma channel config feature.
Definition: pan_dmac.h:171
uint32_t CFG_H
Definition: pan_dmac.h:175
uint32_t CFG_L
Definition: pan_dmac.h:174
uint32_t CTL_H
Definition: pan_dmac.h:173
uint32_t CTL_L
Definition: pan_dmac.h:172
Structure with dma channel detail config.
Definition: pan_dmac.h:227
uint32_t ChannelSuspend
Definition: pan_dmac.h:248
uint32_t PeripheralSrc
Definition: pan_dmac.h:266
uint32_t __Rev0
Definition: pan_dmac.h:237
uint32_t Done
Definition: pan_dmac.h:243
uint32_t LockBus
Definition: pan_dmac.h:252
uint32_t AddrChangeSrc
Definition: pan_dmac.h:232
uint32_t GatherEnSrc
Definition: pan_dmac.h:235
uint32_t __Rev1
Definition: pan_dmac.h:240
uint32_t ScatterEnDst
Definition: pan_dmac.h:236
uint32_t __Rev4
Definition: pan_dmac.h:258
uint32_t HandshakePolarityDst
Definition: pan_dmac.h:256
uint32_t TransferType
Definition: pan_dmac.h:238
uint32_t ProtectControl
Definition: pan_dmac.h:264
uint32_t HandshakeSrc
Definition: pan_dmac.h:251
uint32_t DataWidthSrc
Definition: pan_dmac.h:230
uint32_t __Rev2
Definition: pan_dmac.h:244
uint32_t AutoReloadSrc
Definition: pan_dmac.h:259
uint32_t HandshakeDst
Definition: pan_dmac.h:250
uint32_t LockBusLevel
Definition: pan_dmac.h:254
uint32_t HandshakePolaritySrc
Definition: pan_dmac.h:257
uint32_t PeripheralDst
Definition: pan_dmac.h:267
uint32_t BlockSize
Definition: pan_dmac.h:242
uint32_t __Rev6
Definition: pan_dmac.h:268
uint32_t DataWidthDst
Definition: pan_dmac.h:229
uint32_t ChannelPriority
Definition: pan_dmac.h:247
uint32_t FlowControl
Definition: pan_dmac.h:239
uint32_t BurstLenDst
Definition: pan_dmac.h:233
uint32_t LockChannel
Definition: pan_dmac.h:253
uint32_t FlowControlMode
Definition: pan_dmac.h:262
uint32_t AutoReloadDst
Definition: pan_dmac.h:260
uint32_t LockChannelLevel
Definition: pan_dmac.h:255
uint32_t __Rev3
Definition: pan_dmac.h:246
uint32_t __Rev5
Definition: pan_dmac.h:265
uint32_t IntEnable
Definition: pan_dmac.h:228
uint32_t FifoMode
Definition: pan_dmac.h:263
uint32_t BurstLenSrc
Definition: pan_dmac.h:234
uint32_t FifoEmpty
Definition: pan_dmac.h:249
uint32_t AddrChangeDst
Definition: pan_dmac.h:231