py32f0xx_hal_dma_ex.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /**
  2. ******************************************************************************
  3. * @file py32f0xx_hal_dma_ex.h
  4. * @author MCU Application Team
  5. * @brief Header file of DMA HAL extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by Puya 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. * @attention
  19. *
  20. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  21. * All rights reserved.</center></h2>
  22. *
  23. * This software component is licensed by ST under BSD 3-Clause license,
  24. * the "License"; You may not use this file except in compliance with the
  25. * License. You may obtain a copy of the License at:
  26. * opensource.org/licenses/BSD-3-Clause
  27. *
  28. ******************************************************************************
  29. */
  30. /* Define to prevent recursive inclusion -------------------------------------*/
  31. #ifndef __PY32F0xx_HAL_DMA_EX_H
  32. #define __PY32F0xx_HAL_DMA_EX_H
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "py32f0xx_hal_def.h"
  38. /** @addtogroup PY32F0xx_HAL_Driver
  39. * @{
  40. */
  41. /** @defgroup DMAEx DMAEx
  42. * @{
  43. */
  44. /* Exported types ------------------------------------------------------------*/
  45. /* Exported constants --------------------------------------------------------*/
  46. /* Exported macro ------------------------------------------------------------*/
  47. /** @defgroup DMAEx_Exported_Macros DMA Extended Exported Macros
  48. * @{
  49. */
  50. /**
  51. * @brief Returns the current DMA Channel transfer complete flag.
  52. * @param __HANDLE__: DMA handle
  53. * @retval The specified transfer complete flag index.
  54. */
  55. #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
  56. (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\
  57. ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TC2 :\
  58. DMA_FLAG_TC3)
  59. /**
  60. * @brief Return the current DMA Channel half transfer complete flag.
  61. * @param __HANDLE__: DMA handle
  62. * @retval The specified half transfer complete flag index.
  63. */
  64. #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
  65. (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\
  66. ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\
  67. DMA_FLAG_HT3)
  68. /**
  69. * @brief Return the current DMA Channel transfer error flag.
  70. * @param __HANDLE__: DMA handle
  71. * @retval The specified transfer error flag index.
  72. */
  73. #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
  74. (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\
  75. ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\
  76. DMA_FLAG_TE3)
  77. /**
  78. * @brief Return the current DMA Channel Global interrupt flag.
  79. * @param __HANDLE__: DMA handle
  80. * @retval The specified transfer error flag index.
  81. */
  82. #define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\
  83. (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_GL1 :\
  84. ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_GL2 :\
  85. DMA_FLAG_GL3)
  86. /**
  87. * @brief Get the DMA Channel pending flags.
  88. * @param __HANDLE__: DMA handle
  89. * @param __FLAG__: Get the specified flag.
  90. * This parameter can be any combination of the following values:
  91. * @arg DMA_FLAG_TCx: Transfer complete flag
  92. * @arg DMA_FLAG_HTx: Half transfer complete flag
  93. * @arg DMA_FLAG_TEx: Transfer error flag
  94. * @arg DMA_FLAG_GLx: Global interrupt flag
  95. * Where x can be 1_7 to select the DMA Channel flag.
  96. * @retval The state of FLAG (SET or RESET).
  97. */
  98. #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (DMA1->ISR & (__FLAG__))
  99. /**
  100. * @brief Clear the DMA Channel pending flags.
  101. * @param __HANDLE__: DMA handle
  102. * @param __FLAG__: specifies the flag to clear.
  103. * This parameter can be any combination of the following values:
  104. * @arg DMA_FLAG_TCx: Transfer complete flag
  105. * @arg DMA_FLAG_HTx: Half transfer complete flag
  106. * @arg DMA_FLAG_TEx: Transfer error flag
  107. * @arg DMA_FLAG_GLx: Global interrupt flag
  108. * Where x can be 1_7 to select the DMA Channel flag.
  109. * @retval None
  110. */
  111. #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) (DMA1->IFCR = (__FLAG__))
  112. /**
  113. * @}
  114. */
  115. /**
  116. * @}
  117. */
  118. /**
  119. * @}
  120. */
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif
  125. /************************ (C) COPYRIGHT Puya *****END OF FILE****/