1 /** 2 ****************************************************************************** 3 * @file stm32mp1xx_hal_dma_ex.h 4 * @author MCD Application Team 5 * @brief Header file of DMA HAL extension module. 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2019 STMicroelectronics. 10 * All rights reserved.</center></h2> 11 * 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 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef STM32MP1xx_HAL_DMA_EX_H 22 #define STM32MP1xx_HAL_DMA_EX_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32mp1xx_hal_def.h" 30 31 /** @addtogroup STM32MP1xx_HAL_Driver 32 * @{ 33 */ 34 35 /** @addtogroup DMAEx 36 * @{ 37 */ 38 39 /* Exported types ------------------------------------------------------------*/ 40 /** @defgroup DMAEx_Exported_Types DMAEx Exported Types 41 * @brief DMAEx Exported types 42 * @{ 43 */ 44 45 /** 46 * @brief HAL DMA Memory definition 47 */ 48 typedef enum 49 { 50 MEMORY0 = 0x00U, /*!< Memory 0 */ 51 MEMORY1 = 0x01U, /*!< Memory 1 */ 52 53 } HAL_DMA_MemoryTypeDef; 54 55 /** 56 * @brief HAL DMAMUX Synchronization configuration structure definition 57 */ 58 typedef struct 59 { 60 uint32_t SyncSignalID; /*!< Specifies the synchronization signal gating the DMA request in periodic mode. 61 This parameter can be a value of @ref DMAEx_MUX_SyncSignalID_selection */ 62 63 uint32_t SyncPolarity; /*!< Specifies the polarity of the signal on which the DMA request is synchronized. 64 This parameter can be a value of @ref DMAEx_MUX_SyncPolarity_selection */ 65 66 FunctionalState SyncEnable; /*!< Specifies if the synchronization shall be enabled or disabled 67 This parameter can take the value ENABLE or DISABLE*/ 68 69 70 FunctionalState EventEnable; /*!< Specifies if an event shall be generated once the RequestNumber is reached. 71 This parameter can take the value ENABLE or DISABLE */ 72 73 uint32_t RequestNumber; /*!< Specifies the number of DMA request that will be authorized after a sync event. 74 This parameters can be in the range 1 to 32 */ 75 76 } HAL_DMA_MuxSyncConfigTypeDef; 77 78 79 /** 80 * @brief HAL DMAMUX request generator parameters structure definition 81 */ 82 typedef struct 83 { 84 uint32_t SignalID; /*!< Specifies the ID of the signal used for DMAMUX request generator 85 This parameter can be a value of @ref DMAEx_MUX_SignalGeneratorID_selection */ 86 87 uint32_t Polarity; /*!< Specifies the polarity of the signal on which the request is generated. 88 This parameter can be a value of @ref DMAEx_MUX_RequestGeneneratorPolarity_selection */ 89 90 uint32_t RequestNumber; /*!< Specifies the number of DMA request that will be generated after a signal event. 91 This parameters can be in the range 1 to 32 */ 92 93 } HAL_DMA_MuxRequestGeneratorConfigTypeDef; 94 95 /** 96 * @} 97 */ 98 99 /* Exported constants --------------------------------------------------------*/ 100 101 /** @defgroup DMAEx_Exported_Constants DMA Exported Constants 102 * @brief DMAEx Exported constants 103 * @{ 104 */ 105 106 /** @defgroup DMAEx_MUX_SyncSignalID_selection DMAEx MUX SyncSignalID selection 107 * @brief DMAEx MUX SyncSignalID selection 108 * @{ 109 */ 110 #define HAL_DMAMUX1_SYNC_DMAMUX1_CH0_EVT 0U /*!< Domain synchronization Signal is DMAMUX1 Channel0 Event */ 111 #define HAL_DMAMUX1_SYNC_DMAMUX1_CH1_EVT 1U /*!< Domain synchronization Signal is DMAMUX1 Channel1 Event */ 112 #define HAL_DMAMUX1_SYNC_DMAMUX1_CH2_EVT 2U /*!< Domain synchronization Signal is DMAMUX1 Channel2 Event */ 113 #define HAL_DMAMUX1_SYNC_LPTIM1_OUT 3U /*!< Domain synchronization Signal is LPTIM1 OUT */ 114 #define HAL_DMAMUX1_SYNC_LPTIM2_OUT 4U /*!< Domain synchronization Signal is LPTIM2 OUT */ 115 #define HAL_DMAMUX1_SYNC_LPTIM3_OUT 5U /*!< Domain synchronization Signal is LPTIM3 OUT */ 116 #define HAL_DMAMUX1_SYNC_EXTI0 6U /*!< Domain synchronization Signal is EXTI0 IT */ 117 #define HAL_DMAMUX1_SYNC_TIM12_TRGO 7U /*!< Domain synchronization Signal is TIM12 TRGO */ 118 119 /** 120 * @} 121 */ 122 123 /** @defgroup DMAEx_MUX_SyncPolarity_selection DMAEx MUX SyncPolarity selection 124 * @brief DMAEx MUX SyncPolarity selection 125 * @{ 126 */ 127 #define HAL_DMAMUX_SYNC_NO_EVENT 0x00000000U /*!< block synchronization events */ 128 #define HAL_DMAMUX_SYNC_RISING DMAMUX_CxCR_SPOL_0 /*!< synchronize with rising edge events */ 129 #define HAL_DMAMUX_SYNC_FALLING DMAMUX_CxCR_SPOL_1 /*!< synchronize with falling edge events */ 130 #define HAL_DMAMUX_SYNC_RISING_FALLING DMAMUX_CxCR_SPOL /*!< synchronize with rising and falling edge events */ 131 132 /** 133 * @} 134 */ 135 136 137 /** @defgroup DMAEx_MUX_SignalGeneratorID_selection DMAEx MUX SignalGeneratorID selection 138 * @brief DMAEx MUX SignalGeneratorID selection 139 * @{ 140 */ 141 #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT 0U /*!< Domain Request generator Signal is DMAMUX1 Channel0 Event */ 142 #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT 1U /*!< Domain Request generator Signal is DMAMUX1 Channel1 Event */ 143 #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH2_EVT 2U /*!< Domain Request generator Signal is DMAMUX1 Channel2 Event */ 144 #define HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT 3U /*!< Domain Request generator Signal is LPTIM1 OUT */ 145 #define HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT 4U /*!< Domain Request generator Signal is LPTIM2 OUT */ 146 #define HAL_DMAMUX1_REQ_GEN_LPTIM3_OUT 5U /*!< Domain Request generator Signal is LPTIM3 OUT */ 147 #define HAL_DMAMUX1_REQ_GEN_EXTI0 6U /*!< Domain Request generator Signal is EXTI0 IT */ 148 #define HAL_DMAMUX1_REQ_GEN_TIM12_TRGO 7U /*!< Domain Request generator Signal is TIM12 TRGO */ 149 150 151 /** 152 * @} 153 */ 154 155 /** @defgroup DMAEx_MUX_RequestGeneneratorPolarity_selection DMAEx MUX RequestGeneneratorPolarity selection 156 * @brief DMAEx MUX RequestGeneneratorPolarity selection 157 * @{ 158 */ 159 #define HAL_DMAMUX_REQ_GEN_NO_EVENT 0x00000000U /*!< block request generator events */ 160 #define HAL_DMAMUX_REQ_GEN_RISING DMAMUX_RGxCR_GPOL_0 /*!< generate request on rising edge events */ 161 #define HAL_DMAMUX_REQ_GEN_FALLING DMAMUX_RGxCR_GPOL_1 /*!< generate request on falling edge events */ 162 #define HAL_DMAMUX_REQ_GEN_RISING_FALLING DMAMUX_RGxCR_GPOL /*!< generate request on rising and falling edge events */ 163 164 /** 165 * @} 166 */ 167 168 /** 169 * @} 170 */ 171 172 /* Exported functions --------------------------------------------------------*/ 173 /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions 174 * @brief DMAEx Exported functions 175 * @{ 176 */ 177 178 /** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions 179 * @brief Extended features functions 180 * @{ 181 */ 182 183 /* IO operation functions *******************************************************/ 184 HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); 185 HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); 186 HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory); 187 HAL_StatusTypeDef HAL_DMAEx_ConfigMuxSync(DMA_HandleTypeDef *hdma, HAL_DMA_MuxSyncConfigTypeDef *pSyncConfig); 188 HAL_StatusTypeDef HAL_DMAEx_ConfigMuxRequestGenerator(DMA_HandleTypeDef *hdma, HAL_DMA_MuxRequestGeneratorConfigTypeDef *pRequestGeneratorConfig); 189 HAL_StatusTypeDef HAL_DMAEx_EnableMuxRequestGenerator(DMA_HandleTypeDef *hdma); 190 HAL_StatusTypeDef HAL_DMAEx_DisableMuxRequestGenerator(DMA_HandleTypeDef *hdma); 191 192 void HAL_DMAEx_MUX_IRQHandler(DMA_HandleTypeDef *hdma); 193 /** 194 * @} 195 */ 196 /** 197 * @} 198 */ 199 200 /* Private macros ------------------------------------------------------------*/ 201 /** @defgroup DMAEx_Private_Macros DMA Private Macros 202 * @brief DMAEx private macros 203 * @{ 204 */ 205 206 #define IS_DMAMUX_SYNC_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_SYNC_TIM12_TRGO) 207 208 #define IS_DMAMUX_SYNC_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0) && ((REQUEST_NUMBER) <= 32)) 209 210 #define IS_DMAMUX_SYNC_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_SYNC_NO_EVENT) || \ 211 ((POLARITY) == HAL_DMAMUX_SYNC_RISING) || \ 212 ((POLARITY) == HAL_DMAMUX_SYNC_FALLING) || \ 213 ((POLARITY) == HAL_DMAMUX_SYNC_RISING_FALLING)) 214 215 #define IS_DMAMUX_SYNC_STATE(SYNC) (((SYNC) == DISABLE) || ((SYNC) == ENABLE)) 216 217 #define IS_DMAMUX_SYNC_EVENT(EVENT) (((EVENT) == DISABLE) || \ 218 ((EVENT) == ENABLE)) 219 220 #define IS_DMAMUX_REQUEST_GEN_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_REQ_GEN_TIM12_TRGO) 221 222 #define IS_DMAMUX_REQUEST_GEN_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0) && ((REQUEST_NUMBER) <= 32)) 223 224 #define IS_DMAMUX_REQUEST_GEN_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_REQ_GEN_NO_EVENT) || \ 225 ((POLARITY) == HAL_DMAMUX_REQ_GEN_RISING) || \ 226 ((POLARITY) == HAL_DMAMUX_REQ_GEN_FALLING) || \ 227 ((POLARITY) == HAL_DMAMUX_REQ_GEN_RISING_FALLING)) 228 229 /** 230 * @} 231 */ 232 233 /* Private functions ---------------------------------------------------------*/ 234 /** @defgroup DMAEx_Private_Functions DMAEx Private Functions 235 * @brief DMAEx Private functions 236 * @{ 237 */ 238 /** 239 * @} 240 */ 241 242 /** 243 * @} 244 */ 245 246 /** 247 * @} 248 */ 249 250 #ifdef __cplusplus 251 } 252 #endif 253 254 #endif /* STM32H7xx_HAL_DMA_H */ 255 256 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 257