STM32L4xx_HAL_Driver  1.14.0
DMAEx Extended features functions

Extended features functions. More...

Functions

HAL_StatusTypeDef HAL_DMAEx_ConfigMuxRequestGenerator (DMA_HandleTypeDef *hdma, HAL_DMA_MuxRequestGeneratorConfigTypeDef *pRequestGeneratorConfig)
 Configure the DMAMUX request generator block used by the given DMA channel (instance). More...
 
HAL_StatusTypeDef HAL_DMAEx_EnableMuxRequestGenerator (DMA_HandleTypeDef *hdma)
 Enable the DMAMUX request generator block used by the given DMA channel (instance). More...
 
HAL_StatusTypeDef HAL_DMAEx_DisableMuxRequestGenerator (DMA_HandleTypeDef *hdma)
 Disable the DMAMUX request generator block used by the given DMA channel (instance). More...
 
HAL_StatusTypeDef HAL_DMAEx_ConfigMuxSync (DMA_HandleTypeDef *hdma, HAL_DMA_MuxSyncConfigTypeDef *pSyncConfig)
 Configure the DMAMUX synchronization parameters for a given DMA channel (instance). More...
 
void HAL_DMAEx_MUX_IRQHandler (DMA_HandleTypeDef *hdma)
 Handles DMAMUX interrupt request. More...
 

Detailed Description

Extended features functions.

 ===============================================================================
                #####  Extended features functions  #####
 ===============================================================================
    [..]  This section provides functions allowing to:

    (+) Configure the DMAMUX Synchronization Block using HAL_DMAEx_ConfigMuxSync function.
    (+) Configure the DMAMUX Request Generator Block using HAL_DMAEx_ConfigMuxRequestGenerator function.
       Functions HAL_DMAEx_EnableMuxRequestGenerator and HAL_DMAEx_DisableMuxRequestGenerator can then be used
       to respectively enable/disable the request generator.

Function Documentation

◆ HAL_DMAEx_ConfigMuxRequestGenerator()

HAL_StatusTypeDef HAL_DMAEx_ConfigMuxRequestGenerator ( DMA_HandleTypeDef hdma,
HAL_DMA_MuxRequestGeneratorConfigTypeDef pRequestGeneratorConfig 
)

Configure the DMAMUX request generator block used by the given DMA channel (instance).

Parameters
hdmapointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA channel.
pRequestGeneratorConfig: pointer to HAL_DMA_MuxRequestGeneratorConfigTypeDef : contains the request generator parameters.
Return values
HALstatus

Definition at line 150 of file stm32l4xx_hal_dma_ex.c.

151 {
152  /* Check the parameters */
153  assert_param(IS_DMA_ALL_INSTANCE(hdma->Instance));
154 
155  assert_param(IS_DMAMUX_REQUEST_GEN_SIGNAL_ID(pRequestGeneratorConfig->SignalID));
156 
157  assert_param(IS_DMAMUX_REQUEST_GEN_POLARITY(pRequestGeneratorConfig->Polarity));
158  assert_param(IS_DMAMUX_REQUEST_GEN_REQUEST_NUMBER(pRequestGeneratorConfig->RequestNumber));
159 
160  /* check if the DMA state is ready
161  and DMA is using a DMAMUX request generator block
162  */
163  if((hdma->State == HAL_DMA_STATE_READY) && (hdma->DMAmuxRequestGen != 0U))
164  {
165  /* Process Locked */
166  __HAL_LOCK(hdma);
167 
168  /* Set the request generator new parameters */
169  hdma->DMAmuxRequestGen->RGCR = pRequestGeneratorConfig->SignalID | \
170  ((pRequestGeneratorConfig->RequestNumber - 1U) << DMAMUX_RGxCR_GNBREQ_Pos)| \
171  pRequestGeneratorConfig->Polarity;
172  /* Process UnLocked */
173  __HAL_UNLOCK(hdma);
174 
175  return HAL_OK;
176  }
177  else
178  {
179  return HAL_ERROR;
180  }
181 }
DMAMUX_RequestGen_TypeDef * DMAmuxRequestGen
DMA_Channel_TypeDef * Instance
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
__IO HAL_DMA_StateTypeDef State
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMAEx_ConfigMuxSync()

HAL_StatusTypeDef HAL_DMAEx_ConfigMuxSync ( DMA_HandleTypeDef hdma,
HAL_DMA_MuxSyncConfigTypeDef pSyncConfig 
)

Configure the DMAMUX synchronization parameters for a given DMA channel (instance).

Parameters
hdmapointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA channel.
pSyncConfig: pointer to HAL_DMA_MuxSyncConfigTypeDef : contains the DMAMUX synchronization parameters
Return values
HALstatus

Definition at line 104 of file stm32l4xx_hal_dma_ex.c.

105 {
106  /* Check the parameters */
107  assert_param(IS_DMA_ALL_INSTANCE(hdma->Instance));
108 
109  assert_param(IS_DMAMUX_SYNC_SIGNAL_ID(pSyncConfig->SyncSignalID));
110 
111  assert_param(IS_DMAMUX_SYNC_POLARITY(pSyncConfig-> SyncPolarity));
112  assert_param(IS_DMAMUX_SYNC_STATE(pSyncConfig->SyncEnable));
113  assert_param(IS_DMAMUX_SYNC_EVENT(pSyncConfig->EventEnable));
114  assert_param(IS_DMAMUX_SYNC_REQUEST_NUMBER(pSyncConfig->RequestNumber));
115 
116  /*Check if the DMA state is ready */
117  if(hdma->State == HAL_DMA_STATE_READY)
118  {
119  /* Process Locked */
120  __HAL_LOCK(hdma);
121 
122  /* Set the new synchronization parameters (and keep the request ID filled during the Init)*/
123  MODIFY_REG( hdma->DMAmuxChannel->CCR, \
124  (~DMAMUX_CxCR_DMAREQ_ID) , \
125  ((pSyncConfig->SyncSignalID) << DMAMUX_CxCR_SYNC_ID_Pos) | ((pSyncConfig->RequestNumber - 1U) << DMAMUX_CxCR_NBREQ_Pos) | \
126  pSyncConfig->SyncPolarity | ((uint32_t)pSyncConfig->SyncEnable << DMAMUX_CxCR_SE_Pos) | \
127  ((uint32_t)pSyncConfig->EventEnable << DMAMUX_CxCR_EGE_Pos));
128 
129  /* Process UnLocked */
130  __HAL_UNLOCK(hdma);
131 
132  return HAL_OK;
133  }
134  else
135  {
136  /*DMA State not Ready*/
137  return HAL_ERROR;
138  }
139 }
DMA_Channel_TypeDef * Instance
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
__IO HAL_DMA_StateTypeDef State
DMAMUX_Channel_TypeDef * DMAmuxChannel
return HAL_OK
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMAEx_DisableMuxRequestGenerator()

HAL_StatusTypeDef HAL_DMAEx_DisableMuxRequestGenerator ( DMA_HandleTypeDef hdma)

Disable the DMAMUX request generator block used by the given DMA channel (instance).

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

Definition at line 217 of file stm32l4xx_hal_dma_ex.c.

218 {
219  /* Check the parameters */
220  assert_param(IS_DMA_ALL_INSTANCE(hdma->Instance));
221 
222  /* check if the DMA state is ready
223  and DMA is using a DMAMUX request generator block
224  */
225  if((hdma->State != HAL_DMA_STATE_RESET) && (hdma->DMAmuxRequestGen != 0))
226  {
227 
228  /* Disable the request generator*/
229  hdma->DMAmuxRequestGen->RGCR &= ~DMAMUX_RGxCR_GE;
230 
231  return HAL_OK;
232  }
233  else
234  {
235  return HAL_ERROR;
236  }
237 }
DMAMUX_RequestGen_TypeDef * DMAmuxRequestGen
DMA_Channel_TypeDef * Instance
__IO HAL_DMA_StateTypeDef State
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMAEx_EnableMuxRequestGenerator()

HAL_StatusTypeDef HAL_DMAEx_EnableMuxRequestGenerator ( DMA_HandleTypeDef hdma)

Enable the DMAMUX request generator block used by the given DMA channel (instance).

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

Definition at line 189 of file stm32l4xx_hal_dma_ex.c.

190 {
191  /* Check the parameters */
192  assert_param(IS_DMA_ALL_INSTANCE(hdma->Instance));
193 
194  /* check if the DMA state is ready
195  and DMA is using a DMAMUX request generator block
196  */
197  if((hdma->State != HAL_DMA_STATE_RESET) && (hdma->DMAmuxRequestGen != 0))
198  {
199 
200  /* Enable the request generator*/
201  hdma->DMAmuxRequestGen->RGCR |= DMAMUX_RGxCR_GE;
202 
203  return HAL_OK;
204  }
205  else
206  {
207  return HAL_ERROR;
208  }
209 }
DMAMUX_RequestGen_TypeDef * DMAmuxRequestGen
DMA_Channel_TypeDef * Instance
__IO HAL_DMA_StateTypeDef State
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMAEx_MUX_IRQHandler()

void HAL_DMAEx_MUX_IRQHandler ( DMA_HandleTypeDef hdma)

Handles DMAMUX interrupt request.

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

Definition at line 245 of file stm32l4xx_hal_dma_ex.c.

246 {
247  /* Check for DMAMUX Synchronization overrun */
248  if((hdma->DMAmuxChannelStatus->CSR & hdma->DMAmuxChannelStatusMask) != 0U)
249  {
250  /* Disable the synchro overrun interrupt */
251  hdma->DMAmuxChannel->CCR &= ~DMAMUX_CxCR_SOIE;
252 
253  /* Clear the DMAMUX synchro overrun flag */
254  hdma->DMAmuxChannelStatus->CFR = hdma->DMAmuxChannelStatusMask;
255 
256  /* Update error code */
257  hdma->ErrorCode |= HAL_DMA_ERROR_SYNC;
258 
259  if(hdma->XferErrorCallback != NULL)
260  {
261  /* Transfer error callback */
262  hdma->XferErrorCallback(hdma);
263  }
264  }
265 
266  if(hdma->DMAmuxRequestGen != 0)
267  {
268  /* if using a DMAMUX request generator block Check for DMAMUX request generator overrun */
269  if((hdma->DMAmuxRequestGenStatus->RGSR & hdma->DMAmuxRequestGenStatusMask) != 0U)
270  {
271  /* Disable the request gen overrun interrupt */
272  hdma->DMAmuxRequestGen->RGCR &= ~DMAMUX_RGxCR_OIE;
273 
274  /* Clear the DMAMUX request generator overrun flag */
276 
277  /* Update error code */
278  hdma->ErrorCode |= HAL_DMA_ERROR_REQGEN;
279 
280  if(hdma->XferErrorCallback != NULL)
281  {
282  /* Transfer error callback */
283  hdma->XferErrorCallback(hdma);
284  }
285  }
286  }
287 }
DMAMUX_RequestGenStatus_TypeDef * DMAmuxRequestGenStatus
DMAMUX_RequestGen_TypeDef * DMAmuxRequestGen
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
DMAMUX_Channel_TypeDef * DMAmuxChannel
uint32_t DMAmuxRequestGenStatusMask
DMAMUX_ChannelStatus_TypeDef * DMAmuxChannelStatus