mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Feb 26 09:45:12 2014 +0000
Revision:
106:ced8cbb51063
Parent:
80:66393a7b209d
Synchronized with git revision 4222735eff5868389433f0e9271976b39c8115cd

Full URL: https://github.com/mbedmicro/mbed/commit/4222735eff5868389433f0e9271976b39c8115cd/

[NUCLEO_xxx] Update STM32CubeF4 driver V1.0.0 + update license

Who changed what in which revision?

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