meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 17 14:27:45 2015 +0000
Revision:
96:487b796308b0
Parent:
92:4fc01daae5a5
Release 96 of the mbed library

Changes:
- IAR support for ble boards, lpc, ethernet stack
- RTC - attach function to redirect time functions
- Nucleo F103RB - cube driver
- k20xx - fixes for teensy and k20 platforms in sleep/deepsleep and usb
- STM32L0, Nucleo/Disco L053 - refactoring

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 84:0b3ab51c8877 1 /**
bogdanm 84:0b3ab51c8877 2 ******************************************************************************
bogdanm 84:0b3ab51c8877 3 * @file stm32l0xx_hal_dma.h
bogdanm 84:0b3ab51c8877 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V1.2.0
Kojto 96:487b796308b0 6 * @date 06-February-2015
bogdanm 84:0b3ab51c8877 7 * @brief Header file of DMA HAL module.
bogdanm 84:0b3ab51c8877 8 ******************************************************************************
bogdanm 84:0b3ab51c8877 9 * @attention
bogdanm 84:0b3ab51c8877 10 *
Kojto 96:487b796308b0 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bogdanm 84:0b3ab51c8877 12 *
bogdanm 84:0b3ab51c8877 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 84:0b3ab51c8877 14 * are permitted provided that the following conditions are met:
bogdanm 84:0b3ab51c8877 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 84:0b3ab51c8877 16 * this list of conditions and the following disclaimer.
bogdanm 84:0b3ab51c8877 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 84:0b3ab51c8877 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 84:0b3ab51c8877 19 * and/or other materials provided with the distribution.
bogdanm 84:0b3ab51c8877 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 84:0b3ab51c8877 21 * may be used to endorse or promote products derived from this software
bogdanm 84:0b3ab51c8877 22 * without specific prior written permission.
bogdanm 84:0b3ab51c8877 23 *
bogdanm 84:0b3ab51c8877 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 84:0b3ab51c8877 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 84:0b3ab51c8877 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 84:0b3ab51c8877 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 84:0b3ab51c8877 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 84:0b3ab51c8877 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 84:0b3ab51c8877 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 84:0b3ab51c8877 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 84:0b3ab51c8877 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 84:0b3ab51c8877 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 84:0b3ab51c8877 34 *
bogdanm 84:0b3ab51c8877 35 ******************************************************************************
bogdanm 84:0b3ab51c8877 36 */
bogdanm 84:0b3ab51c8877 37
bogdanm 84:0b3ab51c8877 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 84:0b3ab51c8877 39 #ifndef __STM32L0xx_HAL_DMA_H
bogdanm 84:0b3ab51c8877 40 #define __STM32L0xx_HAL_DMA_H
bogdanm 84:0b3ab51c8877 41
bogdanm 84:0b3ab51c8877 42 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 43 extern "C" {
bogdanm 84:0b3ab51c8877 44 #endif
bogdanm 84:0b3ab51c8877 45
bogdanm 84:0b3ab51c8877 46 /* Includes ------------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 47 #include "stm32l0xx_hal_def.h"
bogdanm 84:0b3ab51c8877 48
bogdanm 84:0b3ab51c8877 49 /** @addtogroup STM32L0xx_HAL_Driver
bogdanm 84:0b3ab51c8877 50 * @{
bogdanm 84:0b3ab51c8877 51 */
bogdanm 84:0b3ab51c8877 52
Kojto 96:487b796308b0 53 /** @defgroup DMA DMA
bogdanm 84:0b3ab51c8877 54 * @{
bogdanm 84:0b3ab51c8877 55 */
bogdanm 84:0b3ab51c8877 56
bogdanm 84:0b3ab51c8877 57 /* Exported types ------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 58
bogdanm 84:0b3ab51c8877 59 /**
bogdanm 84:0b3ab51c8877 60 * @brief DMA Configuration Structure definition
bogdanm 84:0b3ab51c8877 61 */
bogdanm 84:0b3ab51c8877 62 typedef struct
bogdanm 84:0b3ab51c8877 63 {
bogdanm 84:0b3ab51c8877 64 uint32_t Request; /*!< Specifies the request selected for the specified channel.
bogdanm 84:0b3ab51c8877 65 This parameter can be a value of @ref DMA_request */
bogdanm 84:0b3ab51c8877 66
bogdanm 84:0b3ab51c8877 67 uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
bogdanm 84:0b3ab51c8877 68 from memory to memory or from peripheral to memory.
bogdanm 92:4fc01daae5a5 69 This parameter can be a value of @ref DMA_Data_transfer_direction */
bogdanm 84:0b3ab51c8877 70
bogdanm 84:0b3ab51c8877 71 uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not.
Kojto 96:487b796308b0 72 When Memory to Memory transfer is used, this is the Source Increment mode
bogdanm 92:4fc01daae5a5 73 This parameter can be a value of @ref DMA_Peripheral_incremented_mode */
bogdanm 84:0b3ab51c8877 74
bogdanm 84:0b3ab51c8877 75 uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not.
Kojto 96:487b796308b0 76 When Memory to Memory transfer is used, this is the Destination Increment mode
bogdanm 92:4fc01daae5a5 77 This parameter can be a value of @ref DMA_Memory_incremented_mode */
bogdanm 84:0b3ab51c8877 78
bogdanm 84:0b3ab51c8877 79 uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width.
Kojto 96:487b796308b0 80 When Memory to Memory transfer is used, this is the Source Alignment format
bogdanm 92:4fc01daae5a5 81 This parameter can be a value of @ref DMA_Peripheral_data_size */
bogdanm 84:0b3ab51c8877 82
bogdanm 84:0b3ab51c8877 83 uint32_t MemDataAlignment; /*!< Specifies the Memory data width.
Kojto 96:487b796308b0 84 When Memory to Memory transfer is used, this is the Destination Alignment format
bogdanm 92:4fc01daae5a5 85 This parameter can be a value of @ref DMA_Memory_data_size */
bogdanm 84:0b3ab51c8877 86
Kojto 96:487b796308b0 87 uint32_t Mode; /*!< Specifies the operation mode of the DMAy Channelx (Normal or Circular).
bogdanm 84:0b3ab51c8877 88 This parameter can be a value of @ref DMA_mode
bogdanm 84:0b3ab51c8877 89 @note The circular buffer mode cannot be used if the memory-to-memory
bogdanm 84:0b3ab51c8877 90 data transfer is configured on the selected Channel */
bogdanm 84:0b3ab51c8877 91
bogdanm 84:0b3ab51c8877 92 uint32_t Priority; /*!< Specifies the software priority for the DMAy Channelx.
bogdanm 92:4fc01daae5a5 93 This parameter can be a value of @ref DMA_Priority_level */
bogdanm 84:0b3ab51c8877 94 } DMA_InitTypeDef;
bogdanm 84:0b3ab51c8877 95
bogdanm 84:0b3ab51c8877 96 /**
bogdanm 84:0b3ab51c8877 97 * @brief DMA Configuration enumeration values definition
bogdanm 84:0b3ab51c8877 98 */
bogdanm 84:0b3ab51c8877 99 typedef enum
bogdanm 84:0b3ab51c8877 100 {
bogdanm 84:0b3ab51c8877 101 DMA_MODE = 0, /*!< Control related DMA mode Parameter in DMA_InitTypeDef */
bogdanm 84:0b3ab51c8877 102 DMA_PRIORITY = 1, /*!< Control related priority level Parameter in DMA_InitTypeDef */
bogdanm 84:0b3ab51c8877 103
bogdanm 84:0b3ab51c8877 104 } DMA_ControlTypeDef;
bogdanm 84:0b3ab51c8877 105
bogdanm 84:0b3ab51c8877 106 /**
bogdanm 84:0b3ab51c8877 107 * @brief HAL DMA State structures definition
bogdanm 84:0b3ab51c8877 108 */
bogdanm 84:0b3ab51c8877 109 typedef enum
bogdanm 84:0b3ab51c8877 110 {
bogdanm 84:0b3ab51c8877 111 HAL_DMA_STATE_RESET = 0x00, /*!< DMA not yet initialized or disabled */
bogdanm 84:0b3ab51c8877 112 HAL_DMA_STATE_READY = 0x01, /*!< DMA process success and ready for use */
bogdanm 84:0b3ab51c8877 113 HAL_DMA_STATE_BUSY = 0x02, /*!< DMA process is ongoing */
bogdanm 84:0b3ab51c8877 114 HAL_DMA_STATE_TIMEOUT = 0x03, /*!< DMA timeout state */
bogdanm 84:0b3ab51c8877 115 HAL_DMA_STATE_ERROR = 0x04, /*!< DMA error state */
bogdanm 84:0b3ab51c8877 116 HAL_DMA_STATE_READY_HALF = 0x05, /*!< DMA Half process success */
bogdanm 84:0b3ab51c8877 117 }HAL_DMA_StateTypeDef;
bogdanm 84:0b3ab51c8877 118
bogdanm 84:0b3ab51c8877 119 /**
bogdanm 84:0b3ab51c8877 120 * @brief HAL DMA Error Code structure definition
bogdanm 84:0b3ab51c8877 121 */
bogdanm 84:0b3ab51c8877 122 typedef enum
bogdanm 84:0b3ab51c8877 123 {
bogdanm 84:0b3ab51c8877 124 HAL_DMA_FULL_TRANSFER = 0x00, /*!< Full transfer */
bogdanm 84:0b3ab51c8877 125 HAL_DMA_HALF_TRANSFER = 0x01, /*!< Half Transfer */
bogdanm 84:0b3ab51c8877 126
bogdanm 84:0b3ab51c8877 127 }HAL_DMA_LevelCompleteTypeDef;
bogdanm 84:0b3ab51c8877 128
bogdanm 84:0b3ab51c8877 129
bogdanm 84:0b3ab51c8877 130 /**
bogdanm 84:0b3ab51c8877 131 * @brief DMA handle Structure definition
bogdanm 84:0b3ab51c8877 132 */
bogdanm 84:0b3ab51c8877 133 typedef struct __DMA_HandleTypeDef
bogdanm 84:0b3ab51c8877 134 {
bogdanm 84:0b3ab51c8877 135 DMA_Channel_TypeDef *Instance; /*!< Register base address */
bogdanm 84:0b3ab51c8877 136
bogdanm 84:0b3ab51c8877 137 DMA_InitTypeDef Init; /*!< DMA communication parameters */
bogdanm 84:0b3ab51c8877 138
bogdanm 84:0b3ab51c8877 139 HAL_LockTypeDef Lock; /*!< DMA locking object */
bogdanm 84:0b3ab51c8877 140
bogdanm 84:0b3ab51c8877 141 __IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */
bogdanm 84:0b3ab51c8877 142
bogdanm 84:0b3ab51c8877 143 void *Parent; /*!< Parent object state */
bogdanm 84:0b3ab51c8877 144
bogdanm 84:0b3ab51c8877 145 void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */
bogdanm 84:0b3ab51c8877 146
bogdanm 84:0b3ab51c8877 147 void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */
bogdanm 84:0b3ab51c8877 148
bogdanm 84:0b3ab51c8877 149 void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */
bogdanm 84:0b3ab51c8877 150
bogdanm 84:0b3ab51c8877 151 __IO uint32_t ErrorCode; /*!< DMA Error code */
bogdanm 84:0b3ab51c8877 152
bogdanm 84:0b3ab51c8877 153 } DMA_HandleTypeDef;
bogdanm 84:0b3ab51c8877 154
bogdanm 84:0b3ab51c8877 155 /* Exported constants --------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 156
Kojto 96:487b796308b0 157 /** @defgroup DMA_Exported_Constants DMA Exported Constants
bogdanm 84:0b3ab51c8877 158 * @{
bogdanm 84:0b3ab51c8877 159 */
bogdanm 84:0b3ab51c8877 160
Kojto 96:487b796308b0 161 /** @defgroup DMA_Error_Code DMA Error Codes
bogdanm 84:0b3ab51c8877 162 * @{
bogdanm 84:0b3ab51c8877 163 */
bogdanm 84:0b3ab51c8877 164 #define HAL_DMA_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
bogdanm 84:0b3ab51c8877 165 #define HAL_DMA_ERROR_TE ((uint32_t)0x00000001) /*!< Transfer error */
bogdanm 84:0b3ab51c8877 166 #define HAL_DMA_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout error */
bogdanm 84:0b3ab51c8877 167
bogdanm 84:0b3ab51c8877 168 #define IS_DMA_ALL_PERIPH(PERIPH) (((PERIPH) == DMA1_Channel1) || \
bogdanm 84:0b3ab51c8877 169 ((PERIPH) == DMA1_Channel2) || \
bogdanm 84:0b3ab51c8877 170 ((PERIPH) == DMA1_Channel3) || \
bogdanm 84:0b3ab51c8877 171 ((PERIPH) == DMA1_Channel4) || \
bogdanm 84:0b3ab51c8877 172 ((PERIPH) == DMA1_Channel5) || \
bogdanm 84:0b3ab51c8877 173 ((PERIPH) == DMA1_Channel6) || \
bogdanm 84:0b3ab51c8877 174 ((PERIPH) == DMA1_Channel7))
bogdanm 84:0b3ab51c8877 175
bogdanm 84:0b3ab51c8877 176 #define IS_DMA_ALL_CONTROLLER(CONTROLLER) (((CONTROLLER) == DMA1))
bogdanm 84:0b3ab51c8877 177
bogdanm 84:0b3ab51c8877 178 /**
bogdanm 84:0b3ab51c8877 179 * @}
bogdanm 84:0b3ab51c8877 180 */
bogdanm 84:0b3ab51c8877 181
Kojto 96:487b796308b0 182 /** @defgroup DMA_request DMA request defintiions
bogdanm 84:0b3ab51c8877 183 * @{
bogdanm 84:0b3ab51c8877 184 */
Kojto 96:487b796308b0 185
Kojto 96:487b796308b0 186 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 96:487b796308b0 187
Kojto 96:487b796308b0 188 #define DMA_REQUEST_0 ((uint32_t)0x00000000)
Kojto 96:487b796308b0 189 #define DMA_REQUEST_1 ((uint32_t)0x00000001)
Kojto 96:487b796308b0 190 #define DMA_REQUEST_2 ((uint32_t)0x00000002)
Kojto 96:487b796308b0 191 #define DMA_REQUEST_3 ((uint32_t)0x00000003)
Kojto 96:487b796308b0 192 #define DMA_REQUEST_4 ((uint32_t)0x00000004)
Kojto 96:487b796308b0 193 #define DMA_REQUEST_5 ((uint32_t)0x00000005)
Kojto 96:487b796308b0 194 #define DMA_REQUEST_6 ((uint32_t)0x00000006)
Kojto 96:487b796308b0 195 #define DMA_REQUEST_7 ((uint32_t)0x00000007)
Kojto 96:487b796308b0 196 #define DMA_REQUEST_8 ((uint32_t)0x00000008)
Kojto 96:487b796308b0 197 #define DMA_REQUEST_9 ((uint32_t)0x00000009)
Kojto 96:487b796308b0 198 #define DMA_REQUEST_10 ((uint32_t)0x0000000A)
Kojto 96:487b796308b0 199 #define DMA_REQUEST_11 ((uint32_t)0x0000000B)
Kojto 96:487b796308b0 200 #define DMA_REQUEST_12 ((uint32_t)0x0000000C)
Kojto 96:487b796308b0 201 #define DMA_REQUEST_13 ((uint32_t)0x0000000D)
Kojto 96:487b796308b0 202 #define DMA_REQUEST_14 ((uint32_t)0x0000000E)
Kojto 96:487b796308b0 203 #define DMA_REQUEST_15 ((uint32_t)0x0000000F)
Kojto 96:487b796308b0 204
Kojto 96:487b796308b0 205 #define IS_DMA_ALL_REQUEST(REQUEST) (((REQUEST) == DMA_REQUEST_0) || \
Kojto 96:487b796308b0 206 ((REQUEST) == DMA_REQUEST_1) || \
Kojto 96:487b796308b0 207 ((REQUEST) == DMA_REQUEST_2) || \
Kojto 96:487b796308b0 208 ((REQUEST) == DMA_REQUEST_3) || \
Kojto 96:487b796308b0 209 ((REQUEST) == DMA_REQUEST_4) || \
Kojto 96:487b796308b0 210 ((REQUEST) == DMA_REQUEST_5) || \
Kojto 96:487b796308b0 211 ((REQUEST) == DMA_REQUEST_6) || \
Kojto 96:487b796308b0 212 ((REQUEST) == DMA_REQUEST_7) || \
Kojto 96:487b796308b0 213 ((REQUEST) == DMA_REQUEST_8) || \
Kojto 96:487b796308b0 214 ((REQUEST) == DMA_REQUEST_9) || \
Kojto 96:487b796308b0 215 ((REQUEST) == DMA_REQUEST_10) || \
Kojto 96:487b796308b0 216 ((REQUEST) == DMA_REQUEST_11) || \
Kojto 96:487b796308b0 217 ((REQUEST) == DMA_REQUEST_12) || \
Kojto 96:487b796308b0 218 ((REQUEST) == DMA_REQUEST_13) || \
Kojto 96:487b796308b0 219 ((REQUEST) == DMA_REQUEST_14) || \
Kojto 96:487b796308b0 220 ((REQUEST) == DMA_REQUEST_15))
Kojto 96:487b796308b0 221
Kojto 96:487b796308b0 222 #else /* #if STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
Kojto 96:487b796308b0 223
bogdanm 84:0b3ab51c8877 224 #define DMA_REQUEST_0 ((uint32_t)0x00000000)
bogdanm 84:0b3ab51c8877 225 #define DMA_REQUEST_1 ((uint32_t)0x00000001)
bogdanm 84:0b3ab51c8877 226 #define DMA_REQUEST_2 ((uint32_t)0x00000002)
bogdanm 84:0b3ab51c8877 227 #define DMA_REQUEST_3 ((uint32_t)0x00000003)
bogdanm 84:0b3ab51c8877 228 #define DMA_REQUEST_4 ((uint32_t)0x00000004)
bogdanm 84:0b3ab51c8877 229 #define DMA_REQUEST_5 ((uint32_t)0x00000005)
bogdanm 84:0b3ab51c8877 230 #define DMA_REQUEST_6 ((uint32_t)0x00000006)
bogdanm 84:0b3ab51c8877 231 #define DMA_REQUEST_7 ((uint32_t)0x00000007)
bogdanm 84:0b3ab51c8877 232 #define DMA_REQUEST_8 ((uint32_t)0x00000008)
bogdanm 84:0b3ab51c8877 233 #define DMA_REQUEST_9 ((uint32_t)0x00000009)
bogdanm 84:0b3ab51c8877 234 #define DMA_REQUEST_11 ((uint32_t)0x0000000B)
bogdanm 84:0b3ab51c8877 235
bogdanm 84:0b3ab51c8877 236 #define IS_DMA_ALL_REQUEST(REQUEST) (((REQUEST) == DMA_REQUEST_0) || \
bogdanm 84:0b3ab51c8877 237 ((REQUEST) == DMA_REQUEST_1) || \
bogdanm 84:0b3ab51c8877 238 ((REQUEST) == DMA_REQUEST_2) || \
bogdanm 84:0b3ab51c8877 239 ((REQUEST) == DMA_REQUEST_3) || \
bogdanm 84:0b3ab51c8877 240 ((REQUEST) == DMA_REQUEST_4) || \
bogdanm 84:0b3ab51c8877 241 ((REQUEST) == DMA_REQUEST_5) || \
bogdanm 84:0b3ab51c8877 242 ((REQUEST) == DMA_REQUEST_6) || \
bogdanm 84:0b3ab51c8877 243 ((REQUEST) == DMA_REQUEST_7) || \
bogdanm 84:0b3ab51c8877 244 ((REQUEST) == DMA_REQUEST_8) || \
bogdanm 84:0b3ab51c8877 245 ((REQUEST) == DMA_REQUEST_9) || \
bogdanm 84:0b3ab51c8877 246 ((REQUEST) == DMA_REQUEST_11))
Kojto 96:487b796308b0 247 #endif /* #if defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L082xx) || defined (STM32L083xx) */
Kojto 96:487b796308b0 248
bogdanm 84:0b3ab51c8877 249 /**
bogdanm 84:0b3ab51c8877 250 * @}
bogdanm 84:0b3ab51c8877 251 */
bogdanm 84:0b3ab51c8877 252
Kojto 96:487b796308b0 253 /** @defgroup DMA_Data_transfer_direction DMA Data Transfer directions
bogdanm 84:0b3ab51c8877 254 * @{
bogdanm 84:0b3ab51c8877 255 */
bogdanm 84:0b3ab51c8877 256 #define DMA_PERIPH_TO_MEMORY ((uint32_t)0x00000000) /*!< Peripheral to memory direction */
bogdanm 84:0b3ab51c8877 257 #define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_CCR_DIR) /*!< Memory to peripheral direction */
bogdanm 84:0b3ab51c8877 258 #define DMA_MEMORY_TO_MEMORY ((uint32_t)(DMA_CCR_MEM2MEM)) /*!< Memory to memory direction */
bogdanm 84:0b3ab51c8877 259
bogdanm 84:0b3ab51c8877 260 #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \
bogdanm 84:0b3ab51c8877 261 ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \
bogdanm 84:0b3ab51c8877 262 ((DIRECTION) == DMA_MEMORY_TO_MEMORY))
bogdanm 84:0b3ab51c8877 263 /**
bogdanm 84:0b3ab51c8877 264 * @}
bogdanm 84:0b3ab51c8877 265 */
bogdanm 84:0b3ab51c8877 266
bogdanm 92:4fc01daae5a5 267 /** @defgroup DMA_Data_buffer_size
bogdanm 84:0b3ab51c8877 268 * @{
bogdanm 84:0b3ab51c8877 269 */
bogdanm 84:0b3ab51c8877 270 #define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1) && ((SIZE) < 0x10000))
bogdanm 84:0b3ab51c8877 271 /**
bogdanm 84:0b3ab51c8877 272 * @}
bogdanm 84:0b3ab51c8877 273 */
bogdanm 84:0b3ab51c8877 274
bogdanm 92:4fc01daae5a5 275 /** @defgroup DMA_Peripheral_incremented_mode
bogdanm 84:0b3ab51c8877 276 * @{
bogdanm 84:0b3ab51c8877 277 */
bogdanm 84:0b3ab51c8877 278 #define DMA_PINC_ENABLE ((uint32_t)DMA_CCR_PINC) /*!< Peripheral increment mode Enable */
bogdanm 84:0b3ab51c8877 279 #define DMA_PINC_DISABLE ((uint32_t)0x00000000) /*!< Peripheral increment mode Disable */
bogdanm 84:0b3ab51c8877 280
bogdanm 84:0b3ab51c8877 281 #define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \
bogdanm 84:0b3ab51c8877 282 ((STATE) == DMA_PINC_DISABLE))
bogdanm 84:0b3ab51c8877 283 /**
bogdanm 84:0b3ab51c8877 284 * @}
bogdanm 84:0b3ab51c8877 285 */
bogdanm 84:0b3ab51c8877 286
bogdanm 92:4fc01daae5a5 287 /** @defgroup DMA_Memory_incremented_mode
bogdanm 84:0b3ab51c8877 288 * @{
bogdanm 84:0b3ab51c8877 289 */
bogdanm 84:0b3ab51c8877 290 #define DMA_MINC_ENABLE ((uint32_t)DMA_CCR_MINC) /*!< Memory increment mode Enable */
bogdanm 84:0b3ab51c8877 291 #define DMA_MINC_DISABLE ((uint32_t)0x00000000) /*!< Memory increment mode Disable */
bogdanm 84:0b3ab51c8877 292
bogdanm 84:0b3ab51c8877 293 #define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \
bogdanm 84:0b3ab51c8877 294 ((STATE) == DMA_MINC_DISABLE))
bogdanm 84:0b3ab51c8877 295 /**
bogdanm 84:0b3ab51c8877 296 * @}
bogdanm 84:0b3ab51c8877 297 */
bogdanm 84:0b3ab51c8877 298
bogdanm 92:4fc01daae5a5 299 /** @defgroup DMA_Peripheral_data_size
bogdanm 84:0b3ab51c8877 300 * @{
bogdanm 84:0b3ab51c8877 301 */
bogdanm 84:0b3ab51c8877 302 #define DMA_PDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Peripheral data alignment : Byte */
bogdanm 84:0b3ab51c8877 303 #define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_PSIZE_0) /*!< Peripheral data alignment : HalfWord */
bogdanm 84:0b3ab51c8877 304 #define DMA_PDATAALIGN_WORD ((uint32_t)DMA_CCR_PSIZE_1) /*!< Peripheral data alignment : Word */
bogdanm 84:0b3ab51c8877 305
bogdanm 84:0b3ab51c8877 306 #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \
bogdanm 84:0b3ab51c8877 307 ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \
bogdanm 84:0b3ab51c8877 308 ((SIZE) == DMA_PDATAALIGN_WORD))
bogdanm 84:0b3ab51c8877 309 /**
bogdanm 84:0b3ab51c8877 310 * @}
bogdanm 84:0b3ab51c8877 311 */
bogdanm 84:0b3ab51c8877 312
bogdanm 84:0b3ab51c8877 313
bogdanm 84:0b3ab51c8877 314 /** @defgroup DMA_Memory_data_size
bogdanm 84:0b3ab51c8877 315 * @{
bogdanm 84:0b3ab51c8877 316 */
bogdanm 84:0b3ab51c8877 317 #define DMA_MDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Memory data alignment : Byte */
bogdanm 84:0b3ab51c8877 318 #define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_MSIZE_0) /*!< Memory data alignment : HalfWord */
bogdanm 84:0b3ab51c8877 319 #define DMA_MDATAALIGN_WORD ((uint32_t)DMA_CCR_MSIZE_1) /*!< Memory data alignment : Word */
bogdanm 84:0b3ab51c8877 320
bogdanm 84:0b3ab51c8877 321 #define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \
bogdanm 84:0b3ab51c8877 322 ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \
bogdanm 84:0b3ab51c8877 323 ((SIZE) == DMA_MDATAALIGN_WORD ))
bogdanm 84:0b3ab51c8877 324 /**
bogdanm 84:0b3ab51c8877 325 * @}
bogdanm 84:0b3ab51c8877 326 */
bogdanm 84:0b3ab51c8877 327
bogdanm 92:4fc01daae5a5 328 /** @defgroup DMA_mode
bogdanm 84:0b3ab51c8877 329 * @{
bogdanm 84:0b3ab51c8877 330 */
bogdanm 84:0b3ab51c8877 331 #define DMA_NORMAL ((uint32_t)0x00000000) /*!< Normal Mode */
bogdanm 84:0b3ab51c8877 332 #define DMA_CIRCULAR ((uint32_t)DMA_CCR_CIRC) /*!< Circular Mode */
bogdanm 84:0b3ab51c8877 333
bogdanm 84:0b3ab51c8877 334 #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \
bogdanm 84:0b3ab51c8877 335 ((MODE) == DMA_CIRCULAR))
bogdanm 84:0b3ab51c8877 336 /**
bogdanm 84:0b3ab51c8877 337 * @}
bogdanm 84:0b3ab51c8877 338 */
bogdanm 84:0b3ab51c8877 339
bogdanm 92:4fc01daae5a5 340 /** @defgroup DMA_Priority_level
bogdanm 84:0b3ab51c8877 341 * @{
bogdanm 84:0b3ab51c8877 342 */
bogdanm 84:0b3ab51c8877 343 #define DMA_PRIORITY_LOW ((uint32_t)0x00000000) /*!< Priority level : Low */
bogdanm 84:0b3ab51c8877 344 #define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_CCR_PL_0) /*!< Priority level : Medium */
bogdanm 84:0b3ab51c8877 345 #define DMA_PRIORITY_HIGH ((uint32_t)DMA_CCR_PL_1) /*!< Priority level : High */
bogdanm 84:0b3ab51c8877 346 #define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_CCR_PL) /*!< Priority level : Very_High */
bogdanm 84:0b3ab51c8877 347
bogdanm 84:0b3ab51c8877 348 #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \
bogdanm 84:0b3ab51c8877 349 ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \
bogdanm 84:0b3ab51c8877 350 ((PRIORITY) == DMA_PRIORITY_HIGH) || \
bogdanm 84:0b3ab51c8877 351 ((PRIORITY) == DMA_PRIORITY_VERY_HIGH))
bogdanm 84:0b3ab51c8877 352 /**
bogdanm 84:0b3ab51c8877 353 * @}
bogdanm 84:0b3ab51c8877 354 */
bogdanm 84:0b3ab51c8877 355
bogdanm 84:0b3ab51c8877 356
bogdanm 92:4fc01daae5a5 357 /** @defgroup DMA_interrupt_enable_definitions
bogdanm 84:0b3ab51c8877 358 * @{
bogdanm 84:0b3ab51c8877 359 */
bogdanm 84:0b3ab51c8877 360
bogdanm 84:0b3ab51c8877 361 #define DMA_IT_TC ((uint32_t)DMA_CCR_TCIE)
bogdanm 84:0b3ab51c8877 362 #define DMA_IT_HT ((uint32_t)DMA_CCR_HTIE)
bogdanm 84:0b3ab51c8877 363 #define DMA_IT_TE ((uint32_t)DMA_CCR_TEIE)
bogdanm 84:0b3ab51c8877 364
bogdanm 84:0b3ab51c8877 365 /**
bogdanm 84:0b3ab51c8877 366 * @}
bogdanm 84:0b3ab51c8877 367 */
bogdanm 84:0b3ab51c8877 368
bogdanm 92:4fc01daae5a5 369 /** @defgroup DMA_flag_definitions
bogdanm 84:0b3ab51c8877 370 * @{
bogdanm 84:0b3ab51c8877 371 */
bogdanm 84:0b3ab51c8877 372
bogdanm 84:0b3ab51c8877 373 #define DMA_FLAG_GL1 ((uint32_t)0x00000001)
bogdanm 84:0b3ab51c8877 374 #define DMA_FLAG_TC1 ((uint32_t)0x00000002)
bogdanm 84:0b3ab51c8877 375 #define DMA_FLAG_HT1 ((uint32_t)0x00000004)
bogdanm 84:0b3ab51c8877 376 #define DMA_FLAG_TE1 ((uint32_t)0x00000008)
bogdanm 84:0b3ab51c8877 377 #define DMA_FLAG_GL2 ((uint32_t)0x00000010)
bogdanm 84:0b3ab51c8877 378 #define DMA_FLAG_TC2 ((uint32_t)0x00000020)
bogdanm 84:0b3ab51c8877 379 #define DMA_FLAG_HT2 ((uint32_t)0x00000040)
bogdanm 84:0b3ab51c8877 380 #define DMA_FLAG_TE2 ((uint32_t)0x00000080)
bogdanm 84:0b3ab51c8877 381 #define DMA_FLAG_GL3 ((uint32_t)0x00000100)
bogdanm 84:0b3ab51c8877 382 #define DMA_FLAG_TC3 ((uint32_t)0x00000200)
bogdanm 84:0b3ab51c8877 383 #define DMA_FLAG_HT3 ((uint32_t)0x00000400)
bogdanm 84:0b3ab51c8877 384 #define DMA_FLAG_TE3 ((uint32_t)0x00000800)
bogdanm 84:0b3ab51c8877 385 #define DMA_FLAG_GL4 ((uint32_t)0x00001000)
bogdanm 84:0b3ab51c8877 386 #define DMA_FLAG_TC4 ((uint32_t)0x00002000)
bogdanm 84:0b3ab51c8877 387 #define DMA_FLAG_HT4 ((uint32_t)0x00004000)
bogdanm 84:0b3ab51c8877 388 #define DMA_FLAG_TE4 ((uint32_t)0x00008000)
bogdanm 84:0b3ab51c8877 389 #define DMA_FLAG_GL5 ((uint32_t)0x00010000)
bogdanm 84:0b3ab51c8877 390 #define DMA_FLAG_TC5 ((uint32_t)0x00020000)
bogdanm 84:0b3ab51c8877 391 #define DMA_FLAG_HT5 ((uint32_t)0x00040000)
bogdanm 84:0b3ab51c8877 392 #define DMA_FLAG_TE5 ((uint32_t)0x00080000)
bogdanm 84:0b3ab51c8877 393 #define DMA_FLAG_GL6 ((uint32_t)0x00100000)
bogdanm 84:0b3ab51c8877 394 #define DMA_FLAG_TC6 ((uint32_t)0x00200000)
bogdanm 84:0b3ab51c8877 395 #define DMA_FLAG_HT6 ((uint32_t)0x00400000)
bogdanm 84:0b3ab51c8877 396 #define DMA_FLAG_TE6 ((uint32_t)0x00800000)
bogdanm 84:0b3ab51c8877 397 #define DMA_FLAG_GL7 ((uint32_t)0x01000000)
bogdanm 84:0b3ab51c8877 398 #define DMA_FLAG_TC7 ((uint32_t)0x02000000)
bogdanm 84:0b3ab51c8877 399 #define DMA_FLAG_HT7 ((uint32_t)0x04000000)
bogdanm 84:0b3ab51c8877 400 #define DMA_FLAG_TE7 ((uint32_t)0x08000000)
bogdanm 84:0b3ab51c8877 401
bogdanm 84:0b3ab51c8877 402
bogdanm 84:0b3ab51c8877 403 /**
bogdanm 84:0b3ab51c8877 404 * @}
bogdanm 84:0b3ab51c8877 405 */
Kojto 96:487b796308b0 406
Kojto 96:487b796308b0 407 /**
Kojto 96:487b796308b0 408 * @}
Kojto 96:487b796308b0 409 */
Kojto 96:487b796308b0 410
bogdanm 84:0b3ab51c8877 411 /* Exported macro ------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 412
Kojto 96:487b796308b0 413 /** @defgroup DMA_Exported_Macros DMA Exported Macros
Kojto 96:487b796308b0 414 * @{
Kojto 96:487b796308b0 415 */
Kojto 96:487b796308b0 416
bogdanm 84:0b3ab51c8877 417 /** @brief Reset DMA handle state
bogdanm 84:0b3ab51c8877 418 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 419 * @retval None
bogdanm 84:0b3ab51c8877 420 */
bogdanm 84:0b3ab51c8877 421 #define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET)
bogdanm 84:0b3ab51c8877 422
bogdanm 84:0b3ab51c8877 423 /**
bogdanm 84:0b3ab51c8877 424 * @brief Enable the specified DMA Channel.
bogdanm 84:0b3ab51c8877 425 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 426 * @retval None.
bogdanm 84:0b3ab51c8877 427 */
bogdanm 84:0b3ab51c8877 428 #define __HAL_DMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR |= DMA_CCR_EN)
bogdanm 84:0b3ab51c8877 429
bogdanm 84:0b3ab51c8877 430 /**
bogdanm 84:0b3ab51c8877 431 * @brief Disable the specified DMA Channel.
bogdanm 84:0b3ab51c8877 432 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 433 * @retval None.
bogdanm 84:0b3ab51c8877 434 */
bogdanm 84:0b3ab51c8877 435 #define __HAL_DMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR &= ~DMA_CCR_EN)
bogdanm 84:0b3ab51c8877 436
bogdanm 84:0b3ab51c8877 437
bogdanm 84:0b3ab51c8877 438 /* Interrupt & Flag management */
bogdanm 84:0b3ab51c8877 439
bogdanm 84:0b3ab51c8877 440 /**
bogdanm 84:0b3ab51c8877 441 * @brief Returns the current DMA Channel transfer complete flag.
bogdanm 84:0b3ab51c8877 442 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 443 * @retval The specified transfer complete flag index.
bogdanm 84:0b3ab51c8877 444 */
bogdanm 84:0b3ab51c8877 445
bogdanm 84:0b3ab51c8877 446 #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
bogdanm 84:0b3ab51c8877 447 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\
bogdanm 84:0b3ab51c8877 448 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TC2 :\
bogdanm 84:0b3ab51c8877 449 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TC3 :\
bogdanm 84:0b3ab51c8877 450 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TC4 :\
bogdanm 84:0b3ab51c8877 451 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TC5 :\
bogdanm 84:0b3ab51c8877 452 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\
bogdanm 84:0b3ab51c8877 453 DMA_FLAG_TC7)
bogdanm 84:0b3ab51c8877 454
bogdanm 84:0b3ab51c8877 455 /**
bogdanm 84:0b3ab51c8877 456 * @brief Returns the current DMA Channel half transfer complete flag.
bogdanm 84:0b3ab51c8877 457 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 458 * @retval The specified half transfer complete flag index.
bogdanm 84:0b3ab51c8877 459 */
bogdanm 84:0b3ab51c8877 460 #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
bogdanm 84:0b3ab51c8877 461 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\
bogdanm 84:0b3ab51c8877 462 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\
bogdanm 84:0b3ab51c8877 463 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_HT3 :\
bogdanm 84:0b3ab51c8877 464 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_HT4 :\
bogdanm 84:0b3ab51c8877 465 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_HT5 :\
bogdanm 84:0b3ab51c8877 466 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\
bogdanm 84:0b3ab51c8877 467 DMA_FLAG_HT7)
bogdanm 84:0b3ab51c8877 468
bogdanm 84:0b3ab51c8877 469 /**
bogdanm 84:0b3ab51c8877 470 * @brief Returns the current DMA Channel transfer error flag.
bogdanm 84:0b3ab51c8877 471 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 472 * @retval The specified transfer error flag index.
bogdanm 84:0b3ab51c8877 473 */
bogdanm 84:0b3ab51c8877 474 #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
bogdanm 84:0b3ab51c8877 475 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\
bogdanm 84:0b3ab51c8877 476 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\
bogdanm 84:0b3ab51c8877 477 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_TE3 :\
bogdanm 84:0b3ab51c8877 478 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_TE4 :\
bogdanm 84:0b3ab51c8877 479 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_FLAG_TE5 :\
bogdanm 84:0b3ab51c8877 480 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\
bogdanm 84:0b3ab51c8877 481 DMA_FLAG_TE7)
bogdanm 84:0b3ab51c8877 482
bogdanm 84:0b3ab51c8877 483 /**
bogdanm 84:0b3ab51c8877 484 * @brief Returns the current DMA Channel Global interrupt flag.
bogdanm 84:0b3ab51c8877 485 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 486 * @retval The specified transfer error flag index.
bogdanm 84:0b3ab51c8877 487 */
bogdanm 84:0b3ab51c8877 488 #define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\
bogdanm 84:0b3ab51c8877 489 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_ISR_GIF1 :\
bogdanm 84:0b3ab51c8877 490 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_ISR_GIF2 :\
bogdanm 84:0b3ab51c8877 491 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_ISR_GIF3 :\
bogdanm 84:0b3ab51c8877 492 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_ISR_GIF4 :\
bogdanm 84:0b3ab51c8877 493 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel5))? DMA_ISR_GIF5 :\
bogdanm 84:0b3ab51c8877 494 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_ISR_GIF6 :\
bogdanm 84:0b3ab51c8877 495 DMA_ISR_GIF7)
bogdanm 84:0b3ab51c8877 496 /**
bogdanm 84:0b3ab51c8877 497 * @brief Get the DMA Channel pending flags.
bogdanm 84:0b3ab51c8877 498 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 499 * @param __FLAG__: Get the specified flag.
bogdanm 84:0b3ab51c8877 500 * This parameter can be any combination of the following values:
bogdanm 84:0b3ab51c8877 501 * @arg DMA_FLAG_TCIFx: Transfer complete flag
bogdanm 84:0b3ab51c8877 502 * @arg DMA_FLAG_HTIFx: Half transfer complete flag
bogdanm 84:0b3ab51c8877 503 * @arg DMA_FLAG_TEIFx: Transfer error flag
bogdanm 84:0b3ab51c8877 504 * @arg DMA_ISR_GIFx: Global interrupt flag
bogdanm 84:0b3ab51c8877 505 * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Channel flag.
bogdanm 84:0b3ab51c8877 506 * @retval The state of FLAG (SET or RESET).
bogdanm 84:0b3ab51c8877 507 */
bogdanm 84:0b3ab51c8877 508 #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (DMA1->ISR & (__FLAG__))
bogdanm 84:0b3ab51c8877 509
bogdanm 84:0b3ab51c8877 510 /**
bogdanm 84:0b3ab51c8877 511 * @brief Clears the DMA Channel pending flags.
bogdanm 84:0b3ab51c8877 512 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 513 * @param __FLAG__: specifies the flag to clear.
bogdanm 84:0b3ab51c8877 514 * This parameter can be any combination of the following values:
bogdanm 84:0b3ab51c8877 515 * @arg DMA_FLAG_TCIFx: Transfer complete flag
bogdanm 84:0b3ab51c8877 516 * @arg DMA_FLAG_HTIFx: Half transfer complete flag
bogdanm 84:0b3ab51c8877 517 * @arg DMA_FLAG_TEIFx: Transfer error flag
bogdanm 84:0b3ab51c8877 518 * @arg DMA_ISR_GIFx: Global interrupt flag
bogdanm 84:0b3ab51c8877 519 * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Channel flag.
bogdanm 84:0b3ab51c8877 520 * @retval None
bogdanm 84:0b3ab51c8877 521 */
bogdanm 92:4fc01daae5a5 522 #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) (DMA1->IFCR = (__FLAG__))
bogdanm 84:0b3ab51c8877 523
bogdanm 84:0b3ab51c8877 524 /**
bogdanm 84:0b3ab51c8877 525 * @brief Enables the specified DMA Channel interrupts.
bogdanm 84:0b3ab51c8877 526 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 527 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 528 * This parameter can be any combination of the following values:
bogdanm 84:0b3ab51c8877 529 * @arg DMA_IT_TC: Transfer complete interrupt mask
bogdanm 84:0b3ab51c8877 530 * @arg DMA_IT_HT: Half transfer complete interrupt mask
bogdanm 84:0b3ab51c8877 531 * @arg DMA_IT_TE: Transfer error interrupt mask
bogdanm 84:0b3ab51c8877 532 * @retval None
bogdanm 84:0b3ab51c8877 533 */
bogdanm 84:0b3ab51c8877 534 #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR |= (__INTERRUPT__))
bogdanm 84:0b3ab51c8877 535
bogdanm 84:0b3ab51c8877 536 /**
bogdanm 84:0b3ab51c8877 537 * @brief Disables the specified DMA Channel interrupts.
bogdanm 84:0b3ab51c8877 538 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 539 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
bogdanm 84:0b3ab51c8877 540 * This parameter can be any combination of the following values:
bogdanm 84:0b3ab51c8877 541 * @arg DMA_IT_TC: Transfer complete interrupt mask
bogdanm 84:0b3ab51c8877 542 * @arg DMA_IT_HT: Half transfer complete interrupt mask
bogdanm 84:0b3ab51c8877 543 * @arg DMA_IT_TE: Transfer error interrupt mask
bogdanm 84:0b3ab51c8877 544 * @retval None
bogdanm 84:0b3ab51c8877 545 */
bogdanm 84:0b3ab51c8877 546 #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR &= ~(__INTERRUPT__))
bogdanm 84:0b3ab51c8877 547
bogdanm 84:0b3ab51c8877 548 /**
bogdanm 84:0b3ab51c8877 549 * @brief Checks whether the specified DMA Channel interrupt has occurred or not.
bogdanm 84:0b3ab51c8877 550 * @param __HANDLE__: DMA handle
bogdanm 84:0b3ab51c8877 551 * @param __INTERRUPT__: specifies the DMA interrupt source to check.
bogdanm 84:0b3ab51c8877 552 * This parameter can be one of the following values:
bogdanm 84:0b3ab51c8877 553 * @arg DMA_IT_TC: Transfer complete interrupt mask
bogdanm 84:0b3ab51c8877 554 * @arg DMA_IT_HT: Half transfer complete interrupt mask
bogdanm 84:0b3ab51c8877 555 * @arg DMA_IT_TE: Transfer error interrupt mask
bogdanm 84:0b3ab51c8877 556 * @retval The state of DMA_IT (SET or RESET).
bogdanm 84:0b3ab51c8877 557 */
bogdanm 84:0b3ab51c8877 558 #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CCR & (__INTERRUPT__)))
bogdanm 84:0b3ab51c8877 559
Kojto 96:487b796308b0 560 /**
Kojto 96:487b796308b0 561 * @}
Kojto 96:487b796308b0 562 */
bogdanm 84:0b3ab51c8877 563
bogdanm 84:0b3ab51c8877 564 /* Exported functions --------------------------------------------------------*/
Kojto 96:487b796308b0 565
Kojto 96:487b796308b0 566 /** @defgroup DMA_Exported_Functions DMA Exported Functions
Kojto 96:487b796308b0 567 * @{
Kojto 96:487b796308b0 568 */
Kojto 96:487b796308b0 569
Kojto 96:487b796308b0 570 /** @defgroup DMA_Exported_Functions_Group1 Initialization/de-initialization functions
Kojto 96:487b796308b0 571 * @{
Kojto 96:487b796308b0 572 */
Kojto 96:487b796308b0 573
bogdanm 84:0b3ab51c8877 574 /* Initialization and de-initialization functions *****************************/
bogdanm 84:0b3ab51c8877 575 HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma);
bogdanm 84:0b3ab51c8877 576 HAL_StatusTypeDef HAL_DMA_DeInit (DMA_HandleTypeDef *hdma);
bogdanm 84:0b3ab51c8877 577
Kojto 96:487b796308b0 578 /**
Kojto 96:487b796308b0 579 * @}
Kojto 96:487b796308b0 580 */
Kojto 96:487b796308b0 581
Kojto 96:487b796308b0 582 /** @defgroup DMA_Exported_Functions_Group2 I/O operation functions
Kojto 96:487b796308b0 583 * @{
Kojto 96:487b796308b0 584 */
Kojto 96:487b796308b0 585
bogdanm 84:0b3ab51c8877 586 /* IO operation functions *****************************************************/
bogdanm 84:0b3ab51c8877 587 HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
bogdanm 84:0b3ab51c8877 588 HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
bogdanm 84:0b3ab51c8877 589 HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma);
bogdanm 84:0b3ab51c8877 590 HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout);
bogdanm 84:0b3ab51c8877 591 void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma);
Kojto 96:487b796308b0 592 /**
Kojto 96:487b796308b0 593 * @}
Kojto 96:487b796308b0 594 */
Kojto 96:487b796308b0 595
Kojto 96:487b796308b0 596 /** @defgroup DMA_Exported_Functions_Group3 Peripheral State functions
Kojto 96:487b796308b0 597 * @{
Kojto 96:487b796308b0 598 */
bogdanm 84:0b3ab51c8877 599
bogdanm 84:0b3ab51c8877 600 /* Peripheral State and Error functions ***************************************/
bogdanm 84:0b3ab51c8877 601 HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma);
bogdanm 84:0b3ab51c8877 602 uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma);
bogdanm 84:0b3ab51c8877 603
bogdanm 84:0b3ab51c8877 604 /**
bogdanm 84:0b3ab51c8877 605 * @}
bogdanm 84:0b3ab51c8877 606 */
bogdanm 84:0b3ab51c8877 607
bogdanm 84:0b3ab51c8877 608 /**
bogdanm 84:0b3ab51c8877 609 * @}
bogdanm 84:0b3ab51c8877 610 */
Kojto 96:487b796308b0 611
Kojto 96:487b796308b0 612 /**
Kojto 96:487b796308b0 613 * @}
Kojto 96:487b796308b0 614 */
Kojto 96:487b796308b0 615
Kojto 96:487b796308b0 616 /**
Kojto 96:487b796308b0 617 * @}
Kojto 96:487b796308b0 618 */
bogdanm 84:0b3ab51c8877 619
bogdanm 84:0b3ab51c8877 620 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 621 }
bogdanm 84:0b3ab51c8877 622 #endif
bogdanm 84:0b3ab51c8877 623
bogdanm 84:0b3ab51c8877 624 #endif /* __STM32L0xx_HAL_DMA_H */
bogdanm 84:0b3ab51c8877 625
bogdanm 84:0b3ab51c8877 626 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 96:487b796308b0 627