Set blackbox file handler to NULL after closing file
[inav.git] / lib / main / STM32H7 / Drivers / STM32H7xx_HAL_Driver / Inc / stm32h7xx_hal_dma.h
blob61d3a9985b1db4728ef13d06df51fed7e5735419
1 /**
2 ******************************************************************************
3 * @file stm32h7xx_hal_dma.h
4 * @author MCD Application Team
5 * @brief Header file of DMA HAL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics.
10 * All rights reserved.</center></h2>
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
17 ******************************************************************************
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32H7xx_HAL_DMA_H
22 #define STM32H7xx_HAL_DMA_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32h7xx_hal_def.h"
31 /** @addtogroup STM32H7xx_HAL_Driver
32 * @{
35 /** @addtogroup DMA
36 * @{
39 /* Exported types ------------------------------------------------------------*/
41 /** @defgroup DMA_Exported_Types DMA Exported Types
42 * @brief DMA Exported Types
43 * @{
46 /**
47 * @brief DMA Configuration Structure definition
49 typedef struct
51 uint32_t Request; /*!< Specifies the request selected for the specified stream.
52 This parameter can be a value of @ref DMA_Request_selection */
54 uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
55 from memory to memory or from peripheral to memory.
56 This parameter can be a value of @ref DMA_Data_transfer_direction */
58 uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not.
59 This parameter can be a value of @ref DMA_Peripheral_incremented_mode */
61 uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not.
62 This parameter can be a value of @ref DMA_Memory_incremented_mode */
64 uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width.
65 This parameter can be a value of @ref DMA_Peripheral_data_size */
67 uint32_t MemDataAlignment; /*!< Specifies the Memory data width.
68 This parameter can be a value of @ref DMA_Memory_data_size */
70 uint32_t Mode; /*!< Specifies the operation mode of the DMAy Streamx.
71 This parameter can be a value of @ref DMA_mode
72 @note The circular buffer mode cannot be used if the memory-to-memory
73 data transfer is configured on the selected Stream */
75 uint32_t Priority; /*!< Specifies the software priority for the DMAy Streamx.
76 This parameter can be a value of @ref DMA_Priority_level */
78 uint32_t FIFOMode; /*!< Specifies if the FIFO mode or Direct mode will be used for the specified stream.
79 This parameter can be a value of @ref DMA_FIFO_direct_mode
80 @note The Direct mode (FIFO mode disabled) cannot be used if the
81 memory-to-memory data transfer is configured on the selected stream */
83 uint32_t FIFOThreshold; /*!< Specifies the FIFO threshold level.
84 This parameter can be a value of @ref DMA_FIFO_threshold_level */
86 uint32_t MemBurst; /*!< Specifies the Burst transfer configuration for the memory transfers.
87 It specifies the amount of data to be transferred in a single non interruptible
88 transaction.
89 This parameter can be a value of @ref DMA_Memory_burst
90 @note The burst mode is possible only if the address Increment mode is enabled. */
92 uint32_t PeriphBurst; /*!< Specifies the Burst transfer configuration for the peripheral transfers.
93 It specifies the amount of data to be transferred in a single non interruptible
94 transaction.
95 This parameter can be a value of @ref DMA_Peripheral_burst
96 @note The burst mode is possible only if the address Increment mode is enabled. */
97 }DMA_InitTypeDef;
99 /**
100 * @brief HAL DMA State structures definition
102 typedef enum
104 HAL_DMA_STATE_RESET = 0x00U, /*!< DMA not yet initialized or disabled */
105 HAL_DMA_STATE_READY = 0x01U, /*!< DMA initialized and ready for use */
106 HAL_DMA_STATE_BUSY = 0x02U, /*!< DMA process is ongoing */
107 HAL_DMA_STATE_ERROR = 0x03U, /*!< DMA error state */
108 HAL_DMA_STATE_ABORT = 0x04U, /*!< DMA Abort state */
109 }HAL_DMA_StateTypeDef;
112 * @brief HAL DMA Transfer complete level structure definition
114 typedef enum
116 HAL_DMA_FULL_TRANSFER = 0x00U, /*!< Full transfer */
117 HAL_DMA_HALF_TRANSFER = 0x01U, /*!< Half Transfer */
118 }HAL_DMA_LevelCompleteTypeDef;
121 * @brief HAL DMA Callbacks IDs structure definition
123 typedef enum
125 HAL_DMA_XFER_CPLT_CB_ID = 0x00U, /*!< Full transfer */
126 HAL_DMA_XFER_HALFCPLT_CB_ID = 0x01U, /*!< Half Transfer */
127 HAL_DMA_XFER_M1CPLT_CB_ID = 0x02U, /*!< M1 Full Transfer */
128 HAL_DMA_XFER_M1HALFCPLT_CB_ID = 0x03U, /*!< M1 Half Transfer */
129 HAL_DMA_XFER_ERROR_CB_ID = 0x04U, /*!< Error */
130 HAL_DMA_XFER_ABORT_CB_ID = 0x05U, /*!< Abort */
131 HAL_DMA_XFER_ALL_CB_ID = 0x06U /*!< All */
132 }HAL_DMA_CallbackIDTypeDef;
135 * @brief DMA handle Structure definition
137 typedef struct __DMA_HandleTypeDef
139 void *Instance; /*!< Register base address */
141 DMA_InitTypeDef Init; /*!< DMA communication parameters */
143 HAL_LockTypeDef Lock; /*!< DMA locking object */
145 __IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */
147 void *Parent; /*!< Parent object state */
149 void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */
151 void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */
153 void (* XferM1CpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete Memory1 callback */
155 void (* XferM1HalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer Half complete Memory1 callback */
157 void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */
159 void (* XferAbortCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer Abort callback */
161 __IO uint32_t ErrorCode; /*!< DMA Error code */
163 uint32_t StreamBaseAddress; /*!< DMA Stream Base Address */
165 uint32_t StreamIndex; /*!< DMA Stream Index */
167 DMAMUX_Channel_TypeDef *DMAmuxChannel; /*!< DMAMUX Channel Base Address */
169 DMAMUX_ChannelStatus_TypeDef *DMAmuxChannelStatus; /*!< DMAMUX Channels Status Base Address */
171 uint32_t DMAmuxChannelStatusMask; /*!< DMAMUX Channel Status Mask */
174 DMAMUX_RequestGen_TypeDef *DMAmuxRequestGen; /*!< DMAMUX request generator Base Address */
176 DMAMUX_RequestGenStatus_TypeDef *DMAmuxRequestGenStatus; /*!< DMAMUX request generator Status Address */
178 uint32_t DMAmuxRequestGenStatusMask; /*!< DMAMUX request generator Status mask */
180 }DMA_HandleTypeDef;
183 * @}
187 /* Exported constants --------------------------------------------------------*/
189 /** @defgroup DMA_Exported_Constants DMA Exported Constants
190 * @brief DMA Exported constants
191 * @{
194 /** @defgroup DMA_Error_Code DMA Error Code
195 * @brief DMA Error Code
196 * @{
198 #define HAL_DMA_ERROR_NONE (0x00000000U) /*!< No error */
199 #define HAL_DMA_ERROR_TE (0x00000001U) /*!< Transfer error */
200 #define HAL_DMA_ERROR_FE (0x00000002U) /*!< FIFO error */
201 #define HAL_DMA_ERROR_DME (0x00000004U) /*!< Direct Mode error */
202 #define HAL_DMA_ERROR_TIMEOUT (0x00000020U) /*!< Timeout error */
203 #define HAL_DMA_ERROR_PARAM (0x00000040U) /*!< Parameter error */
204 #define HAL_DMA_ERROR_NO_XFER (0x00000080U) /*!< Abort requested with no Xfer ongoing */
205 #define HAL_DMA_ERROR_NOT_SUPPORTED (0x00000100U) /*!< Not supported mode */
206 #define HAL_DMA_ERROR_SYNC (0x00000200U) /*!< DMAMUX sync overrun error */
207 #define HAL_DMA_ERROR_REQGEN (0x00000400U) /*!< DMAMUX request generator overrun error */
208 #define HAL_DMA_ERROR_BUSY (0x00000800U) /*!< DMA Busy error */
211 * @}
214 /** @defgroup DMA_Request_selection DMA Request selection
215 * @brief DMA Request selection
216 * @{
218 /* DMAMUX1 requests */
219 #define DMA_REQUEST_MEM2MEM 0U /*!< memory to memory transfer */
221 #define DMA_REQUEST_GENERATOR0 1U /*!< DMAMUX1 request generator 0 */
222 #define DMA_REQUEST_GENERATOR1 2U /*!< DMAMUX1 request generator 1 */
223 #define DMA_REQUEST_GENERATOR2 3U /*!< DMAMUX1 request generator 2 */
224 #define DMA_REQUEST_GENERATOR3 4U /*!< DMAMUX1 request generator 3 */
225 #define DMA_REQUEST_GENERATOR4 5U /*!< DMAMUX1 request generator 4 */
226 #define DMA_REQUEST_GENERATOR5 6U /*!< DMAMUX1 request generator 5 */
227 #define DMA_REQUEST_GENERATOR6 7U /*!< DMAMUX1 request generator 6 */
228 #define DMA_REQUEST_GENERATOR7 8U /*!< DMAMUX1 request generator 7 */
230 #define DMA_REQUEST_ADC1 9U /*!< DMAMUX1 ADC1 request */
231 #define DMA_REQUEST_ADC2 10U /*!< DMAMUX1 ADC2 request */
233 #define DMA_REQUEST_TIM1_CH1 11U /*!< DMAMUX1 TIM1 CH1 request */
234 #define DMA_REQUEST_TIM1_CH2 12U /*!< DMAMUX1 TIM1 CH2 request */
235 #define DMA_REQUEST_TIM1_CH3 13U /*!< DMAMUX1 TIM1 CH3 request */
236 #define DMA_REQUEST_TIM1_CH4 14U /*!< DMAMUX1 TIM1 CH4 request */
237 #define DMA_REQUEST_TIM1_UP 15U /*!< DMAMUX1 TIM1 UP request */
238 #define DMA_REQUEST_TIM1_TRIG 16U /*!< DMAMUX1 TIM1 TRIG request */
239 #define DMA_REQUEST_TIM1_COM 17U /*!< DMAMUX1 TIM1 COM request */
241 #define DMA_REQUEST_TIM2_CH1 18U /*!< DMAMUX1 TIM2 CH1 request */
242 #define DMA_REQUEST_TIM2_CH2 19U /*!< DMAMUX1 TIM2 CH2 request */
243 #define DMA_REQUEST_TIM2_CH3 20U /*!< DMAMUX1 TIM2 CH3 request */
244 #define DMA_REQUEST_TIM2_CH4 21U /*!< DMAMUX1 TIM2 CH4 request */
245 #define DMA_REQUEST_TIM2_UP 22U /*!< DMAMUX1 TIM2 UP request */
247 #define DMA_REQUEST_TIM3_CH1 23U /*!< DMAMUX1 TIM3 CH1 request */
248 #define DMA_REQUEST_TIM3_CH2 24U /*!< DMAMUX1 TIM3 CH2 request */
249 #define DMA_REQUEST_TIM3_CH3 25U /*!< DMAMUX1 TIM3 CH3 request */
250 #define DMA_REQUEST_TIM3_CH4 26U /*!< DMAMUX1 TIM3 CH4 request */
251 #define DMA_REQUEST_TIM3_UP 27U /*!< DMAMUX1 TIM3 UP request */
252 #define DMA_REQUEST_TIM3_TRIG 28U /*!< DMAMUX1 TIM3 TRIG request */
254 #define DMA_REQUEST_TIM4_CH1 29U /*!< DMAMUX1 TIM4 CH1 request */
255 #define DMA_REQUEST_TIM4_CH2 30U /*!< DMAMUX1 TIM4 CH2 request */
256 #define DMA_REQUEST_TIM4_CH3 31U /*!< DMAMUX1 TIM4 CH3 request */
257 #define DMA_REQUEST_TIM4_UP 32U /*!< DMAMUX1 TIM4 UP request */
259 #define DMA_REQUEST_I2C1_RX 33U /*!< DMAMUX1 I2C1 RX request */
260 #define DMA_REQUEST_I2C1_TX 34U /*!< DMAMUX1 I2C1 TX request */
261 #define DMA_REQUEST_I2C2_RX 35U /*!< DMAMUX1 I2C2 RX request */
262 #define DMA_REQUEST_I2C2_TX 36U /*!< DMAMUX1 I2C2 TX request */
264 #define DMA_REQUEST_SPI1_RX 37U /*!< DMAMUX1 SPI1 RX request */
265 #define DMA_REQUEST_SPI1_TX 38U /*!< DMAMUX1 SPI1 TX request */
266 #define DMA_REQUEST_SPI2_RX 39U /*!< DMAMUX1 SPI2 RX request */
267 #define DMA_REQUEST_SPI2_TX 40U /*!< DMAMUX1 SPI2 TX request */
269 #define DMA_REQUEST_USART1_RX 41U /*!< DMAMUX1 USART1 RX request */
270 #define DMA_REQUEST_USART1_TX 42U /*!< DMAMUX1 USART1 TX request */
271 #define DMA_REQUEST_USART2_RX 43U /*!< DMAMUX1 USART2 RX request */
272 #define DMA_REQUEST_USART2_TX 44U /*!< DMAMUX1 USART2 TX request */
273 #define DMA_REQUEST_USART3_RX 45U /*!< DMAMUX1 USART3 RX request */
274 #define DMA_REQUEST_USART3_TX 46U /*!< DMAMUX1 USART3 TX request */
276 #define DMA_REQUEST_TIM8_CH1 47U /*!< DMAMUX1 TIM8 CH1 request */
277 #define DMA_REQUEST_TIM8_CH2 48U /*!< DMAMUX1 TIM8 CH2 request */
278 #define DMA_REQUEST_TIM8_CH3 49U /*!< DMAMUX1 TIM8 CH3 request */
279 #define DMA_REQUEST_TIM8_CH4 50U /*!< DMAMUX1 TIM8 CH4 request */
280 #define DMA_REQUEST_TIM8_UP 51U /*!< DMAMUX1 TIM8 UP request */
281 #define DMA_REQUEST_TIM8_TRIG 52U /*!< DMAMUX1 TIM8 TRIG request */
282 #define DMA_REQUEST_TIM8_COM 53U /*!< DMAMUX1 TIM8 COM request */
284 #define DMA_REQUEST_TIM5_CH1 55U /*!< DMAMUX1 TIM5 CH1 request */
285 #define DMA_REQUEST_TIM5_CH2 56U /*!< DMAMUX1 TIM5 CH2 request */
286 #define DMA_REQUEST_TIM5_CH3 57U /*!< DMAMUX1 TIM5 CH3 request */
287 #define DMA_REQUEST_TIM5_CH4 58U /*!< DMAMUX1 TIM5 CH4 request */
288 #define DMA_REQUEST_TIM5_UP 59U /*!< DMAMUX1 TIM5 UP request */
289 #define DMA_REQUEST_TIM5_TRIG 60U /*!< DMAMUX1 TIM5 TRIG request */
291 #define DMA_REQUEST_SPI3_RX 61U /*!< DMAMUX1 SPI3 RX request */
292 #define DMA_REQUEST_SPI3_TX 62U /*!< DMAMUX1 SPI3 TX request */
294 #define DMA_REQUEST_UART4_RX 63U /*!< DMAMUX1 UART4 RX request */
295 #define DMA_REQUEST_UART4_TX 64U /*!< DMAMUX1 UART4 TX request */
296 #define DMA_REQUEST_UART5_RX 65U /*!< DMAMUX1 UART5 RX request */
297 #define DMA_REQUEST_UART5_TX 66U /*!< DMAMUX1 UART5 TX request */
299 #define DMA_REQUEST_DAC1_CH1 67U /*!< DMAMUX1 DAC1 Channel 1 request */
300 #define DMA_REQUEST_DAC1_CH2 68U /*!< DMAMUX1 DAC1 Channel 2 request */
302 #define DMA_REQUEST_TIM6_UP 69U /*!< DMAMUX1 TIM6 UP request */
303 #define DMA_REQUEST_TIM7_UP 70U /*!< DMAMUX1 TIM7 UP request */
305 #define DMA_REQUEST_USART6_RX 71U /*!< DMAMUX1 USART6 RX request */
306 #define DMA_REQUEST_USART6_TX 72U /*!< DMAMUX1 USART6 TX request */
308 #define DMA_REQUEST_I2C3_RX 73U /*!< DMAMUX1 I2C3 RX request */
309 #define DMA_REQUEST_I2C3_TX 74U /*!< DMAMUX1 I2C3 TX request */
311 #if defined (PSSI)
312 #define DMA_REQUEST_DCMI_PSSI 75U /*!< DMAMUX1 DCMI/PSSI request */
313 #define DMA_REQUEST_DCMI DMA_REQUEST_DCMI_PSSI /* Legacy define */
314 #else
315 #define DMA_REQUEST_DCMI 75U /*!< DMAMUX1 DCMI request */
316 #endif /* PSSI */
318 #define DMA_REQUEST_CRYP_IN 76U /*!< DMAMUX1 CRYP IN request */
319 #define DMA_REQUEST_CRYP_OUT 77U /*!< DMAMUX1 CRYP OUT request */
321 #define DMA_REQUEST_HASH_IN 78U /*!< DMAMUX1 HASH IN request */
323 #define DMA_REQUEST_UART7_RX 79U /*!< DMAMUX1 UART7 RX request */
324 #define DMA_REQUEST_UART7_TX 80U /*!< DMAMUX1 UART7 TX request */
325 #define DMA_REQUEST_UART8_RX 81U /*!< DMAMUX1 UART8 RX request */
326 #define DMA_REQUEST_UART8_TX 82U /*!< DMAMUX1 UART8 TX request */
328 #define DMA_REQUEST_SPI4_RX 83U /*!< DMAMUX1 SPI4 RX request */
329 #define DMA_REQUEST_SPI4_TX 84U /*!< DMAMUX1 SPI4 TX request */
330 #define DMA_REQUEST_SPI5_RX 85U /*!< DMAMUX1 SPI5 RX request */
331 #define DMA_REQUEST_SPI5_TX 86U /*!< DMAMUX1 SPI5 TX request */
333 #define DMA_REQUEST_SAI1_A 87U /*!< DMAMUX1 SAI1 A request */
334 #define DMA_REQUEST_SAI1_B 88U /*!< DMAMUX1 SAI1 B request */
335 #define DMA_REQUEST_SAI2_A 89U /*!< DMAMUX1 SAI2 A request */
336 #define DMA_REQUEST_SAI2_B 90U /*!< DMAMUX1 SAI2 B request */
338 #define DMA_REQUEST_SWPMI_RX 91U /*!< DMAMUX1 SWPMI RX request */
339 #define DMA_REQUEST_SWPMI_TX 92U /*!< DMAMUX1 SWPMI TX request */
341 #define DMA_REQUEST_SPDIF_RX_DT 93U /*!< DMAMUX1 SPDIF RXDT request*/
342 #define DMA_REQUEST_SPDIF_RX_CS 94U /*!< DMAMUX1 SPDIF RXCS request*/
344 #if defined(HRTIM1)
345 #define DMA_REQUEST_HRTIM_MASTER 95U /*!< DMAMUX1 HRTIM1 Master request 1 */
346 #define DMA_REQUEST_HRTIM_TIMER_A 96U /*!< DMAMUX1 HRTIM1 TimerA request 2 */
347 #define DMA_REQUEST_HRTIM_TIMER_B 97U /*!< DMAMUX1 HRTIM1 TimerB request 3 */
348 #define DMA_REQUEST_HRTIM_TIMER_C 98U /*!< DMAMUX1 HRTIM1 TimerC request 4 */
349 #define DMA_REQUEST_HRTIM_TIMER_D 99U /*!< DMAMUX1 HRTIM1 TimerD request 5 */
350 #define DMA_REQUEST_HRTIM_TIMER_E 100U /*!< DMAMUX1 HRTIM1 TimerE request 6 */
351 #endif /* HRTIM1 */
353 #define DMA_REQUEST_DFSDM1_FLT0 101U /*!< DMAMUX1 DFSDM Filter0 request */
354 #define DMA_REQUEST_DFSDM1_FLT1 102U /*!< DMAMUX1 DFSDM Filter1 request */
355 #define DMA_REQUEST_DFSDM1_FLT2 103U /*!< DMAMUX1 DFSDM Filter2 request */
356 #define DMA_REQUEST_DFSDM1_FLT3 104U /*!< DMAMUX1 DFSDM Filter3 request */
358 #define DMA_REQUEST_TIM15_CH1 105U /*!< DMAMUX1 TIM15 CH1 request */
359 #define DMA_REQUEST_TIM15_UP 106U /*!< DMAMUX1 TIM15 UP request */
360 #define DMA_REQUEST_TIM15_TRIG 107U /*!< DMAMUX1 TIM15 TRIG request */
361 #define DMA_REQUEST_TIM15_COM 108U /*!< DMAMUX1 TIM15 COM request */
363 #define DMA_REQUEST_TIM16_CH1 109U /*!< DMAMUX1 TIM16 CH1 request */
364 #define DMA_REQUEST_TIM16_UP 110U /*!< DMAMUX1 TIM16 UP request */
366 #define DMA_REQUEST_TIM17_CH1 111U /*!< DMAMUX1 TIM17 CH1 request */
367 #define DMA_REQUEST_TIM17_UP 112U /*!< DMAMUX1 TIM17 UP request */
369 #if defined(SAI3)
370 #define DMA_REQUEST_SAI3_A 113U /*!< DMAMUX1 SAI3 A request */
371 #define DMA_REQUEST_SAI3_B 114U /*!< DMAMUX1 SAI3 B request */
372 #endif /* SAI3 */
374 #if defined(ADC3)
375 #define DMA_REQUEST_ADC3 115U /*!< DMAMUX1 ADC3 request */
376 #endif /* ADC3 */
378 #if defined(UART9)
379 #define DMA_REQUEST_UART9_RX 116U /*!< DMAMUX1 UART9 request */
380 #define DMA_REQUEST_UART9_TX 117U /*!< DMAMUX1 UART9 request */
381 #endif /* UART9 */
383 #if defined(USART10)
384 #define DMA_REQUEST_USART10_RX 118U /*!< DMAMUX1 USART10 request */
385 #define DMA_REQUEST_USART10_TX 119U /*!< DMAMUX1 USART10 request */
386 #endif /* USART10 */
389 /* DMAMUX2 requests */
390 #define BDMA_REQUEST_MEM2MEM 0U /*!< memory to memory transfer */
391 #define BDMA_REQUEST_GENERATOR0 1U /*!< DMAMUX2 request generator 0 */
392 #define BDMA_REQUEST_GENERATOR1 2U /*!< DMAMUX2 request generator 1 */
393 #define BDMA_REQUEST_GENERATOR2 3U /*!< DMAMUX2 request generator 2 */
394 #define BDMA_REQUEST_GENERATOR3 4U /*!< DMAMUX2 request generator 3 */
395 #define BDMA_REQUEST_GENERATOR4 5U /*!< DMAMUX2 request generator 4 */
396 #define BDMA_REQUEST_GENERATOR5 6U /*!< DMAMUX2 request generator 5 */
397 #define BDMA_REQUEST_GENERATOR6 7U /*!< DMAMUX2 request generator 6 */
398 #define BDMA_REQUEST_GENERATOR7 8U /*!< DMAMUX2 request generator 7 */
399 #define BDMA_REQUEST_LPUART1_RX 9U /*!< DMAMUX2 LP_UART1_RX request */
400 #define BDMA_REQUEST_LPUART1_TX 10U /*!< DMAMUX2 LP_UART1_TX request */
401 #define BDMA_REQUEST_SPI6_RX 11U /*!< DMAMUX2 SPI6 RX request */
402 #define BDMA_REQUEST_SPI6_TX 12U /*!< DMAMUX2 SPI6 TX request */
403 #define BDMA_REQUEST_I2C4_RX 13U /*!< DMAMUX2 I2C4 RX request */
404 #define BDMA_REQUEST_I2C4_TX 14U /*!< DMAMUX2 I2C4 TX request */
405 #if defined(SAI4)
406 #define BDMA_REQUEST_SAI4_A 15U /*!< DMAMUX2 SAI4 A request */
407 #define BDMA_REQUEST_SAI4_B 16U /*!< DMAMUX2 SAI4 B request */
408 #endif /* SAI4 */
409 #if defined(ADC3)
410 #define BDMA_REQUEST_ADC3 17U /*!< DMAMUX2 ADC3 request */
411 #endif /* ADC3 */
412 #if defined(DAC2)
413 #define BDMA_REQUEST_DAC2_CH1 17U /*!< DMAMUX2 DAC2 CH1 request */
414 #endif /* DAC2 */
415 #if defined(DFSDM2_Channel0)
416 #define BDMA_REQUEST_DFSDM2_FLT0 18U /*!< DMAMUX2 DFSDM2 request */
417 #endif /* DFSDM1_Channel0 */
420 * @}
423 /** @defgroup DMA_Data_transfer_direction DMA Data transfer direction
424 * @brief DMA data transfer direction
425 * @{
427 #define DMA_PERIPH_TO_MEMORY ((uint32_t)0x00000000U) /*!< Peripheral to memory direction */
428 #define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_SxCR_DIR_0) /*!< Memory to peripheral direction */
429 #define DMA_MEMORY_TO_MEMORY ((uint32_t)DMA_SxCR_DIR_1) /*!< Memory to memory direction */
431 * @}
434 /** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode
435 * @brief DMA peripheral incremented mode
436 * @{
438 #define DMA_PINC_ENABLE ((uint32_t)DMA_SxCR_PINC) /*!< Peripheral increment mode enable */
439 #define DMA_PINC_DISABLE ((uint32_t)0x00000000U) /*!< Peripheral increment mode disable */
441 * @}
444 /** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode
445 * @brief DMA memory incremented mode
446 * @{
448 #define DMA_MINC_ENABLE ((uint32_t)DMA_SxCR_MINC) /*!< Memory increment mode enable */
449 #define DMA_MINC_DISABLE ((uint32_t)0x00000000U) /*!< Memory increment mode disable */
451 * @}
454 /** @defgroup DMA_Peripheral_data_size DMA Peripheral data size
455 * @brief DMA peripheral data size
456 * @{
458 #define DMA_PDATAALIGN_BYTE ((uint32_t)0x00000000U) /*!< Peripheral data alignment: Byte */
459 #define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */
460 #define DMA_PDATAALIGN_WORD ((uint32_t)DMA_SxCR_PSIZE_1) /*!< Peripheral data alignment: Word */
462 * @}
465 /** @defgroup DMA_Memory_data_size DMA Memory data size
466 * @brief DMA memory data size
467 * @{
469 #define DMA_MDATAALIGN_BYTE ((uint32_t)0x00000000U) /*!< Memory data alignment: Byte */
470 #define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_MSIZE_0) /*!< Memory data alignment: HalfWord */
471 #define DMA_MDATAALIGN_WORD ((uint32_t)DMA_SxCR_MSIZE_1) /*!< Memory data alignment: Word */
473 * @}
476 /** @defgroup DMA_mode DMA mode
477 * @brief DMA mode
478 * @{
480 #define DMA_NORMAL ((uint32_t)0x00000000U) /*!< Normal mode */
481 #define DMA_CIRCULAR ((uint32_t)DMA_SxCR_CIRC) /*!< Circular mode */
482 #define DMA_PFCTRL ((uint32_t)DMA_SxCR_PFCTRL) /*!< Peripheral flow control mode */
483 #define DMA_DOUBLE_BUFFER_M0 ((uint32_t)DMA_SxCR_DBM) /*!< Double buffer mode with first target memory M0 */
484 #define DMA_DOUBLE_BUFFER_M1 ((uint32_t)(DMA_SxCR_DBM | DMA_SxCR_CT)) /*!< Double buffer mode with first target memory M1 */
486 * @}
489 /** @defgroup DMA_Priority_level DMA Priority level
490 * @brief DMA priority levels
491 * @{
493 #define DMA_PRIORITY_LOW ((uint32_t)0x00000000U) /*!< Priority level: Low */
494 #define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_SxCR_PL_0) /*!< Priority level: Medium */
495 #define DMA_PRIORITY_HIGH ((uint32_t)DMA_SxCR_PL_1) /*!< Priority level: High */
496 #define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_SxCR_PL) /*!< Priority level: Very High */
498 * @}
501 /** @defgroup DMA_FIFO_direct_mode DMA FIFO direct mode
502 * @brief DMA FIFO direct mode
503 * @{
505 #define DMA_FIFOMODE_DISABLE ((uint32_t)0x00000000U) /*!< FIFO mode disable */
506 #define DMA_FIFOMODE_ENABLE ((uint32_t)DMA_SxFCR_DMDIS) /*!< FIFO mode enable */
508 * @}
511 /** @defgroup DMA_FIFO_threshold_level DMA FIFO threshold level
512 * @brief DMA FIFO level
513 * @{
515 #define DMA_FIFO_THRESHOLD_1QUARTERFULL ((uint32_t)0x00000000U) /*!< FIFO threshold 1 quart full configuration */
516 #define DMA_FIFO_THRESHOLD_HALFFULL ((uint32_t)DMA_SxFCR_FTH_0) /*!< FIFO threshold half full configuration */
517 #define DMA_FIFO_THRESHOLD_3QUARTERSFULL ((uint32_t)DMA_SxFCR_FTH_1) /*!< FIFO threshold 3 quarts full configuration */
518 #define DMA_FIFO_THRESHOLD_FULL ((uint32_t)DMA_SxFCR_FTH) /*!< FIFO threshold full configuration */
520 * @}
523 /** @defgroup DMA_Memory_burst DMA Memory burst
524 * @brief DMA memory burst
525 * @{
527 #define DMA_MBURST_SINGLE ((uint32_t)0x00000000U)
528 #define DMA_MBURST_INC4 ((uint32_t)DMA_SxCR_MBURST_0)
529 #define DMA_MBURST_INC8 ((uint32_t)DMA_SxCR_MBURST_1)
530 #define DMA_MBURST_INC16 ((uint32_t)DMA_SxCR_MBURST)
532 * @}
535 /** @defgroup DMA_Peripheral_burst DMA Peripheral burst
536 * @brief DMA peripheral burst
537 * @{
539 #define DMA_PBURST_SINGLE ((uint32_t)0x00000000U)
540 #define DMA_PBURST_INC4 ((uint32_t)DMA_SxCR_PBURST_0)
541 #define DMA_PBURST_INC8 ((uint32_t)DMA_SxCR_PBURST_1)
542 #define DMA_PBURST_INC16 ((uint32_t)DMA_SxCR_PBURST)
544 * @}
547 /** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions
548 * @brief DMA interrupts definition
549 * @{
551 #define DMA_IT_TC ((uint32_t)DMA_SxCR_TCIE)
552 #define DMA_IT_HT ((uint32_t)DMA_SxCR_HTIE)
553 #define DMA_IT_TE ((uint32_t)DMA_SxCR_TEIE)
554 #define DMA_IT_DME ((uint32_t)DMA_SxCR_DMEIE)
555 #define DMA_IT_FE ((uint32_t)0x00000080U)
557 * @}
560 /** @defgroup DMA_flag_definitions DMA flag definitions
561 * @brief DMA flag definitions
562 * @{
564 #define DMA_FLAG_FEIF0_4 ((uint32_t)0x00000001U)
565 #define DMA_FLAG_DMEIF0_4 ((uint32_t)0x00000004U)
566 #define DMA_FLAG_TEIF0_4 ((uint32_t)0x00000008U)
567 #define DMA_FLAG_HTIF0_4 ((uint32_t)0x00000010U)
568 #define DMA_FLAG_TCIF0_4 ((uint32_t)0x00000020U)
569 #define DMA_FLAG_FEIF1_5 ((uint32_t)0x00000040U)
570 #define DMA_FLAG_DMEIF1_5 ((uint32_t)0x00000100U)
571 #define DMA_FLAG_TEIF1_5 ((uint32_t)0x00000200U)
572 #define DMA_FLAG_HTIF1_5 ((uint32_t)0x00000400U)
573 #define DMA_FLAG_TCIF1_5 ((uint32_t)0x00000800U)
574 #define DMA_FLAG_FEIF2_6 ((uint32_t)0x00010000U)
575 #define DMA_FLAG_DMEIF2_6 ((uint32_t)0x00040000U)
576 #define DMA_FLAG_TEIF2_6 ((uint32_t)0x00080000U)
577 #define DMA_FLAG_HTIF2_6 ((uint32_t)0x00100000U)
578 #define DMA_FLAG_TCIF2_6 ((uint32_t)0x00200000U)
579 #define DMA_FLAG_FEIF3_7 ((uint32_t)0x00400000U)
580 #define DMA_FLAG_DMEIF3_7 ((uint32_t)0x01000000U)
581 #define DMA_FLAG_TEIF3_7 ((uint32_t)0x02000000U)
582 #define DMA_FLAG_HTIF3_7 ((uint32_t)0x04000000U)
583 #define DMA_FLAG_TCIF3_7 ((uint32_t)0x08000000U)
585 * @}
588 /** @defgroup BDMA_flag_definitions BDMA flag definitions
589 * @brief BDMA flag definitions
590 * @{
592 #define BDMA_FLAG_GL0 ((uint32_t)0x00000001)
593 #define BDMA_FLAG_TC0 ((uint32_t)0x00000002)
594 #define BDMA_FLAG_HT0 ((uint32_t)0x00000004)
595 #define BDMA_FLAG_TE0 ((uint32_t)0x00000008)
596 #define BDMA_FLAG_GL1 ((uint32_t)0x00000010)
597 #define BDMA_FLAG_TC1 ((uint32_t)0x00000020)
598 #define BDMA_FLAG_HT1 ((uint32_t)0x00000040)
599 #define BDMA_FLAG_TE1 ((uint32_t)0x00000080)
600 #define BDMA_FLAG_GL2 ((uint32_t)0x00000100)
601 #define BDMA_FLAG_TC2 ((uint32_t)0x00000200)
602 #define BDMA_FLAG_HT2 ((uint32_t)0x00000400)
603 #define BDMA_FLAG_TE2 ((uint32_t)0x00000800)
604 #define BDMA_FLAG_GL3 ((uint32_t)0x00001000)
605 #define BDMA_FLAG_TC3 ((uint32_t)0x00002000)
606 #define BDMA_FLAG_HT3 ((uint32_t)0x00004000)
607 #define BDMA_FLAG_TE3 ((uint32_t)0x00008000)
608 #define BDMA_FLAG_GL4 ((uint32_t)0x00010000)
609 #define BDMA_FLAG_TC4 ((uint32_t)0x00020000)
610 #define BDMA_FLAG_HT4 ((uint32_t)0x00040000)
611 #define BDMA_FLAG_TE4 ((uint32_t)0x00080000)
612 #define BDMA_FLAG_GL5 ((uint32_t)0x00100000)
613 #define BDMA_FLAG_TC5 ((uint32_t)0x00200000)
614 #define BDMA_FLAG_HT5 ((uint32_t)0x00400000)
615 #define BDMA_FLAG_TE5 ((uint32_t)0x00800000)
616 #define BDMA_FLAG_GL6 ((uint32_t)0x01000000)
617 #define BDMA_FLAG_TC6 ((uint32_t)0x02000000)
618 #define BDMA_FLAG_HT6 ((uint32_t)0x04000000)
619 #define BDMA_FLAG_TE6 ((uint32_t)0x08000000)
620 #define BDMA_FLAG_GL7 ((uint32_t)0x10000000)
621 #define BDMA_FLAG_TC7 ((uint32_t)0x20000000)
622 #define BDMA_FLAG_HT7 ((uint32_t)0x40000000)
623 #define BDMA_FLAG_TE7 ((uint32_t)0x80000000)
626 * @}
630 * @}
633 /* Exported macro ------------------------------------------------------------*/
634 /** @defgroup DMA_Exported_Macros DMA Exported Macros
635 * @{
638 /** @brief Reset DMA handle state
639 * @param __HANDLE__: specifies the DMA handle.
640 * @retval None
642 #define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET)
645 * @brief Return the current DMA Stream FIFO filled level.
646 * @param __HANDLE__: DMA handle
647 * @retval The FIFO filling state.
648 * - DMA_FIFOStatus_Less1QuarterFull: when FIFO is less than 1 quarter-full
649 * and not empty.
650 * - DMA_FIFOStatus_1QuarterFull: if more than 1 quarter-full.
651 * - DMA_FIFOStatus_HalfFull: if more than 1 half-full.
652 * - DMA_FIFOStatus_3QuartersFull: if more than 3 quarters-full.
653 * - DMA_FIFOStatus_Empty: when FIFO is empty
654 * - DMA_FIFOStatus_Full: when FIFO is full
656 #define __HAL_DMA_GET_FS(__HANDLE__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR & (DMA_SxFCR_FS)) : 0)
659 * @brief Enable the specified DMA Stream.
660 * @param __HANDLE__: DMA handle
661 * @retval None
663 #define __HAL_DMA_ENABLE(__HANDLE__) \
664 ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR |= DMA_SxCR_EN) : \
665 (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR |= BDMA_CCR_EN))
668 * @brief Disable the specified DMA Stream.
669 * @param __HANDLE__: DMA handle
670 * @retval None
672 #define __HAL_DMA_DISABLE(__HANDLE__) \
673 ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR &= ~DMA_SxCR_EN) : \
674 (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR &= ~BDMA_CCR_EN))
676 /* Interrupt & Flag management */
679 * @brief Return the current DMA Stream transfer complete flag.
680 * @param __HANDLE__: DMA handle
681 * @retval The specified transfer complete flag index.
683 #if defined(BDMA1)
684 #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
685 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TCIF0_4 :\
686 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TCIF0_4 :\
687 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TCIF0_4 :\
688 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TCIF0_4 :\
689 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TCIF1_5 :\
690 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TCIF1_5 :\
691 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TCIF1_5 :\
692 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TCIF1_5 :\
693 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TCIF2_6 :\
694 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TCIF2_6 :\
695 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TCIF2_6 :\
696 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TCIF2_6 :\
697 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_TCIF3_7 :\
698 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_TCIF3_7 :\
699 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_TCIF3_7 :\
700 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_TCIF3_7 :\
701 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel0))? BDMA_FLAG_TC0 :\
702 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel0))? BDMA_FLAG_TC0 :\
703 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel1))? BDMA_FLAG_TC1 :\
704 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel1))? BDMA_FLAG_TC1 :\
705 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel2))? BDMA_FLAG_TC2 :\
706 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel2))? BDMA_FLAG_TC2 :\
707 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel3))? BDMA_FLAG_TC3 :\
708 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel3))? BDMA_FLAG_TC3 :\
709 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel4))? BDMA_FLAG_TC4 :\
710 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel4))? BDMA_FLAG_TC4 :\
711 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel5))? BDMA_FLAG_TC5 :\
712 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel5))? BDMA_FLAG_TC5 :\
713 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel6))? BDMA_FLAG_TC6 :\
714 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel6))? BDMA_FLAG_TC6 :\
715 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel7))? BDMA_FLAG_TC7 :\
716 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel7))? BDMA_FLAG_TC7 :\
717 (uint32_t)0x00000000)
718 #else
719 #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
720 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TCIF0_4 :\
721 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TCIF0_4 :\
722 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TCIF0_4 :\
723 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TCIF0_4 :\
724 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TCIF1_5 :\
725 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TCIF1_5 :\
726 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TCIF1_5 :\
727 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TCIF1_5 :\
728 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TCIF2_6 :\
729 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TCIF2_6 :\
730 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TCIF2_6 :\
731 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TCIF2_6 :\
732 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_TCIF3_7 :\
733 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_TCIF3_7 :\
734 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_TCIF3_7 :\
735 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_TCIF3_7 :\
736 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_TC0 :\
737 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_TC1 :\
738 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_TC2 :\
739 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_TC3 :\
740 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_TC4 :\
741 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_TC5 :\
742 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_TC6 :\
743 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_TC7 :\
744 (uint32_t)0x00000000)
745 #endif /* BDMA1 */
748 * @brief Return the current DMA Stream half transfer complete flag.
749 * @param __HANDLE__: DMA handle
750 * @retval The specified half transfer complete flag index.
752 #if defined(BDMA1)
753 #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
754 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_HTIF0_4 :\
755 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_HTIF0_4 :\
756 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_HTIF0_4 :\
757 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_HTIF0_4 :\
758 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_HTIF1_5 :\
759 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_HTIF1_5 :\
760 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_HTIF1_5 :\
761 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_HTIF1_5 :\
762 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_HTIF2_6 :\
763 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_HTIF2_6 :\
764 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_HTIF2_6 :\
765 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_HTIF2_6 :\
766 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_HTIF3_7 :\
767 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_HTIF3_7 :\
768 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_HTIF3_7 :\
769 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_HTIF3_7 :\
770 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel0))? BDMA_FLAG_HT0 :\
771 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel0))? BDMA_FLAG_HT0 :\
772 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel1))? BDMA_FLAG_HT1 :\
773 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel1))? BDMA_FLAG_HT1 :\
774 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel2))? BDMA_FLAG_HT2 :\
775 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel2))? BDMA_FLAG_HT2 :\
776 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel3))? BDMA_FLAG_HT3 :\
777 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel3))? BDMA_FLAG_HT3 :\
778 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel4))? BDMA_FLAG_HT4 :\
779 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel4))? BDMA_FLAG_HT4 :\
780 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel5))? BDMA_FLAG_HT5 :\
781 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel5))? BDMA_FLAG_HT5 :\
782 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel6))? BDMA_FLAG_HT6 :\
783 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel6))? BDMA_FLAG_HT6 :\
784 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel7))? BDMA_FLAG_HT7 :\
785 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel7))? BDMA_FLAG_HT7 :\
786 (uint32_t)0x00000000)
787 #else
788 #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
789 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_HTIF0_4 :\
790 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_HTIF0_4 :\
791 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_HTIF0_4 :\
792 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_HTIF0_4 :\
793 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_HTIF1_5 :\
794 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_HTIF1_5 :\
795 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_HTIF1_5 :\
796 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_HTIF1_5 :\
797 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_HTIF2_6 :\
798 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_HTIF2_6 :\
799 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_HTIF2_6 :\
800 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_HTIF2_6 :\
801 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_HTIF3_7 :\
802 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_HTIF3_7 :\
803 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_HTIF3_7 :\
804 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_HTIF3_7 :\
805 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_HT0 :\
806 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_HT1 :\
807 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_HT2 :\
808 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_HT3 :\
809 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_HT4 :\
810 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_HT5 :\
811 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_HT6 :\
812 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_HT7 :\
813 (uint32_t)0x00000000)
814 #endif /* BDMA1 */
817 * @brief Return the current DMA Stream transfer error flag.
818 * @param __HANDLE__: DMA handle
819 * @retval The specified transfer error flag index.
821 #if defined(BDMA1)
822 #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
823 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TEIF0_4 :\
824 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TEIF0_4 :\
825 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TEIF0_4 :\
826 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TEIF0_4 :\
827 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TEIF1_5 :\
828 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TEIF1_5 :\
829 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TEIF1_5 :\
830 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TEIF1_5 :\
831 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TEIF2_6 :\
832 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TEIF2_6 :\
833 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TEIF2_6 :\
834 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TEIF2_6 :\
835 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_TEIF3_7 :\
836 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_TEIF3_7 :\
837 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_TEIF3_7 :\
838 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_TEIF3_7 :\
839 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel0))? BDMA_FLAG_TE0 :\
840 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel0))? BDMA_FLAG_TE0 :\
841 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel1))? BDMA_FLAG_TE1 :\
842 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel1))? BDMA_FLAG_TE1 :\
843 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel2))? BDMA_FLAG_TE2 :\
844 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel2))? BDMA_FLAG_TE2 :\
845 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel3))? BDMA_FLAG_TE3 :\
846 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel3))? BDMA_FLAG_TE3 :\
847 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel4))? BDMA_FLAG_TE4 :\
848 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel4))? BDMA_FLAG_TE4 :\
849 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel5))? BDMA_FLAG_TE5 :\
850 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel5))? BDMA_FLAG_TE5 :\
851 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel6))? BDMA_FLAG_TE6 :\
852 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel6))? BDMA_FLAG_TE6 :\
853 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel7))? BDMA_FLAG_TE7 :\
854 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel7))? BDMA_FLAG_TE7 :\
855 (uint32_t)0x00000000)
856 #else
857 #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
858 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TEIF0_4 :\
859 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TEIF0_4 :\
860 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TEIF0_4 :\
861 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TEIF0_4 :\
862 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TEIF1_5 :\
863 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TEIF1_5 :\
864 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TEIF1_5 :\
865 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TEIF1_5 :\
866 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TEIF2_6 :\
867 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TEIF2_6 :\
868 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TEIF2_6 :\
869 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TEIF2_6 :\
870 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_TEIF3_7 :\
871 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_TEIF3_7 :\
872 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_TEIF3_7 :\
873 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_TEIF3_7 :\
874 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_TE0 :\
875 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_TE1 :\
876 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_TE2 :\
877 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_TE3 :\
878 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_TE4 :\
879 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_TE5 :\
880 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_TE6 :\
881 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_TE7 :\
882 (uint32_t)0x00000000)
883 #endif /* BDMA1 */
886 * @brief Return the current DMA Stream FIFO error flag.
887 * @param __HANDLE__: DMA handle
888 * @retval The specified FIFO error flag index.
890 #define __HAL_DMA_GET_FE_FLAG_INDEX(__HANDLE__)\
891 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_FEIF0_4 :\
892 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_FEIF0_4 :\
893 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_FEIF0_4 :\
894 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_FEIF0_4 :\
895 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_FEIF1_5 :\
896 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_FEIF1_5 :\
897 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_FEIF1_5 :\
898 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_FEIF1_5 :\
899 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_FEIF2_6 :\
900 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_FEIF2_6 :\
901 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_FEIF2_6 :\
902 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_FEIF2_6 :\
903 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_FEIF3_7 :\
904 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_FEIF3_7 :\
905 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_FEIF3_7 :\
906 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_FEIF3_7 :\
907 (uint32_t)0x00000000)
910 * @brief Return the current DMA Stream direct mode error flag.
911 * @param __HANDLE__: DMA handle
912 * @retval The specified direct mode error flag index.
914 #define __HAL_DMA_GET_DME_FLAG_INDEX(__HANDLE__)\
915 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_DMEIF0_4 :\
916 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_DMEIF0_4 :\
917 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_DMEIF0_4 :\
918 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_DMEIF0_4 :\
919 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_DMEIF1_5 :\
920 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_DMEIF1_5 :\
921 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_DMEIF1_5 :\
922 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_DMEIF1_5 :\
923 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_DMEIF2_6 :\
924 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_DMEIF2_6 :\
925 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_DMEIF2_6 :\
926 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_DMEIF2_6 :\
927 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream3))? DMA_FLAG_DMEIF3_7 :\
928 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_DMEIF3_7 :\
929 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_DMEIF3_7 :\
930 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_DMEIF3_7 :\
931 (uint32_t)0x00000000)
934 * @brief Returns the current BDMA Channel Global interrupt flag.
935 * @param __HANDLE__: DMA handle
936 * @retval The specified transfer error flag index.
938 #if defined(BDMA1)
939 #define __HAL_BDMA_GET_GI_FLAG_INDEX(__HANDLE__)\
940 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel0))? BDMA_ISR_GIF0 :\
941 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel0))? BDMA_ISR_GIF0 :\
942 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel1))? BDMA_ISR_GIF1 :\
943 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel1))? BDMA_ISR_GIF1 :\
944 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel2))? BDMA_ISR_GIF2 :\
945 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel2))? BDMA_ISR_GIF2 :\
946 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel3))? BDMA_ISR_GIF3 :\
947 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel3))? BDMA_ISR_GIF3 :\
948 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel4))? BDMA_ISR_GIF4 :\
949 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel4))? BDMA_ISR_GIF4 :\
950 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel5))? BDMA_ISR_GIF5 :\
951 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel5))? BDMA_ISR_GIF5 :\
952 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel6))? BDMA_ISR_GIF6 :\
953 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel6))? BDMA_ISR_GIF6 :\
954 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA1_Channel7))? BDMA_ISR_GIF7 :\
955 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA2_Channel7))? BDMA_ISR_GIF7 :\
956 (uint32_t)0x00000000)
957 #else
958 #define __HAL_BDMA_GET_GI_FLAG_INDEX(__HANDLE__)\
959 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_ISR_GIF0 :\
960 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_ISR_GIF1 :\
961 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_ISR_GIF2 :\
962 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_ISR_GIF3 :\
963 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_ISR_GIF4 :\
964 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_ISR_GIF5 :\
965 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_ISR_GIF6 :\
966 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_ISR_GIF7 :\
967 (uint32_t)0x00000000)
968 #endif /* BDMA1 */
971 * @brief Get the DMA Stream pending flags.
972 * @param __HANDLE__: DMA handle
973 * @param __FLAG__: Get the specified flag.
974 * This parameter can be any combination of the following values:
975 * @arg DMA_FLAG_TCIFx: Transfer complete flag.
976 * @arg DMA_FLAG_HTIFx: Half transfer complete flag.
977 * @arg DMA_FLAG_TEIFx: Transfer error flag.
978 * @arg DMA_FLAG_DMEIFx: Direct mode error flag.
979 * @arg DMA_FLAG_FEIFx: FIFO error flag.
980 * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag.
981 * @retval The state of FLAG (SET or RESET).
983 #if defined(BDMA1)
984 #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__)\
985 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)BDMA1_Channel7)? (BDMA2->ISR & (__FLAG__)) :\
986 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream7 )? (BDMA1->ISR & (__FLAG__)) :\
987 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3 )? (DMA2->HISR & (__FLAG__)) :\
988 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7 )? (DMA2->LISR & (__FLAG__)) :\
989 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3 )? (DMA1->HISR & (__FLAG__)) : (DMA1->LISR & (__FLAG__)))
990 #else
991 #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__)\
992 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream7)? (BDMA->ISR & (__FLAG__)) :\
993 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HISR & (__FLAG__)) :\
994 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LISR & (__FLAG__)) :\
995 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HISR & (__FLAG__)) : (DMA1->LISR & (__FLAG__)))
996 #endif /* BDMA1 */
999 * @brief Clear the DMA Stream pending flags.
1000 * @param __HANDLE__: DMA handle
1001 * @param __FLAG__: specifies the flag to clear.
1002 * This parameter can be any combination of the following values:
1003 * @arg DMA_FLAG_TCIFx: Transfer complete flag.
1004 * @arg DMA_FLAG_HTIFx: Half transfer complete flag.
1005 * @arg DMA_FLAG_TEIFx: Transfer error flag.
1006 * @arg DMA_FLAG_DMEIFx: Direct mode error flag.
1007 * @arg DMA_FLAG_FEIFx: FIFO error flag.
1008 * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag.
1009 * @retval None
1011 #if defined(BDMA1)
1012 #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \
1013 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)BDMA1_Channel7)? (BDMA2->IFCR = (__FLAG__)) :\
1014 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream7)? (BDMA1->IFCR = (__FLAG__)) :\
1015 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HIFCR = (__FLAG__)) :\
1016 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LIFCR = (__FLAG__)) :\
1017 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HIFCR = (__FLAG__)) : (DMA1->LIFCR = (__FLAG__)))
1018 #else
1019 #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \
1020 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream7)? (BDMA->IFCR = (__FLAG__)) :\
1021 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HIFCR = (__FLAG__)) :\
1022 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LIFCR = (__FLAG__)) :\
1023 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HIFCR = (__FLAG__)) : (DMA1->LIFCR = (__FLAG__)))
1024 #endif /* BDMA1 */
1026 #define DMA_TO_BDMA_IT(__DMA_IT__) \
1027 ((((__DMA_IT__) & (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)) == (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)) ? (BDMA_CCR_TCIE | BDMA_CCR_HTIE |BDMA_CCR_TEIE) :\
1028 (((__DMA_IT__) & (DMA_IT_TC | DMA_IT_HT)) == (DMA_IT_TC | DMA_IT_HT)) ? (BDMA_CCR_TCIE | BDMA_CCR_HTIE) :\
1029 (((__DMA_IT__) & (DMA_IT_HT | DMA_IT_TE)) == (DMA_IT_HT | DMA_IT_TE)) ? (BDMA_CCR_HTIE |BDMA_CCR_TEIE) :\
1030 (((__DMA_IT__) & (DMA_IT_TC | DMA_IT_TE)) == (DMA_IT_TC | DMA_IT_TE)) ? (BDMA_CCR_TCIE |BDMA_CCR_TEIE) :\
1031 ((__DMA_IT__) == DMA_IT_TC) ? BDMA_CCR_TCIE :\
1032 ((__DMA_IT__) == DMA_IT_HT) ? BDMA_CCR_HTIE :\
1033 ((__DMA_IT__) == DMA_IT_TE) ? BDMA_CCR_TEIE :\
1034 (uint32_t)0x00000000)
1037 #define __HAL_BDMA_CHANNEL_ENABLE_IT(__HANDLE__, __INTERRUPT__) \
1038 (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR |= (DMA_TO_BDMA_IT(__INTERRUPT__)))
1040 #define __HAL_DMA_STREAM_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
1041 (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR |= (__INTERRUPT__)) : (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR |= (__INTERRUPT__)))
1044 * @brief Enable the specified DMA Stream interrupts.
1045 * @param __HANDLE__: DMA handle
1046 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
1047 * This parameter can be one of the following values:
1048 * @arg DMA_IT_TC: Transfer complete interrupt mask.
1049 * @arg DMA_IT_HT: Half transfer complete interrupt mask.
1050 * @arg DMA_IT_TE: Transfer error interrupt mask.
1051 * @arg DMA_IT_FE: FIFO error interrupt mask.
1052 * @arg DMA_IT_DME: Direct mode error interrupt.
1053 * @retval None
1055 #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))?\
1056 (__HAL_DMA_STREAM_ENABLE_IT((__HANDLE__), (__INTERRUPT__))) :\
1057 (__HAL_BDMA_CHANNEL_ENABLE_IT((__HANDLE__), (__INTERRUPT__))))
1060 #define __HAL_BDMA_CHANNEL_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR &= ~(DMA_TO_BDMA_IT(__INTERRUPT__)))
1062 #define __HAL_DMA_STREAM_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
1063 (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR &= ~(__INTERRUPT__)) : (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR &= ~(__INTERRUPT__)))
1066 * @brief Disable the specified DMA Stream interrupts.
1067 * @param __HANDLE__: DMA handle
1068 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
1069 * This parameter can be one of the following values:
1070 * @arg DMA_IT_TC: Transfer complete interrupt mask.
1071 * @arg DMA_IT_HT: Half transfer complete interrupt mask.
1072 * @arg DMA_IT_TE: Transfer error interrupt mask.
1073 * @arg DMA_IT_FE: FIFO error interrupt mask.
1074 * @arg DMA_IT_DME: Direct mode error interrupt.
1075 * @retval None
1077 #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))?\
1078 (__HAL_DMA_STREAM_DISABLE_IT((__HANDLE__), (__INTERRUPT__))) :\
1079 (__HAL_BDMA_CHANNEL_DISABLE_IT((__HANDLE__), (__INTERRUPT__))))
1082 #define __HAL_BDMA_CHANNEL_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR & (DMA_TO_BDMA_IT(__INTERRUPT__))))
1084 #define __HAL_DMA_STREAM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
1085 (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR & (__INTERRUPT__)) : \
1086 (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR & (__INTERRUPT__)))
1089 * @brief Check whether the specified DMA Stream interrupt is enabled or not.
1090 * @param __HANDLE__: DMA handle
1091 * @param __INTERRUPT__: specifies the DMA interrupt source to check.
1092 * This parameter can be one of the following values:
1093 * @arg DMA_IT_TC: Transfer complete interrupt mask.
1094 * @arg DMA_IT_HT: Half transfer complete interrupt mask.
1095 * @arg DMA_IT_TE: Transfer error interrupt mask.
1096 * @arg DMA_IT_FE: FIFO error interrupt mask.
1097 * @arg DMA_IT_DME: Direct mode error interrupt.
1098 * @retval The state of DMA_IT.
1100 #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? \
1101 (__HAL_DMA_STREAM_GET_IT_SOURCE((__HANDLE__), (__INTERRUPT__))) :\
1102 (__HAL_BDMA_CHANNEL_GET_IT_SOURCE((__HANDLE__), (__INTERRUPT__))))
1105 * @brief Writes the number of data units to be transferred on the DMA Stream.
1106 * @param __HANDLE__: DMA handle
1107 * @param __COUNTER__: Number of data units to be transferred (from 0 to 65535)
1108 * Number of data items depends only on the Peripheral data format.
1110 * @note If Peripheral data format is Bytes: number of data units is equal
1111 * to total number of bytes to be transferred.
1113 * @note If Peripheral data format is Half-Word: number of data units is
1114 * equal to total number of bytes to be transferred / 2.
1116 * @note If Peripheral data format is Word: number of data units is equal
1117 * to total number of bytes to be transferred / 4.
1119 * @retval The number of remaining data units in the current DMAy Streamx transfer.
1121 #define __HAL_DMA_SET_COUNTER(__HANDLE__, __COUNTER__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? \
1122 (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->NDTR = (uint16_t)(__COUNTER__)) :\
1123 (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CNDTR = (uint16_t)(__COUNTER__)))
1126 * @brief Returns the number of remaining data units in the current DMAy Streamx transfer.
1127 * @param __HANDLE__: DMA handle
1129 * @retval The number of remaining data units in the current DMA Stream transfer.
1131 #define __HAL_DMA_GET_COUNTER(__HANDLE__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? \
1132 (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->NDTR) :\
1133 (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CNDTR))
1136 * @}
1139 /* Include DMA HAL Extension module */
1140 #include "stm32h7xx_hal_dma_ex.h"
1142 /* Exported functions --------------------------------------------------------*/
1144 /** @defgroup DMA_Exported_Functions DMA Exported Functions
1145 * @brief DMA Exported functions
1146 * @{
1149 /** @defgroup DMA_Exported_Functions_Group1 Initialization and de-initialization functions
1150 * @brief Initialization and de-initialization functions
1151 * @{
1153 HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma);
1154 HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma);
1156 * @}
1159 /** @defgroup DMA_Exported_Functions_Group2 I/O operation functions
1160 * @brief I/O operation functions
1161 * @{
1163 HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
1164 HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
1165 HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma);
1166 HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma);
1167 HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, HAL_DMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout);
1168 void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma);
1169 HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)(DMA_HandleTypeDef *_hdma));
1170 HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID);
1173 * @}
1176 /** @defgroup DMA_Exported_Functions_Group3 Peripheral State functions
1177 * @brief Peripheral State functions
1178 * @{
1180 HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma);
1181 uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma);
1183 * @}
1186 * @}
1188 /* Private Constants -------------------------------------------------------------*/
1189 /** @defgroup DMA_Private_Constants DMA Private Constants
1190 * @brief DMA private defines and constants
1191 * @{
1194 * @}
1197 /* Private macros ------------------------------------------------------------*/
1198 /** @defgroup DMA_Private_Macros DMA Private Macros
1199 * @brief DMA private macros
1200 * @{
1203 #if defined(ADC3)
1204 #define IS_DMA_REQUEST(REQUEST) (((REQUEST) <= DMA_REQUEST_ADC3))
1205 #else
1206 #define IS_DMA_REQUEST(REQUEST) (((REQUEST) <= DMA_REQUEST_USART10_TX))
1207 #endif /* ADC3 */
1209 #if defined(ADC3)
1210 #define IS_BDMA_REQUEST(REQUEST) (((REQUEST) <= BDMA_REQUEST_ADC3))
1211 #else
1212 #define IS_BDMA_REQUEST(REQUEST) (((REQUEST) <= BDMA_REQUEST_DFSDM2_FLT0))
1213 #endif /* ADC3 */
1215 #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \
1216 ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \
1217 ((DIRECTION) == DMA_MEMORY_TO_MEMORY))
1219 #define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x01U) && ((SIZE) < 0x10000U))
1221 #define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \
1222 ((STATE) == DMA_PINC_DISABLE))
1224 #define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \
1225 ((STATE) == DMA_MINC_DISABLE))
1227 #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \
1228 ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \
1229 ((SIZE) == DMA_PDATAALIGN_WORD))
1231 #define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \
1232 ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \
1233 ((SIZE) == DMA_MDATAALIGN_WORD ))
1235 #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \
1236 ((MODE) == DMA_CIRCULAR) || \
1237 ((MODE) == DMA_PFCTRL) || \
1238 ((MODE) == DMA_DOUBLE_BUFFER_M0) || \
1239 ((MODE) == DMA_DOUBLE_BUFFER_M1))
1241 #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \
1242 ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \
1243 ((PRIORITY) == DMA_PRIORITY_HIGH) || \
1244 ((PRIORITY) == DMA_PRIORITY_VERY_HIGH))
1246 #define IS_DMA_FIFO_MODE_STATE(STATE) (((STATE) == DMA_FIFOMODE_DISABLE ) || \
1247 ((STATE) == DMA_FIFOMODE_ENABLE))
1249 #define IS_DMA_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == DMA_FIFO_THRESHOLD_1QUARTERFULL ) || \
1250 ((THRESHOLD) == DMA_FIFO_THRESHOLD_HALFFULL) || \
1251 ((THRESHOLD) == DMA_FIFO_THRESHOLD_3QUARTERSFULL) || \
1252 ((THRESHOLD) == DMA_FIFO_THRESHOLD_FULL))
1254 #define IS_DMA_MEMORY_BURST(BURST) (((BURST) == DMA_MBURST_SINGLE) || \
1255 ((BURST) == DMA_MBURST_INC4) || \
1256 ((BURST) == DMA_MBURST_INC8) || \
1257 ((BURST) == DMA_MBURST_INC16))
1259 #define IS_DMA_PERIPHERAL_BURST(BURST) (((BURST) == DMA_PBURST_SINGLE) || \
1260 ((BURST) == DMA_PBURST_INC4) || \
1261 ((BURST) == DMA_PBURST_INC8) || \
1262 ((BURST) == DMA_PBURST_INC16))
1264 * @}
1267 /* Private functions ---------------------------------------------------------*/
1268 /** @defgroup DMA_Private_Functions DMA Private Functions
1269 * @brief DMA private functions
1270 * @{
1273 * @}
1277 * @}
1281 * @}
1284 #ifdef __cplusplus
1286 #endif
1288 #endif /* STM32H7xx_HAL_DMA_H */
1290 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/