2 ******************************************************************************
\r
3 * @file stm32l4xx_hal_dma_ex.h
\r
4 * @author MCD Application Team
\r
5 * @brief Header file of DMA HAL extension module.
\r
6 ******************************************************************************
\r
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
10 * All rights reserved.</center></h2>
\r
12 * This software component is licensed by ST under BSD 3-Clause license,
\r
13 * the "License"; You may not use this file except in compliance with the
\r
14 * License. You may obtain a copy of the License at:
\r
15 * opensource.org/licenses/BSD-3-Clause
\r
17 ******************************************************************************
\r
20 /* Define to prevent recursive inclusion -------------------------------------*/
\r
21 #ifndef STM32L4xx_HAL_DMA_EX_H
\r
22 #define STM32L4xx_HAL_DMA_EX_H
\r
28 #if defined(DMAMUX1)
\r
30 /* Includes ------------------------------------------------------------------*/
\r
31 #include "stm32l4xx_hal_def.h"
\r
33 /** @addtogroup STM32L4xx_HAL_Driver
\r
37 /** @addtogroup DMAEx
\r
41 /* Exported types ------------------------------------------------------------*/
\r
42 /** @defgroup DMAEx_Exported_Types DMAEx Exported Types
\r
47 * @brief HAL DMA Synchro definition
\r
52 * @brief HAL DMAMUX Synchronization configuration structure definition
\r
56 uint32_t SyncSignalID; /*!< Specifies the synchronization signal gating the DMA request in periodic mode.
\r
57 This parameter can be a value of @ref DMAEx_DMAMUX_SyncSignalID_selection */
\r
59 uint32_t SyncPolarity; /*!< Specifies the polarity of the signal on which the DMA request is synchronized.
\r
60 This parameter can be a value of @ref DMAEx_DMAMUX_SyncPolarity_selection */
\r
62 FunctionalState SyncEnable; /*!< Specifies if the synchronization shall be enabled or disabled
\r
63 This parameter can take the value ENABLE or DISABLE*/
\r
66 FunctionalState EventEnable; /*!< Specifies if an event shall be generated once the RequestNumber is reached.
\r
67 This parameter can take the value ENABLE or DISABLE */
\r
69 uint32_t RequestNumber; /*!< Specifies the number of DMA request that will be authorized after a sync event
\r
70 This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
\r
73 }HAL_DMA_MuxSyncConfigTypeDef;
\r
77 * @brief HAL DMAMUX request generator parameters structure definition
\r
81 uint32_t SignalID; /*!< Specifies the ID of the signal used for DMAMUX request generator
\r
82 This parameter can be a value of @ref DMAEx_DMAMUX_SignalGeneratorID_selection */
\r
84 uint32_t Polarity; /*!< Specifies the polarity of the signal on which the request is generated.
\r
85 This parameter can be a value of @ref DMAEx_DMAMUX_RequestGeneneratorPolarity_selection */
\r
87 uint32_t RequestNumber; /*!< Specifies the number of DMA request that will be generated after a signal event
\r
88 This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
\r
90 }HAL_DMA_MuxRequestGeneratorConfigTypeDef;
\r
96 /* Exported constants --------------------------------------------------------*/
\r
97 /** @defgroup DMAEx_Exported_Constants DMAEx Exported Constants
\r
101 /** @defgroup DMAEx_DMAMUX_SyncSignalID_selection DMAMUX SyncSignalID selection
\r
104 #define HAL_DMAMUX1_SYNC_EXTI0 0U /*!< Synchronization Signal is EXTI0 IT */
\r
105 #define HAL_DMAMUX1_SYNC_EXTI1 1U /*!< Synchronization Signal is EXTI1 IT */
\r
106 #define HAL_DMAMUX1_SYNC_EXTI2 2U /*!< Synchronization Signal is EXTI2 IT */
\r
107 #define HAL_DMAMUX1_SYNC_EXTI3 3U /*!< Synchronization Signal is EXTI3 IT */
\r
108 #define HAL_DMAMUX1_SYNC_EXTI4 4U /*!< Synchronization Signal is EXTI4 IT */
\r
109 #define HAL_DMAMUX1_SYNC_EXTI5 5U /*!< Synchronization Signal is EXTI5 IT */
\r
110 #define HAL_DMAMUX1_SYNC_EXTI6 6U /*!< Synchronization Signal is EXTI6 IT */
\r
111 #define HAL_DMAMUX1_SYNC_EXTI7 7U /*!< Synchronization Signal is EXTI7 IT */
\r
112 #define HAL_DMAMUX1_SYNC_EXTI8 8U /*!< Synchronization Signal is EXTI8 IT */
\r
113 #define HAL_DMAMUX1_SYNC_EXTI9 9U /*!< Synchronization Signal is EXTI9 IT */
\r
114 #define HAL_DMAMUX1_SYNC_EXTI10 10U /*!< Synchronization Signal is EXTI10 IT */
\r
115 #define HAL_DMAMUX1_SYNC_EXTI11 11U /*!< Synchronization Signal is EXTI11 IT */
\r
116 #define HAL_DMAMUX1_SYNC_EXTI12 12U /*!< Synchronization Signal is EXTI12 IT */
\r
117 #define HAL_DMAMUX1_SYNC_EXTI13 13U /*!< Synchronization Signal is EXTI13 IT */
\r
118 #define HAL_DMAMUX1_SYNC_EXTI14 14U /*!< Synchronization Signal is EXTI14 IT */
\r
119 #define HAL_DMAMUX1_SYNC_EXTI15 15U /*!< Synchronization Signal is EXTI15 IT */
\r
120 #define HAL_DMAMUX1_SYNC_DMAMUX1_CH0_EVT 16U /*!< Synchronization Signal is DMAMUX1 Channel0 Event */
\r
121 #define HAL_DMAMUX1_SYNC_DMAMUX1_CH1_EVT 17U /*!< Synchronization Signal is DMAMUX1 Channel1 Event */
\r
122 #define HAL_DMAMUX1_SYNC_DMAMUX1_CH2_EVT 18U /*!< Synchronization Signal is DMAMUX1 Channel2 Event */
\r
123 #define HAL_DMAMUX1_SYNC_DMAMUX1_CH3_EVT 19U /*!< Synchronization Signal is DMAMUX1 Channel3 Event */
\r
124 #define HAL_DMAMUX1_SYNC_LPTIM1_OUT 20U /*!< Synchronization Signal is LPTIM1 OUT */
\r
125 #define HAL_DMAMUX1_SYNC_LPTIM2_OUT 21U /*!< Synchronization Signal is LPTIM2 OUT */
\r
126 #define HAL_DMAMUX1_SYNC_DSI_TE 22U /*!< Synchronization Signal is DSI Tearing Effect */
\r
127 #define HAL_DMAMUX1_SYNC_DSI_EOT 23U /*!< Synchronization Signal is DSI End of refresh */
\r
128 #define HAL_DMAMUX1_SYNC_DMA2D_EOT 24U /*!< Synchronization Signal is DMA2D End of Transfer */
\r
129 #define HAL_DMAMUX1_SYNC_LDTC_IT 25U /*!< Synchronization Signal is LDTC IT */
\r
135 /** @defgroup DMAEx_DMAMUX_SyncPolarity_selection DMAMUX SyncPolarity selection
\r
138 #define HAL_DMAMUX_SYNC_NO_EVENT 0U /*!< block synchronization events */
\r
139 #define HAL_DMAMUX_SYNC_RISING DMAMUX_CxCR_SPOL_0 /*!< synchronize with rising edge events */
\r
140 #define HAL_DMAMUX_SYNC_FALLING DMAMUX_CxCR_SPOL_1 /*!< synchronize with falling edge events */
\r
141 #define HAL_DMAMUX_SYNC_RISING_FALLING DMAMUX_CxCR_SPOL /*!< synchronize with rising and falling edge events */
\r
147 /** @defgroup DMAEx_DMAMUX_SignalGeneratorID_selection DMAMUX SignalGeneratorID selection
\r
151 #define HAL_DMAMUX1_REQ_GEN_EXTI0 0U /*!< Request generator Signal is EXTI0 IT */
\r
152 #define HAL_DMAMUX1_REQ_GEN_EXTI1 1U /*!< Request generator Signal is EXTI1 IT */
\r
153 #define HAL_DMAMUX1_REQ_GEN_EXTI2 2U /*!< Request generator Signal is EXTI2 IT */
\r
154 #define HAL_DMAMUX1_REQ_GEN_EXTI3 3U /*!< Request generator Signal is EXTI3 IT */
\r
155 #define HAL_DMAMUX1_REQ_GEN_EXTI4 4U /*!< Request generator Signal is EXTI4 IT */
\r
156 #define HAL_DMAMUX1_REQ_GEN_EXTI5 5U /*!< Request generator Signal is EXTI5 IT */
\r
157 #define HAL_DMAMUX1_REQ_GEN_EXTI6 6U /*!< Request generator Signal is EXTI6 IT */
\r
158 #define HAL_DMAMUX1_REQ_GEN_EXTI7 7U /*!< Request generator Signal is EXTI7 IT */
\r
159 #define HAL_DMAMUX1_REQ_GEN_EXTI8 8U /*!< Request generator Signal is EXTI8 IT */
\r
160 #define HAL_DMAMUX1_REQ_GEN_EXTI9 9U /*!< Request generator Signal is EXTI9 IT */
\r
161 #define HAL_DMAMUX1_REQ_GEN_EXTI10 10U /*!< Request generator Signal is EXTI10 IT */
\r
162 #define HAL_DMAMUX1_REQ_GEN_EXTI11 11U /*!< Request generator Signal is EXTI11 IT */
\r
163 #define HAL_DMAMUX1_REQ_GEN_EXTI12 12U /*!< Request generator Signal is EXTI12 IT */
\r
164 #define HAL_DMAMUX1_REQ_GEN_EXTI13 13U /*!< Request generator Signal is EXTI13 IT */
\r
165 #define HAL_DMAMUX1_REQ_GEN_EXTI14 14U /*!< Request generator Signal is EXTI14 IT */
\r
166 #define HAL_DMAMUX1_REQ_GEN_EXTI15 15U /*!< Request generator Signal is EXTI15 IT */
\r
167 #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT 16U /*!< Request generator Signal is DMAMUX1 Channel0 Event */
\r
168 #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT 17U /*!< Request generator Signal is DMAMUX1 Channel1 Event */
\r
169 #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH2_EVT 18U /*!< Request generator Signal is DMAMUX1 Channel2 Event */
\r
170 #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH3_EVT 19U /*!< Request generator Signal is DMAMUX1 Channel3 Event */
\r
171 #define HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT 20U /*!< Request generator Signal is LPTIM1 OUT */
\r
172 #define HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT 21U /*!< Request generator Signal is LPTIM2 OUT */
\r
173 #define HAL_DMAMUX1_REQ_GEN_DSI_TE 22U /*!< Request generator Signal is DSI Tearing Effect */
\r
174 #define HAL_DMAMUX1_REQ_GEN_DSI_EOT 23U /*!< Request generator Signal is DSI End of refresh */
\r
175 #define HAL_DMAMUX1_REQ_GEN_DMA2D_EOT 24U /*!< Request generator Signal is DMA2D End of Transfer */
\r
176 #define HAL_DMAMUX1_REQ_GEN_LTDC_IT 25U /*!< Request generator Signal is LTDC IT */
\r
182 /** @defgroup DMAEx_DMAMUX_RequestGeneneratorPolarity_selection DMAMUX RequestGeneneratorPolarity selection
\r
185 #define HAL_DMAMUX_REQ_GEN_NO_EVENT 0U /*!< block request generator events */
\r
186 #define HAL_DMAMUX_REQ_GEN_RISING DMAMUX_RGxCR_GPOL_0 /*!< generate request on rising edge events */
\r
187 #define HAL_DMAMUX_REQ_GEN_FALLING DMAMUX_RGxCR_GPOL_1 /*!< generate request on falling edge events */
\r
188 #define HAL_DMAMUX_REQ_GEN_RISING_FALLING DMAMUX_RGxCR_GPOL /*!< generate request on rising and falling edge events */
\r
198 /* Exported macro ------------------------------------------------------------*/
\r
200 /* Exported functions --------------------------------------------------------*/
\r
201 /** @addtogroup DMAEx_Exported_Functions
\r
205 /* IO operation functions *****************************************************/
\r
206 /** @addtogroup DMAEx_Exported_Functions_Group1
\r
210 /* ------------------------- REQUEST -----------------------------------------*/
\r
211 HAL_StatusTypeDef HAL_DMAEx_ConfigMuxRequestGenerator (DMA_HandleTypeDef *hdma,
\r
212 HAL_DMA_MuxRequestGeneratorConfigTypeDef *pRequestGeneratorConfig);
\r
213 HAL_StatusTypeDef HAL_DMAEx_EnableMuxRequestGenerator (DMA_HandleTypeDef *hdma);
\r
214 HAL_StatusTypeDef HAL_DMAEx_DisableMuxRequestGenerator (DMA_HandleTypeDef *hdma);
\r
215 /* -------------------------------------------------------------------------- */
\r
217 /* ------------------------- SYNCHRO -----------------------------------------*/
\r
218 HAL_StatusTypeDef HAL_DMAEx_ConfigMuxSync(DMA_HandleTypeDef *hdma, HAL_DMA_MuxSyncConfigTypeDef *pSyncConfig);
\r
219 /* -------------------------------------------------------------------------- */
\r
221 void HAL_DMAEx_MUX_IRQHandler(DMA_HandleTypeDef *hdma);
\r
232 /* Private macros ------------------------------------------------------------*/
\r
233 /** @defgroup DMAEx_Private_Macros DMAEx Private Macros
\r
234 * @brief DMAEx private macros
\r
238 #define IS_DMAMUX_SYNC_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_SYNC_LDTC_IT)
\r
240 #define IS_DMAMUX_SYNC_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0U) && ((REQUEST_NUMBER) <= 32U))
\r
242 #define IS_DMAMUX_SYNC_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_SYNC_NO_EVENT) || \
\r
243 ((POLARITY) == HAL_DMAMUX_SYNC_RISING) || \
\r
244 ((POLARITY) == HAL_DMAMUX_SYNC_FALLING) || \
\r
245 ((POLARITY) == HAL_DMAMUX_SYNC_RISING_FALLING))
\r
247 #define IS_DMAMUX_SYNC_STATE(SYNC) (((SYNC) == DISABLE) || ((SYNC) == ENABLE))
\r
249 #define IS_DMAMUX_SYNC_EVENT(EVENT) (((EVENT) == DISABLE) || \
\r
250 ((EVENT) == ENABLE))
\r
252 #define IS_DMAMUX_REQUEST_GEN_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_REQ_GEN_LTDC_IT)
\r
254 #define IS_DMAMUX_REQUEST_GEN_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0U) && ((REQUEST_NUMBER) <= 32U))
\r
256 #define IS_DMAMUX_REQUEST_GEN_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_REQ_GEN_NO_EVENT) || \
\r
257 ((POLARITY) == HAL_DMAMUX_REQ_GEN_RISING) || \
\r
258 ((POLARITY) == HAL_DMAMUX_REQ_GEN_FALLING) || \
\r
259 ((POLARITY) == HAL_DMAMUX_REQ_GEN_RISING_FALLING))
\r
274 #endif /* DMAMUX1 */
\r
280 #endif /* STM32L4xx_HAL_DMA_H */
\r
282 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r