Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
110:165afa46840b
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 110:165afa46840b 1 /**
Kojto 110:165afa46840b 2 ******************************************************************************
Kojto 110:165afa46840b 3 * @file stm32f4xx_hal_dma.h
Kojto 110:165afa46840b 4 * @author MCD Application Team
Kojto 110:165afa46840b 5 * @version V1.4.1
Kojto 110:165afa46840b 6 * @date 09-October-2015
Kojto 110:165afa46840b 7 * @brief Header file of DMA HAL module.
Kojto 110:165afa46840b 8 ******************************************************************************
Kojto 110:165afa46840b 9 * @attention
Kojto 110:165afa46840b 10 *
Kojto 110:165afa46840b 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 110:165afa46840b 12 *
Kojto 110:165afa46840b 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 110:165afa46840b 14 * are permitted provided that the following conditions are met:
Kojto 110:165afa46840b 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 110:165afa46840b 16 * this list of conditions and the following disclaimer.
Kojto 110:165afa46840b 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 110:165afa46840b 18 * this list of conditions and the following disclaimer in the documentation
Kojto 110:165afa46840b 19 * and/or other materials provided with the distribution.
Kojto 110:165afa46840b 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 110:165afa46840b 21 * may be used to endorse or promote products derived from this software
Kojto 110:165afa46840b 22 * without specific prior written permission.
Kojto 110:165afa46840b 23 *
Kojto 110:165afa46840b 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 110:165afa46840b 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 110:165afa46840b 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 110:165afa46840b 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 110:165afa46840b 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 110:165afa46840b 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 110:165afa46840b 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 110:165afa46840b 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 110:165afa46840b 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 110:165afa46840b 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 110:165afa46840b 34 *
Kojto 110:165afa46840b 35 ******************************************************************************
Kojto 110:165afa46840b 36 */
Kojto 110:165afa46840b 37
Kojto 110:165afa46840b 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 110:165afa46840b 39 #ifndef __STM32F4xx_HAL_DMA_H
Kojto 110:165afa46840b 40 #define __STM32F4xx_HAL_DMA_H
Kojto 110:165afa46840b 41
Kojto 110:165afa46840b 42 #ifdef __cplusplus
Kojto 110:165afa46840b 43 extern "C" {
Kojto 110:165afa46840b 44 #endif
Kojto 110:165afa46840b 45
Kojto 110:165afa46840b 46 /* Includes ------------------------------------------------------------------*/
Kojto 110:165afa46840b 47 #include "stm32f4xx_hal_def.h"
Kojto 110:165afa46840b 48
Kojto 110:165afa46840b 49 /** @addtogroup STM32F4xx_HAL_Driver
Kojto 110:165afa46840b 50 * @{
Kojto 110:165afa46840b 51 */
Kojto 110:165afa46840b 52
Kojto 110:165afa46840b 53 /** @addtogroup DMA
Kojto 110:165afa46840b 54 * @{
Kojto 110:165afa46840b 55 */
Kojto 110:165afa46840b 56
Kojto 110:165afa46840b 57 /* Exported types ------------------------------------------------------------*/
Kojto 110:165afa46840b 58
Kojto 110:165afa46840b 59 /** @defgroup DMA_Exported_Types DMA Exported Types
Kojto 110:165afa46840b 60 * @brief DMA Exported Types
Kojto 110:165afa46840b 61 * @{
Kojto 110:165afa46840b 62 */
Kojto 110:165afa46840b 63
Kojto 110:165afa46840b 64 /**
Kojto 110:165afa46840b 65 * @brief DMA Configuration Structure definition
Kojto 110:165afa46840b 66 */
Kojto 110:165afa46840b 67 typedef struct
Kojto 110:165afa46840b 68 {
Kojto 110:165afa46840b 69 uint32_t Channel; /*!< Specifies the channel used for the specified stream.
Kojto 110:165afa46840b 70 This parameter can be a value of @ref DMA_Channel_selection */
Kojto 110:165afa46840b 71
Kojto 110:165afa46840b 72 uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
Kojto 110:165afa46840b 73 from memory to memory or from peripheral to memory.
Kojto 110:165afa46840b 74 This parameter can be a value of @ref DMA_Data_transfer_direction */
Kojto 110:165afa46840b 75
Kojto 110:165afa46840b 76 uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not.
Kojto 110:165afa46840b 77 This parameter can be a value of @ref DMA_Peripheral_incremented_mode */
Kojto 110:165afa46840b 78
Kojto 110:165afa46840b 79 uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not.
Kojto 110:165afa46840b 80 This parameter can be a value of @ref DMA_Memory_incremented_mode */
Kojto 110:165afa46840b 81
Kojto 110:165afa46840b 82 uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width.
Kojto 110:165afa46840b 83 This parameter can be a value of @ref DMA_Peripheral_data_size */
Kojto 110:165afa46840b 84
Kojto 110:165afa46840b 85 uint32_t MemDataAlignment; /*!< Specifies the Memory data width.
Kojto 110:165afa46840b 86 This parameter can be a value of @ref DMA_Memory_data_size */
Kojto 110:165afa46840b 87
Kojto 110:165afa46840b 88 uint32_t Mode; /*!< Specifies the operation mode of the DMAy Streamx.
Kojto 110:165afa46840b 89 This parameter can be a value of @ref DMA_mode
Kojto 110:165afa46840b 90 @note The circular buffer mode cannot be used if the memory-to-memory
Kojto 110:165afa46840b 91 data transfer is configured on the selected Stream */
Kojto 110:165afa46840b 92
Kojto 110:165afa46840b 93 uint32_t Priority; /*!< Specifies the software priority for the DMAy Streamx.
Kojto 110:165afa46840b 94 This parameter can be a value of @ref DMA_Priority_level */
Kojto 110:165afa46840b 95
Kojto 110:165afa46840b 96 uint32_t FIFOMode; /*!< Specifies if the FIFO mode or Direct mode will be used for the specified stream.
Kojto 110:165afa46840b 97 This parameter can be a value of @ref DMA_FIFO_direct_mode
Kojto 110:165afa46840b 98 @note The Direct mode (FIFO mode disabled) cannot be used if the
Kojto 110:165afa46840b 99 memory-to-memory data transfer is configured on the selected stream */
Kojto 110:165afa46840b 100
Kojto 110:165afa46840b 101 uint32_t FIFOThreshold; /*!< Specifies the FIFO threshold level.
Kojto 110:165afa46840b 102 This parameter can be a value of @ref DMA_FIFO_threshold_level */
Kojto 110:165afa46840b 103
Kojto 110:165afa46840b 104 uint32_t MemBurst; /*!< Specifies the Burst transfer configuration for the memory transfers.
Kojto 110:165afa46840b 105 It specifies the amount of data to be transferred in a single non interruptible
Kojto 110:165afa46840b 106 transaction.
Kojto 110:165afa46840b 107 This parameter can be a value of @ref DMA_Memory_burst
Kojto 110:165afa46840b 108 @note The burst mode is possible only if the address Increment mode is enabled. */
Kojto 110:165afa46840b 109
Kojto 110:165afa46840b 110 uint32_t PeriphBurst; /*!< Specifies the Burst transfer configuration for the peripheral transfers.
Kojto 110:165afa46840b 111 It specifies the amount of data to be transferred in a single non interruptable
Kojto 110:165afa46840b 112 transaction.
Kojto 110:165afa46840b 113 This parameter can be a value of @ref DMA_Peripheral_burst
Kojto 110:165afa46840b 114 @note The burst mode is possible only if the address Increment mode is enabled. */
Kojto 110:165afa46840b 115 }DMA_InitTypeDef;
Kojto 110:165afa46840b 116
Kojto 110:165afa46840b 117
Kojto 110:165afa46840b 118 /**
Kojto 110:165afa46840b 119 * @brief HAL DMA State structures definition
Kojto 110:165afa46840b 120 */
Kojto 110:165afa46840b 121 typedef enum
Kojto 110:165afa46840b 122 {
Kojto 110:165afa46840b 123 HAL_DMA_STATE_RESET = 0x00, /*!< DMA not yet initialized or disabled */
Kojto 110:165afa46840b 124 HAL_DMA_STATE_READY = 0x01, /*!< DMA initialized and ready for use */
Kojto 110:165afa46840b 125 HAL_DMA_STATE_READY_MEM0 = 0x11, /*!< DMA Mem0 process success */
Kojto 110:165afa46840b 126 HAL_DMA_STATE_READY_MEM1 = 0x21, /*!< DMA Mem1 process success */
Kojto 110:165afa46840b 127 HAL_DMA_STATE_READY_HALF_MEM0 = 0x31, /*!< DMA Mem0 Half process success */
Kojto 110:165afa46840b 128 HAL_DMA_STATE_READY_HALF_MEM1 = 0x41, /*!< DMA Mem1 Half process success */
Kojto 110:165afa46840b 129 HAL_DMA_STATE_BUSY = 0x02, /*!< DMA process is ongoing */
Kojto 110:165afa46840b 130 HAL_DMA_STATE_BUSY_MEM0 = 0x12, /*!< DMA Mem0 process is ongoing */
Kojto 110:165afa46840b 131 HAL_DMA_STATE_BUSY_MEM1 = 0x22, /*!< DMA Mem1 process is ongoing */
Kojto 110:165afa46840b 132 HAL_DMA_STATE_TIMEOUT = 0x03, /*!< DMA timeout state */
Kojto 110:165afa46840b 133 HAL_DMA_STATE_ERROR = 0x04, /*!< DMA error state */
Kojto 110:165afa46840b 134 }HAL_DMA_StateTypeDef;
Kojto 110:165afa46840b 135
Kojto 110:165afa46840b 136 /**
Kojto 110:165afa46840b 137 * @brief HAL DMA Error Code structure definition
Kojto 110:165afa46840b 138 */
Kojto 110:165afa46840b 139 typedef enum
Kojto 110:165afa46840b 140 {
Kojto 110:165afa46840b 141 HAL_DMA_FULL_TRANSFER = 0x00, /*!< Full transfer */
Kojto 110:165afa46840b 142 HAL_DMA_HALF_TRANSFER = 0x01, /*!< Half Transfer */
Kojto 110:165afa46840b 143 }HAL_DMA_LevelCompleteTypeDef;
Kojto 110:165afa46840b 144
Kojto 110:165afa46840b 145 /**
Kojto 110:165afa46840b 146 * @brief DMA handle Structure definition
Kojto 110:165afa46840b 147 */
Kojto 110:165afa46840b 148 typedef struct __DMA_HandleTypeDef
Kojto 110:165afa46840b 149 {
Kojto 110:165afa46840b 150 DMA_Stream_TypeDef *Instance; /*!< Register base address */
Kojto 110:165afa46840b 151
Kojto 110:165afa46840b 152 DMA_InitTypeDef Init; /*!< DMA communication parameters */
Kojto 110:165afa46840b 153
Kojto 110:165afa46840b 154 HAL_LockTypeDef Lock; /*!< DMA locking object */
Kojto 110:165afa46840b 155
Kojto 110:165afa46840b 156 __IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */
Kojto 110:165afa46840b 157
Kojto 110:165afa46840b 158 void *Parent; /*!< Parent object state */
Kojto 110:165afa46840b 159
Kojto 110:165afa46840b 160 void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */
Kojto 110:165afa46840b 161
Kojto 110:165afa46840b 162 void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */
Kojto 110:165afa46840b 163
Kojto 110:165afa46840b 164 void (* XferM1CpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete Memory1 callback */
Kojto 110:165afa46840b 165
Kojto 110:165afa46840b 166 void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */
Kojto 110:165afa46840b 167
Kojto 110:165afa46840b 168 __IO uint32_t ErrorCode; /*!< DMA Error code */
Kojto 110:165afa46840b 169
Kojto 110:165afa46840b 170 uint32_t StreamBaseAddress; /*!< DMA Stream Base Address */
Kojto 110:165afa46840b 171
Kojto 110:165afa46840b 172 uint32_t StreamIndex; /*!< DMA Stream Index */
Kojto 110:165afa46840b 173 }DMA_HandleTypeDef;
Kojto 110:165afa46840b 174
Kojto 110:165afa46840b 175 /**
Kojto 110:165afa46840b 176 * @}
Kojto 110:165afa46840b 177 */
Kojto 110:165afa46840b 178
Kojto 110:165afa46840b 179 /* Exported constants --------------------------------------------------------*/
Kojto 110:165afa46840b 180
Kojto 110:165afa46840b 181 /** @defgroup DMA_Exported_Constants DMA Exported Constants
Kojto 110:165afa46840b 182 * @brief DMA Exported constants
Kojto 110:165afa46840b 183 * @{
Kojto 110:165afa46840b 184 */
Kojto 110:165afa46840b 185
Kojto 110:165afa46840b 186 /** @defgroup DMA_Error_Code DMA Error Code
Kojto 110:165afa46840b 187 * @brief DMA Error Code
Kojto 110:165afa46840b 188 * @{
Kojto 110:165afa46840b 189 */
Kojto 110:165afa46840b 190 #define HAL_DMA_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
Kojto 110:165afa46840b 191 #define HAL_DMA_ERROR_TE ((uint32_t)0x00000001) /*!< Transfer error */
Kojto 110:165afa46840b 192 #define HAL_DMA_ERROR_FE ((uint32_t)0x00000002) /*!< FIFO error */
Kojto 110:165afa46840b 193 #define HAL_DMA_ERROR_DME ((uint32_t)0x00000004) /*!< Direct Mode error */
Kojto 110:165afa46840b 194 #define HAL_DMA_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout error */
Kojto 110:165afa46840b 195 /**
Kojto 110:165afa46840b 196 * @}
Kojto 110:165afa46840b 197 */
Kojto 110:165afa46840b 198
Kojto 110:165afa46840b 199 /** @defgroup DMA_Channel_selection DMA Channel selection
Kojto 110:165afa46840b 200 * @brief DMA channel selection
Kojto 110:165afa46840b 201 * @{
Kojto 110:165afa46840b 202 */
Kojto 110:165afa46840b 203 #define DMA_CHANNEL_0 ((uint32_t)0x00000000) /*!< DMA Channel 0 */
Kojto 110:165afa46840b 204 #define DMA_CHANNEL_1 ((uint32_t)0x02000000) /*!< DMA Channel 1 */
Kojto 110:165afa46840b 205 #define DMA_CHANNEL_2 ((uint32_t)0x04000000) /*!< DMA Channel 2 */
Kojto 110:165afa46840b 206 #define DMA_CHANNEL_3 ((uint32_t)0x06000000) /*!< DMA Channel 3 */
Kojto 110:165afa46840b 207 #define DMA_CHANNEL_4 ((uint32_t)0x08000000) /*!< DMA Channel 4 */
Kojto 110:165afa46840b 208 #define DMA_CHANNEL_5 ((uint32_t)0x0A000000) /*!< DMA Channel 5 */
Kojto 110:165afa46840b 209 #define DMA_CHANNEL_6 ((uint32_t)0x0C000000) /*!< DMA Channel 6 */
Kojto 110:165afa46840b 210 #define DMA_CHANNEL_7 ((uint32_t)0x0E000000) /*!< DMA Channel 7 */
Kojto 110:165afa46840b 211 /**
Kojto 110:165afa46840b 212 * @}
Kojto 110:165afa46840b 213 */
Kojto 110:165afa46840b 214
Kojto 110:165afa46840b 215 /** @defgroup DMA_Data_transfer_direction DMA Data transfer direction
Kojto 110:165afa46840b 216 * @brief DMA data transfer direction
Kojto 110:165afa46840b 217 * @{
Kojto 110:165afa46840b 218 */
Kojto 110:165afa46840b 219 #define DMA_PERIPH_TO_MEMORY ((uint32_t)0x00000000) /*!< Peripheral to memory direction */
Kojto 110:165afa46840b 220 #define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_SxCR_DIR_0) /*!< Memory to peripheral direction */
Kojto 110:165afa46840b 221 #define DMA_MEMORY_TO_MEMORY ((uint32_t)DMA_SxCR_DIR_1) /*!< Memory to memory direction */
Kojto 110:165afa46840b 222 /**
Kojto 110:165afa46840b 223 * @}
Kojto 110:165afa46840b 224 */
Kojto 110:165afa46840b 225
Kojto 110:165afa46840b 226 /** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode
Kojto 110:165afa46840b 227 * @brief DMA peripheral incremented mode
Kojto 110:165afa46840b 228 * @{
Kojto 110:165afa46840b 229 */
Kojto 110:165afa46840b 230 #define DMA_PINC_ENABLE ((uint32_t)DMA_SxCR_PINC) /*!< Peripheral increment mode enable */
Kojto 110:165afa46840b 231 #define DMA_PINC_DISABLE ((uint32_t)0x00000000) /*!< Peripheral increment mode disable */
Kojto 110:165afa46840b 232 /**
Kojto 110:165afa46840b 233 * @}
Kojto 110:165afa46840b 234 */
Kojto 110:165afa46840b 235
Kojto 110:165afa46840b 236 /** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode
Kojto 110:165afa46840b 237 * @brief DMA memory incremented mode
Kojto 110:165afa46840b 238 * @{
Kojto 110:165afa46840b 239 */
Kojto 110:165afa46840b 240 #define DMA_MINC_ENABLE ((uint32_t)DMA_SxCR_MINC) /*!< Memory increment mode enable */
Kojto 110:165afa46840b 241 #define DMA_MINC_DISABLE ((uint32_t)0x00000000) /*!< Memory increment mode disable */
Kojto 110:165afa46840b 242 /**
Kojto 110:165afa46840b 243 * @}
Kojto 110:165afa46840b 244 */
Kojto 110:165afa46840b 245
Kojto 110:165afa46840b 246 /** @defgroup DMA_Peripheral_data_size DMA Peripheral data size
Kojto 110:165afa46840b 247 * @brief DMA peripheral data size
Kojto 110:165afa46840b 248 * @{
Kojto 110:165afa46840b 249 */
Kojto 110:165afa46840b 250 #define DMA_PDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Peripheral data alignment: Byte */
Kojto 110:165afa46840b 251 #define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */
Kojto 110:165afa46840b 252 #define DMA_PDATAALIGN_WORD ((uint32_t)DMA_SxCR_PSIZE_1) /*!< Peripheral data alignment: Word */
Kojto 110:165afa46840b 253 /**
Kojto 110:165afa46840b 254 * @}
Kojto 110:165afa46840b 255 */
Kojto 110:165afa46840b 256
Kojto 110:165afa46840b 257 /** @defgroup DMA_Memory_data_size DMA Memory data size
Kojto 110:165afa46840b 258 * @brief DMA memory data size
Kojto 110:165afa46840b 259 * @{
Kojto 110:165afa46840b 260 */
Kojto 110:165afa46840b 261 #define DMA_MDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Memory data alignment: Byte */
Kojto 110:165afa46840b 262 #define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_MSIZE_0) /*!< Memory data alignment: HalfWord */
Kojto 110:165afa46840b 263 #define DMA_MDATAALIGN_WORD ((uint32_t)DMA_SxCR_MSIZE_1) /*!< Memory data alignment: Word */
Kojto 110:165afa46840b 264 /**
Kojto 110:165afa46840b 265 * @}
Kojto 110:165afa46840b 266 */
Kojto 110:165afa46840b 267
Kojto 110:165afa46840b 268 /** @defgroup DMA_mode DMA mode
Kojto 110:165afa46840b 269 * @brief DMA mode
Kojto 110:165afa46840b 270 * @{
Kojto 110:165afa46840b 271 */
Kojto 110:165afa46840b 272 #define DMA_NORMAL ((uint32_t)0x00000000) /*!< Normal mode */
Kojto 110:165afa46840b 273 #define DMA_CIRCULAR ((uint32_t)DMA_SxCR_CIRC) /*!< Circular mode */
Kojto 110:165afa46840b 274 #define DMA_PFCTRL ((uint32_t)DMA_SxCR_PFCTRL) /*!< Peripheral flow control mode */
Kojto 110:165afa46840b 275 /**
Kojto 110:165afa46840b 276 * @}
Kojto 110:165afa46840b 277 */
Kojto 110:165afa46840b 278
Kojto 110:165afa46840b 279 /** @defgroup DMA_Priority_level DMA Priority level
Kojto 110:165afa46840b 280 * @brief DMA priority levels
Kojto 110:165afa46840b 281 * @{
Kojto 110:165afa46840b 282 */
Kojto 110:165afa46840b 283 #define DMA_PRIORITY_LOW ((uint32_t)0x00000000) /*!< Priority level: Low */
Kojto 110:165afa46840b 284 #define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_SxCR_PL_0) /*!< Priority level: Medium */
Kojto 110:165afa46840b 285 #define DMA_PRIORITY_HIGH ((uint32_t)DMA_SxCR_PL_1) /*!< Priority level: High */
Kojto 110:165afa46840b 286 #define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_SxCR_PL) /*!< Priority level: Very High */
Kojto 110:165afa46840b 287 /**
Kojto 110:165afa46840b 288 * @}
Kojto 110:165afa46840b 289 */
Kojto 110:165afa46840b 290
Kojto 110:165afa46840b 291 /** @defgroup DMA_FIFO_direct_mode DMA FIFO direct mode
Kojto 110:165afa46840b 292 * @brief DMA FIFO direct mode
Kojto 110:165afa46840b 293 * @{
Kojto 110:165afa46840b 294 */
Kojto 110:165afa46840b 295 #define DMA_FIFOMODE_DISABLE ((uint32_t)0x00000000) /*!< FIFO mode disable */
Kojto 110:165afa46840b 296 #define DMA_FIFOMODE_ENABLE ((uint32_t)DMA_SxFCR_DMDIS) /*!< FIFO mode enable */
Kojto 110:165afa46840b 297 /**
Kojto 110:165afa46840b 298 * @}
Kojto 110:165afa46840b 299 */
Kojto 110:165afa46840b 300
Kojto 110:165afa46840b 301 /** @defgroup DMA_FIFO_threshold_level DMA FIFO threshold level
Kojto 110:165afa46840b 302 * @brief DMA FIFO level
Kojto 110:165afa46840b 303 * @{
Kojto 110:165afa46840b 304 */
Kojto 110:165afa46840b 305 #define DMA_FIFO_THRESHOLD_1QUARTERFULL ((uint32_t)0x00000000) /*!< FIFO threshold 1 quart full configuration */
Kojto 110:165afa46840b 306 #define DMA_FIFO_THRESHOLD_HALFFULL ((uint32_t)DMA_SxFCR_FTH_0) /*!< FIFO threshold half full configuration */
Kojto 110:165afa46840b 307 #define DMA_FIFO_THRESHOLD_3QUARTERSFULL ((uint32_t)DMA_SxFCR_FTH_1) /*!< FIFO threshold 3 quarts full configuration */
Kojto 110:165afa46840b 308 #define DMA_FIFO_THRESHOLD_FULL ((uint32_t)DMA_SxFCR_FTH) /*!< FIFO threshold full configuration */
Kojto 110:165afa46840b 309 /**
Kojto 110:165afa46840b 310 * @}
Kojto 110:165afa46840b 311 */
Kojto 110:165afa46840b 312
Kojto 110:165afa46840b 313 /** @defgroup DMA_Memory_burst DMA Memory burst
Kojto 110:165afa46840b 314 * @brief DMA memory burst
Kojto 110:165afa46840b 315 * @{
Kojto 110:165afa46840b 316 */
Kojto 110:165afa46840b 317 #define DMA_MBURST_SINGLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 318 #define DMA_MBURST_INC4 ((uint32_t)DMA_SxCR_MBURST_0)
Kojto 110:165afa46840b 319 #define DMA_MBURST_INC8 ((uint32_t)DMA_SxCR_MBURST_1)
Kojto 110:165afa46840b 320 #define DMA_MBURST_INC16 ((uint32_t)DMA_SxCR_MBURST)
Kojto 110:165afa46840b 321 /**
Kojto 110:165afa46840b 322 * @}
Kojto 110:165afa46840b 323 */
Kojto 110:165afa46840b 324
Kojto 110:165afa46840b 325 /** @defgroup DMA_Peripheral_burst DMA Peripheral burst
Kojto 110:165afa46840b 326 * @brief DMA peripheral burst
Kojto 110:165afa46840b 327 * @{
Kojto 110:165afa46840b 328 */
Kojto 110:165afa46840b 329 #define DMA_PBURST_SINGLE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 330 #define DMA_PBURST_INC4 ((uint32_t)DMA_SxCR_PBURST_0)
Kojto 110:165afa46840b 331 #define DMA_PBURST_INC8 ((uint32_t)DMA_SxCR_PBURST_1)
Kojto 110:165afa46840b 332 #define DMA_PBURST_INC16 ((uint32_t)DMA_SxCR_PBURST)
Kojto 110:165afa46840b 333 /**
Kojto 110:165afa46840b 334 * @}
Kojto 110:165afa46840b 335 */
Kojto 110:165afa46840b 336
Kojto 110:165afa46840b 337 /** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions
Kojto 110:165afa46840b 338 * @brief DMA interrupts definition
Kojto 110:165afa46840b 339 * @{
Kojto 110:165afa46840b 340 */
Kojto 110:165afa46840b 341 #define DMA_IT_TC ((uint32_t)DMA_SxCR_TCIE)
Kojto 110:165afa46840b 342 #define DMA_IT_HT ((uint32_t)DMA_SxCR_HTIE)
Kojto 110:165afa46840b 343 #define DMA_IT_TE ((uint32_t)DMA_SxCR_TEIE)
Kojto 110:165afa46840b 344 #define DMA_IT_DME ((uint32_t)DMA_SxCR_DMEIE)
Kojto 110:165afa46840b 345 #define DMA_IT_FE ((uint32_t)0x00000080)
Kojto 110:165afa46840b 346 /**
Kojto 110:165afa46840b 347 * @}
Kojto 110:165afa46840b 348 */
Kojto 110:165afa46840b 349
Kojto 110:165afa46840b 350 /** @defgroup DMA_flag_definitions DMA flag definitions
Kojto 110:165afa46840b 351 * @brief DMA flag definitions
Kojto 110:165afa46840b 352 * @{
Kojto 110:165afa46840b 353 */
Kojto 110:165afa46840b 354 #define DMA_FLAG_FEIF0_4 ((uint32_t)0x00800001)
Kojto 110:165afa46840b 355 #define DMA_FLAG_DMEIF0_4 ((uint32_t)0x00800004)
Kojto 110:165afa46840b 356 #define DMA_FLAG_TEIF0_4 ((uint32_t)0x00000008)
Kojto 110:165afa46840b 357 #define DMA_FLAG_HTIF0_4 ((uint32_t)0x00000010)
Kojto 110:165afa46840b 358 #define DMA_FLAG_TCIF0_4 ((uint32_t)0x00000020)
Kojto 110:165afa46840b 359 #define DMA_FLAG_FEIF1_5 ((uint32_t)0x00000040)
Kojto 110:165afa46840b 360 #define DMA_FLAG_DMEIF1_5 ((uint32_t)0x00000100)
Kojto 110:165afa46840b 361 #define DMA_FLAG_TEIF1_5 ((uint32_t)0x00000200)
Kojto 110:165afa46840b 362 #define DMA_FLAG_HTIF1_5 ((uint32_t)0x00000400)
Kojto 110:165afa46840b 363 #define DMA_FLAG_TCIF1_5 ((uint32_t)0x00000800)
Kojto 110:165afa46840b 364 #define DMA_FLAG_FEIF2_6 ((uint32_t)0x00010000)
Kojto 110:165afa46840b 365 #define DMA_FLAG_DMEIF2_6 ((uint32_t)0x00040000)
Kojto 110:165afa46840b 366 #define DMA_FLAG_TEIF2_6 ((uint32_t)0x00080000)
Kojto 110:165afa46840b 367 #define DMA_FLAG_HTIF2_6 ((uint32_t)0x00100000)
Kojto 110:165afa46840b 368 #define DMA_FLAG_TCIF2_6 ((uint32_t)0x00200000)
Kojto 110:165afa46840b 369 #define DMA_FLAG_FEIF3_7 ((uint32_t)0x00400000)
Kojto 110:165afa46840b 370 #define DMA_FLAG_DMEIF3_7 ((uint32_t)0x01000000)
Kojto 110:165afa46840b 371 #define DMA_FLAG_TEIF3_7 ((uint32_t)0x02000000)
Kojto 110:165afa46840b 372 #define DMA_FLAG_HTIF3_7 ((uint32_t)0x04000000)
Kojto 110:165afa46840b 373 #define DMA_FLAG_TCIF3_7 ((uint32_t)0x08000000)
Kojto 110:165afa46840b 374 /**
Kojto 110:165afa46840b 375 * @}
Kojto 110:165afa46840b 376 */
Kojto 110:165afa46840b 377
Kojto 110:165afa46840b 378 /**
Kojto 110:165afa46840b 379 * @}
Kojto 110:165afa46840b 380 */
Kojto 110:165afa46840b 381
Kojto 110:165afa46840b 382 /* Exported macro ------------------------------------------------------------*/
Kojto 110:165afa46840b 383
Kojto 110:165afa46840b 384 /** @brief Reset DMA handle state
Kojto 110:165afa46840b 385 * @param __HANDLE__: specifies the DMA handle.
Kojto 110:165afa46840b 386 * @retval None
Kojto 110:165afa46840b 387 */
Kojto 110:165afa46840b 388 #define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET)
Kojto 110:165afa46840b 389
Kojto 110:165afa46840b 390 /**
Kojto 110:165afa46840b 391 * @brief Return the current DMA Stream FIFO filled level.
Kojto 110:165afa46840b 392 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 393 * @retval The FIFO filling state.
Kojto 110:165afa46840b 394 * - DMA_FIFOStatus_Less1QuarterFull: when FIFO is less than 1 quarter-full
Kojto 110:165afa46840b 395 * and not empty.
Kojto 110:165afa46840b 396 * - DMA_FIFOStatus_1QuarterFull: if more than 1 quarter-full.
Kojto 110:165afa46840b 397 * - DMA_FIFOStatus_HalfFull: if more than 1 half-full.
Kojto 110:165afa46840b 398 * - DMA_FIFOStatus_3QuartersFull: if more than 3 quarters-full.
Kojto 110:165afa46840b 399 * - DMA_FIFOStatus_Empty: when FIFO is empty
Kojto 110:165afa46840b 400 * - DMA_FIFOStatus_Full: when FIFO is full
Kojto 110:165afa46840b 401 */
Kojto 110:165afa46840b 402 #define __HAL_DMA_GET_FS(__HANDLE__) (((__HANDLE__)->Instance->FCR & (DMA_SxFCR_FS)))
Kojto 110:165afa46840b 403
Kojto 110:165afa46840b 404 /**
Kojto 110:165afa46840b 405 * @brief Enable the specified DMA Stream.
Kojto 110:165afa46840b 406 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 407 * @retval None
Kojto 110:165afa46840b 408 */
Kojto 110:165afa46840b 409 #define __HAL_DMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA_SxCR_EN)
Kojto 110:165afa46840b 410
Kojto 110:165afa46840b 411 /**
Kojto 110:165afa46840b 412 * @brief Disable the specified DMA Stream.
Kojto 110:165afa46840b 413 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 414 * @retval None
Kojto 110:165afa46840b 415 */
Kojto 110:165afa46840b 416 #define __HAL_DMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~DMA_SxCR_EN)
Kojto 110:165afa46840b 417
Kojto 110:165afa46840b 418 /* Interrupt & Flag management */
Kojto 110:165afa46840b 419
Kojto 110:165afa46840b 420 /**
Kojto 110:165afa46840b 421 * @brief Return the current DMA Stream transfer complete flag.
Kojto 110:165afa46840b 422 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 423 * @retval The specified transfer complete flag index.
Kojto 110:165afa46840b 424 */
Kojto 110:165afa46840b 425 #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \
Kojto 110:165afa46840b 426 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TCIF0_4 :\
Kojto 110:165afa46840b 427 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TCIF0_4 :\
Kojto 110:165afa46840b 428 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TCIF0_4 :\
Kojto 110:165afa46840b 429 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TCIF0_4 :\
Kojto 110:165afa46840b 430 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TCIF1_5 :\
Kojto 110:165afa46840b 431 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TCIF1_5 :\
Kojto 110:165afa46840b 432 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TCIF1_5 :\
Kojto 110:165afa46840b 433 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TCIF1_5 :\
Kojto 110:165afa46840b 434 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TCIF2_6 :\
Kojto 110:165afa46840b 435 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TCIF2_6 :\
Kojto 110:165afa46840b 436 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TCIF2_6 :\
Kojto 110:165afa46840b 437 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TCIF2_6 :\
Kojto 110:165afa46840b 438 DMA_FLAG_TCIF3_7)
Kojto 110:165afa46840b 439
Kojto 110:165afa46840b 440 /**
Kojto 110:165afa46840b 441 * @brief Return the current DMA Stream half transfer complete flag.
Kojto 110:165afa46840b 442 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 443 * @retval The specified half transfer complete flag index.
Kojto 110:165afa46840b 444 */
Kojto 110:165afa46840b 445 #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\
Kojto 110:165afa46840b 446 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_HTIF0_4 :\
Kojto 110:165afa46840b 447 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_HTIF0_4 :\
Kojto 110:165afa46840b 448 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_HTIF0_4 :\
Kojto 110:165afa46840b 449 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_HTIF0_4 :\
Kojto 110:165afa46840b 450 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_HTIF1_5 :\
Kojto 110:165afa46840b 451 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_HTIF1_5 :\
Kojto 110:165afa46840b 452 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_HTIF1_5 :\
Kojto 110:165afa46840b 453 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_HTIF1_5 :\
Kojto 110:165afa46840b 454 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_HTIF2_6 :\
Kojto 110:165afa46840b 455 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_HTIF2_6 :\
Kojto 110:165afa46840b 456 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_HTIF2_6 :\
Kojto 110:165afa46840b 457 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_HTIF2_6 :\
Kojto 110:165afa46840b 458 DMA_FLAG_HTIF3_7)
Kojto 110:165afa46840b 459
Kojto 110:165afa46840b 460 /**
Kojto 110:165afa46840b 461 * @brief Return the current DMA Stream transfer error flag.
Kojto 110:165afa46840b 462 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 463 * @retval The specified transfer error flag index.
Kojto 110:165afa46840b 464 */
Kojto 110:165afa46840b 465 #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\
Kojto 110:165afa46840b 466 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_TEIF0_4 :\
Kojto 110:165afa46840b 467 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_TEIF0_4 :\
Kojto 110:165afa46840b 468 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_TEIF0_4 :\
Kojto 110:165afa46840b 469 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_TEIF0_4 :\
Kojto 110:165afa46840b 470 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_TEIF1_5 :\
Kojto 110:165afa46840b 471 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_TEIF1_5 :\
Kojto 110:165afa46840b 472 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_TEIF1_5 :\
Kojto 110:165afa46840b 473 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_TEIF1_5 :\
Kojto 110:165afa46840b 474 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_TEIF2_6 :\
Kojto 110:165afa46840b 475 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_TEIF2_6 :\
Kojto 110:165afa46840b 476 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_TEIF2_6 :\
Kojto 110:165afa46840b 477 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_TEIF2_6 :\
Kojto 110:165afa46840b 478 DMA_FLAG_TEIF3_7)
Kojto 110:165afa46840b 479
Kojto 110:165afa46840b 480 /**
Kojto 110:165afa46840b 481 * @brief Return the current DMA Stream FIFO error flag.
Kojto 110:165afa46840b 482 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 483 * @retval The specified FIFO error flag index.
Kojto 110:165afa46840b 484 */
Kojto 110:165afa46840b 485 #define __HAL_DMA_GET_FE_FLAG_INDEX(__HANDLE__)\
Kojto 110:165afa46840b 486 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_FEIF0_4 :\
Kojto 110:165afa46840b 487 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_FEIF0_4 :\
Kojto 110:165afa46840b 488 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_FEIF0_4 :\
Kojto 110:165afa46840b 489 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_FEIF0_4 :\
Kojto 110:165afa46840b 490 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_FEIF1_5 :\
Kojto 110:165afa46840b 491 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_FEIF1_5 :\
Kojto 110:165afa46840b 492 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_FEIF1_5 :\
Kojto 110:165afa46840b 493 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_FEIF1_5 :\
Kojto 110:165afa46840b 494 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_FEIF2_6 :\
Kojto 110:165afa46840b 495 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_FEIF2_6 :\
Kojto 110:165afa46840b 496 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_FEIF2_6 :\
Kojto 110:165afa46840b 497 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_FEIF2_6 :\
Kojto 110:165afa46840b 498 DMA_FLAG_FEIF3_7)
Kojto 110:165afa46840b 499
Kojto 110:165afa46840b 500 /**
Kojto 110:165afa46840b 501 * @brief Return the current DMA Stream direct mode error flag.
Kojto 110:165afa46840b 502 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 503 * @retval The specified direct mode error flag index.
Kojto 110:165afa46840b 504 */
Kojto 110:165afa46840b 505 #define __HAL_DMA_GET_DME_FLAG_INDEX(__HANDLE__)\
Kojto 110:165afa46840b 506 (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream0))? DMA_FLAG_DMEIF0_4 :\
Kojto 110:165afa46840b 507 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream0))? DMA_FLAG_DMEIF0_4 :\
Kojto 110:165afa46840b 508 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream4))? DMA_FLAG_DMEIF0_4 :\
Kojto 110:165afa46840b 509 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream4))? DMA_FLAG_DMEIF0_4 :\
Kojto 110:165afa46840b 510 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream1))? DMA_FLAG_DMEIF1_5 :\
Kojto 110:165afa46840b 511 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream1))? DMA_FLAG_DMEIF1_5 :\
Kojto 110:165afa46840b 512 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream5))? DMA_FLAG_DMEIF1_5 :\
Kojto 110:165afa46840b 513 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream5))? DMA_FLAG_DMEIF1_5 :\
Kojto 110:165afa46840b 514 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream2))? DMA_FLAG_DMEIF2_6 :\
Kojto 110:165afa46840b 515 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream2))? DMA_FLAG_DMEIF2_6 :\
Kojto 110:165afa46840b 516 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream6))? DMA_FLAG_DMEIF2_6 :\
Kojto 110:165afa46840b 517 ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream6))? DMA_FLAG_DMEIF2_6 :\
Kojto 110:165afa46840b 518 DMA_FLAG_DMEIF3_7)
Kojto 110:165afa46840b 519
Kojto 110:165afa46840b 520 /**
Kojto 110:165afa46840b 521 * @brief Get the DMA Stream pending flags.
Kojto 110:165afa46840b 522 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 523 * @param __FLAG__: Get the specified flag.
Kojto 110:165afa46840b 524 * This parameter can be any combination of the following values:
Kojto 110:165afa46840b 525 * @arg DMA_FLAG_TCIFx: Transfer complete flag.
Kojto 110:165afa46840b 526 * @arg DMA_FLAG_HTIFx: Half transfer complete flag.
Kojto 110:165afa46840b 527 * @arg DMA_FLAG_TEIFx: Transfer error flag.
Kojto 110:165afa46840b 528 * @arg DMA_FLAG_DMEIFx: Direct mode error flag.
Kojto 110:165afa46840b 529 * @arg DMA_FLAG_FEIFx: FIFO error flag.
Kojto 110:165afa46840b 530 * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag.
Kojto 110:165afa46840b 531 * @retval The state of FLAG (SET or RESET).
Kojto 110:165afa46840b 532 */
Kojto 110:165afa46840b 533 #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__)\
Kojto 110:165afa46840b 534 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HISR & (__FLAG__)) :\
Kojto 110:165afa46840b 535 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LISR & (__FLAG__)) :\
Kojto 110:165afa46840b 536 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HISR & (__FLAG__)) : (DMA1->LISR & (__FLAG__)))
Kojto 110:165afa46840b 537
Kojto 110:165afa46840b 538 /**
Kojto 110:165afa46840b 539 * @brief Clear the DMA Stream pending flags.
Kojto 110:165afa46840b 540 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 541 * @param __FLAG__: specifies the flag to clear.
Kojto 110:165afa46840b 542 * This parameter can be any combination of the following values:
Kojto 110:165afa46840b 543 * @arg DMA_FLAG_TCIFx: Transfer complete flag.
Kojto 110:165afa46840b 544 * @arg DMA_FLAG_HTIFx: Half transfer complete flag.
Kojto 110:165afa46840b 545 * @arg DMA_FLAG_TEIFx: Transfer error flag.
Kojto 110:165afa46840b 546 * @arg DMA_FLAG_DMEIFx: Direct mode error flag.
Kojto 110:165afa46840b 547 * @arg DMA_FLAG_FEIFx: FIFO error flag.
Kojto 110:165afa46840b 548 * Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Stream flag.
Kojto 110:165afa46840b 549 * @retval None
Kojto 110:165afa46840b 550 */
Kojto 110:165afa46840b 551 #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \
Kojto 110:165afa46840b 552 (((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA2_Stream3)? (DMA2->HIFCR = (__FLAG__)) :\
Kojto 110:165afa46840b 553 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LIFCR = (__FLAG__)) :\
Kojto 110:165afa46840b 554 ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HIFCR = (__FLAG__)) : (DMA1->LIFCR = (__FLAG__)))
Kojto 110:165afa46840b 555
Kojto 110:165afa46840b 556 /**
Kojto 110:165afa46840b 557 * @brief Enable the specified DMA Stream interrupts.
Kojto 110:165afa46840b 558 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 559 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
Kojto 110:165afa46840b 560 * This parameter can be any combination of the following values:
Kojto 110:165afa46840b 561 * @arg DMA_IT_TC: Transfer complete interrupt mask.
Kojto 110:165afa46840b 562 * @arg DMA_IT_HT: Half transfer complete interrupt mask.
Kojto 110:165afa46840b 563 * @arg DMA_IT_TE: Transfer error interrupt mask.
Kojto 110:165afa46840b 564 * @arg DMA_IT_FE: FIFO error interrupt mask.
Kojto 110:165afa46840b 565 * @arg DMA_IT_DME: Direct mode error interrupt.
Kojto 110:165afa46840b 566 * @retval None
Kojto 110:165afa46840b 567 */
Kojto 110:165afa46840b 568 #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
Kojto 110:165afa46840b 569 ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) : ((__HANDLE__)->Instance->FCR |= (__INTERRUPT__)))
Kojto 110:165afa46840b 570
Kojto 110:165afa46840b 571 /**
Kojto 110:165afa46840b 572 * @brief Disable the specified DMA Stream interrupts.
Kojto 110:165afa46840b 573 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 574 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
Kojto 110:165afa46840b 575 * This parameter can be any combination of the following values:
Kojto 110:165afa46840b 576 * @arg DMA_IT_TC: Transfer complete interrupt mask.
Kojto 110:165afa46840b 577 * @arg DMA_IT_HT: Half transfer complete interrupt mask.
Kojto 110:165afa46840b 578 * @arg DMA_IT_TE: Transfer error interrupt mask.
Kojto 110:165afa46840b 579 * @arg DMA_IT_FE: FIFO error interrupt mask.
Kojto 110:165afa46840b 580 * @arg DMA_IT_DME: Direct mode error interrupt.
Kojto 110:165afa46840b 581 * @retval None
Kojto 110:165afa46840b 582 */
Kojto 110:165afa46840b 583 #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
Kojto 110:165afa46840b 584 ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) : ((__HANDLE__)->Instance->FCR &= ~(__INTERRUPT__)))
Kojto 110:165afa46840b 585
Kojto 110:165afa46840b 586 /**
Kojto 110:165afa46840b 587 * @brief Check whether the specified DMA Stream interrupt is enabled or disabled.
Kojto 110:165afa46840b 588 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 589 * @param __INTERRUPT__: specifies the DMA interrupt source to check.
Kojto 110:165afa46840b 590 * This parameter can be one of the following values:
Kojto 110:165afa46840b 591 * @arg DMA_IT_TC: Transfer complete interrupt mask.
Kojto 110:165afa46840b 592 * @arg DMA_IT_HT: Half transfer complete interrupt mask.
Kojto 110:165afa46840b 593 * @arg DMA_IT_TE: Transfer error interrupt mask.
Kojto 110:165afa46840b 594 * @arg DMA_IT_FE: FIFO error interrupt mask.
Kojto 110:165afa46840b 595 * @arg DMA_IT_DME: Direct mode error interrupt.
Kojto 110:165afa46840b 596 * @retval The state of DMA_IT.
Kojto 110:165afa46840b 597 */
Kojto 110:165afa46840b 598 #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \
Kojto 110:165afa46840b 599 ((__HANDLE__)->Instance->CR & (__INTERRUPT__)) : \
Kojto 110:165afa46840b 600 ((__HANDLE__)->Instance->FCR & (__INTERRUPT__)))
Kojto 110:165afa46840b 601
Kojto 110:165afa46840b 602 /**
Kojto 110:165afa46840b 603 * @brief Writes the number of data units to be transferred on the DMA Stream.
Kojto 110:165afa46840b 604 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 605 * @param __COUNTER__: Number of data units to be transferred (from 0 to 65535)
Kojto 110:165afa46840b 606 * Number of data items depends only on the Peripheral data format.
Kojto 110:165afa46840b 607 *
Kojto 110:165afa46840b 608 * @note If Peripheral data format is Bytes: number of data units is equal
Kojto 110:165afa46840b 609 * to total number of bytes to be transferred.
Kojto 110:165afa46840b 610 *
Kojto 110:165afa46840b 611 * @note If Peripheral data format is Half-Word: number of data units is
Kojto 110:165afa46840b 612 * equal to total number of bytes to be transferred / 2.
Kojto 110:165afa46840b 613 *
Kojto 110:165afa46840b 614 * @note If Peripheral data format is Word: number of data units is equal
Kojto 110:165afa46840b 615 * to total number of bytes to be transferred / 4.
Kojto 110:165afa46840b 616 *
Kojto 110:165afa46840b 617 * @retval The number of remaining data units in the current DMAy Streamx transfer.
Kojto 110:165afa46840b 618 */
Kojto 110:165afa46840b 619 #define __HAL_DMA_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->NDTR = (uint16_t)(__COUNTER__))
Kojto 110:165afa46840b 620
Kojto 110:165afa46840b 621 /**
Kojto 110:165afa46840b 622 * @brief Returns the number of remaining data units in the current DMAy Streamx transfer.
Kojto 110:165afa46840b 623 * @param __HANDLE__: DMA handle
Kojto 110:165afa46840b 624 *
Kojto 110:165afa46840b 625 * @retval The number of remaining data units in the current DMA Stream transfer.
Kojto 110:165afa46840b 626 */
Kojto 110:165afa46840b 627 #define __HAL_DMA_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->NDTR)
Kojto 110:165afa46840b 628
Kojto 110:165afa46840b 629
Kojto 110:165afa46840b 630 /* Include DMA HAL Extension module */
Kojto 110:165afa46840b 631 #include "stm32f4xx_hal_dma_ex.h"
Kojto 110:165afa46840b 632
Kojto 110:165afa46840b 633 /* Exported functions --------------------------------------------------------*/
Kojto 110:165afa46840b 634
Kojto 110:165afa46840b 635 /** @defgroup DMA_Exported_Functions DMA Exported Functions
Kojto 110:165afa46840b 636 * @brief DMA Exported functions
Kojto 110:165afa46840b 637 * @{
Kojto 110:165afa46840b 638 */
Kojto 110:165afa46840b 639
Kojto 110:165afa46840b 640 /** @defgroup DMA_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 110:165afa46840b 641 * @brief Initialization and de-initialization functions
Kojto 110:165afa46840b 642 * @{
Kojto 110:165afa46840b 643 */
Kojto 110:165afa46840b 644 HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma);
Kojto 110:165afa46840b 645 HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma);
Kojto 110:165afa46840b 646 /**
Kojto 110:165afa46840b 647 * @}
Kojto 110:165afa46840b 648 */
Kojto 110:165afa46840b 649
Kojto 110:165afa46840b 650 /** @defgroup DMA_Exported_Functions_Group2 I/O operation functions
Kojto 110:165afa46840b 651 * @brief I/O operation functions
Kojto 110:165afa46840b 652 * @{
Kojto 110:165afa46840b 653 */
Kojto 110:165afa46840b 654 HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
Kojto 110:165afa46840b 655 HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
Kojto 110:165afa46840b 656 HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma);
Kojto 110:165afa46840b 657 HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout);
Kojto 110:165afa46840b 658 void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma);
Kojto 110:165afa46840b 659 /**
Kojto 110:165afa46840b 660 * @}
Kojto 110:165afa46840b 661 */
Kojto 110:165afa46840b 662
Kojto 110:165afa46840b 663 /** @defgroup DMA_Exported_Functions_Group3 Peripheral State functions
Kojto 110:165afa46840b 664 * @brief Peripheral State functions
Kojto 110:165afa46840b 665 * @{
Kojto 110:165afa46840b 666 */
Kojto 110:165afa46840b 667 HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma);
Kojto 110:165afa46840b 668 uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma);
Kojto 110:165afa46840b 669 /**
Kojto 110:165afa46840b 670 * @}
Kojto 110:165afa46840b 671 */
Kojto 110:165afa46840b 672 /**
Kojto 110:165afa46840b 673 * @}
Kojto 110:165afa46840b 674 */
Kojto 110:165afa46840b 675 /* Private Constants -------------------------------------------------------------*/
Kojto 110:165afa46840b 676 /** @defgroup DMA_Private_Constants DMA Private Constants
Kojto 110:165afa46840b 677 * @brief DMA private defines and constants
Kojto 110:165afa46840b 678 * @{
Kojto 110:165afa46840b 679 */
Kojto 110:165afa46840b 680 /**
Kojto 110:165afa46840b 681 * @}
Kojto 110:165afa46840b 682 */
Kojto 110:165afa46840b 683
Kojto 110:165afa46840b 684 /* Private macros ------------------------------------------------------------*/
Kojto 110:165afa46840b 685 /** @defgroup DMA_Private_Macros DMA Private Macros
Kojto 110:165afa46840b 686 * @brief DMA private macros
Kojto 110:165afa46840b 687 * @{
Kojto 110:165afa46840b 688 */
Kojto 110:165afa46840b 689 #define IS_DMA_CHANNEL(CHANNEL) (((CHANNEL) == DMA_CHANNEL_0) || \
Kojto 110:165afa46840b 690 ((CHANNEL) == DMA_CHANNEL_1) || \
Kojto 110:165afa46840b 691 ((CHANNEL) == DMA_CHANNEL_2) || \
Kojto 110:165afa46840b 692 ((CHANNEL) == DMA_CHANNEL_3) || \
Kojto 110:165afa46840b 693 ((CHANNEL) == DMA_CHANNEL_4) || \
Kojto 110:165afa46840b 694 ((CHANNEL) == DMA_CHANNEL_5) || \
Kojto 110:165afa46840b 695 ((CHANNEL) == DMA_CHANNEL_6) || \
Kojto 110:165afa46840b 696 ((CHANNEL) == DMA_CHANNEL_7))
Kojto 110:165afa46840b 697
Kojto 110:165afa46840b 698 #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \
Kojto 110:165afa46840b 699 ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \
Kojto 110:165afa46840b 700 ((DIRECTION) == DMA_MEMORY_TO_MEMORY))
Kojto 110:165afa46840b 701
Kojto 110:165afa46840b 702 #define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1) && ((SIZE) < 0x10000))
Kojto 110:165afa46840b 703
Kojto 110:165afa46840b 704 #define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \
Kojto 110:165afa46840b 705 ((STATE) == DMA_PINC_DISABLE))
Kojto 110:165afa46840b 706
Kojto 110:165afa46840b 707 #define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \
Kojto 110:165afa46840b 708 ((STATE) == DMA_MINC_DISABLE))
Kojto 110:165afa46840b 709
Kojto 110:165afa46840b 710 #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \
Kojto 110:165afa46840b 711 ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \
Kojto 110:165afa46840b 712 ((SIZE) == DMA_PDATAALIGN_WORD))
Kojto 110:165afa46840b 713
Kojto 110:165afa46840b 714 #define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \
Kojto 110:165afa46840b 715 ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \
Kojto 110:165afa46840b 716 ((SIZE) == DMA_MDATAALIGN_WORD ))
Kojto 110:165afa46840b 717
Kojto 110:165afa46840b 718 #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \
Kojto 110:165afa46840b 719 ((MODE) == DMA_CIRCULAR) || \
Kojto 110:165afa46840b 720 ((MODE) == DMA_PFCTRL))
Kojto 110:165afa46840b 721
Kojto 110:165afa46840b 722 #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \
Kojto 110:165afa46840b 723 ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \
Kojto 110:165afa46840b 724 ((PRIORITY) == DMA_PRIORITY_HIGH) || \
Kojto 110:165afa46840b 725 ((PRIORITY) == DMA_PRIORITY_VERY_HIGH))
Kojto 110:165afa46840b 726
Kojto 110:165afa46840b 727 #define IS_DMA_FIFO_MODE_STATE(STATE) (((STATE) == DMA_FIFOMODE_DISABLE ) || \
Kojto 110:165afa46840b 728 ((STATE) == DMA_FIFOMODE_ENABLE))
Kojto 110:165afa46840b 729
Kojto 110:165afa46840b 730 #define IS_DMA_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == DMA_FIFO_THRESHOLD_1QUARTERFULL ) || \
Kojto 110:165afa46840b 731 ((THRESHOLD) == DMA_FIFO_THRESHOLD_HALFFULL) || \
Kojto 110:165afa46840b 732 ((THRESHOLD) == DMA_FIFO_THRESHOLD_3QUARTERSFULL) || \
Kojto 110:165afa46840b 733 ((THRESHOLD) == DMA_FIFO_THRESHOLD_FULL))
Kojto 110:165afa46840b 734
Kojto 110:165afa46840b 735 #define IS_DMA_MEMORY_BURST(BURST) (((BURST) == DMA_MBURST_SINGLE) || \
Kojto 110:165afa46840b 736 ((BURST) == DMA_MBURST_INC4) || \
Kojto 110:165afa46840b 737 ((BURST) == DMA_MBURST_INC8) || \
Kojto 110:165afa46840b 738 ((BURST) == DMA_MBURST_INC16))
Kojto 110:165afa46840b 739
Kojto 110:165afa46840b 740 #define IS_DMA_PERIPHERAL_BURST(BURST) (((BURST) == DMA_PBURST_SINGLE) || \
Kojto 110:165afa46840b 741 ((BURST) == DMA_PBURST_INC4) || \
Kojto 110:165afa46840b 742 ((BURST) == DMA_PBURST_INC8) || \
Kojto 110:165afa46840b 743 ((BURST) == DMA_PBURST_INC16))
Kojto 110:165afa46840b 744 /**
Kojto 110:165afa46840b 745 * @}
Kojto 110:165afa46840b 746 */
Kojto 110:165afa46840b 747
Kojto 110:165afa46840b 748 /* Private functions ---------------------------------------------------------*/
Kojto 110:165afa46840b 749 /** @defgroup DMA_Private_Functions DMA Private Functions
Kojto 110:165afa46840b 750 * @brief DMA private functions
Kojto 110:165afa46840b 751 * @{
Kojto 110:165afa46840b 752 */
Kojto 110:165afa46840b 753 /**
Kojto 110:165afa46840b 754 * @}
Kojto 110:165afa46840b 755 */
Kojto 110:165afa46840b 756
Kojto 110:165afa46840b 757 /**
Kojto 110:165afa46840b 758 * @}
Kojto 110:165afa46840b 759 */
Kojto 110:165afa46840b 760
Kojto 110:165afa46840b 761 /**
Kojto 110:165afa46840b 762 * @}
Kojto 110:165afa46840b 763 */
Kojto 110:165afa46840b 764
Kojto 110:165afa46840b 765 #ifdef __cplusplus
Kojto 110:165afa46840b 766 }
Kojto 110:165afa46840b 767 #endif
Kojto 110:165afa46840b 768
Kojto 110:165afa46840b 769 #endif /* __STM32F4xx_HAL_DMA_H */
Kojto 110:165afa46840b 770
Kojto 110:165afa46840b 771 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/