You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

266 lines
13 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32wbxx_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>&copy; 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. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32WBxx_HAL_DMA_EX_H
  21. #define STM32WBxx_HAL_DMA_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32wbxx_hal_def.h"
  27. #include "stm32wbxx_ll_dmamux.h"
  28. /** @addtogroup STM32WBxx_HAL_Driver
  29. * @{
  30. */
  31. /** @addtogroup DMAEx
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /** @defgroup DMAEx_Exported_Types DMAEx Exported Types
  36. * @{
  37. */
  38. /**
  39. * @brief HAL DMA Synchro definition
  40. */
  41. /**
  42. * @brief HAL DMAMUX Synchronization configuration structure definition
  43. */
  44. typedef struct
  45. {
  46. uint32_t SyncSignalID; /*!< Specifies the synchronization signal gating the DMA request in periodic mode.
  47. This parameter can be a value of @ref DMAEx_DMAMUX_SyncSignalID_selection */
  48. uint32_t SyncPolarity; /*!< Specifies the polarity of the signal on which the DMA request is synchronized.
  49. This parameter can be a value of @ref DMAEx_DMAMUX_SyncPolarity_selection */
  50. FunctionalState SyncEnable; /*!< Specifies if the synchronization shall be enabled or disabled
  51. This parameter can take the value ENABLE or DISABLE*/
  52. FunctionalState EventEnable; /*!< Specifies if an event shall be generated once the RequestNumber is reached.
  53. This parameter can take the value ENABLE or DISABLE */
  54. uint32_t RequestNumber; /*!< Specifies the number of DMA request that will be authorized after a sync event
  55. This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
  56. } HAL_DMA_MuxSyncConfigTypeDef;
  57. /**
  58. * @brief HAL DMAMUX request generator parameters structure definition
  59. */
  60. typedef struct
  61. {
  62. uint32_t SignalID; /*!< Specifies the ID of the signal used for DMAMUX request generator
  63. This parameter can be a value of @ref DMAEx_DMAMUX_SignalGeneratorID_selection */
  64. uint32_t Polarity; /*!< Specifies the polarity of the signal on which the request is generated.
  65. This parameter can be a value of @ref DMAEx_DMAMUX_RequestGeneneratorPolarity_selection */
  66. uint32_t RequestNumber; /*!< Specifies the number of DMA request that will be generated after a signal event
  67. This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
  68. } HAL_DMA_MuxRequestGeneratorConfigTypeDef;
  69. /**
  70. * @}
  71. */
  72. /* Exported constants --------------------------------------------------------*/
  73. /** @defgroup DMAEx_Exported_Constants DMAEx Exported Constants
  74. * @{
  75. */
  76. /** @defgroup DMAEx_DMAMUX_SyncSignalID_selection DMAMUX SyncSignalID selection
  77. * @{
  78. */
  79. #define HAL_DMAMUX1_SYNC_EXTI0 LL_DMAMUX_SYNC_EXTI_LINE0 /*!< Synchronization Signal is EXTI0 IT */
  80. #define HAL_DMAMUX1_SYNC_EXTI1 LL_DMAMUX_SYNC_EXTI_LINE1 /*!< Synchronization Signal is EXTI1 IT */
  81. #define HAL_DMAMUX1_SYNC_EXTI2 LL_DMAMUX_SYNC_EXTI_LINE2 /*!< Synchronization Signal is EXTI2 IT */
  82. #define HAL_DMAMUX1_SYNC_EXTI3 LL_DMAMUX_SYNC_EXTI_LINE3 /*!< Synchronization Signal is EXTI3 IT */
  83. #define HAL_DMAMUX1_SYNC_EXTI4 LL_DMAMUX_SYNC_EXTI_LINE4 /*!< Synchronization Signal is EXTI4 IT */
  84. #define HAL_DMAMUX1_SYNC_EXTI5 LL_DMAMUX_SYNC_EXTI_LINE5 /*!< Synchronization Signal is EXTI5 IT */
  85. #define HAL_DMAMUX1_SYNC_EXTI6 LL_DMAMUX_SYNC_EXTI_LINE6 /*!< Synchronization Signal is EXTI6 IT */
  86. #define HAL_DMAMUX1_SYNC_EXTI7 LL_DMAMUX_SYNC_EXTI_LINE7 /*!< Synchronization Signal is EXTI7 IT */
  87. #define HAL_DMAMUX1_SYNC_EXTI8 LL_DMAMUX_SYNC_EXTI_LINE8 /*!< Synchronization Signal is EXTI8 IT */
  88. #define HAL_DMAMUX1_SYNC_EXTI9 LL_DMAMUX_SYNC_EXTI_LINE9 /*!< Synchronization Signal is EXTI9 IT */
  89. #define HAL_DMAMUX1_SYNC_EXTI10 LL_DMAMUX_SYNC_EXTI_LINE10 /*!< Synchronization Signal is EXTI10 IT */
  90. #define HAL_DMAMUX1_SYNC_EXTI11 LL_DMAMUX_SYNC_EXTI_LINE11 /*!< Synchronization Signal is EXTI11 IT */
  91. #define HAL_DMAMUX1_SYNC_EXTI12 LL_DMAMUX_SYNC_EXTI_LINE12 /*!< Synchronization Signal is EXTI12 IT */
  92. #define HAL_DMAMUX1_SYNC_EXTI13 LL_DMAMUX_SYNC_EXTI_LINE13 /*!< Synchronization Signal is EXTI13 IT */
  93. #define HAL_DMAMUX1_SYNC_EXTI14 LL_DMAMUX_SYNC_EXTI_LINE14 /*!< Synchronization Signal is EXTI14 IT */
  94. #define HAL_DMAMUX1_SYNC_EXTI15 LL_DMAMUX_SYNC_EXTI_LINE15 /*!< Synchronization Signal is EXTI15 IT */
  95. #define HAL_DMAMUX1_SYNC_DMAMUX1_CH0_EVT LL_DMAMUX_SYNC_DMAMUX_CH0 /*!< Synchronization Signal is DMAMUX1 Channel0 Event */
  96. #define HAL_DMAMUX1_SYNC_DMAMUX1_CH1_EVT LL_DMAMUX_SYNC_DMAMUX_CH1 /*!< Synchronization Signal is DMAMUX1 Channel1 Event */
  97. #define HAL_DMAMUX1_SYNC_LPTIM1_OUT LL_DMAMUX_SYNC_LPTIM1_OUT /*!< Synchronization Signal is LPTIM1 OUT */
  98. #define HAL_DMAMUX1_SYNC_LPTIM2_OUT LL_DMAMUX_SYNC_LPTIM2_OUT /*!< Synchronization Signal is LPTIM2 OUT */
  99. /**
  100. * @}
  101. */
  102. /** @defgroup DMAEx_DMAMUX_SyncPolarity_selection DMAMUX SyncPolarity selection
  103. * @{
  104. */
  105. #define HAL_DMAMUX_SYNC_NO_EVENT LL_DMAMUX_SYNC_NO_EVENT /*!< block synchronization events */
  106. #define HAL_DMAMUX_SYNC_RISING LL_DMAMUX_SYNC_POL_RISING /*!< synchronize with rising edge events */
  107. #define HAL_DMAMUX_SYNC_FALLING LL_DMAMUX_SYNC_POL_FALLING /*!< synchronize with falling edge events */
  108. #define HAL_DMAMUX_SYNC_RISING_FALLING LL_DMAMUX_SYNC_POL_RISING_FALLING /*!< synchronize with rising and falling edge events */
  109. /**
  110. * @}
  111. */
  112. /** @defgroup DMAEx_DMAMUX_SignalGeneratorID_selection DMAMUX SignalGeneratorID selection
  113. * @{
  114. */
  115. #define HAL_DMAMUX1_REQ_GEN_EXTI0 LL_DMAMUX_REQ_GEN_EXTI_LINE0 /*!< Request generator Signal is EXTI0 IT */
  116. #define HAL_DMAMUX1_REQ_GEN_EXTI1 LL_DMAMUX_REQ_GEN_EXTI_LINE1 /*!< Request generator Signal is EXTI1 IT */
  117. #define HAL_DMAMUX1_REQ_GEN_EXTI2 LL_DMAMUX_REQ_GEN_EXTI_LINE2 /*!< Request generator Signal is EXTI2 IT */
  118. #define HAL_DMAMUX1_REQ_GEN_EXTI3 LL_DMAMUX_REQ_GEN_EXTI_LINE3 /*!< Request generator Signal is EXTI3 IT */
  119. #define HAL_DMAMUX1_REQ_GEN_EXTI4 LL_DMAMUX_REQ_GEN_EXTI_LINE4 /*!< Request generator Signal is EXTI4 IT */
  120. #define HAL_DMAMUX1_REQ_GEN_EXTI5 LL_DMAMUX_REQ_GEN_EXTI_LINE5 /*!< Request generator Signal is EXTI5 IT */
  121. #define HAL_DMAMUX1_REQ_GEN_EXTI6 LL_DMAMUX_REQ_GEN_EXTI_LINE6 /*!< Request generator Signal is EXTI6 IT */
  122. #define HAL_DMAMUX1_REQ_GEN_EXTI7 LL_DMAMUX_REQ_GEN_EXTI_LINE7 /*!< Request generator Signal is EXTI7 IT */
  123. #define HAL_DMAMUX1_REQ_GEN_EXTI8 LL_DMAMUX_REQ_GEN_EXTI_LINE8 /*!< Request generator Signal is EXTI8 IT */
  124. #define HAL_DMAMUX1_REQ_GEN_EXTI9 LL_DMAMUX_REQ_GEN_EXTI_LINE9 /*!< Request generator Signal is EXTI9 IT */
  125. #define HAL_DMAMUX1_REQ_GEN_EXTI10 LL_DMAMUX_REQ_GEN_EXTI_LINE10 /*!< Request generator Signal is EXTI10 IT */
  126. #define HAL_DMAMUX1_REQ_GEN_EXTI11 LL_DMAMUX_REQ_GEN_EXTI_LINE11 /*!< Request generator Signal is EXTI11 IT */
  127. #define HAL_DMAMUX1_REQ_GEN_EXTI12 LL_DMAMUX_REQ_GEN_EXTI_LINE12 /*!< Request generator Signal is EXTI12 IT */
  128. #define HAL_DMAMUX1_REQ_GEN_EXTI13 LL_DMAMUX_REQ_GEN_EXTI_LINE13 /*!< Request generator Signal is EXTI13 IT */
  129. #define HAL_DMAMUX1_REQ_GEN_EXTI14 LL_DMAMUX_REQ_GEN_EXTI_LINE14 /*!< Request generator Signal is EXTI14 IT */
  130. #define HAL_DMAMUX1_REQ_GEN_EXTI15 LL_DMAMUX_REQ_GEN_EXTI_LINE15 /*!< Request generator Signal is EXTI15 IT */
  131. #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT LL_DMAMUX_REQ_GEN_DMAMUX_CH0 /*!< Request generator Signal is DMAMUX1 Channel0 Event */
  132. #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT LL_DMAMUX_REQ_GEN_DMAMUX_CH1 /*!< Request generator Signal is DMAMUX1 Channel1 Event */
  133. #define HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT LL_DMAMUX_REQ_GEN_LPTIM1_OUT /*!< Request generator Signal is LPTIM1 OUT */
  134. #define HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT LL_DMAMUX_REQ_GEN_LPTIM2_OUT /*!< Request generator Signal is LPTIM2 OUT */
  135. /**
  136. * @}
  137. */
  138. /** @defgroup DMAEx_DMAMUX_RequestGeneneratorPolarity_selection DMAMUX RequestGeneneratorPolarity selection
  139. * @{
  140. */
  141. #define HAL_DMAMUX_REQ_GEN_NO_EVENT LL_DMAMUX_REQ_GEN_NO_EVENT /*!< block request generator events */
  142. #define HAL_DMAMUX_REQ_GEN_RISING LL_DMAMUX_REQ_GEN_POL_RISING /*!< generate request on rising edge events */
  143. #define HAL_DMAMUX_REQ_GEN_FALLING LL_DMAMUX_REQ_GEN_POL_FALLING /*!< generate request on falling edge events */
  144. #define HAL_DMAMUX_REQ_GEN_RISING_FALLING LL_DMAMUX_REQ_GEN_POL_RISING_FALLING /*!< generate request on rising and falling edge events */
  145. /**
  146. * @}
  147. */
  148. /**
  149. * @}
  150. */
  151. /* Exported macro ------------------------------------------------------------*/
  152. /* Exported functions --------------------------------------------------------*/
  153. /** @addtogroup DMAEx_Exported_Functions
  154. * @{
  155. */
  156. /* IO operation functions *****************************************************/
  157. /** @addtogroup DMAEx_Exported_Functions_Group1
  158. * @{
  159. */
  160. /* ------------------------- REQUEST -----------------------------------------*/
  161. HAL_StatusTypeDef HAL_DMAEx_ConfigMuxRequestGenerator(DMA_HandleTypeDef *hdma,
  162. HAL_DMA_MuxRequestGeneratorConfigTypeDef *pRequestGeneratorConfig);
  163. HAL_StatusTypeDef HAL_DMAEx_EnableMuxRequestGenerator(DMA_HandleTypeDef *hdma);
  164. HAL_StatusTypeDef HAL_DMAEx_DisableMuxRequestGenerator(DMA_HandleTypeDef *hdma);
  165. /* -------------------------------------------------------------------------- */
  166. /* ------------------------- SYNCHRO -----------------------------------------*/
  167. HAL_StatusTypeDef HAL_DMAEx_ConfigMuxSync(DMA_HandleTypeDef *hdma, HAL_DMA_MuxSyncConfigTypeDef *pSyncConfig);
  168. /* -------------------------------------------------------------------------- */
  169. void HAL_DMAEx_MUX_IRQHandler(DMA_HandleTypeDef *hdma);
  170. /**
  171. * @}
  172. */
  173. /**
  174. * @}
  175. */
  176. /* Private macros ------------------------------------------------------------*/
  177. /** @defgroup DMAEx_Private_Macros DMAEx Private Macros
  178. * @brief DMAEx private macros
  179. * @{
  180. */
  181. #define IS_DMAMUX_SYNC_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_SYNC_LPTIM2_OUT)
  182. #define IS_DMAMUX_SYNC_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0U) && ((REQUEST_NUMBER) <= 32U))
  183. #define IS_DMAMUX_SYNC_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_SYNC_NO_EVENT) || \
  184. ((POLARITY) == HAL_DMAMUX_SYNC_RISING) || \
  185. ((POLARITY) == HAL_DMAMUX_SYNC_FALLING) || \
  186. ((POLARITY) == HAL_DMAMUX_SYNC_RISING_FALLING))
  187. #define IS_DMAMUX_SYNC_STATE(SYNC) (((SYNC) == DISABLE) || ((SYNC) == ENABLE))
  188. #define IS_DMAMUX_SYNC_EVENT(EVENT) (((EVENT) == DISABLE) || \
  189. ((EVENT) == ENABLE))
  190. #define IS_DMAMUX_REQUEST_GEN_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT)
  191. #define IS_DMAMUX_REQUEST_GEN_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0U) && ((REQUEST_NUMBER) <= 32U))
  192. #define IS_DMAMUX_REQUEST_GEN_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_REQ_GEN_NO_EVENT) || \
  193. ((POLARITY) == HAL_DMAMUX_REQ_GEN_RISING) || \
  194. ((POLARITY) == HAL_DMAMUX_REQ_GEN_FALLING) || \
  195. ((POLARITY) == HAL_DMAMUX_REQ_GEN_RISING_FALLING))
  196. /**
  197. * @}
  198. */
  199. /**
  200. * @}
  201. */
  202. /**
  203. * @}
  204. */
  205. #ifdef __cplusplus
  206. }
  207. #endif
  208. #endif /* STM32WBxx_HAL_DMA_EX_H */
  209. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/