MG32F10x Standard Peripherals Firmware Library
Data Structures | Macros | Functions
mg32f10x_dmac.h File Reference

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

#include "mg32f10x.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_SourceMasterInterface_APB   (0x0U << 25)
 
#define DMAC_SourceMasterInterface_AHB   (0x1U << 25)
 
#define DMAC_DestinationMasterInterface_APB   (0x0U << 23)
 
#define DMAC_DestinationMasterInterface_AHB   (0x1U << 23)
 
#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_TIM1_CH1__TIM2_UP__TIM3_CH3   0
 
#define DMAC_HardwareHandshakingInterface_TIM1_CH4__TIM1_TRIG__TIM1_COM__TIM4_CH2   1
 
#define DMAC_HardwareHandshakingInterface_TIM1_UP__TIM2_CH1__TIM4_CH3   2
 
#define DMAC_HardwareHandshakingInterface_TIM1_CH3__TIM3_CH1__TIM3_TRIG   3
 
#define DMAC_HardwareHandshakingInterface_TIM2_CH3__TIM4_CH1   4
 
#define DMAC_HardwareHandshakingInterface_TIM2_CH2__TIM2_CH4__TIM4_UP   5
 
#define DMAC_HardwareHandshakingInterface_TIM3_CH4__TIM3_UP__TIM1_CH2   6
 
#define DMAC_HardwareHandshakingInterface_QSPI_RX   7
 
#define DMAC_HardwareHandshakingInterface_QSPI_TX   8
 
#define DMAC_HardwareHandshakingInterface_SPIS1_RX   9
 
#define DMAC_HardwareHandshakingInterface_SPIS1_TX   10
 
#define DMAC_HardwareHandshakingInterface_UART1_RX   11
 
#define DMAC_HardwareHandshakingInterface_UART1_TX   12
 
#define DMAC_HardwareHandshakingInterface_ADC_Regular   13
 
#define DMAC_HardwareHandshakingInterface_ADC_Injected   14
 
#define DMAC_HardwareHandshakingInterface_SPIM2_RX   0
 
#define DMAC_HardwareHandshakingInterface_SPIM2_TX   1
 
#define DMAC_HardwareHandshakingInterface_SPIS2_RX   2
 
#define DMAC_HardwareHandshakingInterface_SPIS2_TX   3
 
#define DMAC_HardwareHandshakingInterface_UART2_RX   4
 
#define DMAC_HardwareHandshakingInterface_UART2_TX   5
 
#define DMAC_HardwareHandshakingInterface_UART3_RX   6
 
#define DMAC_HardwareHandshakingInterface_UART3_TX   7
 
#define DMAC_HardwareHandshakingInterface_I2C1_RX   8
 
#define DMAC_HardwareHandshakingInterface_I2C1_TX   9
 
#define DMAC_HardwareHandshakingInterface_I2C2_RX   10
 
#define DMAC_HardwareHandshakingInterface_I2C2_TX   11
 
#define DMAC_Channel_0   ((uint8_t)0x00)
 
#define DMAC_Channel_1   ((uint8_t)0x01)
 
#define DMAC_Channel_2   ((uint8_t)0x02)
 
#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_SourceGatherConfig (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, DMAC_SourceGatherInitTypeDef *DMAC_SourceGatherInitStruct)
 Initializes the source gather of DMACx Channely. More...
 
void DMAC_Channel_DestinationScatterConfig (DMAC_TypeDef *DMACx, uint8_t DMAC_Channel, DMAC_DestinationScatterInitTypeDef *DMAC_DestinationScatterInitStruct)
 Initializes the destination scatter of DMACx Channely. 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
megawin Application Team
Version
V0.1.10
Date
05-January-2023