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