mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
jaerts
Date:
Tue Dec 22 13:22:16 2015 +0000
Revision:
637:ed69428d4850
Parent:
155:8435094ec241
Add very shady LPC1768 CAN Filter implementation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 155:8435094ec241 1 /**
mbed_official 155:8435094ec241 2 ******************************************************************************
mbed_official 155:8435094ec241 3 * @file stm32f30x_dma.c
mbed_official 155:8435094ec241 4 * @author MCD Application Team
mbed_official 155:8435094ec241 5 * @version V1.1.0
mbed_official 155:8435094ec241 6 * @date 27-February-2014
mbed_official 155:8435094ec241 7 * @brief This file provides firmware functions to manage the following
mbed_official 155:8435094ec241 8 * functionalities of the Direct Memory Access controller (DMA):
mbed_official 155:8435094ec241 9 * + Initialization and Configuration
mbed_official 155:8435094ec241 10 * + Data Counter
mbed_official 155:8435094ec241 11 * + Interrupts and flags management
mbed_official 155:8435094ec241 12 *
mbed_official 155:8435094ec241 13 @verbatim
mbed_official 155:8435094ec241 14
mbed_official 155:8435094ec241 15 ===============================================================================
mbed_official 155:8435094ec241 16 ##### How to use this driver #####
mbed_official 155:8435094ec241 17 ===============================================================================
mbed_official 155:8435094ec241 18 [..]
mbed_official 155:8435094ec241 19 (#) Enable The DMA controller clock using
mbed_official 155:8435094ec241 20 RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE) function for DMA1 or
mbed_official 155:8435094ec241 21 using RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA2, ENABLE) function for DMA2.
mbed_official 155:8435094ec241 22 (#) Enable and configure the peripheral to be connected to the DMA channel
mbed_official 155:8435094ec241 23 (except for internal SRAM / FLASH memories: no initialization is necessary).
mbed_official 155:8435094ec241 24 (#) For a given Channel, program the Source and Destination addresses,
mbed_official 155:8435094ec241 25 the transfer Direction, the Buffer Size, the Peripheral and Memory
mbed_official 155:8435094ec241 26 Incrementation mode and Data Size, the Circular or Normal mode,
mbed_official 155:8435094ec241 27 the channel transfer Priority and the Memory-to-Memory transfer
mbed_official 155:8435094ec241 28 mode (if needed) using the DMA_Init() function.
mbed_official 155:8435094ec241 29 (#) Enable the NVIC and the corresponding interrupt(s) using the function
mbed_official 155:8435094ec241 30 DMA_ITConfig() if you need to use DMA interrupts.
mbed_official 155:8435094ec241 31 (#) Enable the DMA channel using the DMA_Cmd() function.
mbed_official 155:8435094ec241 32 (#) Activate the needed channel Request using PPP_DMACmd() function for
mbed_official 155:8435094ec241 33 any PPP peripheral except internal SRAM and FLASH (ie. SPI, USART ...)
mbed_official 155:8435094ec241 34 The function allowing this operation is provided in each PPP peripheral
mbed_official 155:8435094ec241 35 driver (ie. SPI_DMACmd for SPI peripheral).
mbed_official 155:8435094ec241 36 (#) Optionally, you can configure the number of data to be transferred
mbed_official 155:8435094ec241 37 when the channel is disabled (ie. after each Transfer Complete event
mbed_official 155:8435094ec241 38 or when a Transfer Error occurs) using the function DMA_SetCurrDataCounter().
mbed_official 155:8435094ec241 39 And you can get the number of remaining data to be transferred using
mbed_official 155:8435094ec241 40 the function DMA_GetCurrDataCounter() at run time (when the DMA channel is
mbed_official 155:8435094ec241 41 enabled and running).
mbed_official 155:8435094ec241 42 (#) To control DMA events you can use one of the following two methods:
mbed_official 155:8435094ec241 43 (##) Check on DMA channel flags using the function DMA_GetFlagStatus().
mbed_official 155:8435094ec241 44 (##) Use DMA interrupts through the function DMA_ITConfig() at initialization
mbed_official 155:8435094ec241 45 phase and DMA_GetITStatus() function into interrupt routines in
mbed_official 155:8435094ec241 46 communication phase.
mbed_official 155:8435094ec241 47 After checking on a flag you should clear it using DMA_ClearFlag()
mbed_official 155:8435094ec241 48 function. And after checking on an interrupt event you should
mbed_official 155:8435094ec241 49 clear it using DMA_ClearITPendingBit() function.
mbed_official 155:8435094ec241 50
mbed_official 155:8435094ec241 51 @endverbatim
mbed_official 155:8435094ec241 52
mbed_official 155:8435094ec241 53 ******************************************************************************
mbed_official 155:8435094ec241 54 * @attention
mbed_official 155:8435094ec241 55 *
mbed_official 155:8435094ec241 56 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 155:8435094ec241 57 *
mbed_official 155:8435094ec241 58 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 155:8435094ec241 59 * are permitted provided that the following conditions are met:
mbed_official 155:8435094ec241 60 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 155:8435094ec241 61 * this list of conditions and the following disclaimer.
mbed_official 155:8435094ec241 62 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 155:8435094ec241 63 * this list of conditions and the following disclaimer in the documentation
mbed_official 155:8435094ec241 64 * and/or other materials provided with the distribution.
mbed_official 155:8435094ec241 65 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 155:8435094ec241 66 * may be used to endorse or promote products derived from this software
mbed_official 155:8435094ec241 67 * without specific prior written permission.
mbed_official 155:8435094ec241 68 *
mbed_official 155:8435094ec241 69 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 155:8435094ec241 70 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 155:8435094ec241 71 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 155:8435094ec241 72 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 155:8435094ec241 73 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 155:8435094ec241 74 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 155:8435094ec241 75 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 155:8435094ec241 76 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 155:8435094ec241 77 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 155:8435094ec241 78 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 155:8435094ec241 79 *
mbed_official 155:8435094ec241 80 ******************************************************************************
mbed_official 155:8435094ec241 81 */
mbed_official 155:8435094ec241 82
mbed_official 155:8435094ec241 83 /* Includes ------------------------------------------------------------------*/
mbed_official 155:8435094ec241 84 #include "stm32f30x_dma.h"
mbed_official 155:8435094ec241 85
mbed_official 155:8435094ec241 86 /** @addtogroup STM32F30x_StdPeriph_Driver
mbed_official 155:8435094ec241 87 * @{
mbed_official 155:8435094ec241 88 */
mbed_official 155:8435094ec241 89
mbed_official 155:8435094ec241 90 /** @defgroup DMA
mbed_official 155:8435094ec241 91 * @brief DMA driver modules
mbed_official 155:8435094ec241 92 * @{
mbed_official 155:8435094ec241 93 */
mbed_official 155:8435094ec241 94
mbed_official 155:8435094ec241 95 /* Private typedef -----------------------------------------------------------*/
mbed_official 155:8435094ec241 96 /* Private define ------------------------------------------------------------*/
mbed_official 155:8435094ec241 97 #define CCR_CLEAR_MASK ((uint32_t)0xFFFF800F) /* DMA Channel config registers Masks */
mbed_official 155:8435094ec241 98 #define FLAG_Mask ((uint32_t)0x10000000) /* DMA2 FLAG mask */
mbed_official 155:8435094ec241 99
mbed_official 155:8435094ec241 100
mbed_official 155:8435094ec241 101 /* DMA1 Channelx interrupt pending bit masks */
mbed_official 155:8435094ec241 102 #define DMA1_CHANNEL1_IT_MASK ((uint32_t)(DMA_ISR_GIF1 | DMA_ISR_TCIF1 | DMA_ISR_HTIF1 | DMA_ISR_TEIF1))
mbed_official 155:8435094ec241 103 #define DMA1_CHANNEL2_IT_MASK ((uint32_t)(DMA_ISR_GIF2 | DMA_ISR_TCIF2 | DMA_ISR_HTIF2 | DMA_ISR_TEIF2))
mbed_official 155:8435094ec241 104 #define DMA1_CHANNEL3_IT_MASK ((uint32_t)(DMA_ISR_GIF3 | DMA_ISR_TCIF3 | DMA_ISR_HTIF3 | DMA_ISR_TEIF3))
mbed_official 155:8435094ec241 105 #define DMA1_CHANNEL4_IT_MASK ((uint32_t)(DMA_ISR_GIF4 | DMA_ISR_TCIF4 | DMA_ISR_HTIF4 | DMA_ISR_TEIF4))
mbed_official 155:8435094ec241 106 #define DMA1_CHANNEL5_IT_MASK ((uint32_t)(DMA_ISR_GIF5 | DMA_ISR_TCIF5 | DMA_ISR_HTIF5 | DMA_ISR_TEIF5))
mbed_official 155:8435094ec241 107 #define DMA1_CHANNEL6_IT_MASK ((uint32_t)(DMA_ISR_GIF6 | DMA_ISR_TCIF6 | DMA_ISR_HTIF6 | DMA_ISR_TEIF6))
mbed_official 155:8435094ec241 108 #define DMA1_CHANNEL7_IT_MASK ((uint32_t)(DMA_ISR_GIF7 | DMA_ISR_TCIF7 | DMA_ISR_HTIF7 | DMA_ISR_TEIF7))
mbed_official 155:8435094ec241 109
mbed_official 155:8435094ec241 110 /* DMA2 Channelx interrupt pending bit masks */
mbed_official 155:8435094ec241 111 #define DMA2_CHANNEL1_IT_MASK ((uint32_t)(DMA_ISR_GIF1 | DMA_ISR_TCIF1 | DMA_ISR_HTIF1 | DMA_ISR_TEIF1))
mbed_official 155:8435094ec241 112 #define DMA2_CHANNEL2_IT_MASK ((uint32_t)(DMA_ISR_GIF2 | DMA_ISR_TCIF2 | DMA_ISR_HTIF2 | DMA_ISR_TEIF2))
mbed_official 155:8435094ec241 113 #define DMA2_CHANNEL3_IT_MASK ((uint32_t)(DMA_ISR_GIF3 | DMA_ISR_TCIF3 | DMA_ISR_HTIF3 | DMA_ISR_TEIF3))
mbed_official 155:8435094ec241 114 #define DMA2_CHANNEL4_IT_MASK ((uint32_t)(DMA_ISR_GIF4 | DMA_ISR_TCIF4 | DMA_ISR_HTIF4 | DMA_ISR_TEIF4))
mbed_official 155:8435094ec241 115 #define DMA2_CHANNEL5_IT_MASK ((uint32_t)(DMA_ISR_GIF5 | DMA_ISR_TCIF5 | DMA_ISR_HTIF5 | DMA_ISR_TEIF5))
mbed_official 155:8435094ec241 116
mbed_official 155:8435094ec241 117 /* Private macro -------------------------------------------------------------*/
mbed_official 155:8435094ec241 118 /* Private variables ---------------------------------------------------------*/
mbed_official 155:8435094ec241 119 /* Private function prototypes -----------------------------------------------*/
mbed_official 155:8435094ec241 120 /* Private functions ---------------------------------------------------------*/
mbed_official 155:8435094ec241 121
mbed_official 155:8435094ec241 122 /** @defgroup DMA_Private_Functions
mbed_official 155:8435094ec241 123 * @{
mbed_official 155:8435094ec241 124 */
mbed_official 155:8435094ec241 125
mbed_official 155:8435094ec241 126 /** @defgroup DMA_Group1 Initialization and Configuration functions
mbed_official 155:8435094ec241 127 * @brief Initialization and Configuration functions
mbed_official 155:8435094ec241 128 *
mbed_official 155:8435094ec241 129 @verbatim
mbed_official 155:8435094ec241 130 ===============================================================================
mbed_official 155:8435094ec241 131 ##### Initialization and Configuration functions #####
mbed_official 155:8435094ec241 132 ===============================================================================
mbed_official 155:8435094ec241 133 [..] This subsection provides functions allowing to initialize the DMA channel
mbed_official 155:8435094ec241 134 source and destination addresses, incrementation and data sizes, transfer
mbed_official 155:8435094ec241 135 direction, buffer size, circular/normal mode selection, memory-to-memory
mbed_official 155:8435094ec241 136 mode selection and channel priority value.
mbed_official 155:8435094ec241 137 [..] The DMA_Init() function follows the DMA configuration procedures as described
mbed_official 155:8435094ec241 138 in reference manual (RM00316).
mbed_official 155:8435094ec241 139
mbed_official 155:8435094ec241 140 @endverbatim
mbed_official 155:8435094ec241 141 * @{
mbed_official 155:8435094ec241 142 */
mbed_official 155:8435094ec241 143
mbed_official 155:8435094ec241 144 /**
mbed_official 155:8435094ec241 145 * @brief Deinitializes the DMAy Channelx registers to their default reset
mbed_official 155:8435094ec241 146 * values.
mbed_official 155:8435094ec241 147 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
mbed_official 155:8435094ec241 148 * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
mbed_official 155:8435094ec241 149 * @retval None
mbed_official 155:8435094ec241 150 */
mbed_official 155:8435094ec241 151 void DMA_DeInit(DMA_Channel_TypeDef* DMAy_Channelx)
mbed_official 155:8435094ec241 152 {
mbed_official 155:8435094ec241 153 /* Check the parameters */
mbed_official 155:8435094ec241 154 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
mbed_official 155:8435094ec241 155
mbed_official 155:8435094ec241 156 /* Disable the selected DMAy Channelx */
mbed_official 155:8435094ec241 157 DMAy_Channelx->CCR &= (uint16_t)(~DMA_CCR_EN);
mbed_official 155:8435094ec241 158
mbed_official 155:8435094ec241 159 /* Reset DMAy Channelx control register */
mbed_official 155:8435094ec241 160 DMAy_Channelx->CCR = 0;
mbed_official 155:8435094ec241 161
mbed_official 155:8435094ec241 162 /* Reset DMAy Channelx remaining bytes register */
mbed_official 155:8435094ec241 163 DMAy_Channelx->CNDTR = 0;
mbed_official 155:8435094ec241 164
mbed_official 155:8435094ec241 165 /* Reset DMAy Channelx peripheral address register */
mbed_official 155:8435094ec241 166 DMAy_Channelx->CPAR = 0;
mbed_official 155:8435094ec241 167
mbed_official 155:8435094ec241 168 /* Reset DMAy Channelx memory address register */
mbed_official 155:8435094ec241 169 DMAy_Channelx->CMAR = 0;
mbed_official 155:8435094ec241 170
mbed_official 155:8435094ec241 171 if (DMAy_Channelx == DMA1_Channel1)
mbed_official 155:8435094ec241 172 {
mbed_official 155:8435094ec241 173 /* Reset interrupt pending bits for DMA1 Channel1 */
mbed_official 155:8435094ec241 174 DMA1->IFCR |= DMA1_CHANNEL1_IT_MASK;
mbed_official 155:8435094ec241 175 }
mbed_official 155:8435094ec241 176 else if (DMAy_Channelx == DMA1_Channel2)
mbed_official 155:8435094ec241 177 {
mbed_official 155:8435094ec241 178 /* Reset interrupt pending bits for DMA1 Channel2 */
mbed_official 155:8435094ec241 179 DMA1->IFCR |= DMA1_CHANNEL2_IT_MASK;
mbed_official 155:8435094ec241 180 }
mbed_official 155:8435094ec241 181 else if (DMAy_Channelx == DMA1_Channel3)
mbed_official 155:8435094ec241 182 {
mbed_official 155:8435094ec241 183 /* Reset interrupt pending bits for DMA1 Channel3 */
mbed_official 155:8435094ec241 184 DMA1->IFCR |= DMA1_CHANNEL3_IT_MASK;
mbed_official 155:8435094ec241 185 }
mbed_official 155:8435094ec241 186 else if (DMAy_Channelx == DMA1_Channel4)
mbed_official 155:8435094ec241 187 {
mbed_official 155:8435094ec241 188 /* Reset interrupt pending bits for DMA1 Channel4 */
mbed_official 155:8435094ec241 189 DMA1->IFCR |= DMA1_CHANNEL4_IT_MASK;
mbed_official 155:8435094ec241 190 }
mbed_official 155:8435094ec241 191 else if (DMAy_Channelx == DMA1_Channel5)
mbed_official 155:8435094ec241 192 {
mbed_official 155:8435094ec241 193 /* Reset interrupt pending bits for DMA1 Channel5 */
mbed_official 155:8435094ec241 194 DMA1->IFCR |= DMA1_CHANNEL5_IT_MASK;
mbed_official 155:8435094ec241 195 }
mbed_official 155:8435094ec241 196 else if (DMAy_Channelx == DMA1_Channel6)
mbed_official 155:8435094ec241 197 {
mbed_official 155:8435094ec241 198 /* Reset interrupt pending bits for DMA1 Channel6 */
mbed_official 155:8435094ec241 199 DMA1->IFCR |= DMA1_CHANNEL6_IT_MASK;
mbed_official 155:8435094ec241 200 }
mbed_official 155:8435094ec241 201 else if (DMAy_Channelx == DMA1_Channel7)
mbed_official 155:8435094ec241 202 {
mbed_official 155:8435094ec241 203 /* Reset interrupt pending bits for DMA1 Channel7 */
mbed_official 155:8435094ec241 204 DMA1->IFCR |= DMA1_CHANNEL7_IT_MASK;
mbed_official 155:8435094ec241 205 }
mbed_official 155:8435094ec241 206 else if (DMAy_Channelx == DMA2_Channel1)
mbed_official 155:8435094ec241 207 {
mbed_official 155:8435094ec241 208 /* Reset interrupt pending bits for DMA2 Channel1 */
mbed_official 155:8435094ec241 209 DMA2->IFCR |= DMA2_CHANNEL1_IT_MASK;
mbed_official 155:8435094ec241 210 }
mbed_official 155:8435094ec241 211 else if (DMAy_Channelx == DMA2_Channel2)
mbed_official 155:8435094ec241 212 {
mbed_official 155:8435094ec241 213 /* Reset interrupt pending bits for DMA2 Channel2 */
mbed_official 155:8435094ec241 214 DMA2->IFCR |= DMA2_CHANNEL2_IT_MASK;
mbed_official 155:8435094ec241 215 }
mbed_official 155:8435094ec241 216 else if (DMAy_Channelx == DMA2_Channel3)
mbed_official 155:8435094ec241 217 {
mbed_official 155:8435094ec241 218 /* Reset interrupt pending bits for DMA2 Channel3 */
mbed_official 155:8435094ec241 219 DMA2->IFCR |= DMA2_CHANNEL3_IT_MASK;
mbed_official 155:8435094ec241 220 }
mbed_official 155:8435094ec241 221 else if (DMAy_Channelx == DMA2_Channel4)
mbed_official 155:8435094ec241 222 {
mbed_official 155:8435094ec241 223 /* Reset interrupt pending bits for DMA2 Channel4 */
mbed_official 155:8435094ec241 224 DMA2->IFCR |= DMA2_CHANNEL4_IT_MASK;
mbed_official 155:8435094ec241 225 }
mbed_official 155:8435094ec241 226 else
mbed_official 155:8435094ec241 227 {
mbed_official 155:8435094ec241 228 if (DMAy_Channelx == DMA2_Channel5)
mbed_official 155:8435094ec241 229 {
mbed_official 155:8435094ec241 230 /* Reset interrupt pending bits for DMA2 Channel5 */
mbed_official 155:8435094ec241 231 DMA2->IFCR |= DMA2_CHANNEL5_IT_MASK;
mbed_official 155:8435094ec241 232 }
mbed_official 155:8435094ec241 233 }
mbed_official 155:8435094ec241 234 }
mbed_official 155:8435094ec241 235
mbed_official 155:8435094ec241 236 /**
mbed_official 155:8435094ec241 237 * @brief Initializes the DMAy Channelx according to the specified parameters
mbed_official 155:8435094ec241 238 * in the DMA_InitStruct.
mbed_official 155:8435094ec241 239 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
mbed_official 155:8435094ec241 240 * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
mbed_official 155:8435094ec241 241 * @param DMA_InitStruct: pointer to a DMA_InitTypeDef structure that contains
mbed_official 155:8435094ec241 242 * the configuration information for the specified DMA Channel.
mbed_official 155:8435094ec241 243 * @retval None
mbed_official 155:8435094ec241 244 */
mbed_official 155:8435094ec241 245 void DMA_Init(DMA_Channel_TypeDef* DMAy_Channelx, DMA_InitTypeDef* DMA_InitStruct)
mbed_official 155:8435094ec241 246 {
mbed_official 155:8435094ec241 247 uint32_t tmpreg = 0;
mbed_official 155:8435094ec241 248
mbed_official 155:8435094ec241 249 /* Check the parameters */
mbed_official 155:8435094ec241 250 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
mbed_official 155:8435094ec241 251 assert_param(IS_DMA_DIR(DMA_InitStruct->DMA_DIR));
mbed_official 155:8435094ec241 252 assert_param(IS_DMA_PERIPHERAL_INC_STATE(DMA_InitStruct->DMA_PeripheralInc));
mbed_official 155:8435094ec241 253 assert_param(IS_DMA_MEMORY_INC_STATE(DMA_InitStruct->DMA_MemoryInc));
mbed_official 155:8435094ec241 254 assert_param(IS_DMA_PERIPHERAL_DATA_SIZE(DMA_InitStruct->DMA_PeripheralDataSize));
mbed_official 155:8435094ec241 255 assert_param(IS_DMA_MEMORY_DATA_SIZE(DMA_InitStruct->DMA_MemoryDataSize));
mbed_official 155:8435094ec241 256 assert_param(IS_DMA_MODE(DMA_InitStruct->DMA_Mode));
mbed_official 155:8435094ec241 257 assert_param(IS_DMA_PRIORITY(DMA_InitStruct->DMA_Priority));
mbed_official 155:8435094ec241 258 assert_param(IS_DMA_M2M_STATE(DMA_InitStruct->DMA_M2M));
mbed_official 155:8435094ec241 259
mbed_official 155:8435094ec241 260 /*--------------------------- DMAy Channelx CCR Configuration ----------------*/
mbed_official 155:8435094ec241 261 /* Get the DMAy_Channelx CCR value */
mbed_official 155:8435094ec241 262 tmpreg = DMAy_Channelx->CCR;
mbed_official 155:8435094ec241 263
mbed_official 155:8435094ec241 264 /* Clear MEM2MEM, PL, MSIZE, PSIZE, MINC, PINC, CIRC and DIR bits */
mbed_official 155:8435094ec241 265 tmpreg &= CCR_CLEAR_MASK;
mbed_official 155:8435094ec241 266
mbed_official 155:8435094ec241 267 /* Configure DMAy Channelx: data transfer, data size, priority level and mode */
mbed_official 155:8435094ec241 268 /* Set DIR bit according to DMA_DIR value */
mbed_official 155:8435094ec241 269 /* Set CIRC bit according to DMA_Mode value */
mbed_official 155:8435094ec241 270 /* Set PINC bit according to DMA_PeripheralInc value */
mbed_official 155:8435094ec241 271 /* Set MINC bit according to DMA_MemoryInc value */
mbed_official 155:8435094ec241 272 /* Set PSIZE bits according to DMA_PeripheralDataSize value */
mbed_official 155:8435094ec241 273 /* Set MSIZE bits according to DMA_MemoryDataSize value */
mbed_official 155:8435094ec241 274 /* Set PL bits according to DMA_Priority value */
mbed_official 155:8435094ec241 275 /* Set the MEM2MEM bit according to DMA_M2M value */
mbed_official 155:8435094ec241 276 tmpreg |= DMA_InitStruct->DMA_DIR | DMA_InitStruct->DMA_Mode |
mbed_official 155:8435094ec241 277 DMA_InitStruct->DMA_PeripheralInc | DMA_InitStruct->DMA_MemoryInc |
mbed_official 155:8435094ec241 278 DMA_InitStruct->DMA_PeripheralDataSize | DMA_InitStruct->DMA_MemoryDataSize |
mbed_official 155:8435094ec241 279 DMA_InitStruct->DMA_Priority | DMA_InitStruct->DMA_M2M;
mbed_official 155:8435094ec241 280
mbed_official 155:8435094ec241 281 /* Write to DMAy Channelx CCR */
mbed_official 155:8435094ec241 282 DMAy_Channelx->CCR = tmpreg;
mbed_official 155:8435094ec241 283
mbed_official 155:8435094ec241 284 /*--------------------------- DMAy Channelx CNDTR Configuration --------------*/
mbed_official 155:8435094ec241 285 /* Write to DMAy Channelx CNDTR */
mbed_official 155:8435094ec241 286 DMAy_Channelx->CNDTR = DMA_InitStruct->DMA_BufferSize;
mbed_official 155:8435094ec241 287
mbed_official 155:8435094ec241 288 /*--------------------------- DMAy Channelx CPAR Configuration ---------------*/
mbed_official 155:8435094ec241 289 /* Write to DMAy Channelx CPAR */
mbed_official 155:8435094ec241 290 DMAy_Channelx->CPAR = DMA_InitStruct->DMA_PeripheralBaseAddr;
mbed_official 155:8435094ec241 291
mbed_official 155:8435094ec241 292 /*--------------------------- DMAy Channelx CMAR Configuration ---------------*/
mbed_official 155:8435094ec241 293 /* Write to DMAy Channelx CMAR */
mbed_official 155:8435094ec241 294 DMAy_Channelx->CMAR = DMA_InitStruct->DMA_MemoryBaseAddr;
mbed_official 155:8435094ec241 295 }
mbed_official 155:8435094ec241 296
mbed_official 155:8435094ec241 297 /**
mbed_official 155:8435094ec241 298 * @brief Fills each DMA_InitStruct member with its default value.
mbed_official 155:8435094ec241 299 * @param DMA_InitStruct: pointer to a DMA_InitTypeDef structure which will
mbed_official 155:8435094ec241 300 * be initialized.
mbed_official 155:8435094ec241 301 * @retval None
mbed_official 155:8435094ec241 302 */
mbed_official 155:8435094ec241 303 void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct)
mbed_official 155:8435094ec241 304 {
mbed_official 155:8435094ec241 305 /*-------------- Reset DMA init structure parameters values ------------------*/
mbed_official 155:8435094ec241 306 /* Initialize the DMA_PeripheralBaseAddr member */
mbed_official 155:8435094ec241 307 DMA_InitStruct->DMA_PeripheralBaseAddr = 0;
mbed_official 155:8435094ec241 308 /* Initialize the DMA_MemoryBaseAddr member */
mbed_official 155:8435094ec241 309 DMA_InitStruct->DMA_MemoryBaseAddr = 0;
mbed_official 155:8435094ec241 310 /* Initialize the DMA_DIR member */
mbed_official 155:8435094ec241 311 DMA_InitStruct->DMA_DIR = DMA_DIR_PeripheralSRC;
mbed_official 155:8435094ec241 312 /* Initialize the DMA_BufferSize member */
mbed_official 155:8435094ec241 313 DMA_InitStruct->DMA_BufferSize = 0;
mbed_official 155:8435094ec241 314 /* Initialize the DMA_PeripheralInc member */
mbed_official 155:8435094ec241 315 DMA_InitStruct->DMA_PeripheralInc = DMA_PeripheralInc_Disable;
mbed_official 155:8435094ec241 316 /* Initialize the DMA_MemoryInc member */
mbed_official 155:8435094ec241 317 DMA_InitStruct->DMA_MemoryInc = DMA_MemoryInc_Disable;
mbed_official 155:8435094ec241 318 /* Initialize the DMA_PeripheralDataSize member */
mbed_official 155:8435094ec241 319 DMA_InitStruct->DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
mbed_official 155:8435094ec241 320 /* Initialize the DMA_MemoryDataSize member */
mbed_official 155:8435094ec241 321 DMA_InitStruct->DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
mbed_official 155:8435094ec241 322 /* Initialize the DMA_Mode member */
mbed_official 155:8435094ec241 323 DMA_InitStruct->DMA_Mode = DMA_Mode_Normal;
mbed_official 155:8435094ec241 324 /* Initialize the DMA_Priority member */
mbed_official 155:8435094ec241 325 DMA_InitStruct->DMA_Priority = DMA_Priority_Low;
mbed_official 155:8435094ec241 326 /* Initialize the DMA_M2M member */
mbed_official 155:8435094ec241 327 DMA_InitStruct->DMA_M2M = DMA_M2M_Disable;
mbed_official 155:8435094ec241 328 }
mbed_official 155:8435094ec241 329
mbed_official 155:8435094ec241 330 /**
mbed_official 155:8435094ec241 331 * @brief Enables or disables the specified DMAy Channelx.
mbed_official 155:8435094ec241 332 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
mbed_official 155:8435094ec241 333 * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
mbed_official 155:8435094ec241 334 * @param NewState: new state of the DMAy Channelx.
mbed_official 155:8435094ec241 335 * This parameter can be: ENABLE or DISABLE.
mbed_official 155:8435094ec241 336 * @retval None
mbed_official 155:8435094ec241 337 */
mbed_official 155:8435094ec241 338 void DMA_Cmd(DMA_Channel_TypeDef* DMAy_Channelx, FunctionalState NewState)
mbed_official 155:8435094ec241 339 {
mbed_official 155:8435094ec241 340 /* Check the parameters */
mbed_official 155:8435094ec241 341 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
mbed_official 155:8435094ec241 342 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 155:8435094ec241 343
mbed_official 155:8435094ec241 344 if (NewState != DISABLE)
mbed_official 155:8435094ec241 345 {
mbed_official 155:8435094ec241 346 /* Enable the selected DMAy Channelx */
mbed_official 155:8435094ec241 347 DMAy_Channelx->CCR |= DMA_CCR_EN;
mbed_official 155:8435094ec241 348 }
mbed_official 155:8435094ec241 349 else
mbed_official 155:8435094ec241 350 {
mbed_official 155:8435094ec241 351 /* Disable the selected DMAy Channelx */
mbed_official 155:8435094ec241 352 DMAy_Channelx->CCR &= (uint16_t)(~DMA_CCR_EN);
mbed_official 155:8435094ec241 353 }
mbed_official 155:8435094ec241 354 }
mbed_official 155:8435094ec241 355
mbed_official 155:8435094ec241 356 /**
mbed_official 155:8435094ec241 357 * @}
mbed_official 155:8435094ec241 358 */
mbed_official 155:8435094ec241 359
mbed_official 155:8435094ec241 360 /** @defgroup DMA_Group2 Data Counter functions
mbed_official 155:8435094ec241 361 * @brief Data Counter functions
mbed_official 155:8435094ec241 362 *
mbed_official 155:8435094ec241 363 @verbatim
mbed_official 155:8435094ec241 364 ===============================================================================
mbed_official 155:8435094ec241 365 ##### Data Counter functions #####
mbed_official 155:8435094ec241 366 ===============================================================================
mbed_official 155:8435094ec241 367 [..] This subsection provides function allowing to configure and read the buffer
mbed_official 155:8435094ec241 368 size (number of data to be transferred).The DMA data counter can be written
mbed_official 155:8435094ec241 369 only when the DMA channel is disabled (ie. after transfer complete event).
mbed_official 155:8435094ec241 370 [..] The following function can be used to write the Channel data counter value:
mbed_official 155:8435094ec241 371 (+) void DMA_SetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx, uint16_t DataNumber).
mbed_official 155:8435094ec241 372 [..]
mbed_official 155:8435094ec241 373 (@) It is advised to use this function rather than DMA_Init() in situations
mbed_official 155:8435094ec241 374 where only the Data buffer needs to be reloaded.
mbed_official 155:8435094ec241 375 [..] The DMA data counter can be read to indicate the number of remaining transfers
mbed_official 155:8435094ec241 376 for the relative DMA channel. This counter is decremented at the end of each
mbed_official 155:8435094ec241 377 data transfer and when the transfer is complete:
mbed_official 155:8435094ec241 378 (+) If Normal mode is selected: the counter is set to 0.
mbed_official 155:8435094ec241 379 (+) If Circular mode is selected: the counter is reloaded with the initial
mbed_official 155:8435094ec241 380 value(configured before enabling the DMA channel).
mbed_official 155:8435094ec241 381 [..] The following function can be used to read the Channel data counter value:
mbed_official 155:8435094ec241 382 (+) uint16_t DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx).
mbed_official 155:8435094ec241 383
mbed_official 155:8435094ec241 384 @endverbatim
mbed_official 155:8435094ec241 385 * @{
mbed_official 155:8435094ec241 386 */
mbed_official 155:8435094ec241 387
mbed_official 155:8435094ec241 388 /**
mbed_official 155:8435094ec241 389 * @brief Sets the number of data units in the current DMAy Channelx transfer.
mbed_official 155:8435094ec241 390 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
mbed_official 155:8435094ec241 391 * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
mbed_official 155:8435094ec241 392 * @param DataNumber: The number of data units in the current DMAy Channelx
mbed_official 155:8435094ec241 393 * transfer.
mbed_official 155:8435094ec241 394 * @note This function can only be used when the DMAy_Channelx is disabled.
mbed_official 155:8435094ec241 395 * @retval None.
mbed_official 155:8435094ec241 396 */
mbed_official 155:8435094ec241 397 void DMA_SetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx, uint16_t DataNumber)
mbed_official 155:8435094ec241 398 {
mbed_official 155:8435094ec241 399 /* Check the parameters */
mbed_official 155:8435094ec241 400 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
mbed_official 155:8435094ec241 401
mbed_official 155:8435094ec241 402 /*--------------------------- DMAy Channelx CNDTR Configuration --------------*/
mbed_official 155:8435094ec241 403 /* Write to DMAy Channelx CNDTR */
mbed_official 155:8435094ec241 404 DMAy_Channelx->CNDTR = DataNumber;
mbed_official 155:8435094ec241 405 }
mbed_official 155:8435094ec241 406
mbed_official 155:8435094ec241 407 /**
mbed_official 155:8435094ec241 408 * @brief Returns the number of remaining data units in the current
mbed_official 155:8435094ec241 409 * DMAy Channelx transfer.
mbed_official 155:8435094ec241 410 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
mbed_official 155:8435094ec241 411 * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
mbed_official 155:8435094ec241 412 * @retval The number of remaining data units in the current DMAy Channelx
mbed_official 155:8435094ec241 413 * transfer.
mbed_official 155:8435094ec241 414 */
mbed_official 155:8435094ec241 415 uint16_t DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx)
mbed_official 155:8435094ec241 416 {
mbed_official 155:8435094ec241 417 /* Check the parameters */
mbed_official 155:8435094ec241 418 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
mbed_official 155:8435094ec241 419 /* Return the number of remaining data units for DMAy Channelx */
mbed_official 155:8435094ec241 420 return ((uint16_t)(DMAy_Channelx->CNDTR));
mbed_official 155:8435094ec241 421 }
mbed_official 155:8435094ec241 422
mbed_official 155:8435094ec241 423 /**
mbed_official 155:8435094ec241 424 * @}
mbed_official 155:8435094ec241 425 */
mbed_official 155:8435094ec241 426
mbed_official 155:8435094ec241 427 /** @defgroup DMA_Group3 Interrupts and flags management functions
mbed_official 155:8435094ec241 428 * @brief Interrupts and flags management functions
mbed_official 155:8435094ec241 429 *
mbed_official 155:8435094ec241 430 @verbatim
mbed_official 155:8435094ec241 431 ===============================================================================
mbed_official 155:8435094ec241 432 ##### Interrupts and flags management functions #####
mbed_official 155:8435094ec241 433 ===============================================================================
mbed_official 155:8435094ec241 434 [..] This subsection provides functions allowing to configure the DMA Interrupt
mbed_official 155:8435094ec241 435 sources and check or clear the flags or pending bits status.
mbed_official 155:8435094ec241 436 The user should identify which mode will be used in his application to manage
mbed_official 155:8435094ec241 437 the DMA controller events: Polling mode or Interrupt mode.
mbed_official 155:8435094ec241 438
mbed_official 155:8435094ec241 439 *** Polling Mode ***
mbed_official 155:8435094ec241 440 ====================
mbed_official 155:8435094ec241 441 [..] Each DMA channel can be managed through 4 event Flags (y : DMA Controller
mbed_official 155:8435094ec241 442 number, x : DMA channel number):
mbed_official 155:8435094ec241 443 (#) DMAy_FLAG_TCx : to indicate that a Transfer Complete event occurred.
mbed_official 155:8435094ec241 444 (#) DMAy_FLAG_HTx : to indicate that a Half-Transfer Complete event occurred.
mbed_official 155:8435094ec241 445 (#) DMAy_FLAG_TEx : to indicate that a Transfer Error occurred.
mbed_official 155:8435094ec241 446 (#) DMAy_FLAG_GLx : to indicate that at least one of the events described
mbed_official 155:8435094ec241 447 above occurred.
mbed_official 155:8435094ec241 448 [..]
mbed_official 155:8435094ec241 449 (@) Clearing DMAy_FLAG_GLx results in clearing all other pending flags of the
mbed_official 155:8435094ec241 450 same channel (DMAy_FLAG_TCx, DMAy_FLAG_HTx and DMAy_FLAG_TEx).
mbed_official 155:8435094ec241 451 [..] In this Mode it is advised to use the following functions:
mbed_official 155:8435094ec241 452 (+) FlagStatus DMA_GetFlagStatus(uint32_t DMA_FLAG);
mbed_official 155:8435094ec241 453 (+) void DMA_ClearFlag(uint32_t DMA_FLAG);
mbed_official 155:8435094ec241 454
mbed_official 155:8435094ec241 455 *** Interrupt Mode ***
mbed_official 155:8435094ec241 456 ======================
mbed_official 155:8435094ec241 457 [..] Each DMA channel can be managed through 4 Interrupts:
mbed_official 155:8435094ec241 458 (+) Interrupt Source
mbed_official 155:8435094ec241 459 (##) DMA_IT_TC: specifies the interrupt source for the Transfer Complete
mbed_official 155:8435094ec241 460 event.
mbed_official 155:8435094ec241 461 (##) DMA_IT_HT: specifies the interrupt source for the Half-transfer Complete
mbed_official 155:8435094ec241 462 event.
mbed_official 155:8435094ec241 463 (##) DMA_IT_TE: specifies the interrupt source for the transfer errors event.
mbed_official 155:8435094ec241 464 (##) DMA_IT_GL: to indicate that at least one of the interrupts described
mbed_official 155:8435094ec241 465 above occurred.
mbed_official 155:8435094ec241 466 -@@- Clearing DMA_IT_GL interrupt results in clearing all other interrupts of
mbed_official 155:8435094ec241 467 the same channel (DMA_IT_TCx, DMA_IT_HT and DMA_IT_TE).
mbed_official 155:8435094ec241 468 [..] In this Mode it is advised to use the following functions:
mbed_official 155:8435094ec241 469 (+) void DMA_ITConfig(DMA_Channel_TypeDef* DMAy_Channelx, uint32_t DMA_IT, FunctionalState NewState);
mbed_official 155:8435094ec241 470 (+) ITStatus DMA_GetITStatus(uint32_t DMA_IT);
mbed_official 155:8435094ec241 471 (+) void DMA_ClearITPendingBit(uint32_t DMA_IT);
mbed_official 155:8435094ec241 472
mbed_official 155:8435094ec241 473 @endverbatim
mbed_official 155:8435094ec241 474 * @{
mbed_official 155:8435094ec241 475 */
mbed_official 155:8435094ec241 476
mbed_official 155:8435094ec241 477 /**
mbed_official 155:8435094ec241 478 * @brief Enables or disables the specified DMAy Channelx interrupts.
mbed_official 155:8435094ec241 479 * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
mbed_official 155:8435094ec241 480 * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
mbed_official 155:8435094ec241 481 * @param DMA_IT: specifies the DMA interrupts sources to be enabled
mbed_official 155:8435094ec241 482 * or disabled.
mbed_official 155:8435094ec241 483 * This parameter can be any combination of the following values:
mbed_official 155:8435094ec241 484 * @arg DMA_IT_TC: Transfer complete interrupt mask
mbed_official 155:8435094ec241 485 * @arg DMA_IT_HT: Half transfer interrupt mask
mbed_official 155:8435094ec241 486 * @arg DMA_IT_TE: Transfer error interrupt mask
mbed_official 155:8435094ec241 487 * @param NewState: new state of the specified DMA interrupts.
mbed_official 155:8435094ec241 488 * This parameter can be: ENABLE or DISABLE.
mbed_official 155:8435094ec241 489 * @retval None
mbed_official 155:8435094ec241 490 */
mbed_official 155:8435094ec241 491 void DMA_ITConfig(DMA_Channel_TypeDef* DMAy_Channelx, uint32_t DMA_IT, FunctionalState NewState)
mbed_official 155:8435094ec241 492 {
mbed_official 155:8435094ec241 493 /* Check the parameters */
mbed_official 155:8435094ec241 494 assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
mbed_official 155:8435094ec241 495 assert_param(IS_DMA_CONFIG_IT(DMA_IT));
mbed_official 155:8435094ec241 496 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 155:8435094ec241 497
mbed_official 155:8435094ec241 498 if (NewState != DISABLE)
mbed_official 155:8435094ec241 499 {
mbed_official 155:8435094ec241 500 /* Enable the selected DMA interrupts */
mbed_official 155:8435094ec241 501 DMAy_Channelx->CCR |= DMA_IT;
mbed_official 155:8435094ec241 502 }
mbed_official 155:8435094ec241 503 else
mbed_official 155:8435094ec241 504 {
mbed_official 155:8435094ec241 505 /* Disable the selected DMA interrupts */
mbed_official 155:8435094ec241 506 DMAy_Channelx->CCR &= ~DMA_IT;
mbed_official 155:8435094ec241 507 }
mbed_official 155:8435094ec241 508 }
mbed_official 155:8435094ec241 509
mbed_official 155:8435094ec241 510 /**
mbed_official 155:8435094ec241 511 * @brief Checks whether the specified DMAy Channelx flag is set or not.
mbed_official 155:8435094ec241 512 * @param DMAy_FLAG: specifies the flag to check.
mbed_official 155:8435094ec241 513 * This parameter can be one of the following values:
mbed_official 155:8435094ec241 514 * @arg DMA1_FLAG_GL1: DMA1 Channel1 global flag.
mbed_official 155:8435094ec241 515 * @arg DMA1_FLAG_TC1: DMA1 Channel1 transfer complete flag.
mbed_official 155:8435094ec241 516 * @arg DMA1_FLAG_HT1: DMA1 Channel1 half transfer flag.
mbed_official 155:8435094ec241 517 * @arg DMA1_FLAG_TE1: DMA1 Channel1 transfer error flag.
mbed_official 155:8435094ec241 518 * @arg DMA1_FLAG_GL2: DMA1 Channel2 global flag.
mbed_official 155:8435094ec241 519 * @arg DMA1_FLAG_TC2: DMA1 Channel2 transfer complete flag.
mbed_official 155:8435094ec241 520 * @arg DMA1_FLAG_HT2: DMA1 Channel2 half transfer flag.
mbed_official 155:8435094ec241 521 * @arg DMA1_FLAG_TE2: DMA1 Channel2 transfer error flag.
mbed_official 155:8435094ec241 522 * @arg DMA1_FLAG_GL3: DMA1 Channel3 global flag.
mbed_official 155:8435094ec241 523 * @arg DMA1_FLAG_TC3: DMA1 Channel3 transfer complete flag.
mbed_official 155:8435094ec241 524 * @arg DMA1_FLAG_HT3: DMA1 Channel3 half transfer flag.
mbed_official 155:8435094ec241 525 * @arg DMA1_FLAG_TE3: DMA1 Channel3 transfer error flag.
mbed_official 155:8435094ec241 526 * @arg DMA1_FLAG_GL4: DMA1 Channel4 global flag.
mbed_official 155:8435094ec241 527 * @arg DMA1_FLAG_TC4: DMA1 Channel4 transfer complete flag.
mbed_official 155:8435094ec241 528 * @arg DMA1_FLAG_HT4: DMA1 Channel4 half transfer flag.
mbed_official 155:8435094ec241 529 * @arg DMA1_FLAG_TE4: DMA1 Channel4 transfer error flag.
mbed_official 155:8435094ec241 530 * @arg DMA1_FLAG_GL5: DMA1 Channel5 global flag.
mbed_official 155:8435094ec241 531 * @arg DMA1_FLAG_TC5: DMA1 Channel5 transfer complete flag.
mbed_official 155:8435094ec241 532 * @arg DMA1_FLAG_HT5: DMA1 Channel5 half transfer flag.
mbed_official 155:8435094ec241 533 * @arg DMA1_FLAG_TE5: DMA1 Channel5 transfer error flag.
mbed_official 155:8435094ec241 534 * @arg DMA1_FLAG_GL6: DMA1 Channel6 global flag.
mbed_official 155:8435094ec241 535 * @arg DMA1_FLAG_TC6: DMA1 Channel6 transfer complete flag.
mbed_official 155:8435094ec241 536 * @arg DMA1_FLAG_HT6: DMA1 Channel6 half transfer flag.
mbed_official 155:8435094ec241 537 * @arg DMA1_FLAG_TE6: DMA1 Channel6 transfer error flag.
mbed_official 155:8435094ec241 538 * @arg DMA1_FLAG_GL7: DMA1 Channel7 global flag.
mbed_official 155:8435094ec241 539 * @arg DMA1_FLAG_TC7: DMA1 Channel7 transfer complete flag.
mbed_official 155:8435094ec241 540 * @arg DMA1_FLAG_HT7: DMA1 Channel7 half transfer flag.
mbed_official 155:8435094ec241 541 * @arg DMA1_FLAG_TE7: DMA1 Channel7 transfer error flag.
mbed_official 155:8435094ec241 542 * @arg DMA2_FLAG_GL1: DMA2 Channel1 global flag.
mbed_official 155:8435094ec241 543 * @arg DMA2_FLAG_TC1: DMA2 Channel1 transfer complete flag.
mbed_official 155:8435094ec241 544 * @arg DMA2_FLAG_HT1: DMA2 Channel1 half transfer flag.
mbed_official 155:8435094ec241 545 * @arg DMA2_FLAG_TE1: DMA2 Channel1 transfer error flag.
mbed_official 155:8435094ec241 546 * @arg DMA2_FLAG_GL2: DMA2 Channel2 global flag.
mbed_official 155:8435094ec241 547 * @arg DMA2_FLAG_TC2: DMA2 Channel2 transfer complete flag.
mbed_official 155:8435094ec241 548 * @arg DMA2_FLAG_HT2: DMA2 Channel2 half transfer flag.
mbed_official 155:8435094ec241 549 * @arg DMA2_FLAG_TE2: DMA2 Channel2 transfer error flag.
mbed_official 155:8435094ec241 550 * @arg DMA2_FLAG_GL3: DMA2 Channel3 global flag.
mbed_official 155:8435094ec241 551 * @arg DMA2_FLAG_TC3: DMA2 Channel3 transfer complete flag.
mbed_official 155:8435094ec241 552 * @arg DMA2_FLAG_HT3: DMA2 Channel3 half transfer flag.
mbed_official 155:8435094ec241 553 * @arg DMA2_FLAG_TE3: DMA2 Channel3 transfer error flag.
mbed_official 155:8435094ec241 554 * @arg DMA2_FLAG_GL4: DMA2 Channel4 global flag.
mbed_official 155:8435094ec241 555 * @arg DMA2_FLAG_TC4: DMA2 Channel4 transfer complete flag.
mbed_official 155:8435094ec241 556 * @arg DMA2_FLAG_HT4: DMA2 Channel4 half transfer flag.
mbed_official 155:8435094ec241 557 * @arg DMA2_FLAG_TE4: DMA2 Channel4 transfer error flag.
mbed_official 155:8435094ec241 558 * @arg DMA2_FLAG_GL5: DMA2 Channel5 global flag.
mbed_official 155:8435094ec241 559 * @arg DMA2_FLAG_TC5: DMA2 Channel5 transfer complete flag.
mbed_official 155:8435094ec241 560 * @arg DMA2_FLAG_HT5: DMA2 Channel5 half transfer flag.
mbed_official 155:8435094ec241 561 * @arg DMA2_FLAG_TE5: DMA2 Channel5 transfer error flag.
mbed_official 155:8435094ec241 562 *
mbed_official 155:8435094ec241 563 * @note
mbed_official 155:8435094ec241 564 * The Global flag (DMAy_FLAG_GLx) is set whenever any of the other flags
mbed_official 155:8435094ec241 565 * relative to the same channel is set (Transfer Complete, Half-transfer
mbed_official 155:8435094ec241 566 * Complete or Transfer Error flags: DMAy_FLAG_TCx, DMAy_FLAG_HTx or
mbed_official 155:8435094ec241 567 * DMAy_FLAG_TEx).
mbed_official 155:8435094ec241 568 *
mbed_official 155:8435094ec241 569 * @retval The new state of DMAy_FLAG (SET or RESET).
mbed_official 155:8435094ec241 570 */
mbed_official 155:8435094ec241 571 FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG)
mbed_official 155:8435094ec241 572 {
mbed_official 155:8435094ec241 573 FlagStatus bitstatus = RESET;
mbed_official 155:8435094ec241 574 uint32_t tmpreg = 0;
mbed_official 155:8435094ec241 575
mbed_official 155:8435094ec241 576 /* Check the parameters */
mbed_official 155:8435094ec241 577 assert_param(IS_DMA_GET_FLAG(DMAy_FLAG));
mbed_official 155:8435094ec241 578
mbed_official 155:8435094ec241 579 /* Calculate the used DMAy */
mbed_official 155:8435094ec241 580 if ((DMAy_FLAG & FLAG_Mask) != (uint32_t)RESET)
mbed_official 155:8435094ec241 581 {
mbed_official 155:8435094ec241 582 /* Get DMA2 ISR register value */
mbed_official 155:8435094ec241 583 tmpreg = DMA2->ISR ;
mbed_official 155:8435094ec241 584 }
mbed_official 155:8435094ec241 585 else
mbed_official 155:8435094ec241 586 {
mbed_official 155:8435094ec241 587 /* Get DMA1 ISR register value */
mbed_official 155:8435094ec241 588 tmpreg = DMA1->ISR ;
mbed_official 155:8435094ec241 589 }
mbed_official 155:8435094ec241 590
mbed_official 155:8435094ec241 591 /* Check the status of the specified DMAy flag */
mbed_official 155:8435094ec241 592 if ((tmpreg & DMAy_FLAG) != (uint32_t)RESET)
mbed_official 155:8435094ec241 593 {
mbed_official 155:8435094ec241 594 /* DMAy_FLAG is set */
mbed_official 155:8435094ec241 595 bitstatus = SET;
mbed_official 155:8435094ec241 596 }
mbed_official 155:8435094ec241 597 else
mbed_official 155:8435094ec241 598 {
mbed_official 155:8435094ec241 599 /* DMAy_FLAG is reset */
mbed_official 155:8435094ec241 600 bitstatus = RESET;
mbed_official 155:8435094ec241 601 }
mbed_official 155:8435094ec241 602
mbed_official 155:8435094ec241 603 /* Return the DMAy_FLAG status */
mbed_official 155:8435094ec241 604 return bitstatus;
mbed_official 155:8435094ec241 605 }
mbed_official 155:8435094ec241 606
mbed_official 155:8435094ec241 607 /**
mbed_official 155:8435094ec241 608 * @brief Clears the DMAy Channelx's pending flags.
mbed_official 155:8435094ec241 609 * @param DMAy_FLAG: specifies the flag to clear.
mbed_official 155:8435094ec241 610 * This parameter can be any combination (for the same DMA) of the following values:
mbed_official 155:8435094ec241 611 * @arg DMA1_FLAG_GL1: DMA1 Channel1 global flag.
mbed_official 155:8435094ec241 612 * @arg DMA1_FLAG_TC1: DMA1 Channel1 transfer complete flag.
mbed_official 155:8435094ec241 613 * @arg DMA1_FLAG_HT1: DMA1 Channel1 half transfer flag.
mbed_official 155:8435094ec241 614 * @arg DMA1_FLAG_TE1: DMA1 Channel1 transfer error flag.
mbed_official 155:8435094ec241 615 * @arg DMA1_FLAG_GL2: DMA1 Channel2 global flag.
mbed_official 155:8435094ec241 616 * @arg DMA1_FLAG_TC2: DMA1 Channel2 transfer complete flag.
mbed_official 155:8435094ec241 617 * @arg DMA1_FLAG_HT2: DMA1 Channel2 half transfer flag.
mbed_official 155:8435094ec241 618 * @arg DMA1_FLAG_TE2: DMA1 Channel2 transfer error flag.
mbed_official 155:8435094ec241 619 * @arg DMA1_FLAG_GL3: DMA1 Channel3 global flag.
mbed_official 155:8435094ec241 620 * @arg DMA1_FLAG_TC3: DMA1 Channel3 transfer complete flag.
mbed_official 155:8435094ec241 621 * @arg DMA1_FLAG_HT3: DMA1 Channel3 half transfer flag.
mbed_official 155:8435094ec241 622 * @arg DMA1_FLAG_TE3: DMA1 Channel3 transfer error flag.
mbed_official 155:8435094ec241 623 * @arg DMA1_FLAG_GL4: DMA1 Channel4 global flag.
mbed_official 155:8435094ec241 624 * @arg DMA1_FLAG_TC4: DMA1 Channel4 transfer complete flag.
mbed_official 155:8435094ec241 625 * @arg DMA1_FLAG_HT4: DMA1 Channel4 half transfer flag.
mbed_official 155:8435094ec241 626 * @arg DMA1_FLAG_TE4: DMA1 Channel4 transfer error flag.
mbed_official 155:8435094ec241 627 * @arg DMA1_FLAG_GL5: DMA1 Channel5 global flag.
mbed_official 155:8435094ec241 628 * @arg DMA1_FLAG_TC5: DMA1 Channel5 transfer complete flag.
mbed_official 155:8435094ec241 629 * @arg DMA1_FLAG_HT5: DMA1 Channel5 half transfer flag.
mbed_official 155:8435094ec241 630 * @arg DMA1_FLAG_TE5: DMA1 Channel5 transfer error flag.
mbed_official 155:8435094ec241 631 * @arg DMA1_FLAG_GL6: DMA1 Channel6 global flag.
mbed_official 155:8435094ec241 632 * @arg DMA1_FLAG_TC6: DMA1 Channel6 transfer complete flag.
mbed_official 155:8435094ec241 633 * @arg DMA1_FLAG_HT6: DMA1 Channel6 half transfer flag.
mbed_official 155:8435094ec241 634 * @arg DMA1_FLAG_TE6: DMA1 Channel6 transfer error flag.
mbed_official 155:8435094ec241 635 * @arg DMA1_FLAG_GL7: DMA1 Channel7 global flag.
mbed_official 155:8435094ec241 636 * @arg DMA1_FLAG_TC7: DMA1 Channel7 transfer complete flag.
mbed_official 155:8435094ec241 637 * @arg DMA1_FLAG_HT7: DMA1 Channel7 half transfer flag.
mbed_official 155:8435094ec241 638 * @arg DMA1_FLAG_TE7: DMA1 Channel7 transfer error flag.
mbed_official 155:8435094ec241 639 * @arg DMA2_FLAG_GL1: DMA2 Channel1 global flag.
mbed_official 155:8435094ec241 640 * @arg DMA2_FLAG_TC1: DMA2 Channel1 transfer complete flag.
mbed_official 155:8435094ec241 641 * @arg DMA2_FLAG_HT1: DMA2 Channel1 half transfer flag.
mbed_official 155:8435094ec241 642 * @arg DMA2_FLAG_TE1: DMA2 Channel1 transfer error flag.
mbed_official 155:8435094ec241 643 * @arg DMA2_FLAG_GL2: DMA2 Channel2 global flag.
mbed_official 155:8435094ec241 644 * @arg DMA2_FLAG_TC2: DMA2 Channel2 transfer complete flag.
mbed_official 155:8435094ec241 645 * @arg DMA2_FLAG_HT2: DMA2 Channel2 half transfer flag.
mbed_official 155:8435094ec241 646 * @arg DMA2_FLAG_TE2: DMA2 Channel2 transfer error flag.
mbed_official 155:8435094ec241 647 * @arg DMA2_FLAG_GL3: DMA2 Channel3 global flag.
mbed_official 155:8435094ec241 648 * @arg DMA2_FLAG_TC3: DMA2 Channel3 transfer complete flag.
mbed_official 155:8435094ec241 649 * @arg DMA2_FLAG_HT3: DMA2 Channel3 half transfer flag.
mbed_official 155:8435094ec241 650 * @arg DMA2_FLAG_TE3: DMA2 Channel3 transfer error flag.
mbed_official 155:8435094ec241 651 * @arg DMA2_FLAG_GL4: DMA2 Channel4 global flag.
mbed_official 155:8435094ec241 652 * @arg DMA2_FLAG_TC4: DMA2 Channel4 transfer complete flag.
mbed_official 155:8435094ec241 653 * @arg DMA2_FLAG_HT4: DMA2 Channel4 half transfer flag.
mbed_official 155:8435094ec241 654 * @arg DMA2_FLAG_TE4: DMA2 Channel4 transfer error flag.
mbed_official 155:8435094ec241 655 * @arg DMA2_FLAG_GL5: DMA2 Channel5 global flag.
mbed_official 155:8435094ec241 656 * @arg DMA2_FLAG_TC5: DMA2 Channel5 transfer complete flag.
mbed_official 155:8435094ec241 657 * @arg DMA2_FLAG_HT5: DMA2 Channel5 half transfer flag.
mbed_official 155:8435094ec241 658 * @arg DMA2_FLAG_TE5: DMA2 Channel5 transfer error flag.
mbed_official 155:8435094ec241 659 *
mbed_official 155:8435094ec241 660 * @note
mbed_official 155:8435094ec241 661 * Clearing the Global flag (DMAy_FLAG_GLx) results in clearing all other flags
mbed_official 155:8435094ec241 662 * relative to the same channel (Transfer Complete, Half-transfer Complete and
mbed_official 155:8435094ec241 663 * Transfer Error flags: DMAy_FLAG_TCx, DMAy_FLAG_HTx and DMAy_FLAG_TEx).
mbed_official 155:8435094ec241 664 *
mbed_official 155:8435094ec241 665 * @retval None
mbed_official 155:8435094ec241 666 */
mbed_official 155:8435094ec241 667 void DMA_ClearFlag(uint32_t DMAy_FLAG)
mbed_official 155:8435094ec241 668 {
mbed_official 155:8435094ec241 669 /* Check the parameters */
mbed_official 155:8435094ec241 670 assert_param(IS_DMA_CLEAR_FLAG(DMAy_FLAG));
mbed_official 155:8435094ec241 671
mbed_official 155:8435094ec241 672 /* Calculate the used DMAy */
mbed_official 155:8435094ec241 673 if ((DMAy_FLAG & FLAG_Mask) != (uint32_t)RESET)
mbed_official 155:8435094ec241 674 {
mbed_official 155:8435094ec241 675 /* Clear the selected DMAy flags */
mbed_official 155:8435094ec241 676 DMA2->IFCR = DMAy_FLAG;
mbed_official 155:8435094ec241 677 }
mbed_official 155:8435094ec241 678 else
mbed_official 155:8435094ec241 679 {
mbed_official 155:8435094ec241 680 /* Clear the selected DMAy flags */
mbed_official 155:8435094ec241 681 DMA1->IFCR = DMAy_FLAG;
mbed_official 155:8435094ec241 682 }
mbed_official 155:8435094ec241 683 }
mbed_official 155:8435094ec241 684
mbed_official 155:8435094ec241 685 /**
mbed_official 155:8435094ec241 686 * @brief Checks whether the specified DMAy Channelx interrupt has occurred or not.
mbed_official 155:8435094ec241 687 * @param DMAy_IT: specifies the DMAy interrupt source to check.
mbed_official 155:8435094ec241 688 * This parameter can be one of the following values:
mbed_official 155:8435094ec241 689 * @arg DMA1_IT_GL1: DMA1 Channel1 global interrupt.
mbed_official 155:8435094ec241 690 * @arg DMA1_IT_TC1: DMA1 Channel1 transfer complete interrupt.
mbed_official 155:8435094ec241 691 * @arg DMA1_IT_HT1: DMA1 Channel1 half transfer interrupt.
mbed_official 155:8435094ec241 692 * @arg DMA1_IT_TE1: DMA1 Channel1 transfer error interrupt.
mbed_official 155:8435094ec241 693 * @arg DMA1_IT_GL2: DMA1 Channel2 global interrupt.
mbed_official 155:8435094ec241 694 * @arg DMA1_IT_TC2: DMA1 Channel2 transfer complete interrupt.
mbed_official 155:8435094ec241 695 * @arg DMA1_IT_HT2: DMA1 Channel2 half transfer interrupt.
mbed_official 155:8435094ec241 696 * @arg DMA1_IT_TE2: DMA1 Channel2 transfer error interrupt.
mbed_official 155:8435094ec241 697 * @arg DMA1_IT_GL3: DMA1 Channel3 global interrupt.
mbed_official 155:8435094ec241 698 * @arg DMA1_IT_TC3: DMA1 Channel3 transfer complete interrupt.
mbed_official 155:8435094ec241 699 * @arg DMA1_IT_HT3: DMA1 Channel3 half transfer interrupt.
mbed_official 155:8435094ec241 700 * @arg DMA1_IT_TE3: DMA1 Channel3 transfer error interrupt.
mbed_official 155:8435094ec241 701 * @arg DMA1_IT_GL4: DMA1 Channel4 global interrupt.
mbed_official 155:8435094ec241 702 * @arg DMA1_IT_TC4: DMA1 Channel4 transfer complete interrupt.
mbed_official 155:8435094ec241 703 * @arg DMA1_IT_HT4: DMA1 Channel4 half transfer interrupt.
mbed_official 155:8435094ec241 704 * @arg DMA1_IT_TE4: DMA1 Channel4 transfer error interrupt.
mbed_official 155:8435094ec241 705 * @arg DMA1_IT_GL5: DMA1 Channel5 global interrupt.
mbed_official 155:8435094ec241 706 * @arg DMA1_IT_TC5: DMA1 Channel5 transfer complete interrupt.
mbed_official 155:8435094ec241 707 * @arg DMA1_IT_HT5: DMA1 Channel5 half transfer interrupt.
mbed_official 155:8435094ec241 708 * @arg DMA1_IT_TE5: DMA1 Channel5 transfer error interrupt.
mbed_official 155:8435094ec241 709 * @arg DMA1_IT_GL6: DMA1 Channel6 global interrupt.
mbed_official 155:8435094ec241 710 * @arg DMA1_IT_TC6: DMA1 Channel6 transfer complete interrupt.
mbed_official 155:8435094ec241 711 * @arg DMA1_IT_HT6: DMA1 Channel6 half transfer interrupt.
mbed_official 155:8435094ec241 712 * @arg DMA1_IT_TE6: DMA1 Channel6 transfer error interrupt.
mbed_official 155:8435094ec241 713 * @arg DMA1_IT_GL7: DMA1 Channel7 global interrupt.
mbed_official 155:8435094ec241 714 * @arg DMA1_IT_TC7: DMA1 Channel7 transfer complete interrupt.
mbed_official 155:8435094ec241 715 * @arg DMA1_IT_HT7: DMA1 Channel7 half transfer interrupt.
mbed_official 155:8435094ec241 716 * @arg DMA1_IT_TE7: DMA1 Channel7 transfer error interrupt.
mbed_official 155:8435094ec241 717 * @arg DMA2_IT_GL1: DMA2 Channel1 global interrupt.
mbed_official 155:8435094ec241 718 * @arg DMA2_IT_TC1: DMA2 Channel1 transfer complete interrupt.
mbed_official 155:8435094ec241 719 * @arg DMA2_IT_HT1: DMA2 Channel1 half transfer interrupt.
mbed_official 155:8435094ec241 720 * @arg DMA2_IT_TE1: DMA2 Channel1 transfer error interrupt.
mbed_official 155:8435094ec241 721 * @arg DMA2_IT_GL2: DMA2 Channel2 global interrupt.
mbed_official 155:8435094ec241 722 * @arg DMA2_IT_TC2: DMA2 Channel2 transfer complete interrupt.
mbed_official 155:8435094ec241 723 * @arg DMA2_IT_HT2: DMA2 Channel2 half transfer interrupt.
mbed_official 155:8435094ec241 724 * @arg DMA2_IT_TE2: DMA2 Channel2 transfer error interrupt.
mbed_official 155:8435094ec241 725 * @arg DMA2_IT_GL3: DMA2 Channel3 global interrupt.
mbed_official 155:8435094ec241 726 * @arg DMA2_IT_TC3: DMA2 Channel3 transfer complete interrupt.
mbed_official 155:8435094ec241 727 * @arg DMA2_IT_HT3: DMA2 Channel3 half transfer interrupt.
mbed_official 155:8435094ec241 728 * @arg DMA2_IT_TE3: DMA2 Channel3 transfer error interrupt.
mbed_official 155:8435094ec241 729 * @arg DMA2_IT_GL4: DMA2 Channel4 global interrupt.
mbed_official 155:8435094ec241 730 * @arg DMA2_IT_TC4: DMA2 Channel4 transfer complete interrupt.
mbed_official 155:8435094ec241 731 * @arg DMA2_IT_HT4: DMA2 Channel4 half transfer interrupt.
mbed_official 155:8435094ec241 732 * @arg DMA2_IT_TE4: DMA2 Channel4 transfer error interrupt.
mbed_official 155:8435094ec241 733 * @arg DMA2_IT_GL5: DMA2 Channel5 global interrupt.
mbed_official 155:8435094ec241 734 * @arg DMA2_IT_TC5: DMA2 Channel5 transfer complete interrupt.
mbed_official 155:8435094ec241 735 * @arg DMA2_IT_HT5: DMA2 Channel5 half transfer interrupt.
mbed_official 155:8435094ec241 736 * @arg DMA2_IT_TE5: DMA2 Channel5 transfer error interrupt.
mbed_official 155:8435094ec241 737 *
mbed_official 155:8435094ec241 738 * @note
mbed_official 155:8435094ec241 739 * The Global interrupt (DMAy_FLAG_GLx) is set whenever any of the other
mbed_official 155:8435094ec241 740 * interrupts relative to the same channel is set (Transfer Complete,
mbed_official 155:8435094ec241 741 * Half-transfer Complete or Transfer Error interrupts: DMAy_IT_TCx,
mbed_official 155:8435094ec241 742 * DMAy_IT_HTx or DMAy_IT_TEx).
mbed_official 155:8435094ec241 743 *
mbed_official 155:8435094ec241 744 * @retval The new state of DMAy_IT (SET or RESET).
mbed_official 155:8435094ec241 745 */
mbed_official 155:8435094ec241 746 ITStatus DMA_GetITStatus(uint32_t DMAy_IT)
mbed_official 155:8435094ec241 747 {
mbed_official 155:8435094ec241 748 ITStatus bitstatus = RESET;
mbed_official 155:8435094ec241 749 uint32_t tmpreg = 0;
mbed_official 155:8435094ec241 750
mbed_official 155:8435094ec241 751 /* Check the parameters */
mbed_official 155:8435094ec241 752 assert_param(IS_DMA_GET_IT(DMAy_IT));
mbed_official 155:8435094ec241 753
mbed_official 155:8435094ec241 754 /* Calculate the used DMA */
mbed_official 155:8435094ec241 755 if ((DMAy_IT & FLAG_Mask) != (uint32_t)RESET)
mbed_official 155:8435094ec241 756 {
mbed_official 155:8435094ec241 757 /* Get DMA2 ISR register value */
mbed_official 155:8435094ec241 758 tmpreg = DMA2->ISR;
mbed_official 155:8435094ec241 759 }
mbed_official 155:8435094ec241 760 else
mbed_official 155:8435094ec241 761 {
mbed_official 155:8435094ec241 762 /* Get DMA1 ISR register value */
mbed_official 155:8435094ec241 763 tmpreg = DMA1->ISR;
mbed_official 155:8435094ec241 764 }
mbed_official 155:8435094ec241 765
mbed_official 155:8435094ec241 766 /* Check the status of the specified DMAy interrupt */
mbed_official 155:8435094ec241 767 if ((tmpreg & DMAy_IT) != (uint32_t)RESET)
mbed_official 155:8435094ec241 768 {
mbed_official 155:8435094ec241 769 /* DMAy_IT is set */
mbed_official 155:8435094ec241 770 bitstatus = SET;
mbed_official 155:8435094ec241 771 }
mbed_official 155:8435094ec241 772 else
mbed_official 155:8435094ec241 773 {
mbed_official 155:8435094ec241 774 /* DMAy_IT is reset */
mbed_official 155:8435094ec241 775 bitstatus = RESET;
mbed_official 155:8435094ec241 776 }
mbed_official 155:8435094ec241 777 /* Return the DMAy_IT status */
mbed_official 155:8435094ec241 778 return bitstatus;
mbed_official 155:8435094ec241 779 }
mbed_official 155:8435094ec241 780
mbed_official 155:8435094ec241 781 /**
mbed_official 155:8435094ec241 782 * @brief Clears the DMAy Channelx's interrupt pending bits.
mbed_official 155:8435094ec241 783 * @param DMAy_IT: specifies the DMAy interrupt pending bit to clear.
mbed_official 155:8435094ec241 784 * This parameter can be any combination (for the same DMA) of the following values:
mbed_official 155:8435094ec241 785 * @arg DMA1_IT_GL1: DMA1 Channel1 global interrupt.
mbed_official 155:8435094ec241 786 * @arg DMA1_IT_TC1: DMA1 Channel1 transfer complete interrupt.
mbed_official 155:8435094ec241 787 * @arg DMA1_IT_HT1: DMA1 Channel1 half transfer interrupt.
mbed_official 155:8435094ec241 788 * @arg DMA1_IT_TE1: DMA1 Channel1 transfer error interrupt.
mbed_official 155:8435094ec241 789 * @arg DMA1_IT_GL2: DMA1 Channel2 global interrupt.
mbed_official 155:8435094ec241 790 * @arg DMA1_IT_TC2: DMA1 Channel2 transfer complete interrupt.
mbed_official 155:8435094ec241 791 * @arg DMA1_IT_HT2: DMA1 Channel2 half transfer interrupt.
mbed_official 155:8435094ec241 792 * @arg DMA1_IT_TE2: DMA1 Channel2 transfer error interrupt.
mbed_official 155:8435094ec241 793 * @arg DMA1_IT_GL3: DMA1 Channel3 global interrupt.
mbed_official 155:8435094ec241 794 * @arg DMA1_IT_TC3: DMA1 Channel3 transfer complete interrupt.
mbed_official 155:8435094ec241 795 * @arg DMA1_IT_HT3: DMA1 Channel3 half transfer interrupt.
mbed_official 155:8435094ec241 796 * @arg DMA1_IT_TE3: DMA1 Channel3 transfer error interrupt.
mbed_official 155:8435094ec241 797 * @arg DMA1_IT_GL4: DMA1 Channel4 global interrupt.
mbed_official 155:8435094ec241 798 * @arg DMA1_IT_TC4: DMA1 Channel4 transfer complete interrupt.
mbed_official 155:8435094ec241 799 * @arg DMA1_IT_HT4: DMA1 Channel4 half transfer interrupt.
mbed_official 155:8435094ec241 800 * @arg DMA1_IT_TE4: DMA1 Channel4 transfer error interrupt.
mbed_official 155:8435094ec241 801 * @arg DMA1_IT_GL5: DMA1 Channel5 global interrupt.
mbed_official 155:8435094ec241 802 * @arg DMA1_IT_TC5: DMA1 Channel5 transfer complete interrupt.
mbed_official 155:8435094ec241 803 * @arg DMA1_IT_HT5: DMA1 Channel5 half transfer interrupt.
mbed_official 155:8435094ec241 804 * @arg DMA1_IT_TE5: DMA1 Channel5 transfer error interrupt.
mbed_official 155:8435094ec241 805 * @arg DMA1_IT_GL6: DMA1 Channel6 global interrupt.
mbed_official 155:8435094ec241 806 * @arg DMA1_IT_TC6: DMA1 Channel6 transfer complete interrupt.
mbed_official 155:8435094ec241 807 * @arg DMA1_IT_HT6: DMA1 Channel6 half transfer interrupt.
mbed_official 155:8435094ec241 808 * @arg DMA1_IT_TE6: DMA1 Channel6 transfer error interrupt.
mbed_official 155:8435094ec241 809 * @arg DMA1_IT_GL7: DMA1 Channel7 global interrupt.
mbed_official 155:8435094ec241 810 * @arg DMA1_IT_TC7: DMA1 Channel7 transfer complete interrupt.
mbed_official 155:8435094ec241 811 * @arg DMA1_IT_HT7: DMA1 Channel7 half transfer interrupt.
mbed_official 155:8435094ec241 812 * @arg DMA1_IT_TE7: DMA1 Channel7 transfer error interrupt.
mbed_official 155:8435094ec241 813 * @arg DMA2_IT_GL1: DMA2 Channel1 global interrupt.
mbed_official 155:8435094ec241 814 * @arg DMA2_IT_TC1: DMA2 Channel1 transfer complete interrupt.
mbed_official 155:8435094ec241 815 * @arg DMA2_IT_HT1: DMA2 Channel1 half transfer interrupt.
mbed_official 155:8435094ec241 816 * @arg DMA2_IT_TE1: DMA2 Channel1 transfer error interrupt.
mbed_official 155:8435094ec241 817 * @arg DMA2_IT_GL2: DMA2 Channel2 global interrupt.
mbed_official 155:8435094ec241 818 * @arg DMA2_IT_TC2: DMA2 Channel2 transfer complete interrupt.
mbed_official 155:8435094ec241 819 * @arg DMA2_IT_HT2: DMA2 Channel2 half transfer interrupt.
mbed_official 155:8435094ec241 820 * @arg DMA2_IT_TE2: DMA2 Channel2 transfer error interrupt.
mbed_official 155:8435094ec241 821 * @arg DMA2_IT_GL3: DMA2 Channel3 global interrupt.
mbed_official 155:8435094ec241 822 * @arg DMA2_IT_TC3: DMA2 Channel3 transfer complete interrupt.
mbed_official 155:8435094ec241 823 * @arg DMA2_IT_HT3: DMA2 Channel3 half transfer interrupt.
mbed_official 155:8435094ec241 824 * @arg DMA2_IT_TE3: DMA2 Channel3 transfer error interrupt.
mbed_official 155:8435094ec241 825 * @arg DMA2_IT_GL4: DMA2 Channel4 global interrupt.
mbed_official 155:8435094ec241 826 * @arg DMA2_IT_TC4: DMA2 Channel4 transfer complete interrupt.
mbed_official 155:8435094ec241 827 * @arg DMA2_IT_HT4: DMA2 Channel4 half transfer interrupt.
mbed_official 155:8435094ec241 828 * @arg DMA2_IT_TE4: DMA2 Channel4 transfer error interrupt.
mbed_official 155:8435094ec241 829 * @arg DMA2_IT_GL5: DMA2 Channel5 global interrupt.
mbed_official 155:8435094ec241 830 * @arg DMA2_IT_TC5: DMA2 Channel5 transfer complete interrupt.
mbed_official 155:8435094ec241 831 * @arg DMA2_IT_HT5: DMA2 Channel5 half transfer interrupt.
mbed_official 155:8435094ec241 832 * @arg DMA2_IT_TE5: DMA2 Channel5 transfer error interrupt.
mbed_official 155:8435094ec241 833 *
mbed_official 155:8435094ec241 834 * @note
mbed_official 155:8435094ec241 835 * Clearing the Global interrupt (DMAy_IT_GLx) results in clearing all other
mbed_official 155:8435094ec241 836 * interrupts relative to the same channel (Transfer Complete, Half-transfer
mbed_official 155:8435094ec241 837 * Complete and Transfer Error interrupts: DMAy_IT_TCx, DMAy_IT_HTx and
mbed_official 155:8435094ec241 838 * DMAy_IT_TEx).
mbed_official 155:8435094ec241 839 *
mbed_official 155:8435094ec241 840 * @retval None
mbed_official 155:8435094ec241 841 */
mbed_official 155:8435094ec241 842 void DMA_ClearITPendingBit(uint32_t DMAy_IT)
mbed_official 155:8435094ec241 843 {
mbed_official 155:8435094ec241 844 /* Check the parameters */
mbed_official 155:8435094ec241 845 assert_param(IS_DMA_CLEAR_IT(DMAy_IT));
mbed_official 155:8435094ec241 846
mbed_official 155:8435094ec241 847 /* Calculate the used DMAy */
mbed_official 155:8435094ec241 848 if ((DMAy_IT & FLAG_Mask) != (uint32_t)RESET)
mbed_official 155:8435094ec241 849 {
mbed_official 155:8435094ec241 850 /* Clear the selected DMAy interrupt pending bits */
mbed_official 155:8435094ec241 851 DMA2->IFCR = DMAy_IT;
mbed_official 155:8435094ec241 852 }
mbed_official 155:8435094ec241 853 else
mbed_official 155:8435094ec241 854 {
mbed_official 155:8435094ec241 855 /* Clear the selected DMAy interrupt pending bits */
mbed_official 155:8435094ec241 856 DMA1->IFCR = DMAy_IT;
mbed_official 155:8435094ec241 857 }
mbed_official 155:8435094ec241 858 }
mbed_official 155:8435094ec241 859
mbed_official 155:8435094ec241 860 /**
mbed_official 155:8435094ec241 861 * @}
mbed_official 155:8435094ec241 862 */
mbed_official 155:8435094ec241 863
mbed_official 155:8435094ec241 864 /**
mbed_official 155:8435094ec241 865 * @}
mbed_official 155:8435094ec241 866 */
mbed_official 155:8435094ec241 867
mbed_official 155:8435094ec241 868 /**
mbed_official 155:8435094ec241 869 * @}
mbed_official 155:8435094ec241 870 */
mbed_official 155:8435094ec241 871
mbed_official 155:8435094ec241 872 /**
mbed_official 155:8435094ec241 873 * @}
mbed_official 155:8435094ec241 874 */
mbed_official 155:8435094ec241 875
mbed_official 155:8435094ec241 876 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/