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