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