version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_NUCLEO_L152RE/stm32l1xx_dma.h@81:7d30d6019079, 2014-03-19 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Mar 19 18:28:32 2014 +0000
- Revision:
- 81:7d30d6019079
- Parent:
- 77:869cf507173a
Release 81 of the mbed library
Main changes:
- Updates and fixes for many targets
- LPC1768: serial interface code fixes
- nRF51822 targets now output a .hex file
- More exporters
- More flexible GPIO API
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
emilmont | 77:869cf507173a | 3 | * @file stm32l1xx_dma.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
emilmont | 77:869cf507173a | 5 | * @version V1.3.0 |
emilmont | 77:869cf507173a | 6 | * @date 31-January-2014 |
emilmont | 77:869cf507173a | 7 | * @brief This file contains all the functions prototypes for the DMA firmware |
emilmont | 77:869cf507173a | 8 | * library. |
emilmont | 77:869cf507173a | 9 | ****************************************************************************** |
emilmont | 77:869cf507173a | 10 | * @attention |
emilmont | 77:869cf507173a | 11 | * |
bogdanm | 81:7d30d6019079 | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 13 | * |
bogdanm | 81:7d30d6019079 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 81:7d30d6019079 | 15 | * are permitted provided that the following conditions are met: |
bogdanm | 81:7d30d6019079 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 81:7d30d6019079 | 17 | * this list of conditions and the following disclaimer. |
bogdanm | 81:7d30d6019079 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 81:7d30d6019079 | 19 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 81:7d30d6019079 | 20 | * and/or other materials provided with the distribution. |
bogdanm | 81:7d30d6019079 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 81:7d30d6019079 | 22 | * may be used to endorse or promote products derived from this software |
bogdanm | 81:7d30d6019079 | 23 | * without specific prior written permission. |
emilmont | 77:869cf507173a | 24 | * |
bogdanm | 81:7d30d6019079 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 81:7d30d6019079 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 81:7d30d6019079 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 81:7d30d6019079 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 81:7d30d6019079 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 81:7d30d6019079 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 81:7d30d6019079 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 81:7d30d6019079 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 81:7d30d6019079 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 81:7d30d6019079 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
emilmont | 77:869cf507173a | 35 | * |
emilmont | 77:869cf507173a | 36 | ****************************************************************************** |
emilmont | 77:869cf507173a | 37 | */ |
emilmont | 77:869cf507173a | 38 | |
emilmont | 77:869cf507173a | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 40 | #ifndef __STM32L1xx_DMA_H |
emilmont | 77:869cf507173a | 41 | #define __STM32L1xx_DMA_H |
emilmont | 77:869cf507173a | 42 | |
emilmont | 77:869cf507173a | 43 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 44 | extern "C" { |
emilmont | 77:869cf507173a | 45 | #endif |
emilmont | 77:869cf507173a | 46 | |
emilmont | 77:869cf507173a | 47 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 48 | #include "stm32l1xx.h" |
emilmont | 77:869cf507173a | 49 | |
emilmont | 77:869cf507173a | 50 | /** @addtogroup STM32L1xx_StdPeriph_Driver |
emilmont | 77:869cf507173a | 51 | * @{ |
emilmont | 77:869cf507173a | 52 | */ |
emilmont | 77:869cf507173a | 53 | |
emilmont | 77:869cf507173a | 54 | /** @addtogroup DMA |
emilmont | 77:869cf507173a | 55 | * @{ |
emilmont | 77:869cf507173a | 56 | */ |
emilmont | 77:869cf507173a | 57 | |
emilmont | 77:869cf507173a | 58 | /* Exported types ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 59 | |
emilmont | 77:869cf507173a | 60 | /** |
emilmont | 77:869cf507173a | 61 | * @brief DMA Init structure definition |
emilmont | 77:869cf507173a | 62 | */ |
emilmont | 77:869cf507173a | 63 | |
emilmont | 77:869cf507173a | 64 | typedef struct |
emilmont | 77:869cf507173a | 65 | { |
emilmont | 77:869cf507173a | 66 | uint32_t DMA_PeripheralBaseAddr; /*!< Specifies the peripheral base address for DMAy Channelx. */ |
emilmont | 77:869cf507173a | 67 | |
emilmont | 77:869cf507173a | 68 | uint32_t DMA_MemoryBaseAddr; /*!< Specifies the memory base address for DMAy Channelx. */ |
emilmont | 77:869cf507173a | 69 | |
emilmont | 77:869cf507173a | 70 | uint32_t DMA_DIR; /*!< Specifies if the peripheral is the source or destination. |
emilmont | 77:869cf507173a | 71 | This parameter can be a value of @ref DMA_data_transfer_direction */ |
emilmont | 77:869cf507173a | 72 | |
emilmont | 77:869cf507173a | 73 | uint32_t DMA_BufferSize; /*!< Specifies the buffer size, in data unit, of the specified Channel. |
emilmont | 77:869cf507173a | 74 | The data unit is equal to the configuration set in DMA_PeripheralDataSize |
emilmont | 77:869cf507173a | 75 | or DMA_MemoryDataSize members depending in the transfer direction. */ |
emilmont | 77:869cf507173a | 76 | |
emilmont | 77:869cf507173a | 77 | uint32_t DMA_PeripheralInc; /*!< Specifies whether the Peripheral address register is incremented or not. |
emilmont | 77:869cf507173a | 78 | This parameter can be a value of @ref DMA_peripheral_incremented_mode */ |
emilmont | 77:869cf507173a | 79 | |
emilmont | 77:869cf507173a | 80 | uint32_t DMA_MemoryInc; /*!< Specifies whether the memory address register is incremented or not. |
emilmont | 77:869cf507173a | 81 | This parameter can be a value of @ref DMA_memory_incremented_mode */ |
emilmont | 77:869cf507173a | 82 | |
emilmont | 77:869cf507173a | 83 | uint32_t DMA_PeripheralDataSize; /*!< Specifies the Peripheral data width. |
emilmont | 77:869cf507173a | 84 | This parameter can be a value of @ref DMA_peripheral_data_size */ |
emilmont | 77:869cf507173a | 85 | |
emilmont | 77:869cf507173a | 86 | uint32_t DMA_MemoryDataSize; /*!< Specifies the Memory data width. |
emilmont | 77:869cf507173a | 87 | This parameter can be a value of @ref DMA_memory_data_size */ |
emilmont | 77:869cf507173a | 88 | |
emilmont | 77:869cf507173a | 89 | uint32_t DMA_Mode; /*!< Specifies the operation mode of the DMAy Channelx. |
emilmont | 77:869cf507173a | 90 | This parameter can be a value of @ref DMA_circular_normal_mode |
emilmont | 77:869cf507173a | 91 | @note: The circular buffer mode cannot be used if the memory-to-memory |
emilmont | 77:869cf507173a | 92 | data transfer is configured on the selected Channel */ |
emilmont | 77:869cf507173a | 93 | |
emilmont | 77:869cf507173a | 94 | uint32_t DMA_Priority; /*!< Specifies the software priority for the DMAy Channelx. |
emilmont | 77:869cf507173a | 95 | This parameter can be a value of @ref DMA_priority_level */ |
emilmont | 77:869cf507173a | 96 | |
emilmont | 77:869cf507173a | 97 | uint32_t DMA_M2M; /*!< Specifies if the DMAy Channelx will be used in memory-to-memory transfer. |
emilmont | 77:869cf507173a | 98 | This parameter can be a value of @ref DMA_memory_to_memory */ |
emilmont | 77:869cf507173a | 99 | }DMA_InitTypeDef; |
emilmont | 77:869cf507173a | 100 | |
emilmont | 77:869cf507173a | 101 | /* Exported constants --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 102 | |
emilmont | 77:869cf507173a | 103 | /** @defgroup DMA_Exported_Constants |
emilmont | 77:869cf507173a | 104 | * @{ |
emilmont | 77:869cf507173a | 105 | */ |
emilmont | 77:869cf507173a | 106 | |
emilmont | 77:869cf507173a | 107 | #define IS_DMA_ALL_PERIPH(PERIPH) (((PERIPH) == DMA1_Channel1) || \ |
emilmont | 77:869cf507173a | 108 | ((PERIPH) == DMA1_Channel2) || \ |
emilmont | 77:869cf507173a | 109 | ((PERIPH) == DMA1_Channel3) || \ |
emilmont | 77:869cf507173a | 110 | ((PERIPH) == DMA1_Channel4) || \ |
emilmont | 77:869cf507173a | 111 | ((PERIPH) == DMA1_Channel5) || \ |
emilmont | 77:869cf507173a | 112 | ((PERIPH) == DMA1_Channel6) || \ |
emilmont | 77:869cf507173a | 113 | ((PERIPH) == DMA1_Channel7) || \ |
emilmont | 77:869cf507173a | 114 | ((PERIPH) == DMA2_Channel1) || \ |
emilmont | 77:869cf507173a | 115 | ((PERIPH) == DMA2_Channel2) || \ |
emilmont | 77:869cf507173a | 116 | ((PERIPH) == DMA2_Channel3) || \ |
emilmont | 77:869cf507173a | 117 | ((PERIPH) == DMA2_Channel4) || \ |
emilmont | 77:869cf507173a | 118 | ((PERIPH) == DMA2_Channel5)) |
emilmont | 77:869cf507173a | 119 | |
emilmont | 77:869cf507173a | 120 | /** @defgroup DMA_data_transfer_direction |
emilmont | 77:869cf507173a | 121 | * @{ |
emilmont | 77:869cf507173a | 122 | */ |
emilmont | 77:869cf507173a | 123 | |
emilmont | 77:869cf507173a | 124 | #define DMA_DIR_PeripheralDST ((uint32_t)0x00000010) |
emilmont | 77:869cf507173a | 125 | #define DMA_DIR_PeripheralSRC ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 126 | #define IS_DMA_DIR(DIR) (((DIR) == DMA_DIR_PeripheralDST) || \ |
emilmont | 77:869cf507173a | 127 | ((DIR) == DMA_DIR_PeripheralSRC)) |
emilmont | 77:869cf507173a | 128 | /** |
emilmont | 77:869cf507173a | 129 | * @} |
emilmont | 77:869cf507173a | 130 | */ |
emilmont | 77:869cf507173a | 131 | |
emilmont | 77:869cf507173a | 132 | /** @defgroup DMA_peripheral_incremented_mode |
emilmont | 77:869cf507173a | 133 | * @{ |
emilmont | 77:869cf507173a | 134 | */ |
emilmont | 77:869cf507173a | 135 | |
emilmont | 77:869cf507173a | 136 | #define DMA_PeripheralInc_Enable ((uint32_t)0x00000040) |
emilmont | 77:869cf507173a | 137 | #define DMA_PeripheralInc_Disable ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 138 | #define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PeripheralInc_Enable) || \ |
emilmont | 77:869cf507173a | 139 | ((STATE) == DMA_PeripheralInc_Disable)) |
emilmont | 77:869cf507173a | 140 | /** |
emilmont | 77:869cf507173a | 141 | * @} |
emilmont | 77:869cf507173a | 142 | */ |
emilmont | 77:869cf507173a | 143 | |
emilmont | 77:869cf507173a | 144 | /** @defgroup DMA_memory_incremented_mode |
emilmont | 77:869cf507173a | 145 | * @{ |
emilmont | 77:869cf507173a | 146 | */ |
emilmont | 77:869cf507173a | 147 | |
emilmont | 77:869cf507173a | 148 | #define DMA_MemoryInc_Enable ((uint32_t)0x00000080) |
emilmont | 77:869cf507173a | 149 | #define DMA_MemoryInc_Disable ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 150 | #define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MemoryInc_Enable) || \ |
emilmont | 77:869cf507173a | 151 | ((STATE) == DMA_MemoryInc_Disable)) |
emilmont | 77:869cf507173a | 152 | /** |
emilmont | 77:869cf507173a | 153 | * @} |
emilmont | 77:869cf507173a | 154 | */ |
emilmont | 77:869cf507173a | 155 | |
emilmont | 77:869cf507173a | 156 | /** @defgroup DMA_peripheral_data_size |
emilmont | 77:869cf507173a | 157 | * @{ |
emilmont | 77:869cf507173a | 158 | */ |
emilmont | 77:869cf507173a | 159 | |
emilmont | 77:869cf507173a | 160 | #define DMA_PeripheralDataSize_Byte ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 161 | #define DMA_PeripheralDataSize_HalfWord ((uint32_t)0x00000100) |
emilmont | 77:869cf507173a | 162 | #define DMA_PeripheralDataSize_Word ((uint32_t)0x00000200) |
emilmont | 77:869cf507173a | 163 | #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) (((SIZE) == DMA_PeripheralDataSize_Byte) || \ |
emilmont | 77:869cf507173a | 164 | ((SIZE) == DMA_PeripheralDataSize_HalfWord) || \ |
emilmont | 77:869cf507173a | 165 | ((SIZE) == DMA_PeripheralDataSize_Word)) |
emilmont | 77:869cf507173a | 166 | /** |
emilmont | 77:869cf507173a | 167 | * @} |
emilmont | 77:869cf507173a | 168 | */ |
emilmont | 77:869cf507173a | 169 | |
emilmont | 77:869cf507173a | 170 | /** @defgroup DMA_memory_data_size |
emilmont | 77:869cf507173a | 171 | * @{ |
emilmont | 77:869cf507173a | 172 | */ |
emilmont | 77:869cf507173a | 173 | |
emilmont | 77:869cf507173a | 174 | #define DMA_MemoryDataSize_Byte ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 175 | #define DMA_MemoryDataSize_HalfWord ((uint32_t)0x00000400) |
emilmont | 77:869cf507173a | 176 | #define DMA_MemoryDataSize_Word ((uint32_t)0x00000800) |
emilmont | 77:869cf507173a | 177 | #define IS_DMA_MEMORY_DATA_SIZE(SIZE) (((SIZE) == DMA_MemoryDataSize_Byte) || \ |
emilmont | 77:869cf507173a | 178 | ((SIZE) == DMA_MemoryDataSize_HalfWord) || \ |
emilmont | 77:869cf507173a | 179 | ((SIZE) == DMA_MemoryDataSize_Word)) |
emilmont | 77:869cf507173a | 180 | /** |
emilmont | 77:869cf507173a | 181 | * @} |
emilmont | 77:869cf507173a | 182 | */ |
emilmont | 77:869cf507173a | 183 | |
emilmont | 77:869cf507173a | 184 | /** @defgroup DMA_circular_normal_mode |
emilmont | 77:869cf507173a | 185 | * @{ |
emilmont | 77:869cf507173a | 186 | */ |
emilmont | 77:869cf507173a | 187 | |
emilmont | 77:869cf507173a | 188 | #define DMA_Mode_Circular ((uint32_t)0x00000020) |
emilmont | 77:869cf507173a | 189 | #define DMA_Mode_Normal ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 190 | #define IS_DMA_MODE(MODE) (((MODE) == DMA_Mode_Circular) || ((MODE) == DMA_Mode_Normal)) |
emilmont | 77:869cf507173a | 191 | /** |
emilmont | 77:869cf507173a | 192 | * @} |
emilmont | 77:869cf507173a | 193 | */ |
emilmont | 77:869cf507173a | 194 | |
emilmont | 77:869cf507173a | 195 | /** @defgroup DMA_priority_level |
emilmont | 77:869cf507173a | 196 | * @{ |
emilmont | 77:869cf507173a | 197 | */ |
emilmont | 77:869cf507173a | 198 | |
emilmont | 77:869cf507173a | 199 | #define DMA_Priority_VeryHigh ((uint32_t)0x00003000) |
emilmont | 77:869cf507173a | 200 | #define DMA_Priority_High ((uint32_t)0x00002000) |
emilmont | 77:869cf507173a | 201 | #define DMA_Priority_Medium ((uint32_t)0x00001000) |
emilmont | 77:869cf507173a | 202 | #define DMA_Priority_Low ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 203 | #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_Priority_VeryHigh) || \ |
emilmont | 77:869cf507173a | 204 | ((PRIORITY) == DMA_Priority_High) || \ |
emilmont | 77:869cf507173a | 205 | ((PRIORITY) == DMA_Priority_Medium) || \ |
emilmont | 77:869cf507173a | 206 | ((PRIORITY) == DMA_Priority_Low)) |
emilmont | 77:869cf507173a | 207 | /** |
emilmont | 77:869cf507173a | 208 | * @} |
emilmont | 77:869cf507173a | 209 | */ |
emilmont | 77:869cf507173a | 210 | |
emilmont | 77:869cf507173a | 211 | /** @defgroup DMA_memory_to_memory |
emilmont | 77:869cf507173a | 212 | * @{ |
emilmont | 77:869cf507173a | 213 | */ |
emilmont | 77:869cf507173a | 214 | |
emilmont | 77:869cf507173a | 215 | #define DMA_M2M_Enable ((uint32_t)0x00004000) |
emilmont | 77:869cf507173a | 216 | #define DMA_M2M_Disable ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 217 | #define IS_DMA_M2M_STATE(STATE) (((STATE) == DMA_M2M_Enable) || ((STATE) == DMA_M2M_Disable)) |
emilmont | 77:869cf507173a | 218 | |
emilmont | 77:869cf507173a | 219 | /** |
emilmont | 77:869cf507173a | 220 | * @} |
emilmont | 77:869cf507173a | 221 | */ |
emilmont | 77:869cf507173a | 222 | |
emilmont | 77:869cf507173a | 223 | /** @defgroup DMA_interrupts_definition |
emilmont | 77:869cf507173a | 224 | * @{ |
emilmont | 77:869cf507173a | 225 | */ |
emilmont | 77:869cf507173a | 226 | |
emilmont | 77:869cf507173a | 227 | #define DMA_IT_TC ((uint32_t)0x00000002) |
emilmont | 77:869cf507173a | 228 | #define DMA_IT_HT ((uint32_t)0x00000004) |
emilmont | 77:869cf507173a | 229 | #define DMA_IT_TE ((uint32_t)0x00000008) |
emilmont | 77:869cf507173a | 230 | #define IS_DMA_CONFIG_IT(IT) ((((IT) & 0xFFFFFFF1) == 0x00) && ((IT) != 0x00)) |
emilmont | 77:869cf507173a | 231 | |
emilmont | 77:869cf507173a | 232 | #define DMA1_IT_GL1 ((uint32_t)0x00000001) |
emilmont | 77:869cf507173a | 233 | #define DMA1_IT_TC1 ((uint32_t)0x00000002) |
emilmont | 77:869cf507173a | 234 | #define DMA1_IT_HT1 ((uint32_t)0x00000004) |
emilmont | 77:869cf507173a | 235 | #define DMA1_IT_TE1 ((uint32_t)0x00000008) |
emilmont | 77:869cf507173a | 236 | #define DMA1_IT_GL2 ((uint32_t)0x00000010) |
emilmont | 77:869cf507173a | 237 | #define DMA1_IT_TC2 ((uint32_t)0x00000020) |
emilmont | 77:869cf507173a | 238 | #define DMA1_IT_HT2 ((uint32_t)0x00000040) |
emilmont | 77:869cf507173a | 239 | #define DMA1_IT_TE2 ((uint32_t)0x00000080) |
emilmont | 77:869cf507173a | 240 | #define DMA1_IT_GL3 ((uint32_t)0x00000100) |
emilmont | 77:869cf507173a | 241 | #define DMA1_IT_TC3 ((uint32_t)0x00000200) |
emilmont | 77:869cf507173a | 242 | #define DMA1_IT_HT3 ((uint32_t)0x00000400) |
emilmont | 77:869cf507173a | 243 | #define DMA1_IT_TE3 ((uint32_t)0x00000800) |
emilmont | 77:869cf507173a | 244 | #define DMA1_IT_GL4 ((uint32_t)0x00001000) |
emilmont | 77:869cf507173a | 245 | #define DMA1_IT_TC4 ((uint32_t)0x00002000) |
emilmont | 77:869cf507173a | 246 | #define DMA1_IT_HT4 ((uint32_t)0x00004000) |
emilmont | 77:869cf507173a | 247 | #define DMA1_IT_TE4 ((uint32_t)0x00008000) |
emilmont | 77:869cf507173a | 248 | #define DMA1_IT_GL5 ((uint32_t)0x00010000) |
emilmont | 77:869cf507173a | 249 | #define DMA1_IT_TC5 ((uint32_t)0x00020000) |
emilmont | 77:869cf507173a | 250 | #define DMA1_IT_HT5 ((uint32_t)0x00040000) |
emilmont | 77:869cf507173a | 251 | #define DMA1_IT_TE5 ((uint32_t)0x00080000) |
emilmont | 77:869cf507173a | 252 | #define DMA1_IT_GL6 ((uint32_t)0x00100000) |
emilmont | 77:869cf507173a | 253 | #define DMA1_IT_TC6 ((uint32_t)0x00200000) |
emilmont | 77:869cf507173a | 254 | #define DMA1_IT_HT6 ((uint32_t)0x00400000) |
emilmont | 77:869cf507173a | 255 | #define DMA1_IT_TE6 ((uint32_t)0x00800000) |
emilmont | 77:869cf507173a | 256 | #define DMA1_IT_GL7 ((uint32_t)0x01000000) |
emilmont | 77:869cf507173a | 257 | #define DMA1_IT_TC7 ((uint32_t)0x02000000) |
emilmont | 77:869cf507173a | 258 | #define DMA1_IT_HT7 ((uint32_t)0x04000000) |
emilmont | 77:869cf507173a | 259 | #define DMA1_IT_TE7 ((uint32_t)0x08000000) |
emilmont | 77:869cf507173a | 260 | |
emilmont | 77:869cf507173a | 261 | #define DMA2_IT_GL1 ((uint32_t)0x10000001) |
emilmont | 77:869cf507173a | 262 | #define DMA2_IT_TC1 ((uint32_t)0x10000002) |
emilmont | 77:869cf507173a | 263 | #define DMA2_IT_HT1 ((uint32_t)0x10000004) |
emilmont | 77:869cf507173a | 264 | #define DMA2_IT_TE1 ((uint32_t)0x10000008) |
emilmont | 77:869cf507173a | 265 | #define DMA2_IT_GL2 ((uint32_t)0x10000010) |
emilmont | 77:869cf507173a | 266 | #define DMA2_IT_TC2 ((uint32_t)0x10000020) |
emilmont | 77:869cf507173a | 267 | #define DMA2_IT_HT2 ((uint32_t)0x10000040) |
emilmont | 77:869cf507173a | 268 | #define DMA2_IT_TE2 ((uint32_t)0x10000080) |
emilmont | 77:869cf507173a | 269 | #define DMA2_IT_GL3 ((uint32_t)0x10000100) |
emilmont | 77:869cf507173a | 270 | #define DMA2_IT_TC3 ((uint32_t)0x10000200) |
emilmont | 77:869cf507173a | 271 | #define DMA2_IT_HT3 ((uint32_t)0x10000400) |
emilmont | 77:869cf507173a | 272 | #define DMA2_IT_TE3 ((uint32_t)0x10000800) |
emilmont | 77:869cf507173a | 273 | #define DMA2_IT_GL4 ((uint32_t)0x10001000) |
emilmont | 77:869cf507173a | 274 | #define DMA2_IT_TC4 ((uint32_t)0x10002000) |
emilmont | 77:869cf507173a | 275 | #define DMA2_IT_HT4 ((uint32_t)0x10004000) |
emilmont | 77:869cf507173a | 276 | #define DMA2_IT_TE4 ((uint32_t)0x10008000) |
emilmont | 77:869cf507173a | 277 | #define DMA2_IT_GL5 ((uint32_t)0x10010000) |
emilmont | 77:869cf507173a | 278 | #define DMA2_IT_TC5 ((uint32_t)0x10020000) |
emilmont | 77:869cf507173a | 279 | #define DMA2_IT_HT5 ((uint32_t)0x10040000) |
emilmont | 77:869cf507173a | 280 | #define DMA2_IT_TE5 ((uint32_t)0x10080000) |
emilmont | 77:869cf507173a | 281 | |
emilmont | 77:869cf507173a | 282 | #define IS_DMA_CLEAR_IT(IT) (((((IT) & 0xF0000000) == 0x00) || (((IT) & 0xEFF00000) == 0x00)) && ((IT) != 0x00)) |
emilmont | 77:869cf507173a | 283 | |
emilmont | 77:869cf507173a | 284 | #define IS_DMA_GET_IT(IT) (((IT) == DMA1_IT_GL1) || ((IT) == DMA1_IT_TC1) || \ |
emilmont | 77:869cf507173a | 285 | ((IT) == DMA1_IT_HT1) || ((IT) == DMA1_IT_TE1) || \ |
emilmont | 77:869cf507173a | 286 | ((IT) == DMA1_IT_GL2) || ((IT) == DMA1_IT_TC2) || \ |
emilmont | 77:869cf507173a | 287 | ((IT) == DMA1_IT_HT2) || ((IT) == DMA1_IT_TE2) || \ |
emilmont | 77:869cf507173a | 288 | ((IT) == DMA1_IT_GL3) || ((IT) == DMA1_IT_TC3) || \ |
emilmont | 77:869cf507173a | 289 | ((IT) == DMA1_IT_HT3) || ((IT) == DMA1_IT_TE3) || \ |
emilmont | 77:869cf507173a | 290 | ((IT) == DMA1_IT_GL4) || ((IT) == DMA1_IT_TC4) || \ |
emilmont | 77:869cf507173a | 291 | ((IT) == DMA1_IT_HT4) || ((IT) == DMA1_IT_TE4) || \ |
emilmont | 77:869cf507173a | 292 | ((IT) == DMA1_IT_GL5) || ((IT) == DMA1_IT_TC5) || \ |
emilmont | 77:869cf507173a | 293 | ((IT) == DMA1_IT_HT5) || ((IT) == DMA1_IT_TE5) || \ |
emilmont | 77:869cf507173a | 294 | ((IT) == DMA1_IT_GL6) || ((IT) == DMA1_IT_TC6) || \ |
emilmont | 77:869cf507173a | 295 | ((IT) == DMA1_IT_HT6) || ((IT) == DMA1_IT_TE6) || \ |
emilmont | 77:869cf507173a | 296 | ((IT) == DMA1_IT_GL7) || ((IT) == DMA1_IT_TC7) || \ |
emilmont | 77:869cf507173a | 297 | ((IT) == DMA1_IT_HT7) || ((IT) == DMA1_IT_TE7) || \ |
emilmont | 77:869cf507173a | 298 | ((IT) == DMA2_IT_GL1) || ((IT) == DMA2_IT_TC1) || \ |
emilmont | 77:869cf507173a | 299 | ((IT) == DMA2_IT_HT1) || ((IT) == DMA2_IT_TE1) || \ |
emilmont | 77:869cf507173a | 300 | ((IT) == DMA2_IT_GL2) || ((IT) == DMA2_IT_TC2) || \ |
emilmont | 77:869cf507173a | 301 | ((IT) == DMA2_IT_HT2) || ((IT) == DMA2_IT_TE2) || \ |
emilmont | 77:869cf507173a | 302 | ((IT) == DMA2_IT_GL3) || ((IT) == DMA2_IT_TC3) || \ |
emilmont | 77:869cf507173a | 303 | ((IT) == DMA2_IT_HT3) || ((IT) == DMA2_IT_TE3) || \ |
emilmont | 77:869cf507173a | 304 | ((IT) == DMA2_IT_GL4) || ((IT) == DMA2_IT_TC4) || \ |
emilmont | 77:869cf507173a | 305 | ((IT) == DMA2_IT_HT4) || ((IT) == DMA2_IT_TE4) || \ |
emilmont | 77:869cf507173a | 306 | ((IT) == DMA2_IT_GL5) || ((IT) == DMA2_IT_TC5) || \ |
emilmont | 77:869cf507173a | 307 | ((IT) == DMA2_IT_HT5) || ((IT) == DMA2_IT_TE5)) |
emilmont | 77:869cf507173a | 308 | /** |
emilmont | 77:869cf507173a | 309 | * @} |
emilmont | 77:869cf507173a | 310 | */ |
emilmont | 77:869cf507173a | 311 | |
emilmont | 77:869cf507173a | 312 | /** @defgroup DMA_flags_definition |
emilmont | 77:869cf507173a | 313 | * @{ |
emilmont | 77:869cf507173a | 314 | */ |
emilmont | 77:869cf507173a | 315 | #define DMA1_FLAG_GL1 ((uint32_t)0x00000001) |
emilmont | 77:869cf507173a | 316 | #define DMA1_FLAG_TC1 ((uint32_t)0x00000002) |
emilmont | 77:869cf507173a | 317 | #define DMA1_FLAG_HT1 ((uint32_t)0x00000004) |
emilmont | 77:869cf507173a | 318 | #define DMA1_FLAG_TE1 ((uint32_t)0x00000008) |
emilmont | 77:869cf507173a | 319 | #define DMA1_FLAG_GL2 ((uint32_t)0x00000010) |
emilmont | 77:869cf507173a | 320 | #define DMA1_FLAG_TC2 ((uint32_t)0x00000020) |
emilmont | 77:869cf507173a | 321 | #define DMA1_FLAG_HT2 ((uint32_t)0x00000040) |
emilmont | 77:869cf507173a | 322 | #define DMA1_FLAG_TE2 ((uint32_t)0x00000080) |
emilmont | 77:869cf507173a | 323 | #define DMA1_FLAG_GL3 ((uint32_t)0x00000100) |
emilmont | 77:869cf507173a | 324 | #define DMA1_FLAG_TC3 ((uint32_t)0x00000200) |
emilmont | 77:869cf507173a | 325 | #define DMA1_FLAG_HT3 ((uint32_t)0x00000400) |
emilmont | 77:869cf507173a | 326 | #define DMA1_FLAG_TE3 ((uint32_t)0x00000800) |
emilmont | 77:869cf507173a | 327 | #define DMA1_FLAG_GL4 ((uint32_t)0x00001000) |
emilmont | 77:869cf507173a | 328 | #define DMA1_FLAG_TC4 ((uint32_t)0x00002000) |
emilmont | 77:869cf507173a | 329 | #define DMA1_FLAG_HT4 ((uint32_t)0x00004000) |
emilmont | 77:869cf507173a | 330 | #define DMA1_FLAG_TE4 ((uint32_t)0x00008000) |
emilmont | 77:869cf507173a | 331 | #define DMA1_FLAG_GL5 ((uint32_t)0x00010000) |
emilmont | 77:869cf507173a | 332 | #define DMA1_FLAG_TC5 ((uint32_t)0x00020000) |
emilmont | 77:869cf507173a | 333 | #define DMA1_FLAG_HT5 ((uint32_t)0x00040000) |
emilmont | 77:869cf507173a | 334 | #define DMA1_FLAG_TE5 ((uint32_t)0x00080000) |
emilmont | 77:869cf507173a | 335 | #define DMA1_FLAG_GL6 ((uint32_t)0x00100000) |
emilmont | 77:869cf507173a | 336 | #define DMA1_FLAG_TC6 ((uint32_t)0x00200000) |
emilmont | 77:869cf507173a | 337 | #define DMA1_FLAG_HT6 ((uint32_t)0x00400000) |
emilmont | 77:869cf507173a | 338 | #define DMA1_FLAG_TE6 ((uint32_t)0x00800000) |
emilmont | 77:869cf507173a | 339 | #define DMA1_FLAG_GL7 ((uint32_t)0x01000000) |
emilmont | 77:869cf507173a | 340 | #define DMA1_FLAG_TC7 ((uint32_t)0x02000000) |
emilmont | 77:869cf507173a | 341 | #define DMA1_FLAG_HT7 ((uint32_t)0x04000000) |
emilmont | 77:869cf507173a | 342 | #define DMA1_FLAG_TE7 ((uint32_t)0x08000000) |
emilmont | 77:869cf507173a | 343 | |
emilmont | 77:869cf507173a | 344 | #define DMA2_FLAG_GL1 ((uint32_t)0x10000001) |
emilmont | 77:869cf507173a | 345 | #define DMA2_FLAG_TC1 ((uint32_t)0x10000002) |
emilmont | 77:869cf507173a | 346 | #define DMA2_FLAG_HT1 ((uint32_t)0x10000004) |
emilmont | 77:869cf507173a | 347 | #define DMA2_FLAG_TE1 ((uint32_t)0x10000008) |
emilmont | 77:869cf507173a | 348 | #define DMA2_FLAG_GL2 ((uint32_t)0x10000010) |
emilmont | 77:869cf507173a | 349 | #define DMA2_FLAG_TC2 ((uint32_t)0x10000020) |
emilmont | 77:869cf507173a | 350 | #define DMA2_FLAG_HT2 ((uint32_t)0x10000040) |
emilmont | 77:869cf507173a | 351 | #define DMA2_FLAG_TE2 ((uint32_t)0x10000080) |
emilmont | 77:869cf507173a | 352 | #define DMA2_FLAG_GL3 ((uint32_t)0x10000100) |
emilmont | 77:869cf507173a | 353 | #define DMA2_FLAG_TC3 ((uint32_t)0x10000200) |
emilmont | 77:869cf507173a | 354 | #define DMA2_FLAG_HT3 ((uint32_t)0x10000400) |
emilmont | 77:869cf507173a | 355 | #define DMA2_FLAG_TE3 ((uint32_t)0x10000800) |
emilmont | 77:869cf507173a | 356 | #define DMA2_FLAG_GL4 ((uint32_t)0x10001000) |
emilmont | 77:869cf507173a | 357 | #define DMA2_FLAG_TC4 ((uint32_t)0x10002000) |
emilmont | 77:869cf507173a | 358 | #define DMA2_FLAG_HT4 ((uint32_t)0x10004000) |
emilmont | 77:869cf507173a | 359 | #define DMA2_FLAG_TE4 ((uint32_t)0x10008000) |
emilmont | 77:869cf507173a | 360 | #define DMA2_FLAG_GL5 ((uint32_t)0x10010000) |
emilmont | 77:869cf507173a | 361 | #define DMA2_FLAG_TC5 ((uint32_t)0x10020000) |
emilmont | 77:869cf507173a | 362 | #define DMA2_FLAG_HT5 ((uint32_t)0x10040000) |
emilmont | 77:869cf507173a | 363 | #define DMA2_FLAG_TE5 ((uint32_t)0x10080000) |
emilmont | 77:869cf507173a | 364 | |
emilmont | 77:869cf507173a | 365 | #define IS_DMA_CLEAR_FLAG(FLAG) (((((FLAG) & 0xF0000000) == 0x00) || (((FLAG) & 0xEFF00000) == 0x00)) && ((FLAG) != 0x00)) |
emilmont | 77:869cf507173a | 366 | |
emilmont | 77:869cf507173a | 367 | #define IS_DMA_GET_FLAG(FLAG) (((FLAG) == DMA1_FLAG_GL1) || ((FLAG) == DMA1_FLAG_TC1) || \ |
emilmont | 77:869cf507173a | 368 | ((FLAG) == DMA1_FLAG_HT1) || ((FLAG) == DMA1_FLAG_TE1) || \ |
emilmont | 77:869cf507173a | 369 | ((FLAG) == DMA1_FLAG_GL2) || ((FLAG) == DMA1_FLAG_TC2) || \ |
emilmont | 77:869cf507173a | 370 | ((FLAG) == DMA1_FLAG_HT2) || ((FLAG) == DMA1_FLAG_TE2) || \ |
emilmont | 77:869cf507173a | 371 | ((FLAG) == DMA1_FLAG_GL3) || ((FLAG) == DMA1_FLAG_TC3) || \ |
emilmont | 77:869cf507173a | 372 | ((FLAG) == DMA1_FLAG_HT3) || ((FLAG) == DMA1_FLAG_TE3) || \ |
emilmont | 77:869cf507173a | 373 | ((FLAG) == DMA1_FLAG_GL4) || ((FLAG) == DMA1_FLAG_TC4) || \ |
emilmont | 77:869cf507173a | 374 | ((FLAG) == DMA1_FLAG_HT4) || ((FLAG) == DMA1_FLAG_TE4) || \ |
emilmont | 77:869cf507173a | 375 | ((FLAG) == DMA1_FLAG_GL5) || ((FLAG) == DMA1_FLAG_TC5) || \ |
emilmont | 77:869cf507173a | 376 | ((FLAG) == DMA1_FLAG_HT5) || ((FLAG) == DMA1_FLAG_TE5) || \ |
emilmont | 77:869cf507173a | 377 | ((FLAG) == DMA1_FLAG_GL6) || ((FLAG) == DMA1_FLAG_TC6) || \ |
emilmont | 77:869cf507173a | 378 | ((FLAG) == DMA1_FLAG_HT6) || ((FLAG) == DMA1_FLAG_TE6) || \ |
emilmont | 77:869cf507173a | 379 | ((FLAG) == DMA1_FLAG_GL7) || ((FLAG) == DMA1_FLAG_TC7) || \ |
emilmont | 77:869cf507173a | 380 | ((FLAG) == DMA1_FLAG_HT7) || ((FLAG) == DMA1_FLAG_TE7) || \ |
emilmont | 77:869cf507173a | 381 | ((FLAG) == DMA2_FLAG_GL1) || ((FLAG) == DMA2_FLAG_TC1) || \ |
emilmont | 77:869cf507173a | 382 | ((FLAG) == DMA2_FLAG_HT1) || ((FLAG) == DMA2_FLAG_TE1) || \ |
emilmont | 77:869cf507173a | 383 | ((FLAG) == DMA2_FLAG_GL2) || ((FLAG) == DMA2_FLAG_TC2) || \ |
emilmont | 77:869cf507173a | 384 | ((FLAG) == DMA2_FLAG_HT2) || ((FLAG) == DMA2_FLAG_TE2) || \ |
emilmont | 77:869cf507173a | 385 | ((FLAG) == DMA2_FLAG_GL3) || ((FLAG) == DMA2_FLAG_TC3) || \ |
emilmont | 77:869cf507173a | 386 | ((FLAG) == DMA2_FLAG_HT3) || ((FLAG) == DMA2_FLAG_TE3) || \ |
emilmont | 77:869cf507173a | 387 | ((FLAG) == DMA2_FLAG_GL4) || ((FLAG) == DMA2_FLAG_TC4) || \ |
emilmont | 77:869cf507173a | 388 | ((FLAG) == DMA2_FLAG_HT4) || ((FLAG) == DMA2_FLAG_TE4) || \ |
emilmont | 77:869cf507173a | 389 | ((FLAG) == DMA2_FLAG_GL5) || ((FLAG) == DMA2_FLAG_TC5) || \ |
emilmont | 77:869cf507173a | 390 | ((FLAG) == DMA2_FLAG_HT5) || ((FLAG) == DMA2_FLAG_TE5)) |
emilmont | 77:869cf507173a | 391 | /** |
emilmont | 77:869cf507173a | 392 | * @} |
emilmont | 77:869cf507173a | 393 | */ |
emilmont | 77:869cf507173a | 394 | |
emilmont | 77:869cf507173a | 395 | /** @defgroup DMA_Buffer_Size |
emilmont | 77:869cf507173a | 396 | * @{ |
emilmont | 77:869cf507173a | 397 | */ |
emilmont | 77:869cf507173a | 398 | |
emilmont | 77:869cf507173a | 399 | #define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1) && ((SIZE) < 0x10000)) |
emilmont | 77:869cf507173a | 400 | |
emilmont | 77:869cf507173a | 401 | /** |
emilmont | 77:869cf507173a | 402 | * @} |
emilmont | 77:869cf507173a | 403 | */ |
emilmont | 77:869cf507173a | 404 | |
emilmont | 77:869cf507173a | 405 | /** |
emilmont | 77:869cf507173a | 406 | * @} |
emilmont | 77:869cf507173a | 407 | */ |
emilmont | 77:869cf507173a | 408 | |
emilmont | 77:869cf507173a | 409 | /* Exported macro ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 410 | /* Exported functions ------------------------------------------------------- */ |
emilmont | 77:869cf507173a | 411 | |
emilmont | 77:869cf507173a | 412 | /* Function used to set the DMA configuration to the default reset state *****/ |
emilmont | 77:869cf507173a | 413 | void DMA_DeInit(DMA_Channel_TypeDef* DMAy_Channelx); |
emilmont | 77:869cf507173a | 414 | |
emilmont | 77:869cf507173a | 415 | /* Initialization and Configuration functions *********************************/ |
emilmont | 77:869cf507173a | 416 | void DMA_Init(DMA_Channel_TypeDef* DMAy_Channelx, DMA_InitTypeDef* DMA_InitStruct); |
emilmont | 77:869cf507173a | 417 | void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct); |
emilmont | 77:869cf507173a | 418 | void DMA_Cmd(DMA_Channel_TypeDef* DMAy_Channelx, FunctionalState NewState); |
emilmont | 77:869cf507173a | 419 | |
emilmont | 77:869cf507173a | 420 | /* Data Counter functions *****************************************************/ |
emilmont | 77:869cf507173a | 421 | void DMA_SetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx, uint16_t DataNumber); |
emilmont | 77:869cf507173a | 422 | uint16_t DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx); |
emilmont | 77:869cf507173a | 423 | |
emilmont | 77:869cf507173a | 424 | /* Interrupts and flags management functions **********************************/ |
emilmont | 77:869cf507173a | 425 | void DMA_ITConfig(DMA_Channel_TypeDef* DMAy_Channelx, uint32_t DMA_IT, FunctionalState NewState); |
emilmont | 77:869cf507173a | 426 | FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG); |
emilmont | 77:869cf507173a | 427 | void DMA_ClearFlag(uint32_t DMAy_FLAG); |
emilmont | 77:869cf507173a | 428 | ITStatus DMA_GetITStatus(uint32_t DMAy_IT); |
emilmont | 77:869cf507173a | 429 | void DMA_ClearITPendingBit(uint32_t DMAy_IT); |
emilmont | 77:869cf507173a | 430 | |
emilmont | 77:869cf507173a | 431 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 432 | } |
emilmont | 77:869cf507173a | 433 | #endif |
emilmont | 77:869cf507173a | 434 | |
emilmont | 77:869cf507173a | 435 | #endif /*__STM32L1xx_DMA_H */ |
emilmont | 77:869cf507173a | 436 | |
emilmont | 77:869cf507173a | 437 | /** |
emilmont | 77:869cf507173a | 438 | * @} |
emilmont | 77:869cf507173a | 439 | */ |
emilmont | 77:869cf507173a | 440 | |
emilmont | 77:869cf507173a | 441 | /** |
emilmont | 77:869cf507173a | 442 | * @} |
emilmont | 77:869cf507173a | 443 | */ |
emilmont | 77:869cf507173a | 444 | |
emilmont | 77:869cf507173a | 445 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |