STM32L4xx_HAL_Driver  1.14.0
DMA Private Functions

Functions

static void DMA_SetConfig (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
 Sets the DMA Transfer parameter. More...
 
static void DMA_CalcDMAMUXChannelBaseAndMask (DMA_HandleTypeDef *hdma)
 Updates the DMA handle with the DMAMUX channel and status mask depending on channel number. More...
 
static void DMA_CalcDMAMUXRequestGenBaseAndMask (DMA_HandleTypeDef *hdma)
 Updates the DMA handle with the DMAMUX request generator params. More...
 

Detailed Description

Function Documentation

◆ DMA_CalcDMAMUXChannelBaseAndMask()

static void DMA_CalcDMAMUXChannelBaseAndMask ( DMA_HandleTypeDef hdma)
static

Updates the DMA handle with the DMAMUX channel and status mask depending on channel number.

Parameters
hdmapointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA Channel.
Return values
None

Definition at line 1115 of file stm32l4xx_hal_dma.c.

1116 {
1117  uint32_t channel_number;
1118 
1119  /* check if instance is not outside the DMA channel range */
1120  if ((uint32_t)hdma->Instance < (uint32_t)DMA2_Channel1)
1121  {
1122  /* DMA1 */
1123  hdma->DMAmuxChannel = (DMAMUX1_Channel0 + (hdma->ChannelIndex >> 2U));
1124  }
1125  else
1126  {
1127  /* DMA2 */
1128  hdma->DMAmuxChannel = (DMAMUX1_Channel7 + (hdma->ChannelIndex >> 2U));
1129  }
1130 
1131  channel_number = (((uint32_t)hdma->Instance & 0xFFU) - 8U) / 20U;
1132  hdma->DMAmuxChannelStatus = DMAMUX1_ChannelStatus;
1133  hdma->DMAmuxChannelStatusMask = 1UL << (channel_number & 0x1CU);
1134 }
DMA_Channel_TypeDef * Instance
DMAMUX_Channel_TypeDef * DMAmuxChannel
DMAMUX_ChannelStatus_TypeDef * DMAmuxChannelStatus

◆ DMA_CalcDMAMUXRequestGenBaseAndMask()

static void DMA_CalcDMAMUXRequestGenBaseAndMask ( DMA_HandleTypeDef hdma)
static

Updates the DMA handle with the DMAMUX request generator params.

Parameters
hdmapointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA Channel.
Return values
None

Definition at line 1143 of file stm32l4xx_hal_dma.c.

1144 {
1145  uint32_t request = hdma->Init.Request & DMAMUX_CxCR_DMAREQ_ID;
1146 
1147  /* DMA Channels are connected to DMAMUX1 request generator blocks*/
1148  hdma->DMAmuxRequestGen = (DMAMUX_RequestGen_TypeDef *)((uint32_t)(((uint32_t)DMAMUX1_RequestGenerator0) + ((request - 1U) * 4U)));
1149 
1150  hdma->DMAmuxRequestGenStatus = DMAMUX1_RequestGenStatus;
1151 
1152  /* here "Request" is either DMA_REQUEST_GENERATOR0 to DMA_REQUEST_GENERATOR3, i.e. <= 4*/
1153  hdma->DMAmuxRequestGenStatusMask = 1UL << ((request - 1U) & 0x3U);
1154 }
DMAMUX_RequestGenStatus_TypeDef * DMAmuxRequestGenStatus
DMAMUX_RequestGen_TypeDef * DMAmuxRequestGen
DMA_InitTypeDef Init
uint32_t DMAmuxRequestGenStatusMask

◆ DMA_SetConfig()

static void DMA_SetConfig ( DMA_HandleTypeDef hdma,
uint32_t  SrcAddress,
uint32_t  DstAddress,
uint32_t  DataLength 
)
static

Sets the DMA Transfer parameter.

Parameters
hdmapointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA Channel.
SrcAddressThe source memory Buffer address
DstAddressThe destination memory Buffer address
DataLengthThe length of data to be transferred from source to destination
Return values
HALstatus

Definition at line 1068 of file stm32l4xx_hal_dma.c.

1069 {
1070 #if defined(DMAMUX1)
1071  /* Clear the DMAMUX synchro overrun flag */
1072  hdma->DMAmuxChannelStatus->CFR = hdma->DMAmuxChannelStatusMask;
1073 
1074  if(hdma->DMAmuxRequestGen != 0U)
1075  {
1076  /* Clear the DMAMUX request generator overrun flag */
1078  }
1079 #endif
1080 
1081  /* Clear all flags */
1082  hdma->DmaBaseAddress->IFCR = (DMA_ISR_GIF1 << (hdma->ChannelIndex & 0x1CU));
1083 
1084  /* Configure DMA Channel data length */
1085  hdma->Instance->CNDTR = DataLength;
1086 
1087  /* Memory to Peripheral */
1088  if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH)
1089  {
1090  /* Configure DMA Channel destination address */
1091  hdma->Instance->CPAR = DstAddress;
1092 
1093  /* Configure DMA Channel source address */
1094  hdma->Instance->CMAR = SrcAddress;
1095  }
1096  /* Peripheral to Memory */
1097  else
1098  {
1099  /* Configure DMA Channel source address */
1100  hdma->Instance->CPAR = SrcAddress;
1101 
1102  /* Configure DMA Channel destination address */
1103  hdma->Instance->CMAR = DstAddress;
1104  }
1105 }
DMAMUX_RequestGenStatus_TypeDef * DMAmuxRequestGenStatus
DMAMUX_RequestGen_TypeDef * DMAmuxRequestGen
DMA_Channel_TypeDef * Instance
DMA_InitTypeDef Init
DMA_TypeDef * DmaBaseAddress
uint32_t DMAmuxRequestGenStatusMask
DMAMUX_ChannelStatus_TypeDef * DMAmuxChannelStatus