MG32F157 Standard Peripherals Firmware Library
Data Structures | Macros | Functions
mg32f157_dmac.h File Reference

This file contains all the functions prototypes for the DMAC firmware library. More...

#include "mg32f157.h"

Go to the source code of this file.

Data Structures

struct  DMAC_SourceGatherInitTypeDef
 DMAC Source Gather Structure definition. More...
 
struct  DMAC_DestinationScatterInitTypeDef
 DMAC Destination Scatter Structure definition. More...
 
struct  DMAC_Channel_InitTypeDef
 DMAC Channel Init Structure definition. More...
 

Macros

#define DMAC_Interrupt_Enable   ((uint32_t)0x00000001)
 
#define DMAC_Interrupt_Disable   ((uint32_t)0x00000000)
 
#define DMAC_SourceTransferWidth_8b   DMAC_CTLL_SRC_TR_WIDTH_8
 
#define DMAC_SourceTransferWidth_16b   DMAC_CTLL_SRC_TR_WIDTH_16
 
#define DMAC_SourceTransferWidth_32b   DMAC_CTLL_SRC_TR_WIDTH_32
 
#define DMAC_DestinationTransferWidth_8b   DMAC_CTLL_DST_TR_WIDTH_8
 
#define DMAC_DestinationTransferWidth_16b   DMAC_CTLL_DST_TR_WIDTH_16
 
#define DMAC_DestinationTransferWidth_32b   DMAC_CTLL_DST_TR_WIDTH_32
 
#define DMAC_SourceAddrInc_Increment   DMAC_CTLL_SINC_INC
 
#define DMAC_SourceAddrInc_Decrement   DMAC_CTLL_SINC_DEC
 
#define DMAC_SourceAddrInc_NoChange   DMAC_CTLL_SINC_NO
 
#define DMAC_DestinationAddrInc_Increment   DMAC_CTLL_DINC_INC
 
#define DMAC_DestinationAddrInc_Decrement   DMAC_CTLL_DINC_DEC
 
#define DMAC_DestinationAddrInc_NoChange   DMAC_CTLL_DINC_NO
 
#define DMAC_SourceTransactionLength_1   DMAC_CTLL_SRC_MSIZE_1
 
#define DMAC_SourceTransactionLength_4   DMAC_CTLL_SRC_MSIZE_4
 
#define DMAC_SourceTransactionLength_8   DMAC_CTLL_SRC_MSIZE_8
 
#define DMAC_DestinationTransactionLength_1   DMAC_CTLL_DEST_MSIZE_1
 
#define DMAC_DestinationTransactionLength_4   DMAC_CTLL_DEST_MSIZE_4
 
#define DMAC_DestinationTransactionLength_8   DMAC_CTLL_DEST_MSIZE_8
 
#define DMAC_TransferTypeAndFlowControl_MemoryToMemory_DMAC   DMAC_CTLL_TT_FC_M2M_DMAC
 
#define DMAC_TransferTypeAndFlowControl_MemoryToPeripheral_DMAC   DMAC_CTLL_TT_FC_M2P_DMAC
 
#define DMAC_TransferTypeAndFlowControl_PeripheralToMemory_DMAC   DMAC_CTLL_TT_FC_P2M_DMAC
 
#define DMAC_TransferTypeAndFlowControl_PeripheralToPeripheral_DMAC   DMAC_CTLL_TT_FC_P2P_DMAC
 
#define DMAC_TransferTypeAndFlowControl_PeripheralToMemory_Peripheral   DMAC_CTLL_TT_FC_P2M_PERIPH
 
#define DMAC_TransferTypeAndFlowControl_PeripheralToPeripheral_SourcePeripheral   DMAC_CTLL_TT_FC_P2P_SRC_PERIPH
 
#define DMAC_TransferTypeAndFlowControl_MemoryToPeripheral_Peripheral   DMAC_CTLL_TT_FC_M2P_PERIPH
 
#define DMAC_TransferTypeAndFlowControl_PeripheralToPeripheral_DestinationPeripheral   DMAC_CTLL_TT_FC_P2P_DST_PERIPH
 
#define DMAC_SourceHandshakingInterfaceSelect_Hardware   (0x0U << 11)
 
#define DMAC_SourceHandshakingInterfaceSelect_Software   (0x1U << 11)
 
#define DMAC_DestinationHandshakingInterfaceSelect_Hardware   (0x0U << 10)
 
#define DMAC_DestinationHandshakingInterfaceSelect_Software   (0x1U << 10)
 
#define DMAC_SourceHandshakingInterfacePolarity_High   (0x0U << 19)
 
#define DMAC_SourceHandshakingInterfacePolarity_Low   (0x1U << 19)
 
#define DMAC_DestinationHandshakingInterfacePolarity_High   (0x0U << 18)
 
#define DMAC_DestinationHandshakingInterfacePolarity_Low   (0x1U << 18)
 
#define DMAC_AutomaticSourceReload_Enable   (DMAC_CFGL_RELOAD_SRC)
 
#define DMAC_AutomaticSourceReload_Disable   ((uint32_t)0x00000000)
 
#define DMAC_AutomaticDestinationReload_Enable   (DMAC_CFGL_RELOAD_DST)
 
#define DMAC_AutomaticDestinationReload_Disable   ((uint32_t)0x00000000)
 
#define DMAC_FlowControlMode_0   (0x0 << 0)
 
#define DMAC_FlowControlMode_1   (0x1 << 0)
 
#define DMAC_FIFOMode_0   (0x0 << 1)
 
#define DMAC_FIFOMode_1   (0x1 << 1)
 
#define DMAC_HardwareHandshakingInterface_ADC1__TIM2_CH3__TIM4_CH1__QSPI0__AES_RX   0
 
#define DMAC_HardwareHandshakingInterface_USART3_TX__TIM1_CH1__TIM2_UP__TIM3_CH3__SPI1_RX__AES_TX   1
 
#define DMAC_HardwareHandshakingInterface_USART3_RX__TIM1_CH2__TIM3_CH4__TIM3_UP__SPI1_TX   2
 
#define DMAC_HardwareHandshakingInterface_USART1_TX__TIM1_CH4__TIM1_TRIG__TIM1_COM__TIM4_CH2__SPI2_RX__I2C2_TX   3
 
#define DMAC_HardwareHandshakingInterface_USART1_RX__TIM1_UP__SPI2_TX__TIM2_CH1__TIM4_CH3__I2C2_RX   4
 
#define DMAC_HardwareHandshakingInterface_USART2_RX__TIM1_CH3__TIM3_CH1__TIM3_TRIG__I2C1_TX   5
 
#define DMAC_HardwareHandshakingInterface_USART2_TX__TIM2_CH2__TIM2_CH4__TIM4_UP_I2C1_RX   6
 
#define DMAC_HardwareHandshakingInterface_TIM5_CH4__TIM5_TRIG__TIM8_CH3__TIM8_UP__SPI3_RX   0
 
#define DMAC_HardwareHandshakingInterface_TIM8_CH4__TIM8_TRIG__TIM8_COM__TIM5_CH3__TIM5_UP__SPI3_TX   1
 
#define DMAC_HardwareHandshakingInterface_TIM8_CH1__UART4_RX__TIM6_UP__DAC1   2
 
#define DMAC_HardwareHandshakingInterface_TIM5_CH2__SDIO__TIM7_UP__DAC2   3
 
#define DMAC_HardwareHandshakingInterface_ADC3__TIM8_CH2__TIM5_CH1__UART4_TX   4
 
#define DMAC_Channel_1   ((uint8_t)0x00)
 
#define DMAC_Channel_2   ((uint8_t)0x01)
 
#define DMAC_Channel_3   ((uint8_t)0x02)
 
#define DMAC_Channel_4   ((uint8_t)0x03)
 
#define DMAC_Channel_5   ((uint8_t)0x04)
 
#define DMAC_Channel_6   ((uint8_t)0x05)
 
#define DMAC_Channel_7   ((uint8_t)0x06)
 
#define DMAC_IT_TFR   ((uint16_t)0x0000) /* Transfer complete interrupt */
 
#define DMAC_IT_BLOCK   ((uint16_t)0x0008) /* Block complete interrupt */
 
#define DMAC_IT_SRCTRAN   ((uint16_t)0x0010) /* Source transaction complete interrupt */
 
#define DMAC_IT_DSTTRAN   ((uint16_t)0x0018) /* Destination transaction complete interrupt */
 
#define DMAC_IT_ERR   ((uint16_t)0x0020) /* Error interrupt */
 

Functions

void DMAC_DeInit (DMAC_TypeDef *DMACx)
 Deinitializes the DMACx peripheral registers to their default reset values. More...
 
void DMAC_Channel_Init (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, DMAC_Channel_InitTypeDef *DMAC_Channel_InitStruct)
 Initializes the DMACx Channely according to the specified parameters in the DMAC_Channel_InitStruct structure. More...
 
void DMAC_Channel_StructInit (DMAC_Channel_InitTypeDef *DMAC_Channel_InitStruct)
 Fills each DMAC_Channel_InitStruct member with its default value. More...
 
void DMAC_Channel_SetSourceAddress (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, uint32_t SourceAddress)
 Sets the source address of the specified DMACx Channely. More...
 
void DMAC_Channel_SetDestinationAddress (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, uint32_t DestinationAddress)
 Sets the destination address of the specified DMACx Channely. More...
 
void DMAC_Channel_SetBlockTransferSize (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, uint16_t DMAC_BlockTransferSize)
 Sets the number of data units to be transferred on the block transfer. More...
 
uint16_t DMAC_Channel_GetBlockTransferSize (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the number of remaining data units in the current DMACx Channely block transfer. More...
 
void DMAC_Channel_SuspendCmd (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, FunctionalState NewState)
 Forces or releases the current DMACx Channely transfer suspend. More...
 
FlagStatus DMAC_Channel_IsFIFOEmpty (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Checks whether the DMACx Channely FIFO is empty or not. More...
 
void DMAC_Cmd (DMAC_TypeDef *DMACx, FunctionalState NewState)
 Enables or disables the specified DMACx peripheral. More...
 
FunctionalState DMAC_GetCmdStatus (DMAC_TypeDef *DMACx)
 Returns the status of EN bit for the specified DMACx. More...
 
void DMAC_ChannelCmd (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, FunctionalState NewState)
 Enables or disables the specified DMACx Channely. More...
 
FunctionalState DMAC_GetChannelCmdStatus (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the status of EN bit for the specified DMACx Channely. More...
 
void DMAC_ITConfig (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, uint16_t DMAC_IT, FunctionalState NewState)
 Enables or disables the specified DMACx Channely interrupts. More...
 
ITStatus DMAC_GetRawITStatus (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, uint16_t DMAC_IT)
 Checks whether the specified DMACx Channely raw interrupt status. More...
 
ITStatus DMAC_GetITStatus (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, uint16_t DMAC_IT)
 Checks whether the specified DMACx Channely interrupt has occurred or not. More...
 
ITStatus DMAC_GetCombinedITStatus (DMAC_TypeDef *DMACx, uint16_t DMAC_IT)
 Checks whether the specified DMACx interrupt has occurred or not. More...
 
void DMAC_ClearITPendingBit (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, uint16_t DMAC_IT)
 Clears the DMACx's interrupt pending bits. More...
 
void DMAC_SWHS_SetReqSrcSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, SignalState NewState)
 Controls the state of ReqSrc signal for the corresponding channels. More...
 
void DMAC_SWHS_SetReqDstSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, SignalState NewState)
 Controls the state of ReqDst signal for the corresponding channels. More...
 
void DMAC_SWHS_SetSglReqSrcSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, SignalState NewState)
 Controls the state of SglReqSrc signal for the corresponding channels. More...
 
void DMAC_SWHS_SetSglReqDstSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, SignalState NewState)
 Controls the state of SglReqDst signal for the corresponding channels. More...
 
void DMAC_SWHS_SetLstSrcSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, SignalState NewState)
 Controls the state of LstSrc signal for the corresponding channels. More...
 
void DMAC_SWHS_SetLstDstSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, SignalState NewState)
 Controls the state of LstDst signal for the corresponding channels. More...
 
SignalState DMAC_SWHS_GetReqSrcSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the state of ReqSrc signal for the corresponding channel. More...
 
SignalState DMAC_SWHS_GetReqDstSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the state of ReqDst signal for the corresponding channel. More...
 
SignalState DMAC_SWHS_GetSglReqSrcSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the state of SglReqSrc signal for the corresponding channel. More...
 
SignalState DMAC_SWHS_GetSglReqDstSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the state of SglReqDst signal for the corresponding channel. More...
 
SignalState DMAC_SWHS_GetLstSrcSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the state of LstSrc signal for the corresponding channel. More...
 
SignalState DMAC_SWHS_GetLstDstSignalState (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel)
 Returns the state of LstDst signal for the corresponding channel. More...
 

Detailed Description

This file contains all the functions prototypes for the DMAC firmware library.

Author
MegawinTech Application Team
Version
V0.0.4
Date
16-June-2023