Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 28 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /** |
1 | /** |
| 2 | ****************************************************************************** |
2 | ****************************************************************************** |
| 3 | * @file stm32l1xx_hal_dma.h |
3 | * @file stm32l1xx_hal_dma.h |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @version V1.2.0 |
- | |
| 6 | * @date 01-July-2016 |
- | |
| 7 | * @brief Header file of DMA HAL module. |
5 | * @brief Header file of DMA HAL module. |
| 8 | ****************************************************************************** |
6 | ****************************************************************************** |
| 9 | * @attention |
7 | * @attention |
| 10 | * |
8 | * |
| 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 12 | * |
11 | * |
| 13 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 14 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 15 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer. |
- | |
| 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 18 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 19 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 21 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 22 | * without specific prior written permission. |
- | |
| 23 | * |
- | |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 34 | * |
16 | * |
| 35 | ****************************************************************************** |
17 | ****************************************************************************** |
| 36 | */ |
18 | */ |
| 37 | 19 | ||
| 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| 39 | #ifndef __STM32L1xx_HAL_DMA_H |
21 | #ifndef STM32L1xx_HAL_DMA_H |
| 40 | #define __STM32L1xx_HAL_DMA_H |
22 | #define STM32L1xx_HAL_DMA_H |
| 41 | 23 | ||
| 42 | #ifdef __cplusplus |
24 | #ifdef __cplusplus |
| 43 | extern "C" { |
25 | extern "C" { |
| 44 | #endif |
26 | #endif |
| 45 | 27 | ||
| Line 50... | Line 32... | ||
| 50 | * @{ |
32 | * @{ |
| 51 | */ |
33 | */ |
| 52 | 34 | ||
| 53 | /** @addtogroup DMA |
35 | /** @addtogroup DMA |
| 54 | * @{ |
36 | * @{ |
| 55 | */ |
37 | */ |
| 56 | 38 | ||
| 57 | /* Exported types ------------------------------------------------------------*/ |
39 | /* Exported types ------------------------------------------------------------*/ |
| 58 | - | ||
| 59 | /** @defgroup DMA_Exported_Types DMA Exported Types |
40 | /** @defgroup DMA_Exported_Types DMA Exported Types |
| 60 | * @{ |
41 | * @{ |
| 61 | */ |
42 | */ |
| 62 | 43 | ||
| 63 | /** |
44 | /** |
| 64 | * @brief DMA Configuration Structure definition |
45 | * @brief DMA Configuration Structure definition |
| 65 | */ |
46 | */ |
| 66 | typedef struct |
47 | typedef struct |
| 67 | { |
48 | { |
| 68 | uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral, |
49 | uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral, |
| 69 | from memory to memory or from peripheral to memory. |
50 | from memory to memory or from peripheral to memory. |
| 70 | This parameter can be a value of @ref DMA_Data_transfer_direction */ |
51 | This parameter can be a value of @ref DMA_Data_transfer_direction */ |
| 71 | 52 | ||
| 72 | uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not. |
53 | uint32_t PeriphInc; /*!< Specifies whether the Peripheral address register should be incremented or not. |
| 73 | This parameter can be a value of @ref DMA_Peripheral_incremented_mode */ |
54 | This parameter can be a value of @ref DMA_Peripheral_incremented_mode */ |
| 74 | - | ||
| - | 55 | ||
| 75 | uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not. |
56 | uint32_t MemInc; /*!< Specifies whether the memory address register should be incremented or not. |
| 76 | This parameter can be a value of @ref DMA_Memory_incremented_mode */ |
57 | This parameter can be a value of @ref DMA_Memory_incremented_mode */ |
| 77 | 58 | ||
| 78 | uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width. |
59 | uint32_t PeriphDataAlignment; /*!< Specifies the Peripheral data width. |
| 79 | This parameter can be a value of @ref DMA_Peripheral_data_size */ |
60 | This parameter can be a value of @ref DMA_Peripheral_data_size */ |
| 80 | 61 | ||
| 81 | uint32_t MemDataAlignment; /*!< Specifies the Memory data width. |
62 | uint32_t MemDataAlignment; /*!< Specifies the Memory data width. |
| 82 | This parameter can be a value of @ref DMA_Memory_data_size */ |
63 | This parameter can be a value of @ref DMA_Memory_data_size */ |
| 83 | - | ||
| - | 64 | ||
| 84 | uint32_t Mode; /*!< Specifies the operation mode of the DMAy Channelx. |
65 | uint32_t Mode; /*!< Specifies the operation mode of the DMAy Channelx. |
| 85 | This parameter can be a value of @ref DMA_mode |
66 | This parameter can be a value of @ref DMA_mode |
| 86 | @note The circular buffer mode cannot be used if the memory-to-memory |
67 | @note The circular buffer mode cannot be used if the memory-to-memory |
| 87 | data transfer is configured on the selected Channel */ |
68 | data transfer is configured on the selected Channel */ |
| 88 | 69 | ||
| 89 | uint32_t Priority; /*!< Specifies the software priority for the DMAy Channelx. |
70 | uint32_t Priority; /*!< Specifies the software priority for the DMAy Channelx. |
| 90 | This parameter can be a value of @ref DMA_Priority_level */ |
71 | This parameter can be a value of @ref DMA_Priority_level */ |
| 91 | } DMA_InitTypeDef; |
72 | } DMA_InitTypeDef; |
| 92 | 73 | ||
| 93 | /** |
74 | /** |
| 94 | * @brief HAL DMA State structures definition |
75 | * @brief HAL DMA State structures definition |
| 95 | */ |
76 | */ |
| 96 | typedef enum |
77 | typedef enum |
| 97 | { |
78 | { |
| 98 | HAL_DMA_STATE_RESET = 0x00, /*!< DMA not yet initialized or disabled */ |
79 | HAL_DMA_STATE_RESET = 0x00U, /*!< DMA not yet initialized or disabled */ |
| 99 | HAL_DMA_STATE_READY = 0x01, /*!< DMA initialized and ready for use */ |
80 | HAL_DMA_STATE_READY = 0x01U, /*!< DMA initialized and ready for use */ |
| 100 | HAL_DMA_STATE_BUSY = 0x02, /*!< DMA process is ongoing */ |
81 | HAL_DMA_STATE_BUSY = 0x02U, /*!< DMA process is ongoing */ |
| 101 | HAL_DMA_STATE_TIMEOUT = 0x03, /*!< DMA timeout state */ |
82 | HAL_DMA_STATE_TIMEOUT = 0x03U, /*!< DMA timeout state */ |
| 102 | }HAL_DMA_StateTypeDef; |
83 | }HAL_DMA_StateTypeDef; |
| 103 | 84 | ||
| 104 | /** |
85 | /** |
| 105 | * @brief HAL DMA Error Code structure definition |
86 | * @brief HAL DMA Error Code structure definition |
| 106 | */ |
87 | */ |
| 107 | typedef enum |
88 | typedef enum |
| 108 | { |
89 | { |
| 109 | HAL_DMA_FULL_TRANSFER = 0x00, /*!< Full transfer */ |
90 | HAL_DMA_FULL_TRANSFER = 0x00U, /*!< Full transfer */ |
| 110 | HAL_DMA_HALF_TRANSFER = 0x01 /*!< Half Transfer */ |
91 | HAL_DMA_HALF_TRANSFER = 0x01U /*!< Half Transfer */ |
| 111 | }HAL_DMA_LevelCompleteTypeDef; |
92 | }HAL_DMA_LevelCompleteTypeDef; |
| 112 | 93 | ||
| 113 | 94 | ||
| 114 | /** |
95 | /** |
| 115 | * @brief HAL DMA Callback ID structure definition |
96 | * @brief HAL DMA Callback ID structure definition |
| 116 | */ |
97 | */ |
| 117 | typedef enum |
98 | typedef enum |
| 118 | { |
99 | { |
| 119 | HAL_DMA_XFER_CPLT_CB_ID = 0x00, /*!< Full transfer */ |
100 | HAL_DMA_XFER_CPLT_CB_ID = 0x00U, /*!< Full transfer */ |
| 120 | HAL_DMA_XFER_HALFCPLT_CB_ID = 0x01, /*!< Half transfer */ |
101 | HAL_DMA_XFER_HALFCPLT_CB_ID = 0x01U, /*!< Half transfer */ |
| 121 | HAL_DMA_XFER_ERROR_CB_ID = 0x02, /*!< Error */ |
102 | HAL_DMA_XFER_ERROR_CB_ID = 0x02U, /*!< Error */ |
| 122 | HAL_DMA_XFER_ABORT_CB_ID = 0x03, /*!< Abort */ |
103 | HAL_DMA_XFER_ABORT_CB_ID = 0x03U, /*!< Abort */ |
| 123 | HAL_DMA_XFER_ALL_CB_ID = 0x04 /*!< All */ |
104 | HAL_DMA_XFER_ALL_CB_ID = 0x04U /*!< All */ |
| 124 | - | ||
| 125 | }HAL_DMA_CallbackIDTypeDef; |
105 | }HAL_DMA_CallbackIDTypeDef; |
| 126 | 106 | ||
| 127 | /** |
107 | /** |
| 128 | * @brief DMA handle Structure definition |
108 | * @brief DMA handle Structure definition |
| 129 | */ |
109 | */ |
| 130 | typedef struct __DMA_HandleTypeDef |
110 | typedef struct __DMA_HandleTypeDef |
| 131 | { |
111 | { |
| 132 | DMA_Channel_TypeDef *Instance; /*!< Register base address */ |
112 | DMA_Channel_TypeDef *Instance; /*!< Register base address */ |
| 133 | 113 | ||
| 134 | DMA_InitTypeDef Init; /*!< DMA communication parameters */ |
114 | DMA_InitTypeDef Init; /*!< DMA communication parameters */ |
| 135 | 115 | ||
| 136 | HAL_LockTypeDef Lock; /*!< DMA locking object */ |
116 | HAL_LockTypeDef Lock; /*!< DMA locking object */ |
| 137 | 117 | ||
| 138 | __IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */ |
118 | __IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */ |
| 139 | 119 | ||
| 140 | void *Parent; /*!< Parent object state */ |
120 | void *Parent; /*!< Parent object state */ |
| 141 | 121 | ||
| 142 | void (* XferCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */ |
122 | void (* XferCpltCallback)(struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer complete callback */ |
| 143 | 123 | ||
| 144 | void (* XferHalfCpltCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */ |
124 | void (* XferHalfCpltCallback)(struct __DMA_HandleTypeDef * hdma); /*!< DMA Half transfer complete callback */ |
| 145 | 125 | ||
| 146 | void (* XferErrorCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */ |
126 | void (* XferErrorCallback)(struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer error callback */ |
| 147 | 127 | ||
| 148 | void (* XferAbortCallback)( struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer abort callback */ |
128 | void (* XferAbortCallback)(struct __DMA_HandleTypeDef * hdma); /*!< DMA transfer abort callback */ |
| 149 | 129 | ||
| 150 | __IO uint32_t ErrorCode; /*!< DMA Error code */ |
130 | __IO uint32_t ErrorCode; /*!< DMA Error code */ |
| 151 | 131 | ||
| 152 | DMA_TypeDef *DmaBaseAddress; /*!< DMA Channel Base Address */ |
132 | DMA_TypeDef *DmaBaseAddress; /*!< DMA Channel Base Address */ |
| 153 | 133 | ||
| 154 | uint32_t ChannelIndex; /*!< DMA Channel Index */ |
134 | uint32_t ChannelIndex; /*!< DMA Channel Index */ |
| - | 135 | ||
| - | 136 | }DMA_HandleTypeDef; |
|
| 155 | 137 | ||
| 156 | } DMA_HandleTypeDef; |
- | |
| 157 | /** |
138 | /** |
| 158 | * @} |
139 | * @} |
| 159 | */ |
140 | */ |
| 160 | 141 | ||
| 161 | /* Exported constants --------------------------------------------------------*/ |
142 | /* Exported constants --------------------------------------------------------*/ |
| Line 165... | Line 146... | ||
| 165 | */ |
146 | */ |
| 166 | 147 | ||
| 167 | /** @defgroup DMA_Error_Code DMA Error Code |
148 | /** @defgroup DMA_Error_Code DMA Error Code |
| 168 | * @{ |
149 | * @{ |
| 169 | */ |
150 | */ |
| 170 | #define HAL_DMA_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ |
151 | #define HAL_DMA_ERROR_NONE 0x00000000U /*!< No error */ |
| 171 | #define HAL_DMA_ERROR_TE ((uint32_t)0x00000001) /*!< Transfer error */ |
152 | #define HAL_DMA_ERROR_TE 0x00000001U /*!< Transfer error */ |
| 172 | #define HAL_DMA_ERROR_NO_XFER ((uint32_t)0x00000004) /*!< no ongoing transfer */ |
153 | #define HAL_DMA_ERROR_NO_XFER 0x00000004U /*!< Abort requested with no Xfer ongoing */ |
| 173 | #define HAL_DMA_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout error */ |
154 | #define HAL_DMA_ERROR_TIMEOUT 0x00000020U /*!< Timeout error */ |
| 174 | #define HAL_DMA_ERROR_NOT_SUPPORTED ((uint32_t)0x00000100) /*!< Not supported mode */ |
155 | #define HAL_DMA_ERROR_NOT_SUPPORTED 0x00000100U /*!< Not supported mode */ |
| 175 | /** |
- | |
| 176 | * @} |
- | |
| 177 | */ |
- | |
| 178 | - | ||
| 179 | /** @defgroup DMA_request DMA request |
- | |
| 180 | * @{ |
- | |
| 181 | */ |
- | |
| 182 | #define DMA_REQUEST_0 ((uint32_t)0x00000000) |
- | |
| 183 | #define DMA_REQUEST_1 ((uint32_t)0x00000001) |
- | |
| 184 | #define DMA_REQUEST_2 ((uint32_t)0x00000002) |
- | |
| 185 | #define DMA_REQUEST_3 ((uint32_t)0x00000003) |
- | |
| 186 | #define DMA_REQUEST_4 ((uint32_t)0x00000004) |
- | |
| 187 | #define DMA_REQUEST_5 ((uint32_t)0x00000005) |
- | |
| 188 | #define DMA_REQUEST_6 ((uint32_t)0x00000006) |
- | |
| 189 | #define DMA_REQUEST_7 ((uint32_t)0x00000007) |
- | |
| 190 | 156 | ||
| 191 | /** |
157 | /** |
| 192 | * @} |
158 | * @} |
| 193 | */ |
159 | */ |
| 194 | 160 | ||
| 195 | /** @defgroup DMA_Data_transfer_direction DMA Data transfer direction |
161 | /** @defgroup DMA_Data_transfer_direction DMA Data transfer direction |
| 196 | * @{ |
162 | * @{ |
| 197 | */ |
163 | */ |
| 198 | #define DMA_PERIPH_TO_MEMORY ((uint32_t)0x00000000) /*!< Peripheral to memory direction */ |
164 | #define DMA_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */ |
| 199 | #define DMA_MEMORY_TO_PERIPH ((uint32_t)DMA_CCR_DIR) /*!< Memory to peripheral direction */ |
165 | #define DMA_MEMORY_TO_PERIPH DMA_CCR_DIR /*!< Memory to peripheral direction */ |
| 200 | #define DMA_MEMORY_TO_MEMORY ((uint32_t)DMA_CCR_MEM2MEM) /*!< Memory to memory direction */ |
166 | #define DMA_MEMORY_TO_MEMORY DMA_CCR_MEM2MEM /*!< Memory to memory direction */ |
| 201 | - | ||
| 202 | /** |
167 | /** |
| 203 | * @} |
168 | * @} |
| 204 | */ |
169 | */ |
| 205 | 170 | ||
| 206 | /** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode |
171 | /** @defgroup DMA_Peripheral_incremented_mode DMA Peripheral incremented mode |
| 207 | * @{ |
172 | * @{ |
| 208 | */ |
173 | */ |
| 209 | #define DMA_PINC_ENABLE ((uint32_t)DMA_CCR_PINC) /*!< Peripheral increment mode Enable */ |
174 | #define DMA_PINC_ENABLE DMA_CCR_PINC /*!< Peripheral increment mode Enable */ |
| 210 | #define DMA_PINC_DISABLE ((uint32_t)0x00000000) /*!< Peripheral increment mode Disable */ |
175 | #define DMA_PINC_DISABLE 0x00000000U /*!< Peripheral increment mode Disable */ |
| 211 | /** |
176 | /** |
| 212 | * @} |
177 | * @} |
| 213 | */ |
178 | */ |
| 214 | 179 | ||
| 215 | /** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode |
180 | /** @defgroup DMA_Memory_incremented_mode DMA Memory incremented mode |
| 216 | * @{ |
181 | * @{ |
| 217 | */ |
182 | */ |
| 218 | #define DMA_MINC_ENABLE ((uint32_t)DMA_CCR_MINC) /*!< Memory increment mode Enable */ |
183 | #define DMA_MINC_ENABLE DMA_CCR_MINC /*!< Memory increment mode Enable */ |
| 219 | #define DMA_MINC_DISABLE ((uint32_t)0x00000000) /*!< Memory increment mode Disable */ |
184 | #define DMA_MINC_DISABLE 0x00000000U /*!< Memory increment mode Disable */ |
| 220 | /** |
185 | /** |
| 221 | * @} |
186 | * @} |
| 222 | */ |
187 | */ |
| 223 | 188 | ||
| 224 | /** @defgroup DMA_Peripheral_data_size DMA Peripheral data size |
189 | /** @defgroup DMA_Peripheral_data_size DMA Peripheral data size |
| 225 | * @{ |
190 | * @{ |
| 226 | */ |
191 | */ |
| 227 | #define DMA_PDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Peripheral data alignment: Byte */ |
192 | #define DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment : Byte */ |
| 228 | #define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */ |
193 | #define DMA_PDATAALIGN_HALFWORD DMA_CCR_PSIZE_0 /*!< Peripheral data alignment : HalfWord */ |
| 229 | #define DMA_PDATAALIGN_WORD ((uint32_t)DMA_CCR_PSIZE_1) /*!< Peripheral data alignment: Word */ |
194 | #define DMA_PDATAALIGN_WORD DMA_CCR_PSIZE_1 /*!< Peripheral data alignment : Word */ |
| 230 | /** |
195 | /** |
| 231 | * @} |
196 | * @} |
| 232 | */ |
197 | */ |
| 233 | 198 | ||
| 234 | /** @defgroup DMA_Memory_data_size DMA Memory data size |
199 | /** @defgroup DMA_Memory_data_size DMA Memory data size |
| 235 | * @{ |
200 | * @{ |
| 236 | */ |
201 | */ |
| 237 | #define DMA_MDATAALIGN_BYTE ((uint32_t)0x00000000) /*!< Memory data alignment: Byte */ |
202 | #define DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment : Byte */ |
| 238 | #define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_CCR_MSIZE_0) /*!< Memory data alignment: HalfWord */ |
203 | #define DMA_MDATAALIGN_HALFWORD DMA_CCR_MSIZE_0 /*!< Memory data alignment : HalfWord */ |
| 239 | #define DMA_MDATAALIGN_WORD ((uint32_t)DMA_CCR_MSIZE_1) /*!< Memory data alignment: Word */ |
204 | #define DMA_MDATAALIGN_WORD DMA_CCR_MSIZE_1 /*!< Memory data alignment : Word */ |
| 240 | /** |
205 | /** |
| 241 | * @} |
206 | * @} |
| 242 | */ |
207 | */ |
| 243 | 208 | ||
| 244 | /** @defgroup DMA_mode DMA mode |
209 | /** @defgroup DMA_mode DMA mode |
| 245 | * @{ |
210 | * @{ |
| 246 | */ |
211 | */ |
| 247 | #define DMA_NORMAL ((uint32_t)0x00000000) /*!< Normal mode */ |
212 | #define DMA_NORMAL 0x00000000U /*!< Normal mode */ |
| 248 | #define DMA_CIRCULAR ((uint32_t)DMA_CCR_CIRC) /*!< Circular mode */ |
213 | #define DMA_CIRCULAR DMA_CCR_CIRC /*!< Circular mode */ |
| 249 | /** |
214 | /** |
| 250 | * @} |
215 | * @} |
| 251 | */ |
216 | */ |
| 252 | 217 | ||
| 253 | /** @defgroup DMA_Priority_level DMA Priority level |
218 | /** @defgroup DMA_Priority_level DMA Priority level |
| 254 | * @{ |
219 | * @{ |
| 255 | */ |
220 | */ |
| 256 | #define DMA_PRIORITY_LOW ((uint32_t)0x00000000) /*!< Priority level : Low */ |
221 | #define DMA_PRIORITY_LOW 0x00000000U /*!< Priority level : Low */ |
| 257 | #define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_CCR_PL_0) /*!< Priority level : Medium */ |
222 | #define DMA_PRIORITY_MEDIUM DMA_CCR_PL_0 /*!< Priority level : Medium */ |
| 258 | #define DMA_PRIORITY_HIGH ((uint32_t)DMA_CCR_PL_1) /*!< Priority level : High */ |
223 | #define DMA_PRIORITY_HIGH DMA_CCR_PL_1 /*!< Priority level : High */ |
| 259 | #define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_CCR_PL) /*!< Priority level : Very_High */ |
224 | #define DMA_PRIORITY_VERY_HIGH DMA_CCR_PL /*!< Priority level : Very_High */ |
| 260 | /** |
225 | /** |
| 261 | * @} |
226 | * @} |
| 262 | */ |
227 | */ |
| 263 | 228 | ||
| 264 | 229 | ||
| 265 | /** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions |
230 | /** @defgroup DMA_interrupt_enable_definitions DMA interrupt enable definitions |
| 266 | * @{ |
231 | * @{ |
| 267 | */ |
232 | */ |
| 268 | #define DMA_IT_TC ((uint32_t)DMA_CCR_TCIE) |
233 | #define DMA_IT_TC DMA_CCR_TCIE |
| 269 | #define DMA_IT_HT ((uint32_t)DMA_CCR_HTIE) |
234 | #define DMA_IT_HT DMA_CCR_HTIE |
| 270 | #define DMA_IT_TE ((uint32_t)DMA_CCR_TEIE) |
235 | #define DMA_IT_TE DMA_CCR_TEIE |
| 271 | /** |
236 | /** |
| 272 | * @} |
237 | * @} |
| 273 | */ |
238 | */ |
| 274 | 239 | ||
| 275 | /** @defgroup DMA_flag_definitions DMA flag definitions |
240 | /** @defgroup DMA_flag_definitions DMA flag definitions |
| 276 | * @{ |
241 | * @{ |
| 277 | */ |
242 | */ |
| 278 | #define DMA_FLAG_GL1 ((uint32_t)0x00000001) |
243 | #define DMA_FLAG_GL1 DMA_ISR_GIF1 |
| 279 | #define DMA_FLAG_TC1 ((uint32_t)0x00000002) |
244 | #define DMA_FLAG_TC1 DMA_ISR_TCIF1 |
| 280 | #define DMA_FLAG_HT1 ((uint32_t)0x00000004) |
245 | #define DMA_FLAG_HT1 DMA_ISR_HTIF1 |
| 281 | #define DMA_FLAG_TE1 ((uint32_t)0x00000008) |
246 | #define DMA_FLAG_TE1 DMA_ISR_TEIF1 |
| 282 | #define DMA_FLAG_GL2 ((uint32_t)0x00000010) |
247 | #define DMA_FLAG_GL2 DMA_ISR_GIF2 |
| 283 | #define DMA_FLAG_TC2 ((uint32_t)0x00000020) |
248 | #define DMA_FLAG_TC2 DMA_ISR_TCIF2 |
| 284 | #define DMA_FLAG_HT2 ((uint32_t)0x00000040) |
249 | #define DMA_FLAG_HT2 DMA_ISR_HTIF2 |
| 285 | #define DMA_FLAG_TE2 ((uint32_t)0x00000080) |
250 | #define DMA_FLAG_TE2 DMA_ISR_TEIF2 |
| 286 | #define DMA_FLAG_GL3 ((uint32_t)0x00000100) |
251 | #define DMA_FLAG_GL3 DMA_ISR_GIF3 |
| 287 | #define DMA_FLAG_TC3 ((uint32_t)0x00000200) |
252 | #define DMA_FLAG_TC3 DMA_ISR_TCIF3 |
| 288 | #define DMA_FLAG_HT3 ((uint32_t)0x00000400) |
253 | #define DMA_FLAG_HT3 DMA_ISR_HTIF3 |
| 289 | #define DMA_FLAG_TE3 ((uint32_t)0x00000800) |
254 | #define DMA_FLAG_TE3 DMA_ISR_TEIF3 |
| 290 | #define DMA_FLAG_GL4 ((uint32_t)0x00001000) |
255 | #define DMA_FLAG_GL4 DMA_ISR_GIF4 |
| 291 | #define DMA_FLAG_TC4 ((uint32_t)0x00002000) |
256 | #define DMA_FLAG_TC4 DMA_ISR_TCIF4 |
| 292 | #define DMA_FLAG_HT4 ((uint32_t)0x00004000) |
257 | #define DMA_FLAG_HT4 DMA_ISR_HTIF4 |
| 293 | #define DMA_FLAG_TE4 ((uint32_t)0x00008000) |
258 | #define DMA_FLAG_TE4 DMA_ISR_TEIF4 |
| 294 | #define DMA_FLAG_GL5 ((uint32_t)0x00010000) |
259 | #define DMA_FLAG_GL5 DMA_ISR_GIF5 |
| 295 | #define DMA_FLAG_TC5 ((uint32_t)0x00020000) |
260 | #define DMA_FLAG_TC5 DMA_ISR_TCIF5 |
| 296 | #define DMA_FLAG_HT5 ((uint32_t)0x00040000) |
261 | #define DMA_FLAG_HT5 DMA_ISR_HTIF5 |
| 297 | #define DMA_FLAG_TE5 ((uint32_t)0x00080000) |
262 | #define DMA_FLAG_TE5 DMA_ISR_TEIF5 |
| 298 | #define DMA_FLAG_GL6 ((uint32_t)0x00100000) |
263 | #define DMA_FLAG_GL6 DMA_ISR_GIF6 |
| 299 | #define DMA_FLAG_TC6 ((uint32_t)0x00200000) |
264 | #define DMA_FLAG_TC6 DMA_ISR_TCIF6 |
| 300 | #define DMA_FLAG_HT6 ((uint32_t)0x00400000) |
265 | #define DMA_FLAG_HT6 DMA_ISR_HTIF6 |
| 301 | #define DMA_FLAG_TE6 ((uint32_t)0x00800000) |
266 | #define DMA_FLAG_TE6 DMA_ISR_TEIF6 |
| 302 | #define DMA_FLAG_GL7 ((uint32_t)0x01000000) |
267 | #define DMA_FLAG_GL7 DMA_ISR_GIF7 |
| 303 | #define DMA_FLAG_TC7 ((uint32_t)0x02000000) |
268 | #define DMA_FLAG_TC7 DMA_ISR_TCIF7 |
| 304 | #define DMA_FLAG_HT7 ((uint32_t)0x04000000) |
269 | #define DMA_FLAG_HT7 DMA_ISR_HTIF7 |
| 305 | #define DMA_FLAG_TE7 ((uint32_t)0x08000000) |
270 | #define DMA_FLAG_TE7 DMA_ISR_TEIF7 |
| 306 | /** |
271 | /** |
| 307 | * @} |
272 | * @} |
| 308 | */ |
273 | */ |
| 309 | 274 | ||
| 310 | /** |
275 | /** |
| 311 | * @} |
276 | * @} |
| 312 | */ |
277 | */ |
| 313 | 278 | ||
| 314 | /* Exported macros -----------------------------------------------------------*/ |
279 | /* Exported macros -----------------------------------------------------------*/ |
| 315 | /** @defgroup DMA_Exported_Macros DMA Exported Macros |
280 | /** @defgroup DMA_Exported_Macros DMA Exported Macros |
| 316 | * @{ |
281 | * @{ |
| 317 | */ |
282 | */ |
| 318 | 283 | ||
| 319 | /** @brief Reset DMA handle state |
284 | /** @brief Reset DMA handle state. |
| 320 | * @param __HANDLE__: DMA handle |
285 | * @param __HANDLE__ DMA handle |
| 321 | * @retval None |
286 | * @retval None |
| 322 | */ |
287 | */ |
| 323 | #define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET) |
288 | #define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA_STATE_RESET) |
| 324 | 289 | ||
| 325 | /** |
290 | /** |
| 326 | * @brief Enable the specified DMA Channel. |
291 | * @brief Enable the specified DMA Channel. |
| 327 | * @param __HANDLE__: DMA handle |
292 | * @param __HANDLE__ DMA handle |
| 328 | * @retval None |
293 | * @retval None |
| 329 | */ |
294 | */ |
| 330 | #define __HAL_DMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR |= DMA_CCR_EN) |
295 | #define __HAL_DMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR |= DMA_CCR_EN) |
| 331 | 296 | ||
| 332 | /** |
297 | /** |
| 333 | * @brief Disable the specified DMA Channel. |
298 | * @brief Disable the specified DMA Channel. |
| 334 | * @param __HANDLE__: DMA handle |
299 | * @param __HANDLE__ DMA handle |
| 335 | * @retval None |
300 | * @retval None |
| 336 | */ |
301 | */ |
| 337 | #define __HAL_DMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR &= ~DMA_CCR_EN) |
302 | #define __HAL_DMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR &= ~DMA_CCR_EN) |
| 338 | 303 | ||
| 339 | 304 | ||
| Line 342... | Line 307... | ||
| 342 | defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || \ |
307 | defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || \ |
| 343 | defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) |
308 | defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) |
| 344 | 309 | ||
| 345 | /** |
310 | /** |
| 346 | * @brief Return the current DMA Channel transfer complete flag. |
311 | * @brief Return the current DMA Channel transfer complete flag. |
| 347 | * @param __HANDLE__: DMA handle |
312 | * @param __HANDLE__ DMA handle |
| 348 | * @retval The specified transfer complete flag index. |
313 | * @retval The specified transfer complete flag index. |
| 349 | */ |
314 | */ |
| 350 | 315 | ||
| 351 | #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \ |
316 | #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \ |
| 352 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\ |
317 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\ |
| Line 362... | Line 327... | ||
| 362 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\ |
327 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\ |
| 363 | DMA_FLAG_TC7) |
328 | DMA_FLAG_TC7) |
| 364 | 329 | ||
| 365 | /** |
330 | /** |
| 366 | * @brief Return the current DMA Channel half transfer complete flag. |
331 | * @brief Return the current DMA Channel half transfer complete flag. |
| 367 | * @param __HANDLE__: DMA handle |
332 | * @param __HANDLE__ DMA handle |
| 368 | * @retval The specified half transfer complete flag index. |
333 | * @retval The specified half transfer complete flag index. |
| 369 | */ |
334 | */ |
| 370 | #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\ |
335 | #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\ |
| 371 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\ |
336 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\ |
| 372 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_HT1 :\ |
337 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_HT1 :\ |
| 373 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\ |
338 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\ |
| 374 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_HT2 :\ |
339 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel2))? DMA_FLAG_HT2 :\ |
| Line 381... | Line 346... | ||
| 381 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\ |
346 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\ |
| 382 | DMA_FLAG_HT7) |
347 | DMA_FLAG_HT7) |
| 383 | 348 | ||
| 384 | /** |
349 | /** |
| 385 | * @brief Return the current DMA Channel transfer error flag. |
350 | * @brief Return the current DMA Channel transfer error flag. |
| 386 | * @param __HANDLE__: DMA handle |
351 | * @param __HANDLE__ DMA handle |
| 387 | * @retval The specified transfer error flag index. |
352 | * @retval The specified transfer error flag index. |
| 388 | */ |
353 | */ |
| 389 | #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\ |
354 | #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\ |
| 390 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\ |
355 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\ |
| 391 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_TE1 :\ |
356 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_FLAG_TE1 :\ |
| Line 400... | Line 365... | ||
| 400 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\ |
365 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\ |
| 401 | DMA_FLAG_TE7) |
366 | DMA_FLAG_TE7) |
| 402 | 367 | ||
| 403 | /** |
368 | /** |
| 404 | * @brief Return the current DMA Channel Global interrupt flag. |
369 | * @brief Return the current DMA Channel Global interrupt flag. |
| 405 | * @param __HANDLE__: DMA handle |
370 | * @param __HANDLE__ DMA handle |
| 406 | * @retval The specified transfer error flag index. |
371 | * @retval The specified transfer error flag index. |
| 407 | */ |
372 | */ |
| 408 | #define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\ |
373 | #define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\ |
| 409 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_ISR_GIF1 :\ |
374 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_ISR_GIF1 :\ |
| 410 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_ISR_GIF1 :\ |
375 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Channel1))? DMA_ISR_GIF1 :\ |
| Line 419... | Line 384... | ||
| 419 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_ISR_GIF6 :\ |
384 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_ISR_GIF6 :\ |
| 420 | DMA_ISR_GIF7) |
385 | DMA_ISR_GIF7) |
| 421 | 386 | ||
| 422 | /** |
387 | /** |
| 423 | * @brief Get the DMA Channel pending flags. |
388 | * @brief Get the DMA Channel pending flags. |
| 424 | * @param __HANDLE__: DMA handle |
389 | * @param __HANDLE__ DMA handle |
| 425 | * @param __FLAG__: Get the specified flag. |
390 | * @param __FLAG__ Get the specified flag. |
| 426 | * This parameter can be any combination of the following values: |
391 | * This parameter can be any combination of the following values: |
| 427 | * @arg DMA_FLAG_TCx: Transfer complete flag |
392 | * @arg DMA_FLAG_TCx: Transfer complete flag |
| 428 | * @arg DMA_FLAG_HTx: Half transfer complete flag |
393 | * @arg DMA_FLAG_HTx: Half transfer complete flag |
| 429 | * @arg DMA_FLAG_TEx: Transfer error flag |
394 | * @arg DMA_FLAG_TEx: Transfer error flag |
| 430 | * @arg DMA_FLAG_GLx: Global interrupt flag |
395 | * @arg DMA_FLAG_GLx: Global interrupt flag |
| Line 434... | Line 399... | ||
| 434 | #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (((uint32_t)((__HANDLE__)->Instance) > ((uint32_t)DMA1_Channel7))? \ |
399 | #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (((uint32_t)((__HANDLE__)->Instance) > ((uint32_t)DMA1_Channel7))? \ |
| 435 | (DMA2->ISR & (__FLAG__)) : (DMA1->ISR & (__FLAG__))) |
400 | (DMA2->ISR & (__FLAG__)) : (DMA1->ISR & (__FLAG__))) |
| 436 | 401 | ||
| 437 | /** |
402 | /** |
| 438 | * @brief Clear the DMA Channel pending flags. |
403 | * @brief Clear the DMA Channel pending flags. |
| 439 | * @param __HANDLE__: DMA handle |
404 | * @param __HANDLE__ DMA handle |
| 440 | * @param __FLAG__: specifies the flag to clear. |
405 | * @param __FLAG__ specifies the flag to clear. |
| 441 | * This parameter can be any combination of the following values: |
406 | * This parameter can be any combination of the following values: |
| 442 | * @arg DMA_FLAG_TCx: Transfer complete flag |
407 | * @arg DMA_FLAG_TCx: Transfer complete flag |
| 443 | * @arg DMA_FLAG_HTx: Half transfer complete flag |
408 | * @arg DMA_FLAG_HTx: Half transfer complete flag |
| 444 | * @arg DMA_FLAG_TEx: Transfer error flag |
409 | * @arg DMA_FLAG_TEx: Transfer error flag |
| 445 | * @arg DMA_FLAG_GLx: Global interrupt flag |
410 | * @arg DMA_FLAG_GLx: Global interrupt flag |
| Line 450... | Line 415... | ||
| 450 | (DMA2->IFCR = (__FLAG__)) : (DMA1->IFCR = (__FLAG__))) |
415 | (DMA2->IFCR = (__FLAG__)) : (DMA1->IFCR = (__FLAG__))) |
| 451 | 416 | ||
| 452 | #else |
417 | #else |
| 453 | /** |
418 | /** |
| 454 | * @brief Return the current DMA Channel transfer complete flag. |
419 | * @brief Return the current DMA Channel transfer complete flag. |
| 455 | * @param __HANDLE__: DMA handle |
420 | * @param __HANDLE__ DMA handle |
| 456 | * @retval The specified transfer complete flag index. |
421 | * @retval The specified transfer complete flag index. |
| 457 | */ |
422 | */ |
| 458 | 423 | ||
| 459 | #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \ |
424 | #define __HAL_DMA_GET_TC_FLAG_INDEX(__HANDLE__) \ |
| 460 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\ |
425 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TC1 :\ |
| Line 465... | Line 430... | ||
| 465 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\ |
430 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TC6 :\ |
| 466 | DMA_FLAG_TC7) |
431 | DMA_FLAG_TC7) |
| 467 | 432 | ||
| 468 | /** |
433 | /** |
| 469 | * @brief Return the current DMA Channel half transfer complete flag. |
434 | * @brief Return the current DMA Channel half transfer complete flag. |
| 470 | * @param __HANDLE__: DMA handle |
435 | * @param __HANDLE__ DMA handle |
| 471 | * @retval The specified half transfer complete flag index. |
436 | * @retval The specified half transfer complete flag index. |
| 472 | */ |
437 | */ |
| 473 | #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\ |
438 | #define __HAL_DMA_GET_HT_FLAG_INDEX(__HANDLE__)\ |
| 474 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\ |
439 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_HT1 :\ |
| 475 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\ |
440 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_HT2 :\ |
| 476 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_HT3 :\ |
441 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel3))? DMA_FLAG_HT3 :\ |
| 477 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_HT4 :\ |
442 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel4))? DMA_FLAG_HT4 :\ |
| Line 479... | Line 444... | ||
| 479 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\ |
444 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_HT6 :\ |
| 480 | DMA_FLAG_HT7) |
445 | DMA_FLAG_HT7) |
| 481 | 446 | ||
| 482 | /** |
447 | /** |
| 483 | * @brief Return the current DMA Channel transfer error flag. |
448 | * @brief Return the current DMA Channel transfer error flag. |
| 484 | * @param __HANDLE__: DMA handle |
449 | * @param __HANDLE__ DMA handle |
| 485 | * @retval The specified transfer error flag index. |
450 | * @retval The specified transfer error flag index. |
| 486 | */ |
451 | */ |
| 487 | #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\ |
452 | #define __HAL_DMA_GET_TE_FLAG_INDEX(__HANDLE__)\ |
| 488 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\ |
453 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_FLAG_TE1 :\ |
| 489 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\ |
454 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_FLAG_TE2 :\ |
| Line 493... | Line 458... | ||
| 493 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\ |
458 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_FLAG_TE6 :\ |
| 494 | DMA_FLAG_TE7) |
459 | DMA_FLAG_TE7) |
| 495 | 460 | ||
| 496 | /** |
461 | /** |
| 497 | * @brief Return the current DMA Channel Global interrupt flag. |
462 | * @brief Return the current DMA Channel Global interrupt flag. |
| 498 | * @param __HANDLE__: DMA handle |
463 | * @param __HANDLE__ DMA handle |
| 499 | * @retval The specified transfer error flag index. |
464 | * @retval The specified transfer error flag index. |
| 500 | */ |
465 | */ |
| 501 | #define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\ |
466 | #define __HAL_DMA_GET_GI_FLAG_INDEX(__HANDLE__)\ |
| 502 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_ISR_GIF1 :\ |
467 | (((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel1))? DMA_ISR_GIF1 :\ |
| 503 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_ISR_GIF2 :\ |
468 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel2))? DMA_ISR_GIF2 :\ |
| Line 507... | Line 472... | ||
| 507 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_ISR_GIF6 :\ |
472 | ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Channel6))? DMA_ISR_GIF6 :\ |
| 508 | DMA_ISR_GIF7) |
473 | DMA_ISR_GIF7) |
| 509 | 474 | ||
| 510 | /** |
475 | /** |
| 511 | * @brief Get the DMA Channel pending flags. |
476 | * @brief Get the DMA Channel pending flags. |
| 512 | * @param __HANDLE__: DMA handle |
477 | * @param __HANDLE__ DMA handle |
| 513 | * @param __FLAG__: Get the specified flag. |
478 | * @param __FLAG__ Get the specified flag. |
| 514 | * This parameter can be any combination of the following values: |
479 | * This parameter can be any combination of the following values: |
| 515 | * @arg DMA_FLAG_TCx: Transfer complete flag |
480 | * @arg DMA_FLAG_TCIFx: Transfer complete flag |
| 516 | * @arg DMA_FLAG_HTx: Half transfer complete flag |
481 | * @arg DMA_FLAG_HTIFx: Half transfer complete flag |
| 517 | * @arg DMA_FLAG_TEx: Transfer error flag |
482 | * @arg DMA_FLAG_TEIFx: Transfer error flag |
| 518 | * @arg DMA_FLAG_GLx: Global interrupt flag |
483 | * @arg DMA_ISR_GIFx: Global interrupt flag |
| 519 | * Where x can be from 1 to 7 to select the DMA Channel x flag. |
484 | * Where x can be from 1 to 7 to select the DMA Channel x flag. |
| 520 | * @retval The state of FLAG (SET or RESET). |
485 | * @retval The state of FLAG (SET or RESET). |
| 521 | */ |
486 | */ |
| 522 | #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (DMA1->ISR & (__FLAG__)) |
487 | #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) (DMA1->ISR & (__FLAG__)) |
| 523 | 488 | ||
| 524 | /** |
489 | /** |
| 525 | * @brief Clear the DMA Channel pending flags. |
490 | * @brief Clear the DMA Channel pending flags. |
| 526 | * @param __HANDLE__: DMA handle |
491 | * @param __HANDLE__ DMA handle |
| 527 | * @param __FLAG__: specifies the flag to clear. |
492 | * @param __FLAG__ specifies the flag to clear. |
| 528 | * This parameter can be any combination of the following values: |
493 | * This parameter can be any combination of the following values: |
| 529 | * @arg DMA_FLAG_TCx: Transfer complete flag |
494 | * @arg DMA_FLAG_TCx: Transfer complete flag |
| 530 | * @arg DMA_FLAG_HTx: Half transfer complete flag |
495 | * @arg DMA_FLAG_HTx: Half transfer complete flag |
| 531 | * @arg DMA_FLAG_TEx: Transfer error flag |
496 | * @arg DMA_FLAG_TEx: Transfer error flag |
| 532 | * @arg DMA_FLAG_GLx: Global interrupt flag |
497 | * @arg DMA_FLAG_GLx: Global interrupt flag |
| Line 537... | Line 502... | ||
| 537 | 502 | ||
| 538 | #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ |
503 | #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ |
| 539 | 504 | ||
| 540 | /** |
505 | /** |
| 541 | * @brief Enable the specified DMA Channel interrupts. |
506 | * @brief Enable the specified DMA Channel interrupts. |
| 542 | * @param __HANDLE__: DMA handle |
507 | * @param __HANDLE__ DMA handle |
| 543 | * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled. |
508 | * @param __INTERRUPT__ specifies the DMA interrupt sources to be enabled or disabled. |
| 544 | * This parameter can be any combination of the following values: |
509 | * This parameter can be any combination of the following values: |
| 545 | * @arg DMA_IT_TC: Transfer complete interrupt mask |
510 | * @arg DMA_IT_TC: Transfer complete interrupt mask |
| 546 | * @arg DMA_IT_HT: Half transfer complete interrupt mask |
511 | * @arg DMA_IT_HT: Half transfer complete interrupt mask |
| 547 | * @arg DMA_IT_TE: Transfer error interrupt mask |
512 | * @arg DMA_IT_TE: Transfer error interrupt mask |
| 548 | * @retval None |
513 | * @retval None |
| 549 | */ |
514 | */ |
| 550 | #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR |= (__INTERRUPT__)) |
515 | #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR |= (__INTERRUPT__)) |
| 551 | 516 | ||
| 552 | /** |
517 | /** |
| 553 | * @brief Disable the specified DMA Channel interrupts. |
518 | * @brief Disable the specified DMA Channel interrupts. |
| 554 | * @param __HANDLE__: DMA handle |
519 | * @param __HANDLE__ DMA handle |
| 555 | * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled. |
520 | * @param __INTERRUPT__ specifies the DMA interrupt sources to be enabled or disabled. |
| 556 | * This parameter can be any combination of the following values: |
521 | * This parameter can be any combination of the following values: |
| 557 | * @arg DMA_IT_TC: Transfer complete interrupt mask |
522 | * @arg DMA_IT_TC: Transfer complete interrupt mask |
| 558 | * @arg DMA_IT_HT: Half transfer complete interrupt mask |
523 | * @arg DMA_IT_HT: Half transfer complete interrupt mask |
| 559 | * @arg DMA_IT_TE: Transfer error interrupt mask |
524 | * @arg DMA_IT_TE: Transfer error interrupt mask |
| 560 | * @retval None |
525 | * @retval None |
| 561 | */ |
526 | */ |
| 562 | #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR &= ~(__INTERRUPT__)) |
527 | #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR &= ~(__INTERRUPT__)) |
| 563 | 528 | ||
| 564 | /** |
529 | /** |
| 565 | * @brief Check whether the specified DMA Channel interrupt is enabled or not. |
530 | * @brief Check whether the specified DMA Channel interrupt is enabled or not. |
| 566 | * @param __HANDLE__: DMA handle |
531 | * @param __HANDLE__ DMA handle |
| 567 | * @param __INTERRUPT__: specifies the DMA interrupt source to check. |
532 | * @param __INTERRUPT__ specifies the DMA interrupt source to check. |
| 568 | * This parameter can be one of the following values: |
533 | * This parameter can be one of the following values: |
| 569 | * @arg DMA_IT_TC: Transfer complete interrupt mask |
534 | * @arg DMA_IT_TC: Transfer complete interrupt mask |
| 570 | * @arg DMA_IT_HT: Half transfer complete interrupt mask |
535 | * @arg DMA_IT_HT: Half transfer complete interrupt mask |
| 571 | * @arg DMA_IT_TE: Transfer error interrupt mask |
536 | * @arg DMA_IT_TE: Transfer error interrupt mask |
| 572 | * @retval The state of DMA_IT (SET or RESET). |
537 | * @retval The state of DMA_IT (SET or RESET). |
| 573 | */ |
538 | */ |
| 574 | #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CCR & (__INTERRUPT__))) |
539 | #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CCR & (__INTERRUPT__))) |
| 575 | 540 | ||
| 576 | /** |
541 | /** |
| 577 | * @brief Return the number of remaining data units in the current DMA Channel transfer. |
542 | * @brief Return the number of remaining data units in the current DMA Channel transfer. |
| 578 | * @param __HANDLE__: DMA handle |
543 | * @param __HANDLE__ DMA handle |
| 579 | * @retval The number of remaining data units in the current DMA Channel transfer. |
544 | * @retval The number of remaining data units in the current DMA Channel transfer. |
| 580 | */ |
545 | */ |
| 581 | #define __HAL_DMA_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNDTR) |
546 | #define __HAL_DMA_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNDTR) |
| 582 | 547 | ||
| 583 | /** |
548 | /** |
| Line 606... | Line 571... | ||
| 606 | /* IO operation functions *****************************************************/ |
571 | /* IO operation functions *****************************************************/ |
| 607 | HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); |
572 | HAL_StatusTypeDef HAL_DMA_Start (DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); |
| 608 | HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); |
573 | HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength); |
| 609 | HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma); |
574 | HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma); |
| 610 | HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma); |
575 | HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma); |
| 611 | HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout); |
576 | HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, HAL_DMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout); |
| 612 | void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma); |
577 | void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma); |
| 613 | HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)( DMA_HandleTypeDef * _hdma)); |
578 | HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID, void (* pCallback)( DMA_HandleTypeDef * _hdma)); |
| 614 | HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID); |
579 | HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *hdma, HAL_DMA_CallbackIDTypeDef CallbackID); |
| 615 | 580 | ||
| 616 | /** |
581 | /** |
| 617 | * @} |
582 | * @} |
| Line 636... | Line 601... | ||
| 636 | * @{ |
601 | * @{ |
| 637 | */ |
602 | */ |
| 638 | 603 | ||
| 639 | #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \ |
604 | #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \ |
| 640 | ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \ |
605 | ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \ |
| 641 | ((DIRECTION) == DMA_MEMORY_TO_MEMORY)) |
606 | ((DIRECTION) == DMA_MEMORY_TO_MEMORY)) |
| 642 | 607 | ||
| 643 | #define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1) && ((SIZE) < 0x10000)) |
608 | #define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1U) && ((SIZE) < 0x10000U)) |
| 644 | 609 | ||
| 645 | #define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \ |
610 | #define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PINC_ENABLE) || \ |
| 646 | ((STATE) == DMA_PINC_DISABLE)) |
611 | ((STATE) == DMA_PINC_DISABLE)) |
| 647 | 612 | ||
| 648 | #define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \ |
613 | #define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MINC_ENABLE) || \ |
| 649 | ((STATE) == DMA_MINC_DISABLE)) |
614 | ((STATE) == DMA_MINC_DISABLE)) |
| 650 | 615 | ||
| 651 | #define IS_DMA_ALL_REQUEST(REQUEST) (((REQUEST) == DMA_REQUEST_0) || \ |
- | |
| 652 | ((REQUEST) == DMA_REQUEST_1) || \ |
- | |
| 653 | ((REQUEST) == DMA_REQUEST_2) || \ |
- | |
| 654 | ((REQUEST) == DMA_REQUEST_3) || \ |
- | |
| 655 | ((REQUEST) == DMA_REQUEST_4) || \ |
- | |
| 656 | ((REQUEST) == DMA_REQUEST_5) || \ |
- | |
| 657 | ((REQUEST) == DMA_REQUEST_6) || \ |
- | |
| 658 | ((REQUEST) == DMA_REQUEST_7)) |
- | |
| 659 | #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \ |
616 | #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PDATAALIGN_BYTE) || \ |
| 660 | ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \ |
617 | ((SIZE) == DMA_PDATAALIGN_HALFWORD) || \ |
| 661 | ((SIZE) == DMA_PDATAALIGN_WORD)) |
618 | ((SIZE) == DMA_PDATAALIGN_WORD)) |
| 662 | 619 | ||
| 663 | #define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \ |
620 | #define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MDATAALIGN_BYTE) || \ |
| 664 | ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \ |
621 | ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \ |
| 665 | ((SIZE) == DMA_MDATAALIGN_WORD )) |
622 | ((SIZE) == DMA_MDATAALIGN_WORD )) |
| 666 | 623 | ||
| 667 | #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \ |
624 | #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \ |
| 668 | ((MODE) == DMA_CIRCULAR)) |
625 | ((MODE) == DMA_CIRCULAR)) |
| 669 | 626 | ||
| 670 | #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \ |
627 | #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \ |
| 671 | ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \ |
628 | ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \ |
| 672 | ((PRIORITY) == DMA_PRIORITY_HIGH) || \ |
629 | ((PRIORITY) == DMA_PRIORITY_HIGH) || \ |
| 673 | ((PRIORITY) == DMA_PRIORITY_VERY_HIGH)) |
630 | ((PRIORITY) == DMA_PRIORITY_VERY_HIGH)) |
| 674 | 631 | ||
| 675 | /** |
632 | /** |
| 676 | * @} |
633 | * @} |
| 677 | */ |
634 | */ |
| 678 | 635 | ||
| 679 | /* Private functions ---------------------------------------------------------*/ |
636 | /* Private functions ---------------------------------------------------------*/ |
| 680 | 637 | ||
| 681 | /** |
638 | /** |
| 682 | * @} |
639 | * @} |
| 683 | */ |
640 | */ |
| 684 | 641 | ||
| 685 | /** |
642 | /** |
| 686 | * @} |
643 | * @} |
| 687 | */ |
644 | */ |
| 688 | 645 | ||
| 689 | #ifdef __cplusplus |
646 | #ifdef __cplusplus |
| 690 | } |
647 | } |
| 691 | #endif |
648 | #endif |
| 692 | 649 | ||
| 693 | #endif /* __STM32L1xx_HAL_DMA_H */ |
650 | #endif /* STM32L1xx_HAL_DMA_H */ |
| 694 | 651 | ||
| 695 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
652 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |