2
|
1 /**
|
|
2 ******************************************************************************
|
|
3 * @file stm32f1xx_hal_dma_ex.h
|
|
4 * @author MCD Application Team
|
|
5 * @version V1.0.4
|
|
6 * @date 29-April-2016
|
|
7 * @brief Header file of DMA HAL extension module.
|
|
8 ******************************************************************************
|
|
9 * @attention
|
|
10 *
|
|
11 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
|
12 *
|
|
13 * Redistribution and use in source and binary forms, with or without modification,
|
|
14 * are permitted provided that the following conditions are met:
|
|
15 * 1. Redistributions of source code must retain the above copyright notice,
|
|
16 * this list of conditions and the following disclaimer.
|
|
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
18 * this list of conditions and the following disclaimer in the documentation
|
|
19 * and/or other materials provided with the distribution.
|
|
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
21 * may be used to endorse or promote products derived from this software
|
|
22 * without specific prior written permission.
|
|
23 *
|
|
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34 *
|
|
35 ******************************************************************************
|
|
36 */
|
|
37
|
|
38 /* Define to prevent recursive inclusion -------------------------------------*/
|
|
39 #ifndef __STM32F1xx_HAL_DMA_EX_H
|
|
40 #define __STM32F1xx_HAL_DMA_EX_H
|
|
41
|
|
42 #ifdef __cplusplus
|
|
43 extern "C" {
|
|
44 #endif
|
|
45
|
|
46 /* Includes ------------------------------------------------------------------*/
|
|
47 #include "stm32f1xx_hal_def.h"
|
|
48
|
|
49 /** @addtogroup STM32F1xx_HAL_Driver
|
|
50 * @{
|
|
51 */
|
|
52
|
|
53 /** @defgroup DMAEx DMAEx
|
|
54 * @{
|
|
55 */
|
|
56
|
|
57 /* Exported types ------------------------------------------------------------*/
|
|
58 /* Exported constants --------------------------------------------------------*/
|
|
59 /* Exported macro ------------------------------------------------------------*/
|
|
60 /** @defgroup DMAEx_Exported_Macros DMA Extended Exported Macros
|
|
61 * @{
|
|
62 */
|
|
63 /* Interrupt & Flag management */
|
|
64 #if defined (STM32F100xE) || defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F103xE) || \
|
|
65 defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
|
|
66 /** @defgroup DMAEx_High_density_XL_density_Product_devices DMAEx High density and XL density product devices
|
|
67 * @{
|
|
68 */
|
|
69
|
|
70 /**
|
|
71 * @brief Returns the current DMA Channel transfer complete flag.
|
|
72 * @param __HANDLE__: DMA handle
|
|
73 * @retval The specified transfer complete flag index.
|
|
74 */
|
|
75 #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
|
|
76 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\
|
|
77 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TC2 :\
|
|
78 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TC3 :\
|
|
79 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TC4 :\
|
|
80 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TC5 :\
|
|
81 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\
|
|
82 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel7))? DMA_FLAG_TC7 :\
|
|
83 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_TC1 :\
|
|
84 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_TC2 :\
|
|
85 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel3))? DMA_FLAG_TC3 :\
|
|
86 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel4))? DMA_FLAG_TC4 :\
|
|
87 DMA_FLAG_TC5)
|
|
88
|
|
89 /**
|
|
90 * @brief Returns the current DMA Channel half transfer complete flag.
|
|
91 * @param __HANDLE__: DMA handle
|
|
92 * @retval The specified half transfer complete flag index.
|
|
93 */
|
|
94 #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
|
|
95 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\
|
|
96 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\
|
|
97 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_HT3 :\
|
|
98 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_HT4 :\
|
|
99 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_HT5 :\
|
|
100 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\
|
|
101 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel7))? DMA_FLAG_HT7 :\
|
|
102 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_HT1 :\
|
|
103 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_HT2 :\
|
|
104 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel3))? DMA_FLAG_HT3 :\
|
|
105 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel4))? DMA_FLAG_HT4 :\
|
|
106 DMA_FLAG_HT5)
|
|
107
|
|
108 /**
|
|
109 * @brief Returns the current DMA Channel transfer error flag.
|
|
110 * @param __HANDLE__: DMA handle
|
|
111 * @retval The specified transfer error flag index.
|
|
112 */
|
|
113 #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
|
|
114 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\
|
|
115 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\
|
|
116 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TE3 :\
|
|
117 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TE4 :\
|
|
118 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TE5 :\
|
|
119 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\
|
|
120 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel7))? DMA_FLAG_TE7 :\
|
|
121 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_TE1 :\
|
|
122 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_TE2 :\
|
|
123 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel3))? DMA_FLAG_TE3 :\
|
|
124 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel4))? DMA_FLAG_TE4 :\
|
|
125 DMA_FLAG_TE5)
|
|
126
|
|
127 /**
|
|
128 * @brief Get the DMA Channel pending flags.
|
|
129 * @param __HANDLE__: DMA handle
|
|
130 * @param __FLAG__: Get the specified flag.
|
|
131 * This parameter can be any combination of the following values:
|
|
132 * @arg DMA_FLAG_TCx: Transfer complete flag
|
|
133 * @arg DMA_FLAG_HTx: Half transfer complete flag
|
|
134 * @arg DMA_FLAG_TEx: Transfer error flag
|
|
135 * Where x can be 1_7 or 1_5 (depending on DMA1 or DMA2) to select the DMA Channel flag.
|
|
136 * @retval The state of FLAG (SET or RESET).
|
|
137 */
|
|
138 #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__)\
|
|
139 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Channel7)? (DMA2->ISR & (__FLAG__)) :\
|
|
140 (DMA1->ISR & (__FLAG__)))
|
|
141
|
|
142 /**
|
|
143 * @brief Clears the DMA Channel pending flags.
|
|
144 * @param __HANDLE__: DMA handle
|
|
145 * @param __FLAG__: specifies the flag to clear.
|
|
146 * This parameter can be any combination of the following values:
|
|
147 * @arg DMA_FLAG_TCx: Transfer complete flag
|
|
148 * @arg DMA_FLAG_HTx: Half transfer complete flag
|
|
149 * @arg DMA_FLAG_TEx: Transfer error flag
|
|
150 * Where x can be 1_7 or 1_5 (depending on DMA1 or DMA2) to select the DMA Channel flag.
|
|
151 * @retval None
|
|
152 */
|
|
153 #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \
|
|
154 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Channel7)? (DMA2->IFCR = (__FLAG__)) :\
|
|
155 (DMA1->IFCR = (__FLAG__)))
|
|
156
|
|
157 /**
|
|
158 * @}
|
|
159 */
|
|
160
|
|
161 #else
|
|
162 /** @defgroup DMA_Low_density_Medium_density_Product_devices DMA Low density and Medium density product devices
|
|
163 * @{
|
|
164 */
|
|
165
|
|
166 /**
|
|
167 * @brief Returns the current DMA Channel transfer complete flag.
|
|
168 * @param __HANDLE__: DMA handle
|
|
169 * @retval The specified transfer complete flag index.
|
|
170 */
|
|
171 #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
|
|
172 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\
|
|
173 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TC2 :\
|
|
174 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TC3 :\
|
|
175 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TC4 :\
|
|
176 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TC5 :\
|
|
177 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\
|
|
178 DMA_FLAG_TC7)
|
|
179
|
|
180 /**
|
|
181 * @brief Returns the current DMA Channel half transfer complete flag.
|
|
182 * @param __HANDLE__: DMA handle
|
|
183 * @retval The specified half transfer complete flag index.
|
|
184 */
|
|
185 #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
|
|
186 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\
|
|
187 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\
|
|
188 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_HT3 :\
|
|
189 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_HT4 :\
|
|
190 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_HT5 :\
|
|
191 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\
|
|
192 DMA_FLAG_HT7)
|
|
193
|
|
194 /**
|
|
195 * @brief Returns the current DMA Channel transfer error flag.
|
|
196 * @param __HANDLE__: DMA handle
|
|
197 * @retval The specified transfer error flag index.
|
|
198 */
|
|
199 #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
|
|
200 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\
|
|
201 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\
|
|
202 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TE3 :\
|
|
203 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TE4 :\
|
|
204 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TE5 :\
|
|
205 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\
|
|
206 DMA_FLAG_TE7)
|
|
207
|
|
208 /**
|
|
209 * @brief Get the DMA Channel pending flags.
|
|
210 * @param __HANDLE__: DMA handle
|
|
211 * @param __FLAG__: Get the specified flag.
|
|
212 * This parameter can be any combination of the following values:
|
|
213 * @arg DMA_FLAG_TCx: Transfer complete flag
|
|
214 * @arg DMA_FLAG_HTx: Half transfer complete flag
|
|
215 * @arg DMA_FLAG_TEx: Transfer error flag
|
|
216 * Where x can be 1_7 to select the DMA Channel flag.
|
|
217 * @retval The state of FLAG (SET or RESET).
|
|
218 */
|
|
219
|
|
220 #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (DMA1->ISR & (__FLAG__))
|
|
221
|
|
222 /**
|
|
223 * @brief Clears the DMA Channel pending flags.
|
|
224 * @param __HANDLE__: DMA handle
|
|
225 * @param __FLAG__: specifies the flag to clear.
|
|
226 * This parameter can be any combination of the following values:
|
|
227 * @arg DMA_FLAG_TCx: Transfer complete flag
|
|
228 * @arg DMA_FLAG_HTx: Half transfer complete flag
|
|
229 * @arg DMA_FLAG_TEx: Transfer error flag
|
|
230 * Where x can be 1_7 to select the DMA Channel flag.
|
|
231 * @retval None
|
|
232 */
|
|
233 #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) (DMA1->IFCR = (__FLAG__))
|
|
234
|
|
235 /**
|
|
236 * @}
|
|
237 */
|
|
238
|
|
239 #endif
|
|
240
|
|
241 /**
|
|
242 * @}
|
|
243 */
|
|
244
|
|
245 /**
|
|
246 * @}
|
|
247 */
|
|
248
|
|
249 /**
|
|
250 * @}
|
|
251 */
|
|
252
|
|
253 #ifdef __cplusplus
|
|
254 }
|
|
255 #endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || */
|
|
256 /* STM32F103xG || STM32F105xC || STM32F107xC */
|
|
257
|
|
258 #endif /* __STM32F1xx_HAL_DMA_H */
|
|
259
|
|
260 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|