125 #include "stm32f4xx_rcc.h" 140 #define TRANSFER_IT_ENABLE_MASK (uint32_t)(DMA_SxCR_TCIE | DMA_SxCR_HTIE | \ 141 DMA_SxCR_TEIE | DMA_SxCR_DMEIE) 143 #define DMA_Stream0_IT_MASK (uint32_t)(DMA_LISR_FEIF0 | DMA_LISR_DMEIF0 | \ 144 DMA_LISR_TEIF0 | DMA_LISR_HTIF0 | \ 147 #define DMA_Stream1_IT_MASK (uint32_t)(DMA_Stream0_IT_MASK << 6) 148 #define DMA_Stream2_IT_MASK (uint32_t)(DMA_Stream0_IT_MASK << 16) 149 #define DMA_Stream3_IT_MASK (uint32_t)(DMA_Stream0_IT_MASK << 22) 150 #define DMA_Stream4_IT_MASK (uint32_t)(DMA_Stream0_IT_MASK | (uint32_t)0x20000000) 151 #define DMA_Stream5_IT_MASK (uint32_t)(DMA_Stream1_IT_MASK | (uint32_t)0x20000000) 152 #define DMA_Stream6_IT_MASK (uint32_t)(DMA_Stream2_IT_MASK | (uint32_t)0x20000000) 153 #define DMA_Stream7_IT_MASK (uint32_t)(DMA_Stream3_IT_MASK | (uint32_t)0x20000000) 154 #define TRANSFER_IT_MASK (uint32_t)0x0F3C0F3C 155 #define HIGH_ISR_MASK (uint32_t)0x20000000 156 #define RESERVED_MASK (uint32_t)0x0F7D0F7D 205 DMAy_Streamx->
CR = 0;
208 DMAy_Streamx->
NDTR = 0;
211 DMAy_Streamx->
PAR = 0;
214 DMAy_Streamx->
M0AR = 0;
217 DMAy_Streamx->
M1AR = 0;
220 DMAy_Streamx->
FCR = (uint32_t)0x00000021;
341 tmpreg = DMAy_Streamx->
CR;
367 DMAy_Streamx->
CR = tmpreg;
371 tmpreg = DMAy_Streamx->
FCR;
382 DMAy_Streamx->
FCR = tmpreg;
638 DMAy_Streamx->
NDTR = (uint16_t)Counter;
653 return ((uint16_t)(DMAy_Streamx->
NDTR));
731 uint32_t DMA_CurrentMemory)
749 DMAy_Streamx->
M1AR = Memory1BaseAddr;
803 uint32_t DMA_MemoryTarget)
813 DMAy_Streamx->
M1AR = MemoryBaseAddr;
818 DMAy_Streamx->
M0AR = MemoryBaseAddr;
1008 uint32_t tmpreg = 0;
1030 tmpreg = DMAy->
HISR;
1035 tmpreg = DMAy->
LISR;
1042 if ((tmpreg & DMA_FLAG) != (uint32_t)RESET)
1131 DMAy_Streamx->
FCR |= (uint32_t)DMA_IT_FE;
1136 DMAy_Streamx->
FCR &= ~(uint32_t)DMA_IT_FE;
1141 if (DMA_IT != DMA_IT_FE)
1174 uint32_t tmpreg = 0, enablestatus = 0;
1199 enablestatus = (uint32_t)(DMAy_Streamx->
CR & tmpreg);
1204 enablestatus = (uint32_t)(DMAy_Streamx->
FCR &
DMA_IT_FE);
1211 tmpreg = DMAy->
HISR ;
1216 tmpreg = DMAy->
LISR ;
1223 if (((tmpreg & DMA_IT) != (uint32_t)RESET) && (enablestatus != (uint32_t)RESET))
FunctionalState DMA_GetCmdStatus(DMA_Stream_TypeDef *DMAy_Streamx)
Returns the status of EN bit for the specified DMAy Streamx.
uint32_t DMA_GetFIFOStatus(DMA_Stream_TypeDef *DMAy_Streamx)
Returns the current DMAy Streamx FIFO filled level.
ITStatus DMA_GetITStatus(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_IT)
Checks whether the specified DMAy Streamx interrupt has occurred or not.
#define DMA_Stream3_IT_MASK
#define IS_DMA_FIFO_THRESHOLD(THRESHOLD)
DMA Init structure definition.
#define DMA_Stream2_IT_MASK
#define DMA_MemoryDataSize_Byte
uint16_t DMA_GetCurrDataCounter(DMA_Stream_TypeDef *DMAy_Streamx)
Returns the number of remaining data units in the current DMAy Streamx transfer.
void DMA_ClearFlag(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_FLAG)
Clears the DMAy Streamx's pending flags.
void DMA_PeriphIncOffsetSizeConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_Pincos)
Configures, when the PINC (Peripheral Increment address mode) bit is set, if the peripheral address s...
#define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE)
#define DMA_PeripheralInc_Disable
#define DMA_FlowCtrl_Memory
uint32_t DMA_MemoryDataSize
#define IS_DMA_PERIPHERAL_INC_STATE(STATE)
void assert_param(int val)
#define IS_DMA_MEMORY_INC_STATE(STATE)
#define DMA_Stream4_IT_MASK
uint32_t DMA_PeripheralInc
#define IS_FUNCTIONAL_STATE(STATE)
void DMA_Init(DMA_Stream_TypeDef *DMAy_Streamx, DMA_InitTypeDef *DMA_InitStruct)
Initializes the DMAy Streamx according to the specified parameters in the DMA_InitStruct structure...
void DMA_DeInit(DMA_Stream_TypeDef *DMAy_Streamx)
Deinitialize the DMAy Streamx registers to their default reset values.
uint32_t DMA_PeripheralDataSize
#define DMA_Stream6_IT_MASK
#define DMA_Stream1_IT_MASK
void DMA_SetCurrDataCounter(DMA_Stream_TypeDef *DMAy_Streamx, uint16_t Counter)
Writes the number of data units to be transferred on the DMAy Streamx.
#define IS_DMA_GET_IT(IT)
#define IS_DMA_MEMORY_DATA_SIZE(SIZE)
#define IS_DMA_PERIPHERAL_BURST(BURST)
uint32_t DMA_PeripheralBurst
This file contains all the functions prototypes for the DMA firmware library.
#define DMA_FIFOThreshold_1QuarterFull
uint32_t DMA_PeripheralBaseAddr
uint32_t DMA_Memory0BaseAddr
#define DMA_Stream0_IT_MASK
void DMA_DoubleBufferModeConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t Memory1BaseAddr, uint32_t DMA_CurrentMemory)
Configures, when the DMAy Streamx is disabled, the double buffer mode and the current memory target...
#define DMA_MemoryBurst_Single
#define DMA_Stream5_IT_MASK
uint32_t DMA_FIFOThreshold
#define IS_DMA_BUFFER_SIZE(SIZE)
void DMA_MemoryTargetConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t MemoryBaseAddr, uint32_t DMA_MemoryTarget)
Configures the Memory address for the next buffer transfer in double buffer mode (for dynamic use)...
void DMA_ITConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_IT, FunctionalState NewState)
Enables or disables the specified DMAy Streamx interrupts.
#define IS_DMA_CURRENT_MEM(MEM)
#define DMA_FIFOMode_Disable
#define IS_DMA_PINCOS_SIZE(SIZE)
#define IS_DMA_MODE(MODE)
#define IS_DMA_ALL_PERIPH(PERIPH)
#define DMA_PeripheralDataSize_Byte
#define IS_DMA_FLOW_CTRL(CTRL)
#define IS_DMA_CLEAR_FLAG(FLAG)
#define IS_DMA_CONFIG_IT(IT)
#define IS_DMA_MEMORY_BURST(BURST)
#define IS_DMA_CHANNEL(CHANNEL)
#define DMA_MemoryInc_Disable
#define IS_DMA_CLEAR_IT(IT)
void DMA_ClearITPendingBit(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_IT)
Clears the DMAy Streamx's interrupt pending bits.
#define IS_DMA_DIRECTION(DIRECTION)
#define DMA_DIR_PeripheralToMemory
uint32_t DMA_GetCurrentMemoryTarget(DMA_Stream_TypeDef *DMAy_Streamx)
Returns the current memory target used by double buffer transfer.
void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct)
Fills each DMA_InitStruct member with its default value.
#define IS_DMA_PRIORITY(PRIORITY)
void DMA_DoubleBufferModeCmd(DMA_Stream_TypeDef *DMAy_Streamx, FunctionalState NewState)
Enables or disables the double buffer mode for the selected DMA stream.
#define DMA_Stream7_IT_MASK
void DMA_Cmd(DMA_Stream_TypeDef *DMAy_Streamx, FunctionalState NewState)
Enables or disables the specified DMAy Streamx.
#define IS_DMA_GET_FLAG(FLAG)
#define TRANSFER_IT_ENABLE_MASK
FlagStatus DMA_GetFlagStatus(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_FLAG)
Checks whether the specified DMAy Streamx flag is set or not.
void DMA_FlowControllerConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_FlowCtrl)
Configures, when the DMAy Streamx is disabled, the flow controller for the next transactions (Periphe...
#define IS_DMA_FIFO_MODE_STATE(STATE)
#define DMA_PeripheralBurst_Single