2 ******************************************************************************
\r
3 * @file stm32l1xx_dma.c
\r
4 * @author MCD Application Team
\r
6 * @date 05-March-2012
\r
7 * @brief This file provides firmware functions to manage the following
\r
8 * functionalities of the Direct Memory Access controller (DMA):
\r
9 * + Initialization and Configuration
\r
11 * + Interrupts and flags management
\r
14 ==============================================================================
\r
15 ##### How to use this driver #####
\r
16 ==============================================================================
\r
18 (#) Enable The DMA controller clock using
\r
19 RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE) function for DMA1 or
\r
20 using RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA2, ENABLE) function for DMA2.
\r
21 (#) Enable and configure the peripheral to be connected to the DMA channel
\r
22 (except for internal SRAM / FLASH memories: no initialization is
\r
24 (#) For a given Channel, program the Source and Destination addresses,
\r
25 the transfer Direction, the Buffer Size, the Peripheral and Memory
\r
26 Incrementation mode and Data Size, the Circular or Normal mode,
\r
27 the channel transfer Priority and the Memory-to-Memory transfer
\r
28 mode (if needed) using the DMA_Init() function.
\r
29 (#) Enable the NVIC and the corresponding interrupt(s) using the function
\r
30 DMA_ITConfig() if you need to use DMA interrupts.
\r
31 (#) Enable the DMA channel using the DMA_Cmd() function.
\r
32 (#) Activate the needed channel Request using PPP_DMACmd() function for
\r
33 any PPP peripheral except internal SRAM and FLASH (ie. SPI, USART ...)
\r
34 The function allowing this operation is provided in each PPP peripheral
\r
35 driver (ie. SPI_DMACmd for SPI peripheral).
\r
36 (#) Optionally, you can configure the number of data to be transferred
\r
37 when the channel is disabled (ie. after each Transfer Complete event
\r
38 or when a Transfer Error occurs) using the function DMA_SetCurrDataCounter().
\r
39 And you can get the number of remaining data to be transferred using
\r
40 the function DMA_GetCurrDataCounter() at run time (when the DMA channel is
\r
41 enabled and running).
\r
42 (#) To control DMA events you can use one of the following two methods:
\r
43 (##) Check on DMA channel flags using the function DMA_GetFlagStatus().
\r
44 (##) Use DMA interrupts through the function DMA_ITConfig() at initialization
\r
45 phase and DMA_GetITStatus() function into interrupt routines in
\r
46 communication phase.
\r
47 After checking on a flag you should clear it using DMA_ClearFlag()
\r
48 function. And after checking on an interrupt event you should
\r
49 clear it using DMA_ClearITPendingBit() function.
\r
52 ******************************************************************************
\r
55 * <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
\r
57 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
\r
58 * You may not use this file except in compliance with the License.
\r
59 * You may obtain a copy of the License at:
\r
61 * http://www.st.com/software_license_agreement_liberty_v2
\r
63 * Unless required by applicable law or agreed to in writing, software
\r
64 * distributed under the License is distributed on an "AS IS" BASIS,
\r
65 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
66 * See the License for the specific language governing permissions and
\r
67 * limitations under the License.
\r
69 ******************************************************************************
\r
72 /* Includes ------------------------------------------------------------------*/
\r
73 #include "stm32l1xx_dma.h"
\r
74 #include "stm32l1xx_rcc.h"
\r
76 /** @addtogroup STM32L1xx_StdPeriph_Driver
\r
81 * @brief DMA driver modules
\r
85 /* Private typedef -----------------------------------------------------------*/
\r
86 /* Private define ------------------------------------------------------------*/
\r
88 /* DMA1 Channelx interrupt pending bit masks */
\r
89 #define DMA1_CHANNEL1_IT_MASK ((uint32_t)(DMA_ISR_GIF1 | DMA_ISR_TCIF1 | DMA_ISR_HTIF1 | DMA_ISR_TEIF1))
\r
90 #define DMA1_CHANNEL2_IT_MASK ((uint32_t)(DMA_ISR_GIF2 | DMA_ISR_TCIF2 | DMA_ISR_HTIF2 | DMA_ISR_TEIF2))
\r
91 #define DMA1_CHANNEL3_IT_MASK ((uint32_t)(DMA_ISR_GIF3 | DMA_ISR_TCIF3 | DMA_ISR_HTIF3 | DMA_ISR_TEIF3))
\r
92 #define DMA1_CHANNEL4_IT_MASK ((uint32_t)(DMA_ISR_GIF4 | DMA_ISR_TCIF4 | DMA_ISR_HTIF4 | DMA_ISR_TEIF4))
\r
93 #define DMA1_CHANNEL5_IT_MASK ((uint32_t)(DMA_ISR_GIF5 | DMA_ISR_TCIF5 | DMA_ISR_HTIF5 | DMA_ISR_TEIF5))
\r
94 #define DMA1_CHANNEL6_IT_MASK ((uint32_t)(DMA_ISR_GIF6 | DMA_ISR_TCIF6 | DMA_ISR_HTIF6 | DMA_ISR_TEIF6))
\r
95 #define DMA1_CHANNEL7_IT_MASK ((uint32_t)(DMA_ISR_GIF7 | DMA_ISR_TCIF7 | DMA_ISR_HTIF7 | DMA_ISR_TEIF7))
\r
97 /* DMA2 Channelx interrupt pending bit masks */
\r
98 #define DMA2_CHANNEL1_IT_MASK ((uint32_t)(DMA_ISR_GIF1 | DMA_ISR_TCIF1 | DMA_ISR_HTIF1 | DMA_ISR_TEIF1))
\r
99 #define DMA2_CHANNEL2_IT_MASK ((uint32_t)(DMA_ISR_GIF2 | DMA_ISR_TCIF2 | DMA_ISR_HTIF2 | DMA_ISR_TEIF2))
\r
100 #define DMA2_CHANNEL3_IT_MASK ((uint32_t)(DMA_ISR_GIF3 | DMA_ISR_TCIF3 | DMA_ISR_HTIF3 | DMA_ISR_TEIF3))
\r
101 #define DMA2_CHANNEL4_IT_MASK ((uint32_t)(DMA_ISR_GIF4 | DMA_ISR_TCIF4 | DMA_ISR_HTIF4 | DMA_ISR_TEIF4))
\r
102 #define DMA2_CHANNEL5_IT_MASK ((uint32_t)(DMA_ISR_GIF5 | DMA_ISR_TCIF5 | DMA_ISR_HTIF5 | DMA_ISR_TEIF5))
\r
104 /* DMA FLAG mask */
\r
105 #define FLAG_MASK ((uint32_t)0x10000000)
\r
107 /* DMA registers Masks */
\r
108 #define CCR_CLEAR_MASK ((uint32_t)0xFFFF800F)
\r
110 /* Private macro -------------------------------------------------------------*/
\r
111 /* Private variables ---------------------------------------------------------*/
\r
112 /* Private function prototypes -----------------------------------------------*/
\r
113 /* Private functions ---------------------------------------------------------*/
\r
116 /** @defgroup DMA_Private_Functions
\r
120 /** @defgroup DMA_Group1 Initialization and Configuration functions
\r
121 * @brief Initialization and Configuration functions
\r
124 ===============================================================================
\r
125 ##### Initialization and Configuration functions #####
\r
126 ===============================================================================
\r
127 [..] This subsection provides functions allowing to initialize the DMA channel
\r
128 source and destination addresses, incrementation and data sizes, transfer
\r
129 direction, buffer size, circular/normal mode selection, memory-to-memory
\r
130 mode selection and channel priority value.
\r
131 [..] The DMA_Init() function follows the DMA configuration procedures as described
\r
132 in reference manual (RM0038).
\r
138 * @brief Deinitializes the DMAy Channelx registers to their default reset
\r
140 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and x can be
\r
141 * 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
\r
144 void DMA_DeInit(DMA_Channel_TypeDef* DMAy_Channelx)
\r
146 /* Check the parameters */
\r
147 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
\r
149 /* Disable the selected DMAy Channelx */
\r
150 DMAy_Channelx->CCR &= (uint16_t)(~DMA_CCR1_EN);
\r
152 /* Reset DMAy Channelx control register */
\r
153 DMAy_Channelx->CCR = 0;
\r
155 /* Reset DMAy Channelx remaining bytes register */
\r
156 DMAy_Channelx->CNDTR = 0;
\r
158 /* Reset DMAy Channelx peripheral address register */
\r
159 DMAy_Channelx->CPAR = 0;
\r
161 /* Reset DMAy Channelx memory address register */
\r
162 DMAy_Channelx->CMAR = 0;
\r
164 if (DMAy_Channelx == DMA1_Channel1)
\r
166 /* Reset interrupt pending bits for DMA1 Channel1 */
\r
167 DMA1->IFCR |= DMA1_CHANNEL1_IT_MASK;
\r
169 else if (DMAy_Channelx == DMA1_Channel2)
\r
171 /* Reset interrupt pending bits for DMA1 Channel2 */
\r
172 DMA1->IFCR |= DMA1_CHANNEL2_IT_MASK;
\r
174 else if (DMAy_Channelx == DMA1_Channel3)
\r
176 /* Reset interrupt pending bits for DMA1 Channel3 */
\r
177 DMA1->IFCR |= DMA1_CHANNEL3_IT_MASK;
\r
179 else if (DMAy_Channelx == DMA1_Channel4)
\r
181 /* Reset interrupt pending bits for DMA1 Channel4 */
\r
182 DMA1->IFCR |= DMA1_CHANNEL4_IT_MASK;
\r
184 else if (DMAy_Channelx == DMA1_Channel5)
\r
186 /* Reset interrupt pending bits for DMA1 Channel5 */
\r
187 DMA1->IFCR |= DMA1_CHANNEL5_IT_MASK;
\r
189 else if (DMAy_Channelx == DMA1_Channel6)
\r
191 /* Reset interrupt pending bits for DMA1 Channel6 */
\r
192 DMA1->IFCR |= DMA1_CHANNEL6_IT_MASK;
\r
194 else if (DMAy_Channelx == DMA1_Channel7)
\r
196 /* Reset interrupt pending bits for DMA1 Channel7 */
\r
197 DMA1->IFCR |= DMA1_CHANNEL7_IT_MASK;
\r
199 else if (DMAy_Channelx == DMA2_Channel1)
\r
201 /* Reset interrupt pending bits for DMA2 Channel1 */
\r
202 DMA2->IFCR |= DMA2_CHANNEL1_IT_MASK;
\r
204 else if (DMAy_Channelx == DMA2_Channel2)
\r
206 /* Reset interrupt pending bits for DMA2 Channel2 */
\r
207 DMA2->IFCR |= DMA2_CHANNEL2_IT_MASK;
\r
209 else if (DMAy_Channelx == DMA2_Channel3)
\r
211 /* Reset interrupt pending bits for DMA2 Channel3 */
\r
212 DMA2->IFCR |= DMA2_CHANNEL3_IT_MASK;
\r
214 else if (DMAy_Channelx == DMA2_Channel4)
\r
216 /* Reset interrupt pending bits for DMA2 Channel4 */
\r
217 DMA2->IFCR |= DMA2_CHANNEL4_IT_MASK;
\r
221 if (DMAy_Channelx == DMA2_Channel5)
\r
223 /* Reset interrupt pending bits for DMA2 Channel5 */
\r
224 DMA2->IFCR |= DMA2_CHANNEL5_IT_MASK;
\r
230 * @brief Initializes the DMAy Channelx according to the specified
\r
231 * parameters in the DMA_InitStruct.
\r
232 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and x can be
\r
233 * 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
\r
234 * @param DMA_InitStruct: pointer to a DMA_InitTypeDef structure that
\r
235 * contains the configuration information for the specified DMA Channel.
\r
238 void DMA_Init(DMA_Channel_TypeDef* DMAy_Channelx, DMA_InitTypeDef* DMA_InitStruct)
\r
240 uint32_t tmpreg = 0;
\r
242 /* Check the parameters */
\r
243 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
\r
244 assert_param(IS_DMA_DIR(DMA_InitStruct->DMA_DIR));
\r
245 assert_param(IS_DMA_BUFFER_SIZE(DMA_InitStruct->DMA_BufferSize));
\r
246 assert_param(IS_DMA_PERIPHERAL_INC_STATE(DMA_InitStruct->DMA_PeripheralInc));
\r
247 assert_param(IS_DMA_MEMORY_INC_STATE(DMA_InitStruct->DMA_MemoryInc));
\r
248 assert_param(IS_DMA_PERIPHERAL_DATA_SIZE(DMA_InitStruct->DMA_PeripheralDataSize));
\r
249 assert_param(IS_DMA_MEMORY_DATA_SIZE(DMA_InitStruct->DMA_MemoryDataSize));
\r
250 assert_param(IS_DMA_MODE(DMA_InitStruct->DMA_Mode));
\r
251 assert_param(IS_DMA_PRIORITY(DMA_InitStruct->DMA_Priority));
\r
252 assert_param(IS_DMA_M2M_STATE(DMA_InitStruct->DMA_M2M));
\r
254 /*--------------------------- DMAy Channelx CCR Configuration -----------------*/
\r
255 /* Get the DMAy_Channelx CCR value */
\r
256 tmpreg = DMAy_Channelx->CCR;
\r
257 /* Clear MEM2MEM, PL, MSIZE, PSIZE, MINC, PINC, CIRC and DIR bits */
\r
258 tmpreg &= CCR_CLEAR_MASK;
\r
259 /* Configure DMAy Channelx: data transfer, data size, priority level and mode */
\r
260 /* Set DIR bit according to DMA_DIR value */
\r
261 /* Set CIRC bit according to DMA_Mode value */
\r
262 /* Set PINC bit according to DMA_PeripheralInc value */
\r
263 /* Set MINC bit according to DMA_MemoryInc value */
\r
264 /* Set PSIZE bits according to DMA_PeripheralDataSize value */
\r
265 /* Set MSIZE bits according to DMA_MemoryDataSize value */
\r
266 /* Set PL bits according to DMA_Priority value */
\r
267 /* Set the MEM2MEM bit according to DMA_M2M value */
\r
268 tmpreg |= DMA_InitStruct->DMA_DIR | DMA_InitStruct->DMA_Mode |
\r
269 DMA_InitStruct->DMA_PeripheralInc | DMA_InitStruct->DMA_MemoryInc |
\r
270 DMA_InitStruct->DMA_PeripheralDataSize | DMA_InitStruct->DMA_MemoryDataSize |
\r
271 DMA_InitStruct->DMA_Priority | DMA_InitStruct->DMA_M2M;
\r
273 /* Write to DMAy Channelx CCR */
\r
274 DMAy_Channelx->CCR = tmpreg;
\r
276 /*--------------------------- DMAy Channelx CNDTR Configuration ---------------*/
\r
277 /* Write to DMAy Channelx CNDTR */
\r
278 DMAy_Channelx->CNDTR = DMA_InitStruct->DMA_BufferSize;
\r
280 /*--------------------------- DMAy Channelx CPAR Configuration ----------------*/
\r
281 /* Write to DMAy Channelx CPAR */
\r
282 DMAy_Channelx->CPAR = DMA_InitStruct->DMA_PeripheralBaseAddr;
\r
284 /*--------------------------- DMAy Channelx CMAR Configuration ----------------*/
\r
285 /* Write to DMAy Channelx CMAR */
\r
286 DMAy_Channelx->CMAR = DMA_InitStruct->DMA_MemoryBaseAddr;
\r
290 * @brief Fills each DMA_InitStruct member with its default value.
\r
291 * @param DMA_InitStruct: pointer to a DMA_InitTypeDef structure which will
\r
295 void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct)
\r
297 /*-------------- Reset DMA init structure parameters values ------------------*/
\r
298 /* Initialize the DMA_PeripheralBaseAddr member */
\r
299 DMA_InitStruct->DMA_PeripheralBaseAddr = 0;
\r
300 /* Initialize the DMA_MemoryBaseAddr member */
\r
301 DMA_InitStruct->DMA_MemoryBaseAddr = 0;
\r
302 /* Initialize the DMA_DIR member */
\r
303 DMA_InitStruct->DMA_DIR = DMA_DIR_PeripheralSRC;
\r
304 /* Initialize the DMA_BufferSize member */
\r
305 DMA_InitStruct->DMA_BufferSize = 0;
\r
306 /* Initialize the DMA_PeripheralInc member */
\r
307 DMA_InitStruct->DMA_PeripheralInc = DMA_PeripheralInc_Disable;
\r
308 /* Initialize the DMA_MemoryInc member */
\r
309 DMA_InitStruct->DMA_MemoryInc = DMA_MemoryInc_Disable;
\r
310 /* Initialize the DMA_PeripheralDataSize member */
\r
311 DMA_InitStruct->DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
\r
312 /* Initialize the DMA_MemoryDataSize member */
\r
313 DMA_InitStruct->DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
\r
314 /* Initialize the DMA_Mode member */
\r
315 DMA_InitStruct->DMA_Mode = DMA_Mode_Normal;
\r
316 /* Initialize the DMA_Priority member */
\r
317 DMA_InitStruct->DMA_Priority = DMA_Priority_Low;
\r
318 /* Initialize the DMA_M2M member */
\r
319 DMA_InitStruct->DMA_M2M = DMA_M2M_Disable;
\r
323 * @brief Enables or disables the specified DMAy Channelx.
\r
324 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and x can be
\r
325 * 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
\r
326 * @param NewState: new state of the DMAy Channelx.
\r
327 * This parameter can be: ENABLE or DISABLE.
\r
330 void DMA_Cmd(DMA_Channel_TypeDef* DMAy_Channelx, FunctionalState NewState)
\r
332 /* Check the parameters */
\r
333 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
\r
334 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
336 if (NewState != DISABLE)
\r
338 /* Enable the selected DMAy Channelx */
\r
339 DMAy_Channelx->CCR |= DMA_CCR1_EN;
\r
343 /* Disable the selected DMAy Channelx */
\r
344 DMAy_Channelx->CCR &= (uint16_t)(~DMA_CCR1_EN);
\r
352 /** @defgroup DMA_Group2 Data Counter functions
\r
353 * @brief Data Counter functions
\r
356 ===============================================================================
\r
357 ##### Data Counter functions #####
\r
358 ===============================================================================
\r
359 [..] This subsection provides function allowing to configure and read the buffer
\r
360 size (number of data to be transferred).The DMA data counter can be written
\r
361 only when the DMA channel is disabled (ie. after transfer complete event).
\r
362 [..] The following function can be used to write the Channel data counter value:
\r
363 (+) void DMA_SetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx, uint16_t
\r
365 -@- It is advised to use this function rather than DMA_Init() in situations
\r
366 where only the Data buffer needs to be reloaded.
\r
367 [..] The DMA data counter can be read to indicate the number of remaining transfers
\r
368 for the relative DMA channel. This counter is decremented at the end of each
\r
369 data transfer and when the transfer is complete:
\r
370 (+) If Normal mode is selected: the counter is set to 0.
\r
371 (+) If Circular mode is selected: the counter is reloaded with the initial
\r
372 value(configured before enabling the DMA channel).
\r
373 [..] The following function can be used to read the Channel data counter value:
\r
374 (+) uint16_t DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx).
\r
381 * @brief Sets the number of data units in the current DMAy Channelx transfer.
\r
382 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and x can be
\r
383 * 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
\r
384 * @param DataNumber: The number of data units in the current DMAy Channelx
\r
386 * @note This function can only be used when the DMAy_Channelx is disabled.
\r
389 void DMA_SetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx, uint16_t DataNumber)
\r
391 /* Check the parameters */
\r
392 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
\r
394 /*--------------------------- DMAy Channelx CNDTR Configuration ---------------*/
\r
395 /* Write to DMAy Channelx CNDTR */
\r
396 DMAy_Channelx->CNDTR = DataNumber;
\r
400 * @brief Returns the number of remaining data units in the current
\r
401 * DMAy Channelx transfer.
\r
402 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and x can be
\r
403 * 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
\r
404 * @retval The number of remaining data units in the current DMAy Channelx
\r
407 uint16_t DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx)
\r
409 /* Check the parameters */
\r
410 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
\r
411 /* Return the number of remaining data units for DMAy Channelx */
\r
412 return ((uint16_t)(DMAy_Channelx->CNDTR));
\r
419 /** @defgroup DMA_Group3 Interrupts and flags management functions
\r
420 * @brief Interrupts and flags management functions
\r
423 ===============================================================================
\r
424 ##### Interrupts and flags management functions #####
\r
425 ===============================================================================
\r
426 [..] This subsection provides functions allowing to configure the DMA Interrupts
\r
427 sources and check or clear the flags or pending bits status.
\r
428 The user should identify which mode will be used in his application to manage
\r
429 the DMA controller events: Polling mode or Interrupt mode.
\r
430 *** Polling Mode ***
\r
431 ====================
\r
432 [..] Each DMA channel can be managed through 4 event Flags:(y : DMA Controller
\r
433 number x : DMA channel number ).
\r
434 (#) DMAy_FLAG_TCx : to indicate that a Transfer Complete event occurred.
\r
435 (#) DMAy_FLAG_HTx : to indicate that a Half-Transfer Complete event occurred.
\r
436 (#) DMAy_FLAG_TEx : to indicate that a Transfer Error occurred.
\r
437 (#) DMAy_FLAG_GLx : to indicate that at least one of the events described
\r
439 -@- Clearing DMAy_FLAG_GLx results in clearing all other pending flags of the
\r
440 same channel (DMAy_FLAG_TCx, DMAy_FLAG_HTx and DMAy_FLAG_TEx).
\r
441 [..]In this Mode it is advised to use the following functions:
\r
442 (+) FlagStatus DMA_GetFlagStatus(uint32_t DMA_FLAG);
\r
443 (+) void DMA_ClearFlag(uint32_t DMA_FLAG);
\r
445 *** Interrupt Mode ***
\r
446 ======================
\r
447 [..] Each DMA channel can be managed through 4 Interrupts:
\r
448 (+) Interrupt Source
\r
449 (##) DMA_IT_TC: specifies the interrupt source for the Transfer Complete
\r
451 (##) DMA_IT_HT : specifies the interrupt source for the Half-transfer Complete
\r
453 (##) DMA_IT_TE : specifies the interrupt source for the transfer errors event.
\r
454 (##) DMA_IT_GL : to indicate that at least one of the interrupts described
\r
456 -@@- Clearing DMA_IT_GL interrupt results in clearing all other interrupts of
\r
457 the same channel (DMA_IT_TCx, DMA_IT_HT and DMA_IT_TE).
\r
458 [..]In this Mode it is advised to use the following functions:
\r
459 (+) void DMA_ITConfig(DMA_Channel_TypeDef* DMAy_Channelx, uint32_t DMA_IT,
\r
460 FunctionalState NewState);
\r
461 (+) ITStatus DMA_GetITStatus(uint32_t DMA_IT);
\r
462 (+) void DMA_ClearITPendingBit(uint32_t DMA_IT);
\r
469 * @brief Enables or disables the specified DMAy Channelx interrupts.
\r
470 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and x can be
\r
471 * 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
\r
472 * @param DMA_IT: specifies the DMA interrupts sources to be enabled
\r
474 * This parameter can be any combination of the following values:
\r
475 * @arg DMA_IT_TC: Transfer complete interrupt mask
\r
476 * @arg DMA_IT_HT: Half transfer interrupt mask
\r
477 * @arg DMA_IT_TE: Transfer error interrupt mask
\r
478 * @param NewState: new state of the specified DMA interrupts.
\r
479 * This parameter can be: ENABLE or DISABLE.
\r
482 void DMA_ITConfig(DMA_Channel_TypeDef* DMAy_Channelx, uint32_t DMA_IT, FunctionalState NewState)
\r
484 /* Check the parameters */
\r
485 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
\r
486 assert_param(IS_DMA_CONFIG_IT(DMA_IT));
\r
487 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
489 if (NewState != DISABLE)
\r
491 /* Enable the selected DMA interrupts */
\r
492 DMAy_Channelx->CCR |= DMA_IT;
\r
496 /* Disable the selected DMA interrupts */
\r
497 DMAy_Channelx->CCR &= ~DMA_IT;
\r
502 * @brief Checks whether the specified DMAy Channelx flag is set or not.
\r
503 * @param DMAy_FLAG: specifies the flag to check.
\r
504 * This parameter can be one of the following values:
\r
505 * @arg DMA1_FLAG_GL1: DMA1 Channel1 global flag.
\r
506 * @arg DMA1_FLAG_TC1: DMA1 Channel1 transfer complete flag.
\r
507 * @arg DMA1_FLAG_HT1: DMA1 Channel1 half transfer flag.
\r
508 * @arg DMA1_FLAG_TE1: DMA1 Channel1 transfer error flag.
\r
509 * @arg DMA1_FLAG_GL2: DMA1 Channel2 global flag.
\r
510 * @arg DMA1_FLAG_TC2: DMA1 Channel2 transfer complete flag.
\r
511 * @arg DMA1_FLAG_HT2: DMA1 Channel2 half transfer flag.
\r
512 * @arg DMA1_FLAG_TE2: DMA1 Channel2 transfer error flag.
\r
513 * @arg DMA1_FLAG_GL3: DMA1 Channel3 global flag.
\r
514 * @arg DMA1_FLAG_TC3: DMA1 Channel3 transfer complete flag.
\r
515 * @arg DMA1_FLAG_HT3: DMA1 Channel3 half transfer flag.
\r
516 * @arg DMA1_FLAG_TE3: DMA1 Channel3 transfer error flag.
\r
517 * @arg DMA1_FLAG_GL4: DMA1 Channel4 global flag.
\r
518 * @arg DMA1_FLAG_TC4: DMA1 Channel4 transfer complete flag.
\r
519 * @arg DMA1_FLAG_HT4: DMA1 Channel4 half transfer flag.
\r
520 * @arg DMA1_FLAG_TE4: DMA1 Channel4 transfer error flag.
\r
521 * @arg DMA1_FLAG_GL5: DMA1 Channel5 global flag.
\r
522 * @arg DMA1_FLAG_TC5: DMA1 Channel5 transfer complete flag.
\r
523 * @arg DMA1_FLAG_HT5: DMA1 Channel5 half transfer flag.
\r
524 * @arg DMA1_FLAG_TE5: DMA1 Channel5 transfer error flag.
\r
525 * @arg DMA1_FLAG_GL6: DMA1 Channel6 global flag.
\r
526 * @arg DMA1_FLAG_TC6: DMA1 Channel6 transfer complete flag.
\r
527 * @arg DMA1_FLAG_HT6: DMA1 Channel6 half transfer flag.
\r
528 * @arg DMA1_FLAG_TE6: DMA1 Channel6 transfer error flag.
\r
529 * @arg DMA1_FLAG_GL7: DMA1 Channel7 global flag.
\r
530 * @arg DMA1_FLAG_TC7: DMA1 Channel7 transfer complete flag.
\r
531 * @arg DMA1_FLAG_HT7: DMA1 Channel7 half transfer flag.
\r
532 * @arg DMA1_FLAG_TE7: DMA1 Channel7 transfer error flag.
\r
533 * @arg DMA2_FLAG_GL1: DMA2 Channel1 global flag.
\r
534 * @arg DMA2_FLAG_TC1: DMA2 Channel1 transfer complete flag.
\r
535 * @arg DMA2_FLAG_HT1: DMA2 Channel1 half transfer flag.
\r
536 * @arg DMA2_FLAG_TE1: DMA2 Channel1 transfer error flag.
\r
537 * @arg DMA2_FLAG_GL2: DMA2 Channel2 global flag.
\r
538 * @arg DMA2_FLAG_TC2: DMA2 Channel2 transfer complete flag.
\r
539 * @arg DMA2_FLAG_HT2: DMA2 Channel2 half transfer flag.
\r
540 * @arg DMA2_FLAG_TE2: DMA2 Channel2 transfer error flag.
\r
541 * @arg DMA2_FLAG_GL3: DMA2 Channel3 global flag.
\r
542 * @arg DMA2_FLAG_TC3: DMA2 Channel3 transfer complete flag.
\r
543 * @arg DMA2_FLAG_HT3: DMA2 Channel3 half transfer flag.
\r
544 * @arg DMA2_FLAG_TE3: DMA2 Channel3 transfer error flag.
\r
545 * @arg DMA2_FLAG_GL4: DMA2 Channel4 global flag.
\r
546 * @arg DMA2_FLAG_TC4: DMA2 Channel4 transfer complete flag.
\r
547 * @arg DMA2_FLAG_HT4: DMA2 Channel4 half transfer flag.
\r
548 * @arg DMA2_FLAG_TE4: DMA2 Channel4 transfer error flag.
\r
549 * @arg DMA2_FLAG_GL5: DMA2 Channel5 global flag.
\r
550 * @arg DMA2_FLAG_TC5: DMA2 Channel5 transfer complete flag.
\r
551 * @arg DMA2_FLAG_HT5: DMA2 Channel5 half transfer flag.
\r
552 * @arg DMA2_FLAG_TE5: DMA2 Channel5 transfer error flag.
\r
555 * The Global flag (DMAy_FLAG_GLx) is set whenever any of the other flags
\r
556 * relative to the same channel is set (Transfer Complete, Half-transfer
\r
557 * Complete or Transfer Error flags: DMAy_FLAG_TCx, DMAy_FLAG_HTx or
\r
560 * @retval The new state of DMAy_FLAG (SET or RESET).
\r
562 FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG)
\r
564 FlagStatus bitstatus = RESET;
\r
565 uint32_t tmpreg = 0;
\r
567 /* Check the parameters */
\r
568 assert_param(IS_DMA_GET_FLAG(DMAy_FLAG));
\r
570 /* Calculate the used DMAy */
\r
571 if ((DMAy_FLAG & FLAG_MASK) == (uint32_t)RESET)
\r
573 /* Get DMA1 ISR register value */
\r
574 tmpreg = DMA1->ISR;
\r
578 /* Get DMA2 ISR register value */
\r
579 tmpreg = DMA2->ISR;
\r
582 /* Check the status of the specified DMAy flag */
\r
583 if ((tmpreg & DMAy_FLAG) != (uint32_t)RESET)
\r
585 /* DMAy_FLAG is set */
\r
590 /* DMAy_FLAG is reset */
\r
594 /* Return the DMAy_FLAG status */
\r
599 * @brief Clears the DMAy Channelx's pending flags.
\r
600 * @param DMAy_FLAG: specifies the flag to clear.
\r
601 * This parameter can be any combination (for the same DMA) of the following values:
\r
602 * @arg DMA1_FLAG_GL1: DMA1 Channel1 global flag.
\r
603 * @arg DMA1_FLAG_TC1: DMA1 Channel1 transfer complete flag.
\r
604 * @arg DMA1_FLAG_HT1: DMA1 Channel1 half transfer flag.
\r
605 * @arg DMA1_FLAG_TE1: DMA1 Channel1 transfer error flag.
\r
606 * @arg DMA1_FLAG_GL2: DMA1 Channel2 global flag.
\r
607 * @arg DMA1_FLAG_TC2: DMA1 Channel2 transfer complete flag.
\r
608 * @arg DMA1_FLAG_HT2: DMA1 Channel2 half transfer flag.
\r
609 * @arg DMA1_FLAG_TE2: DMA1 Channel2 transfer error flag.
\r
610 * @arg DMA1_FLAG_GL3: DMA1 Channel3 global flag.
\r
611 * @arg DMA1_FLAG_TC3: DMA1 Channel3 transfer complete flag.
\r
612 * @arg DMA1_FLAG_HT3: DMA1 Channel3 half transfer flag.
\r
613 * @arg DMA1_FLAG_TE3: DMA1 Channel3 transfer error flag.
\r
614 * @arg DMA1_FLAG_GL4: DMA1 Channel4 global flag.
\r
615 * @arg DMA1_FLAG_TC4: DMA1 Channel4 transfer complete flag.
\r
616 * @arg DMA1_FLAG_HT4: DMA1 Channel4 half transfer flag.
\r
617 * @arg DMA1_FLAG_TE4: DMA1 Channel4 transfer error flag.
\r
618 * @arg DMA1_FLAG_GL5: DMA1 Channel5 global flag.
\r
619 * @arg DMA1_FLAG_TC5: DMA1 Channel5 transfer complete flag.
\r
620 * @arg DMA1_FLAG_HT5: DMA1 Channel5 half transfer flag.
\r
621 * @arg DMA1_FLAG_TE5: DMA1 Channel5 transfer error flag.
\r
622 * @arg DMA1_FLAG_GL6: DMA1 Channel6 global flag.
\r
623 * @arg DMA1_FLAG_TC6: DMA1 Channel6 transfer complete flag.
\r
624 * @arg DMA1_FLAG_HT6: DMA1 Channel6 half transfer flag.
\r
625 * @arg DMA1_FLAG_TE6: DMA1 Channel6 transfer error flag.
\r
626 * @arg DMA1_FLAG_GL7: DMA1 Channel7 global flag.
\r
627 * @arg DMA1_FLAG_TC7: DMA1 Channel7 transfer complete flag.
\r
628 * @arg DMA1_FLAG_HT7: DMA1 Channel7 half transfer flag.
\r
629 * @arg DMA1_FLAG_TE7: DMA1 Channel7 transfer error flag.
\r
630 * @arg DMA2_FLAG_GL1: DMA2 Channel1 global flag.
\r
631 * @arg DMA2_FLAG_TC1: DMA2 Channel1 transfer complete flag.
\r
632 * @arg DMA2_FLAG_HT1: DMA2 Channel1 half transfer flag.
\r
633 * @arg DMA2_FLAG_TE1: DMA2 Channel1 transfer error flag.
\r
634 * @arg DMA2_FLAG_GL2: DMA2 Channel2 global flag.
\r
635 * @arg DMA2_FLAG_TC2: DMA2 Channel2 transfer complete flag.
\r
636 * @arg DMA2_FLAG_HT2: DMA2 Channel2 half transfer flag.
\r
637 * @arg DMA2_FLAG_TE2: DMA2 Channel2 transfer error flag.
\r
638 * @arg DMA2_FLAG_GL3: DMA2 Channel3 global flag.
\r
639 * @arg DMA2_FLAG_TC3: DMA2 Channel3 transfer complete flag.
\r
640 * @arg DMA2_FLAG_HT3: DMA2 Channel3 half transfer flag.
\r
641 * @arg DMA2_FLAG_TE3: DMA2 Channel3 transfer error flag.
\r
642 * @arg DMA2_FLAG_GL4: DMA2 Channel4 global flag.
\r
643 * @arg DMA2_FLAG_TC4: DMA2 Channel4 transfer complete flag.
\r
644 * @arg DMA2_FLAG_HT4: DMA2 Channel4 half transfer flag.
\r
645 * @arg DMA2_FLAG_TE4: DMA2 Channel4 transfer error flag.
\r
646 * @arg DMA2_FLAG_GL5: DMA2 Channel5 global flag.
\r
647 * @arg DMA2_FLAG_TC5: DMA2 Channel5 transfer complete flag.
\r
648 * @arg DMA2_FLAG_HT5: DMA2 Channel5 half transfer flag.
\r
649 * @arg DMA2_FLAG_TE5: DMA2 Channel5 transfer error flag.
\r
652 * Clearing the Global flag (DMAy_FLAG_GLx) results in clearing all other flags
\r
653 * relative to the same channel (Transfer Complete, Half-transfer Complete and
\r
654 * Transfer Error flags: DMAy_FLAG_TCx, DMAy_FLAG_HTx and DMAy_FLAG_TEx).
\r
658 void DMA_ClearFlag(uint32_t DMAy_FLAG)
\r
660 /* Check the parameters */
\r
661 assert_param(IS_DMA_CLEAR_FLAG(DMAy_FLAG));
\r
663 if ((DMAy_FLAG & FLAG_MASK) == (uint32_t)RESET)
\r
665 /* Clear the selected DMAy flags */
\r
666 DMA1->IFCR = DMAy_FLAG;
\r
670 /* Clear the selected DMAy flags */
\r
671 DMA2->IFCR = DMAy_FLAG;
\r
676 * @brief Checks whether the specified DMAy Channelx interrupt has occurred or not.
\r
677 * @param DMAy_IT: specifies the DMAy interrupt source to check.
\r
678 * This parameter can be one of the following values:
\r
679 * @arg DMA1_IT_GL1: DMA1 Channel1 global interrupt.
\r
680 * @arg DMA1_IT_TC1: DMA1 Channel1 transfer complete interrupt.
\r
681 * @arg DMA1_IT_HT1: DMA1 Channel1 half transfer interrupt.
\r
682 * @arg DMA1_IT_TE1: DMA1 Channel1 transfer error interrupt.
\r
683 * @arg DMA1_IT_GL2: DMA1 Channel2 global interrupt.
\r
684 * @arg DMA1_IT_TC2: DMA1 Channel2 transfer complete interrupt.
\r
685 * @arg DMA1_IT_HT2: DMA1 Channel2 half transfer interrupt.
\r
686 * @arg DMA1_IT_TE2: DMA1 Channel2 transfer error interrupt.
\r
687 * @arg DMA1_IT_GL3: DMA1 Channel3 global interrupt.
\r
688 * @arg DMA1_IT_TC3: DMA1 Channel3 transfer complete interrupt.
\r
689 * @arg DMA1_IT_HT3: DMA1 Channel3 half transfer interrupt.
\r
690 * @arg DMA1_IT_TE3: DMA1 Channel3 transfer error interrupt.
\r
691 * @arg DMA1_IT_GL4: DMA1 Channel4 global interrupt.
\r
692 * @arg DMA1_IT_TC4: DMA1 Channel4 transfer complete interrupt.
\r
693 * @arg DMA1_IT_HT4: DMA1 Channel4 half transfer interrupt.
\r
694 * @arg DMA1_IT_TE4: DMA1 Channel4 transfer error interrupt.
\r
695 * @arg DMA1_IT_GL5: DMA1 Channel5 global interrupt.
\r
696 * @arg DMA1_IT_TC5: DMA1 Channel5 transfer complete interrupt.
\r
697 * @arg DMA1_IT_HT5: DMA1 Channel5 half transfer interrupt.
\r
698 * @arg DMA1_IT_TE5: DMA1 Channel5 transfer error interrupt.
\r
699 * @arg DMA1_IT_GL6: DMA1 Channel6 global interrupt.
\r
700 * @arg DMA1_IT_TC6: DMA1 Channel6 transfer complete interrupt.
\r
701 * @arg DMA1_IT_HT6: DMA1 Channel6 half transfer interrupt.
\r
702 * @arg DMA1_IT_TE6: DMA1 Channel6 transfer error interrupt.
\r
703 * @arg DMA1_IT_GL7: DMA1 Channel7 global interrupt.
\r
704 * @arg DMA1_IT_TC7: DMA1 Channel7 transfer complete interrupt.
\r
705 * @arg DMA1_IT_HT7: DMA1 Channel7 half transfer interrupt.
\r
706 * @arg DMA1_IT_TE7: DMA1 Channel7 transfer error interrupt.
\r
707 * @arg DMA2_IT_GL1: DMA2 Channel1 global interrupt.
\r
708 * @arg DMA2_IT_TC1: DMA2 Channel1 transfer complete interrupt.
\r
709 * @arg DMA2_IT_HT1: DMA2 Channel1 half transfer interrupt.
\r
710 * @arg DMA2_IT_TE1: DMA2 Channel1 transfer error interrupt.
\r
711 * @arg DMA2_IT_GL2: DMA2 Channel2 global interrupt.
\r
712 * @arg DMA2_IT_TC2: DMA2 Channel2 transfer complete interrupt.
\r
713 * @arg DMA2_IT_HT2: DMA2 Channel2 half transfer interrupt.
\r
714 * @arg DMA2_IT_TE2: DMA2 Channel2 transfer error interrupt.
\r
715 * @arg DMA2_IT_GL3: DMA2 Channel3 global interrupt.
\r
716 * @arg DMA2_IT_TC3: DMA2 Channel3 transfer complete interrupt.
\r
717 * @arg DMA2_IT_HT3: DMA2 Channel3 half transfer interrupt.
\r
718 * @arg DMA2_IT_TE3: DMA2 Channel3 transfer error interrupt.
\r
719 * @arg DMA2_IT_GL4: DMA2 Channel4 global interrupt.
\r
720 * @arg DMA2_IT_TC4: DMA2 Channel4 transfer complete interrupt.
\r
721 * @arg DMA2_IT_HT4: DMA2 Channel4 half transfer interrupt.
\r
722 * @arg DMA2_IT_TE4: DMA2 Channel4 transfer error interrupt.
\r
723 * @arg DMA2_IT_GL5: DMA2 Channel5 global interrupt.
\r
724 * @arg DMA2_IT_TC5: DMA2 Channel5 transfer complete interrupt.
\r
725 * @arg DMA2_IT_HT5: DMA2 Channel5 half transfer interrupt.
\r
726 * @arg DMA2_IT_TE5: DMA2 Channel5 transfer error interrupt.
\r
729 * The Global interrupt (DMAy_FLAG_GLx) is set whenever any of the other
\r
730 * interrupts relative to the same channel is set (Transfer Complete,
\r
731 * Half-transfer Complete or Transfer Error interrupts: DMAy_IT_TCx,
\r
732 * DMAy_IT_HTx or DMAy_IT_TEx).
\r
734 * @retval The new state of DMAy_IT (SET or RESET).
\r
736 ITStatus DMA_GetITStatus(uint32_t DMAy_IT)
\r
738 ITStatus bitstatus = RESET;
\r
739 uint32_t tmpreg = 0;
\r
741 /* Check the parameters */
\r
742 assert_param(IS_DMA_GET_IT(DMAy_IT));
\r
744 /* Calculate the used DMAy */
\r
745 if ((DMAy_IT & FLAG_MASK) == (uint32_t)RESET)
\r
747 /* Get DMA1 ISR register value */
\r
748 tmpreg = DMA1->ISR;
\r
752 /* Get DMA2 ISR register value */
\r
753 tmpreg = DMA2->ISR;
\r
756 /* Check the status of the specified DMAy interrupt */
\r
757 if ((tmpreg & DMAy_IT) != (uint32_t)RESET)
\r
759 /* DMAy_IT is set */
\r
764 /* DMAy_IT is reset */
\r
767 /* Return the DMAy_IT status */
\r
772 * @brief Clears the DMAy Channelx's interrupt pending bits.
\r
773 * @param DMAy_IT: specifies the DMAy interrupt pending bit to clear.
\r
774 * This parameter can be any combination (for the same DMA) of the following values:
\r
775 * @arg DMA1_IT_GL1: DMA1 Channel1 global interrupt.
\r
776 * @arg DMA1_IT_TC1: DMA1 Channel1 transfer complete interrupt.
\r
777 * @arg DMA1_IT_HT1: DMA1 Channel1 half transfer interrupt.
\r
778 * @arg DMA1_IT_TE1: DMA1 Channel1 transfer error interrupt.
\r
779 * @arg DMA1_IT_GL2: DMA1 Channel2 global interrupt.
\r
780 * @arg DMA1_IT_TC2: DMA1 Channel2 transfer complete interrupt.
\r
781 * @arg DMA1_IT_HT2: DMA1 Channel2 half transfer interrupt.
\r
782 * @arg DMA1_IT_TE2: DMA1 Channel2 transfer error interrupt.
\r
783 * @arg DMA1_IT_GL3: DMA1 Channel3 global interrupt.
\r
784 * @arg DMA1_IT_TC3: DMA1 Channel3 transfer complete interrupt.
\r
785 * @arg DMA1_IT_HT3: DMA1 Channel3 half transfer interrupt.
\r
786 * @arg DMA1_IT_TE3: DMA1 Channel3 transfer error interrupt.
\r
787 * @arg DMA1_IT_GL4: DMA1 Channel4 global interrupt.
\r
788 * @arg DMA1_IT_TC4: DMA1 Channel4 transfer complete interrupt.
\r
789 * @arg DMA1_IT_HT4: DMA1 Channel4 half transfer interrupt.
\r
790 * @arg DMA1_IT_TE4: DMA1 Channel4 transfer error interrupt.
\r
791 * @arg DMA1_IT_GL5: DMA1 Channel5 global interrupt.
\r
792 * @arg DMA1_IT_TC5: DMA1 Channel5 transfer complete interrupt.
\r
793 * @arg DMA1_IT_HT5: DMA1 Channel5 half transfer interrupt.
\r
794 * @arg DMA1_IT_TE5: DMA1 Channel5 transfer error interrupt.
\r
795 * @arg DMA1_IT_GL6: DMA1 Channel6 global interrupt.
\r
796 * @arg DMA1_IT_TC6: DMA1 Channel6 transfer complete interrupt.
\r
797 * @arg DMA1_IT_HT6: DMA1 Channel6 half transfer interrupt.
\r
798 * @arg DMA1_IT_TE6: DMA1 Channel6 transfer error interrupt.
\r
799 * @arg DMA1_IT_GL7: DMA1 Channel7 global interrupt.
\r
800 * @arg DMA1_IT_TC7: DMA1 Channel7 transfer complete interrupt.
\r
801 * @arg DMA1_IT_HT7: DMA1 Channel7 half transfer interrupt.
\r
802 * @arg DMA1_IT_TE7: DMA1 Channel7 transfer error interrupt.
\r
803 * @arg DMA2_IT_GL1: DMA2 Channel1 global interrupt.
\r
804 * @arg DMA2_IT_TC1: DMA2 Channel1 transfer complete interrupt.
\r
805 * @arg DMA2_IT_HT1: DMA2 Channel1 half transfer interrupt.
\r
806 * @arg DMA2_IT_TE1: DMA2 Channel1 transfer error interrupt.
\r
807 * @arg DMA2_IT_GL2: DMA2 Channel2 global interrupt.
\r
808 * @arg DMA2_IT_TC2: DMA2 Channel2 transfer complete interrupt.
\r
809 * @arg DMA2_IT_HT2: DMA2 Channel2 half transfer interrupt.
\r
810 * @arg DMA2_IT_TE2: DMA2 Channel2 transfer error interrupt.
\r
811 * @arg DMA2_IT_GL3: DMA2 Channel3 global interrupt.
\r
812 * @arg DMA2_IT_TC3: DMA2 Channel3 transfer complete interrupt.
\r
813 * @arg DMA2_IT_HT3: DMA2 Channel3 half transfer interrupt.
\r
814 * @arg DMA2_IT_TE3: DMA2 Channel3 transfer error interrupt.
\r
815 * @arg DMA2_IT_GL4: DMA2 Channel4 global interrupt.
\r
816 * @arg DMA2_IT_TC4: DMA2 Channel4 transfer complete interrupt.
\r
817 * @arg DMA2_IT_HT4: DMA2 Channel4 half transfer interrupt.
\r
818 * @arg DMA2_IT_TE4: DMA2 Channel4 transfer error interrupt.
\r
819 * @arg DMA2_IT_GL5: DMA2 Channel5 global interrupt.
\r
820 * @arg DMA2_IT_TC5: DMA2 Channel5 transfer complete interrupt.
\r
821 * @arg DMA2_IT_HT5: DMA2 Channel5 half transfer interrupt.
\r
822 * @arg DMA2_IT_TE5: DMA2 Channel5 transfer error interrupt.
\r
825 * Clearing the Global interrupt (DMAy_IT_GLx) results in clearing all other
\r
826 * interrupts relative to the same channel (Transfer Complete, Half-transfer
\r
827 * Complete and Transfer Error interrupts: DMAy_IT_TCx, DMAy_IT_HTx and
\r
832 void DMA_ClearITPendingBit(uint32_t DMAy_IT)
\r
834 /* Check the parameters */
\r
835 assert_param(IS_DMA_CLEAR_IT(DMAy_IT));
\r
837 /* Calculate the used DMAy */
\r
838 if ((DMAy_IT & FLAG_MASK) == (uint32_t)RESET)
\r
840 /* Clear the selected DMAy interrupt pending bits */
\r
841 DMA1->IFCR = DMAy_IT;
\r
845 /* Clear the selected DMAy interrupt pending bits */
\r
846 DMA2->IFCR = DMAy_IT;
\r
866 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r