cc y / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
90:cb3d968589d8
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 90:cb3d968589d8 1 /**
Kojto 90:cb3d968589d8 2 ******************************************************************************
Kojto 90:cb3d968589d8 3 * @file stm32l1xx_hal_dma.h
Kojto 90:cb3d968589d8 4 * @author MCD Application Team
Kojto 122:f9eeca106725 5 * @version V1.1.3
Kojto 122:f9eeca106725 6 * @date 04-March-2016
Kojto 90:cb3d968589d8 7 * @brief Header file of DMA HAL module.
Kojto 90:cb3d968589d8 8 ******************************************************************************
Kojto 90:cb3d968589d8 9 * @attention
Kojto 90:cb3d968589d8 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 90:cb3d968589d8 12 *
Kojto 90:cb3d968589d8 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 90:cb3d968589d8 14 * are permitted provided that the following conditions are met:
Kojto 90:cb3d968589d8 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 90:cb3d968589d8 16 * this list of conditions and the following disclaimer.
Kojto 90:cb3d968589d8 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 90:cb3d968589d8 18 * this list of conditions and the following disclaimer in the documentation
Kojto 90:cb3d968589d8 19 * and/or other materials provided with the distribution.
Kojto 90:cb3d968589d8 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 90:cb3d968589d8 21 * may be used to endorse or promote products derived from this software
Kojto 90:cb3d968589d8 22 * without specific prior written permission.
Kojto 90:cb3d968589d8 23 *
Kojto 90:cb3d968589d8 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 90:cb3d968589d8 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 90:cb3d968589d8 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 90:cb3d968589d8 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 90:cb3d968589d8 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 90:cb3d968589d8 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 90:cb3d968589d8 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 90:cb3d968589d8 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 90:cb3d968589d8 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 90:cb3d968589d8 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 90:cb3d968589d8 34 *
Kojto 90:cb3d968589d8 35 ******************************************************************************
Kojto 90:cb3d968589d8 36 */
Kojto 90:cb3d968589d8 37
Kojto 90:cb3d968589d8 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 90:cb3d968589d8 39 #ifndef __STM32L1xx_HAL_DMA_H
Kojto 90:cb3d968589d8 40 #define __STM32L1xx_HAL_DMA_H
Kojto 90:cb3d968589d8 41
Kojto 90:cb3d968589d8 42 #ifdef __cplusplus
Kojto 90:cb3d968589d8 43 extern "C" {
Kojto 90:cb3d968589d8 44 #endif
Kojto 90:cb3d968589d8 45
Kojto 90:cb3d968589d8 46 /* Includes ------------------------------------------------------------------*/
Kojto 90:cb3d968589d8 47 #include "stm32l1xx_hal_def.h"
Kojto 90:cb3d968589d8 48
Kojto 90:cb3d968589d8 49 /** @addtogroup STM32L1xx_HAL_Driver
Kojto 90:cb3d968589d8 50 * @{
Kojto 90:cb3d968589d8 51 */
Kojto 90:cb3d968589d8 52
Kojto 90:cb3d968589d8 53 /** @addtogroup DMA
Kojto 90:cb3d968589d8 54 * @{
Kojto 90:cb3d968589d8 55 */
Kojto 90:cb3d968589d8 56
Kojto 122:f9eeca106725 57 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 58
Kojto 90:cb3d968589d8 59 /** @defgroup DMA_Exported_Types DMA Exported Types
Kojto 90:cb3d968589d8 60 * @{
Kojto 90:cb3d968589d8 61 */
Kojto 122:f9eeca106725 62
Kojto 90:cb3d968589d8 63 /**
Kojto 122:f9eeca106725 64 * @brief DMA Configuration Structure definition
Kojto 90:cb3d968589d8 65 */
Kojto 90:cb3d968589d8 66 typedef struct
Kojto 90:cb3d968589d8 67 {
Kojto 90:cb3d968589d8 68 uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
Kojto 90:cb3d968589d8 69 from memory to memory or from peripheral to memory.
Kojto 90:cb3d968589d8 70 This parameter can be a value of @ref DMA_Data_transfer_direction */
Kojto 90:cb3d968589d8 71
Kojto 90:cb3d968589d8 72 uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not.
Kojto 90:cb3d968589d8 73 This parameter can be a value of @ref DMA_Peripheral_incremented_mode */
Kojto 90:cb3d968589d8 74
Kojto 90:cb3d968589d8 75 uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not.
Kojto 90:cb3d968589d8 76 This parameter can be a value of @ref DMA_Memory_incremented_mode */
Kojto 90:cb3d968589d8 77
Kojto 90:cb3d968589d8 78 uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width.
Kojto 90:cb3d968589d8 79 This parameter can be a value of @ref DMA_Peripheral_data_size */
Kojto 90:cb3d968589d8 80
Kojto 90:cb3d968589d8 81 uint32_t MemDataAlignment; /*!< Specifies the Memory data width.
Kojto 90:cb3d968589d8 82 This parameter can be a value of @ref DMA_Memory_data_size */
Kojto 90:cb3d968589d8 83
Kojto 90:cb3d968589d8 84 uint32_t Mode; /*!< Specifies the operation mode of the DMAy Channelx.
Kojto 90:cb3d968589d8 85 This parameter can be a value of @ref DMA_mode
Kojto 90:cb3d968589d8 86 @note The circular buffer mode cannot be used if the memory-to-memory
Kojto 90:cb3d968589d8 87 data transfer is configured on the selected Channel */
Kojto 90:cb3d968589d8 88
Kojto 90:cb3d968589d8 89 uint32_t Priority; /*!< Specifies the software priority for the DMAy Channelx.
Kojto 90:cb3d968589d8 90 This parameter can be a value of @ref DMA_Priority_level */
Kojto 90:cb3d968589d8 91 } DMA_InitTypeDef;
Kojto 90:cb3d968589d8 92
Kojto 90:cb3d968589d8 93 /**
Kojto 122:f9eeca106725 94 * @brief DMA Configuration enumeration values definition
Kojto 90:cb3d968589d8 95 */
Kojto 90:cb3d968589d8 96 typedef enum
Kojto 90:cb3d968589d8 97 {
Kojto 90:cb3d968589d8 98 DMA_MODE = 0, /*!< Control related DMA mode Parameter in DMA_InitTypeDef */
Kojto 90:cb3d968589d8 99 DMA_PRIORITY = 1, /*!< Control related priority level Parameter in DMA_InitTypeDef */
Kojto 90:cb3d968589d8 100
Kojto 90:cb3d968589d8 101 } DMA_ControlTypeDef;
Kojto 90:cb3d968589d8 102
Kojto 90:cb3d968589d8 103 /**
Kojto 90:cb3d968589d8 104 * @brief HAL DMA State structures definition
Kojto 90:cb3d968589d8 105 */
Kojto 90:cb3d968589d8 106 typedef enum
Kojto 90:cb3d968589d8 107 {
Kojto 122:f9eeca106725 108 HAL_DMA_STATE_RESET = 0x00, /*!< DMA not yet initialized or disabled */
Kojto 122:f9eeca106725 109 HAL_DMA_STATE_READY = 0x01, /*!< DMA initialized and ready for use */
Kojto 90:cb3d968589d8 110 HAL_DMA_STATE_READY_HALF = 0x11, /*!< DMA Half process success */
Kojto 122:f9eeca106725 111 HAL_DMA_STATE_BUSY = 0x02, /*!< DMA process is ongoing */
Kojto 122:f9eeca106725 112 HAL_DMA_STATE_TIMEOUT = 0x03, /*!< DMA timeout state */
Kojto 90:cb3d968589d8 113 HAL_DMA_STATE_ERROR = 0x04, /*!< DMA error state */
Kojto 90:cb3d968589d8 114 }HAL_DMA_StateTypeDef;
Kojto 90:cb3d968589d8 115
Kojto 90:cb3d968589d8 116 /**
Kojto 122:f9eeca106725 117 * @brief HAL DMA Error Code structure definition
Kojto 122:f9eeca106725 118 */
Kojto 90:cb3d968589d8 119 typedef enum
Kojto 90:cb3d968589d8 120 {
Kojto 90:cb3d968589d8 121 HAL_DMA_FULL_TRANSFER = 0x00, /*!< Full transfer */
Kojto 90:cb3d968589d8 122 HAL_DMA_HALF_TRANSFER = 0x01, /*!< Half Transfer */
Kojto 90:cb3d968589d8 123 }HAL_DMA_LevelCompleteTypeDef;
Kojto 90:cb3d968589d8 124
Kojto 90:cb3d968589d8 125 /**
Kojto 122:f9eeca106725 126 * @brief DMA handle Structure definition
Kojto 122:f9eeca106725 127 */
Kojto 90:cb3d968589d8 128 typedef struct __DMA_HandleTypeDef
Kojto 122:f9eeca106725 129 {
Kojto 122:f9eeca106725 130 DMA_Channel_TypeDef *Instance; /*!< Register base address */
Kojto 90:cb3d968589d8 131
Kojto 90:cb3d968589d8 132 DMA_InitTypeDef Init; /*!< DMA communication parameters */
Kojto 90:cb3d968589d8 133
Kojto 90:cb3d968589d8 134 HAL_LockTypeDef Lock; /*!< DMA locking object */
Kojto 90:cb3d968589d8 135
Kojto 90:cb3d968589d8 136 HAL_DMA_StateTypeDef State; /*!< DMA transfer state */
Kojto 90:cb3d968589d8 137
Kojto 90:cb3d968589d8 138 void *Parent; /*!< Parent object state */
Kojto 90:cb3d968589d8 139
Kojto 90:cb3d968589d8 140 void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */
Kojto 90:cb3d968589d8 141
Kojto 90:cb3d968589d8 142 void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */
Kojto 90:cb3d968589d8 143
Kojto 90:cb3d968589d8 144 void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */
Kojto 90:cb3d968589d8 145
Kojto 122:f9eeca106725 146 __IO uint32_t ErrorCode; /*!< DMA Error code */
Kojto 90:cb3d968589d8 147 } DMA_HandleTypeDef;
Kojto 90:cb3d968589d8 148 /**
Kojto 90:cb3d968589d8 149 * @}
Kojto 90:cb3d968589d8 150 */
Kojto 90:cb3d968589d8 151
Kojto 90:cb3d968589d8 152 /* Exported constants --------------------------------------------------------*/
Kojto 90:cb3d968589d8 153
Kojto 90:cb3d968589d8 154 /** @defgroup DMA_Exported_Constants DMA Exported Constants
Kojto 90:cb3d968589d8 155 * @{
Kojto 90:cb3d968589d8 156 */
Kojto 90:cb3d968589d8 157
Kojto 122:f9eeca106725 158 /** @defgroup DMA_Error_Code DMA Error Code
Kojto 90:cb3d968589d8 159 * @{
Kojto 122:f9eeca106725 160 */
Kojto 122:f9eeca106725 161 #define HAL_DMA_ERROR_NONE ((uint32_t)0x00) /*!< No error */
Kojto 122:f9eeca106725 162 #define HAL_DMA_ERROR_TE ((uint32_t)0x01) /*!< Transfer error */
Kojto 122:f9eeca106725 163 #define HAL_DMA_ERROR_TIMEOUT ((uint32_t)0x20) /*!< Timeout error */
Kojto 122:f9eeca106725 164
Kojto 90:cb3d968589d8 165 /**
Kojto 90:cb3d968589d8 166 * @}
Kojto 90:cb3d968589d8 167 */
Kojto 90:cb3d968589d8 168
Kojto 122:f9eeca106725 169 /** @defgroup DMA_Data_transfer_direction DMA Data transfer direction
Kojto 90:cb3d968589d8 170 * @{
Kojto 90:cb3d968589d8 171 */
Kojto 122:f9eeca106725 172 #define DMA_PERIPH_TO_MEMORY ((uint32_t)0x00000000) /*!< Peripheral to memory direction */
Kojto 122:f9eeca106725 173 #define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_CCR_DIR) /*!< Memory to peripheral direction */
Kojto 122:f9eeca106725 174 #define DMA_MEMORY_TO_MEMORY ((uint32_t)DMA_CCR_MEM2MEM) /*!< Memory to memory direction */
Kojto 90:cb3d968589d8 175
Kojto 90:cb3d968589d8 176 /**
Kojto 90:cb3d968589d8 177 * @}
Kojto 90:cb3d968589d8 178 */
Kojto 90:cb3d968589d8 179
Kojto 122:f9eeca106725 180 /** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode
Kojto 90:cb3d968589d8 181 * @{
Kojto 90:cb3d968589d8 182 */
Kojto 90:cb3d968589d8 183 #define DMA_PINC_ENABLE ((uint32_t)DMA_CCR_PINC) /*!< Peripheral increment mode Enable */
Kojto 90:cb3d968589d8 184 #define DMA_PINC_DISABLE ((uint32_t)0x00000000) /*!< Peripheral increment mode Disable */
Kojto 90:cb3d968589d8 185 /**
Kojto 90:cb3d968589d8 186 * @}
Kojto 90:cb3d968589d8 187 */
Kojto 90:cb3d968589d8 188
Kojto 122:f9eeca106725 189 /** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode
Kojto 90:cb3d968589d8 190 * @{
Kojto 90:cb3d968589d8 191 */
Kojto 122:f9eeca106725 192 #define DMA_MINC_ENABLE ((uint32_t)DMA_CCR_MINC) /*!< Memory increment mode Enable */
Kojto 122:f9eeca106725 193 #define DMA_MINC_DISABLE ((uint32_t)0x00000000) /*!< Memory increment mode Disable */
Kojto 90:cb3d968589d8 194 /**
Kojto 90:cb3d968589d8 195 * @}
Kojto 90:cb3d968589d8 196 */
Kojto 90:cb3d968589d8 197
Kojto 122:f9eeca106725 198 /** @defgroup DMA_Peripheral_data_size DMA Peripheral data size
Kojto 90:cb3d968589d8 199 * @{
Kojto 90:cb3d968589d8 200 */
Kojto 122:f9eeca106725 201 #define DMA_PDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Peripheral data alignment: Byte */
Kojto 122:f9eeca106725 202 #define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */
Kojto 122:f9eeca106725 203 #define DMA_PDATAALIGN_WORD ((uint32_t)DMA_CCR_PSIZE_1) /*!< Peripheral data alignment: Word */
Kojto 122:f9eeca106725 204 /**
Kojto 122:f9eeca106725 205 * @}
Kojto 122:f9eeca106725 206 */
Kojto 122:f9eeca106725 207
Kojto 122:f9eeca106725 208 /** @defgroup DMA_Memory_data_size DMA Memory data size
Kojto 122:f9eeca106725 209 * @{
Kojto 122:f9eeca106725 210 */
Kojto 122:f9eeca106725 211 #define DMA_MDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Memory data alignment: Byte */
Kojto 122:f9eeca106725 212 #define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_MSIZE_0) /*!< Memory data alignment: HalfWord */
Kojto 122:f9eeca106725 213 #define DMA_MDATAALIGN_WORD ((uint32_t)DMA_CCR_MSIZE_1) /*!< Memory data alignment: Word */
Kojto 122:f9eeca106725 214 /**
Kojto 122:f9eeca106725 215 * @}
Kojto 122:f9eeca106725 216 */
Kojto 90:cb3d968589d8 217
Kojto 122:f9eeca106725 218 /** @defgroup DMA_mode DMA mode
Kojto 122:f9eeca106725 219 * @{
Kojto 122:f9eeca106725 220 */
Kojto 122:f9eeca106725 221 #define DMA_NORMAL ((uint32_t)0x00000000) /*!< Normal mode */
Kojto 122:f9eeca106725 222 #define DMA_CIRCULAR ((uint32_t)DMA_CCR_CIRC) /*!< Circular mode */
Kojto 122:f9eeca106725 223 /**
Kojto 122:f9eeca106725 224 * @}
Kojto 122:f9eeca106725 225 */
Kojto 122:f9eeca106725 226
Kojto 122:f9eeca106725 227 /** @defgroup DMA_Priority_level DMA Priority level
Kojto 122:f9eeca106725 228 * @{
Kojto 122:f9eeca106725 229 */
Kojto 122:f9eeca106725 230 #define DMA_PRIORITY_LOW ((uint32_t)0x00000000) /*!< Priority level : Low */
Kojto 122:f9eeca106725 231 #define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_CCR_PL_0) /*!< Priority level : Medium */
Kojto 122:f9eeca106725 232 #define DMA_PRIORITY_HIGH ((uint32_t)DMA_CCR_PL_1) /*!< Priority level : High */
Kojto 122:f9eeca106725 233 #define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_CCR_PL) /*!< Priority level : Very_High */
Kojto 90:cb3d968589d8 234 /**
Kojto 90:cb3d968589d8 235 * @}
Kojto 90:cb3d968589d8 236 */
Kojto 90:cb3d968589d8 237
Kojto 90:cb3d968589d8 238
Kojto 122:f9eeca106725 239 /** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions
Kojto 122:f9eeca106725 240 * @{
Kojto 90:cb3d968589d8 241 */
Kojto 122:f9eeca106725 242 #define DMA_IT_TC ((uint32_t)DMA_CCR_TCIE)
Kojto 122:f9eeca106725 243 #define DMA_IT_HT ((uint32_t)DMA_CCR_HTIE)
Kojto 122:f9eeca106725 244 #define DMA_IT_TE ((uint32_t)DMA_CCR_TEIE)
Kojto 90:cb3d968589d8 245 /**
Kojto 90:cb3d968589d8 246 * @}
Kojto 90:cb3d968589d8 247 */
Kojto 90:cb3d968589d8 248
Kojto 122:f9eeca106725 249 /** @defgroup DMA_flag_definitions DMA flag definitions
Kojto 90:cb3d968589d8 250 * @{
Kojto 90:cb3d968589d8 251 */
Kojto 90:cb3d968589d8 252 #define DMA_FLAG_GL1 ((uint32_t)0x00000001)
Kojto 90:cb3d968589d8 253 #define DMA_FLAG_TC1 ((uint32_t)0x00000002)
Kojto 90:cb3d968589d8 254 #define DMA_FLAG_HT1 ((uint32_t)0x00000004)
Kojto 90:cb3d968589d8 255 #define DMA_FLAG_TE1 ((uint32_t)0x00000008)
Kojto 90:cb3d968589d8 256 #define DMA_FLAG_GL2 ((uint32_t)0x00000010)
Kojto 90:cb3d968589d8 257 #define DMA_FLAG_TC2 ((uint32_t)0x00000020)
Kojto 90:cb3d968589d8 258 #define DMA_FLAG_HT2 ((uint32_t)0x00000040)
Kojto 90:cb3d968589d8 259 #define DMA_FLAG_TE2 ((uint32_t)0x00000080)
Kojto 90:cb3d968589d8 260 #define DMA_FLAG_GL3 ((uint32_t)0x00000100)
Kojto 90:cb3d968589d8 261 #define DMA_FLAG_TC3 ((uint32_t)0x00000200)
Kojto 90:cb3d968589d8 262 #define DMA_FLAG_HT3 ((uint32_t)0x00000400)
Kojto 90:cb3d968589d8 263 #define DMA_FLAG_TE3 ((uint32_t)0x00000800)
Kojto 90:cb3d968589d8 264 #define DMA_FLAG_GL4 ((uint32_t)0x00001000)
Kojto 90:cb3d968589d8 265 #define DMA_FLAG_TC4 ((uint32_t)0x00002000)
Kojto 90:cb3d968589d8 266 #define DMA_FLAG_HT4 ((uint32_t)0x00004000)
Kojto 90:cb3d968589d8 267 #define DMA_FLAG_TE4 ((uint32_t)0x00008000)
Kojto 90:cb3d968589d8 268 #define DMA_FLAG_GL5 ((uint32_t)0x00010000)
Kojto 90:cb3d968589d8 269 #define DMA_FLAG_TC5 ((uint32_t)0x00020000)
Kojto 90:cb3d968589d8 270 #define DMA_FLAG_HT5 ((uint32_t)0x00040000)
Kojto 90:cb3d968589d8 271 #define DMA_FLAG_TE5 ((uint32_t)0x00080000)
Kojto 90:cb3d968589d8 272 #define DMA_FLAG_GL6 ((uint32_t)0x00100000)
Kojto 90:cb3d968589d8 273 #define DMA_FLAG_TC6 ((uint32_t)0x00200000)
Kojto 90:cb3d968589d8 274 #define DMA_FLAG_HT6 ((uint32_t)0x00400000)
Kojto 90:cb3d968589d8 275 #define DMA_FLAG_TE6 ((uint32_t)0x00800000)
Kojto 90:cb3d968589d8 276 #define DMA_FLAG_GL7 ((uint32_t)0x01000000)
Kojto 90:cb3d968589d8 277 #define DMA_FLAG_TC7 ((uint32_t)0x02000000)
Kojto 90:cb3d968589d8 278 #define DMA_FLAG_HT7 ((uint32_t)0x04000000)
Kojto 90:cb3d968589d8 279 #define DMA_FLAG_TE7 ((uint32_t)0x08000000)
Kojto 90:cb3d968589d8 280 /**
Kojto 90:cb3d968589d8 281 * @}
Kojto 90:cb3d968589d8 282 */
Kojto 90:cb3d968589d8 283
Kojto 90:cb3d968589d8 284 /**
Kojto 90:cb3d968589d8 285 * @}
Kojto 90:cb3d968589d8 286 */
Kojto 122:f9eeca106725 287
Kojto 90:cb3d968589d8 288
Kojto 122:f9eeca106725 289 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 290 /** @defgroup DMA_Exported_Macros DMA Exported Macros
Kojto 90:cb3d968589d8 291 * @{
Kojto 90:cb3d968589d8 292 */
Kojto 90:cb3d968589d8 293
Kojto 90:cb3d968589d8 294 /** @brief Reset DMA handle state
Kojto 90:cb3d968589d8 295 * @param __HANDLE__: DMA handle.
Kojto 90:cb3d968589d8 296 * @retval None
Kojto 90:cb3d968589d8 297 */
Kojto 90:cb3d968589d8 298 #define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET)
Kojto 122:f9eeca106725 299
Kojto 90:cb3d968589d8 300 /**
Kojto 90:cb3d968589d8 301 * @brief Enable the specified DMA Channel.
Kojto 90:cb3d968589d8 302 * @param __HANDLE__: DMA handle
Kojto 90:cb3d968589d8 303 * @retval None.
Kojto 90:cb3d968589d8 304 */
Kojto 90:cb3d968589d8 305 #define __HAL_DMA_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CCR, DMA_CCR_EN))
Kojto 90:cb3d968589d8 306
Kojto 90:cb3d968589d8 307 /**
Kojto 90:cb3d968589d8 308 * @brief Disable the specified DMA Channel.
Kojto 90:cb3d968589d8 309 * @param __HANDLE__: DMA handle
Kojto 90:cb3d968589d8 310 * @retval None.
Kojto 90:cb3d968589d8 311 */
Kojto 90:cb3d968589d8 312 #define __HAL_DMA_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CCR, DMA_CCR_EN))
Kojto 90:cb3d968589d8 313
Kojto 90:cb3d968589d8 314
Kojto 90:cb3d968589d8 315 /* Interrupt & Flag management */
Kojto 90:cb3d968589d8 316
Kojto 90:cb3d968589d8 317 /**
Kojto 90:cb3d968589d8 318 * @brief Enables the specified DMA Channel interrupts.
Kojto 90:cb3d968589d8 319 * @param __HANDLE__: DMA handle
Kojto 90:cb3d968589d8 320 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
Kojto 90:cb3d968589d8 321 * This parameter can be any combination of the following values:
Kojto 90:cb3d968589d8 322 * @arg DMA_IT_TC: Transfer complete interrupt mask
Kojto 90:cb3d968589d8 323 * @arg DMA_IT_HT: Half transfer complete interrupt mask
Kojto 90:cb3d968589d8 324 * @arg DMA_IT_TE: Transfer error interrupt mask
Kojto 90:cb3d968589d8 325 * @retval None
Kojto 90:cb3d968589d8 326 */
Kojto 90:cb3d968589d8 327 #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) (SET_BIT((__HANDLE__)->Instance->CCR, (__INTERRUPT__)))
Kojto 90:cb3d968589d8 328
Kojto 90:cb3d968589d8 329 /**
Kojto 90:cb3d968589d8 330 * @brief Disables the specified DMA Channel interrupts.
Kojto 90:cb3d968589d8 331 * @param __HANDLE__: DMA handle
Kojto 122:f9eeca106725 332 * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
Kojto 90:cb3d968589d8 333 * This parameter can be any combination of the following values:
Kojto 90:cb3d968589d8 334 * @arg DMA_IT_TC: Transfer complete interrupt mask
Kojto 90:cb3d968589d8 335 * @arg DMA_IT_HT: Half transfer complete interrupt mask
Kojto 90:cb3d968589d8 336 * @arg DMA_IT_TE: Transfer error interrupt mask
Kojto 90:cb3d968589d8 337 * @retval None
Kojto 90:cb3d968589d8 338 */
Kojto 90:cb3d968589d8 339 #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) (CLEAR_BIT((__HANDLE__)->Instance->CCR , (__INTERRUPT__)))
Kojto 90:cb3d968589d8 340
Kojto 90:cb3d968589d8 341 /**
Kojto 122:f9eeca106725 342 * @brief Checks whether the specified DMA Channel interrupt is enabled or disabled.
Kojto 90:cb3d968589d8 343 * @param __HANDLE__: DMA handle
Kojto 90:cb3d968589d8 344 * @param __INTERRUPT__: specifies the DMA interrupt source to check.
Kojto 90:cb3d968589d8 345 * This parameter can be one of the following values:
Kojto 90:cb3d968589d8 346 * @arg DMA_IT_TC: Transfer complete interrupt mask
Kojto 90:cb3d968589d8 347 * @arg DMA_IT_HT: Half transfer complete interrupt mask
Kojto 90:cb3d968589d8 348 * @arg DMA_IT_TE: Transfer error interrupt mask
Kojto 90:cb3d968589d8 349 * @retval The state of DMA_IT (SET or RESET).
Kojto 90:cb3d968589d8 350 */
Kojto 90:cb3d968589d8 351 #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CCR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
Kojto 90:cb3d968589d8 352
Kojto 90:cb3d968589d8 353 /**
Kojto 90:cb3d968589d8 354 * @}
Kojto 90:cb3d968589d8 355 */
Kojto 90:cb3d968589d8 356
Kojto 90:cb3d968589d8 357 /* Include DMA HAL Extension module */
Kojto 90:cb3d968589d8 358 #include "stm32l1xx_hal_dma_ex.h"
Kojto 90:cb3d968589d8 359
Kojto 90:cb3d968589d8 360 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 361 /** @addtogroup DMA_Exported_Functions DMA Exported Functions
Kojto 90:cb3d968589d8 362 * @{
Kojto 90:cb3d968589d8 363 */
Kojto 90:cb3d968589d8 364
Kojto 122:f9eeca106725 365 /** @addtogroup DMA_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 122:f9eeca106725 366 * @{
Kojto 122:f9eeca106725 367 */
Kojto 90:cb3d968589d8 368 /* Initialization and de-initialization functions *****************************/
Kojto 122:f9eeca106725 369 HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma);
Kojto 90:cb3d968589d8 370 HAL_StatusTypeDef HAL_DMA_DeInit (DMA_HandleTypeDef *hdma);
Kojto 122:f9eeca106725 371 /**
Kojto 122:f9eeca106725 372 * @}
Kojto 122:f9eeca106725 373 */
Kojto 90:cb3d968589d8 374
Kojto 122:f9eeca106725 375 /** @addtogroup DMA_Exported_Functions_Group2 Input and Output operation functions
Kojto 122:f9eeca106725 376 * @{
Kojto 122:f9eeca106725 377 */
Kojto 90:cb3d968589d8 378 /* IO operation functions *****************************************************/
Kojto 90:cb3d968589d8 379 HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
Kojto 90:cb3d968589d8 380 HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
Kojto 90:cb3d968589d8 381 HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma);
Kojto 90:cb3d968589d8 382 HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout);
Kojto 122:f9eeca106725 383 void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma);
Kojto 122:f9eeca106725 384 /**
Kojto 122:f9eeca106725 385 * @}
Kojto 122:f9eeca106725 386 */
Kojto 90:cb3d968589d8 387
Kojto 122:f9eeca106725 388 /** @addtogroup DMA_Exported_Functions_Group3 Peripheral State functions
Kojto 122:f9eeca106725 389 * @{
Kojto 122:f9eeca106725 390 */
Kojto 90:cb3d968589d8 391 /* Peripheral State and Error functions ***************************************/
Kojto 90:cb3d968589d8 392 HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma);
Kojto 90:cb3d968589d8 393 uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma);
Kojto 90:cb3d968589d8 394 /**
Kojto 90:cb3d968589d8 395 * @}
Kojto 90:cb3d968589d8 396 */
Kojto 90:cb3d968589d8 397
Kojto 122:f9eeca106725 398 /**
Kojto 122:f9eeca106725 399 * @}
Kojto 122:f9eeca106725 400 */
Kojto 122:f9eeca106725 401
Kojto 122:f9eeca106725 402 /* Private Constants -------------------------------------------------------------*/
Kojto 122:f9eeca106725 403 /** @defgroup DMA_Private_Constants DMA Private Constants
Kojto 122:f9eeca106725 404 * @brief DMA private defines and constants
Kojto 122:f9eeca106725 405 * @{
Kojto 122:f9eeca106725 406 */
Kojto 122:f9eeca106725 407 /**
Kojto 122:f9eeca106725 408 * @}
Kojto 122:f9eeca106725 409 */
Kojto 122:f9eeca106725 410
Kojto 122:f9eeca106725 411 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 412 /** @defgroup DMA_Private_Macros DMA Private Macros
Kojto 122:f9eeca106725 413 * @brief DMA private macros
Kojto 122:f9eeca106725 414 * @{
Kojto 122:f9eeca106725 415 */
Kojto 122:f9eeca106725 416
Kojto 122:f9eeca106725 417 #define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1) && ((SIZE) < 0x10000))
Kojto 122:f9eeca106725 418
Kojto 122:f9eeca106725 419 #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \
Kojto 122:f9eeca106725 420 ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \
Kojto 122:f9eeca106725 421 ((DIRECTION) == DMA_MEMORY_TO_MEMORY))
Kojto 122:f9eeca106725 422
Kojto 122:f9eeca106725 423 #define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \
Kojto 122:f9eeca106725 424 ((STATE) == DMA_PINC_DISABLE))
Kojto 122:f9eeca106725 425
Kojto 122:f9eeca106725 426 #define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \
Kojto 122:f9eeca106725 427 ((STATE) == DMA_MINC_DISABLE))
Kojto 122:f9eeca106725 428
Kojto 122:f9eeca106725 429 #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \
Kojto 122:f9eeca106725 430 ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \
Kojto 122:f9eeca106725 431 ((SIZE) == DMA_PDATAALIGN_WORD))
Kojto 122:f9eeca106725 432
Kojto 122:f9eeca106725 433 #define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \
Kojto 122:f9eeca106725 434 ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \
Kojto 122:f9eeca106725 435 ((SIZE) == DMA_MDATAALIGN_WORD ))
Kojto 122:f9eeca106725 436
Kojto 122:f9eeca106725 437 #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \
Kojto 122:f9eeca106725 438 ((MODE) == DMA_CIRCULAR))
Kojto 122:f9eeca106725 439
Kojto 122:f9eeca106725 440 #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \
Kojto 122:f9eeca106725 441 ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \
Kojto 122:f9eeca106725 442 ((PRIORITY) == DMA_PRIORITY_HIGH) || \
Kojto 122:f9eeca106725 443 ((PRIORITY) == DMA_PRIORITY_VERY_HIGH))
Kojto 122:f9eeca106725 444
Kojto 122:f9eeca106725 445 /**
Kojto 122:f9eeca106725 446 * @}
Kojto 122:f9eeca106725 447 */
Kojto 122:f9eeca106725 448
Kojto 122:f9eeca106725 449 /* Private functions ---------------------------------------------------------*/
Kojto 122:f9eeca106725 450 /** @defgroup DMA_Private_Functions DMA Private Functions
Kojto 122:f9eeca106725 451 * @brief DMA private functions
Kojto 122:f9eeca106725 452 * @{
Kojto 122:f9eeca106725 453 */
Kojto 122:f9eeca106725 454 /**
Kojto 122:f9eeca106725 455 * @}
Kojto 122:f9eeca106725 456 */
Kojto 90:cb3d968589d8 457
Kojto 90:cb3d968589d8 458 /**
Kojto 90:cb3d968589d8 459 * @}
Kojto 90:cb3d968589d8 460 */
Kojto 90:cb3d968589d8 461
Kojto 90:cb3d968589d8 462 /**
Kojto 90:cb3d968589d8 463 * @}
Kojto 90:cb3d968589d8 464 */
Kojto 90:cb3d968589d8 465
Kojto 90:cb3d968589d8 466 #ifdef __cplusplus
Kojto 90:cb3d968589d8 467 }
Kojto 90:cb3d968589d8 468 #endif
Kojto 90:cb3d968589d8 469
Kojto 90:cb3d968589d8 470 #endif /* __STM32L1xx_HAL_DMA_H */
Kojto 90:cb3d968589d8 471
Kojto 90:cb3d968589d8 472 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/