ads1115 only
Fork of mbed by
TARGET_NUCLEO_F334R8/stm32f3xx_hal_flash.h@122:f9eeca106725, 2016-07-07 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 07 14:34:11 2016 +0100
- Revision:
- 122:f9eeca106725
- Parent:
- 92:4fc01daae5a5
- Child:
- 123:b0220dba8be7
Release 122 of the mbed library
Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 86:04dd9b1680ae | 1 | /** |
bogdanm | 86:04dd9b1680ae | 2 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 3 | * @file stm32f3xx_hal_flash.h |
bogdanm | 86:04dd9b1680ae | 4 | * @author MCD Application Team |
Kojto | 122:f9eeca106725 | 5 | * @version V1.2.1 |
Kojto | 122:f9eeca106725 | 6 | * @date 29-April-2015 |
bogdanm | 86:04dd9b1680ae | 7 | * @brief Header file of Flash HAL module. |
bogdanm | 86:04dd9b1680ae | 8 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 9 | * @attention |
bogdanm | 86:04dd9b1680ae | 10 | * |
Kojto | 122:f9eeca106725 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
bogdanm | 86:04dd9b1680ae | 12 | * |
bogdanm | 86:04dd9b1680ae | 13 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 86:04dd9b1680ae | 14 | * are permitted provided that the following conditions are met: |
bogdanm | 86:04dd9b1680ae | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 86:04dd9b1680ae | 16 | * this list of conditions and the following disclaimer. |
bogdanm | 86:04dd9b1680ae | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 86:04dd9b1680ae | 18 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 86:04dd9b1680ae | 19 | * and/or other materials provided with the distribution. |
bogdanm | 86:04dd9b1680ae | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 86:04dd9b1680ae | 21 | * may be used to endorse or promote products derived from this software |
bogdanm | 86:04dd9b1680ae | 22 | * without specific prior written permission. |
bogdanm | 86:04dd9b1680ae | 23 | * |
bogdanm | 86:04dd9b1680ae | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 86:04dd9b1680ae | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 86:04dd9b1680ae | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 86:04dd9b1680ae | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 86:04dd9b1680ae | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 86:04dd9b1680ae | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 86:04dd9b1680ae | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 86:04dd9b1680ae | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 86:04dd9b1680ae | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 86:04dd9b1680ae | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 86:04dd9b1680ae | 34 | * |
bogdanm | 86:04dd9b1680ae | 35 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 36 | */ |
bogdanm | 86:04dd9b1680ae | 37 | |
bogdanm | 86:04dd9b1680ae | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 39 | #ifndef __STM32F3xx_HAL_FLASH_H |
bogdanm | 86:04dd9b1680ae | 40 | #define __STM32F3xx_HAL_FLASH_H |
bogdanm | 86:04dd9b1680ae | 41 | |
bogdanm | 86:04dd9b1680ae | 42 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 43 | extern "C" { |
bogdanm | 86:04dd9b1680ae | 44 | #endif |
bogdanm | 86:04dd9b1680ae | 45 | |
bogdanm | 86:04dd9b1680ae | 46 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 47 | #include "stm32f3xx_hal_def.h" |
Kojto | 122:f9eeca106725 | 48 | |
bogdanm | 86:04dd9b1680ae | 49 | /** @addtogroup STM32F3xx_HAL_Driver |
bogdanm | 86:04dd9b1680ae | 50 | * @{ |
bogdanm | 86:04dd9b1680ae | 51 | */ |
bogdanm | 86:04dd9b1680ae | 52 | |
Kojto | 122:f9eeca106725 | 53 | /** @addtogroup FLASH |
Kojto | 122:f9eeca106725 | 54 | * @{ |
Kojto | 122:f9eeca106725 | 55 | */ |
Kojto | 122:f9eeca106725 | 56 | |
Kojto | 122:f9eeca106725 | 57 | /** @addtogroup FLASH_Private_Constants |
Kojto | 122:f9eeca106725 | 58 | * @{ |
Kojto | 122:f9eeca106725 | 59 | */ |
Kojto | 122:f9eeca106725 | 60 | #define FLASH_TIMEOUT_VALUE ((uint32_t)50000U) /* 50 s */ |
Kojto | 122:f9eeca106725 | 61 | /** |
Kojto | 122:f9eeca106725 | 62 | * @} |
Kojto | 122:f9eeca106725 | 63 | */ |
Kojto | 122:f9eeca106725 | 64 | |
Kojto | 122:f9eeca106725 | 65 | /** @addtogroup FLASH_Private_Macros |
bogdanm | 86:04dd9b1680ae | 66 | * @{ |
Kojto | 122:f9eeca106725 | 67 | */ |
Kojto | 122:f9eeca106725 | 68 | |
Kojto | 122:f9eeca106725 | 69 | #define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \ |
Kojto | 122:f9eeca106725 | 70 | ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \ |
Kojto | 122:f9eeca106725 | 71 | ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD)) |
Kojto | 122:f9eeca106725 | 72 | |
Kojto | 122:f9eeca106725 | 73 | #define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \ |
Kojto | 122:f9eeca106725 | 74 | ((__LATENCY__) == FLASH_LATENCY_1) || \ |
Kojto | 122:f9eeca106725 | 75 | ((__LATENCY__) == FLASH_LATENCY_2)) |
Kojto | 122:f9eeca106725 | 76 | |
Kojto | 122:f9eeca106725 | 77 | /** |
Kojto | 122:f9eeca106725 | 78 | * @} |
Kojto | 122:f9eeca106725 | 79 | */ |
bogdanm | 86:04dd9b1680ae | 80 | |
bogdanm | 86:04dd9b1680ae | 81 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 82 | /** @defgroup FLASH_Exported_Types FLASH Exported Types |
bogdanm | 86:04dd9b1680ae | 83 | * @{ |
bogdanm | 86:04dd9b1680ae | 84 | */ |
bogdanm | 86:04dd9b1680ae | 85 | |
bogdanm | 86:04dd9b1680ae | 86 | /** |
bogdanm | 86:04dd9b1680ae | 87 | * @brief FLASH Procedure structure definition |
bogdanm | 86:04dd9b1680ae | 88 | */ |
bogdanm | 86:04dd9b1680ae | 89 | typedef enum |
bogdanm | 86:04dd9b1680ae | 90 | { |
bogdanm | 86:04dd9b1680ae | 91 | FLASH_PROC_NONE = 0, |
bogdanm | 86:04dd9b1680ae | 92 | FLASH_PROC_PAGEERASE = 1, |
bogdanm | 86:04dd9b1680ae | 93 | FLASH_PROC_MASSERASE = 2, |
bogdanm | 86:04dd9b1680ae | 94 | FLASH_PROC_PROGRAMHALFWORD = 3, |
bogdanm | 86:04dd9b1680ae | 95 | FLASH_PROC_PROGRAMWORD = 4, |
bogdanm | 86:04dd9b1680ae | 96 | FLASH_PROC_PROGRAMDOUBLEWORD = 5 |
bogdanm | 86:04dd9b1680ae | 97 | } FLASH_ProcedureTypeDef; |
bogdanm | 86:04dd9b1680ae | 98 | |
bogdanm | 86:04dd9b1680ae | 99 | /** |
bogdanm | 86:04dd9b1680ae | 100 | * @brief FLASH handle Structure definition |
bogdanm | 86:04dd9b1680ae | 101 | */ |
bogdanm | 86:04dd9b1680ae | 102 | typedef struct |
bogdanm | 86:04dd9b1680ae | 103 | { |
Kojto | 122:f9eeca106725 | 104 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */ |
bogdanm | 86:04dd9b1680ae | 105 | |
Kojto | 122:f9eeca106725 | 106 | __IO uint32_t DataRemaining; /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */ |
Kojto | 122:f9eeca106725 | 107 | |
Kojto | 122:f9eeca106725 | 108 | __IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */ |
bogdanm | 86:04dd9b1680ae | 109 | |
Kojto | 122:f9eeca106725 | 110 | __IO uint64_t Data; /*!< Internal variable to save data to be programmed */ |
bogdanm | 86:04dd9b1680ae | 111 | |
Kojto | 122:f9eeca106725 | 112 | HAL_LockTypeDef Lock; /*!< FLASH locking object */ |
bogdanm | 86:04dd9b1680ae | 113 | |
Kojto | 122:f9eeca106725 | 114 | __IO uint32_t ErrorCode; /*!< FLASH error code |
Kojto | 122:f9eeca106725 | 115 | This parameter can be a value of @ref FLASH_Error_Codes */ |
bogdanm | 86:04dd9b1680ae | 116 | } FLASH_ProcessTypeDef; |
bogdanm | 86:04dd9b1680ae | 117 | |
bogdanm | 86:04dd9b1680ae | 118 | /** |
bogdanm | 86:04dd9b1680ae | 119 | * @} |
bogdanm | 86:04dd9b1680ae | 120 | */ |
bogdanm | 86:04dd9b1680ae | 121 | |
bogdanm | 86:04dd9b1680ae | 122 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 123 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants |
bogdanm | 86:04dd9b1680ae | 124 | * @{ |
bogdanm | 86:04dd9b1680ae | 125 | */ |
bogdanm | 86:04dd9b1680ae | 126 | |
Kojto | 122:f9eeca106725 | 127 | /** @defgroup FLASH_Error_Codes FLASH Error Codes |
bogdanm | 86:04dd9b1680ae | 128 | * @{ |
Kojto | 122:f9eeca106725 | 129 | */ |
bogdanm | 86:04dd9b1680ae | 130 | |
Kojto | 122:f9eeca106725 | 131 | #define HAL_FLASH_ERROR_NONE 0x00U /*!< No error */ |
Kojto | 122:f9eeca106725 | 132 | #define HAL_FLASH_ERROR_PROG 0x01U /*!< Programming error */ |
Kojto | 122:f9eeca106725 | 133 | #define HAL_FLASH_ERROR_WRP 0x02U /*!< Write protection error */ |
Kojto | 122:f9eeca106725 | 134 | |
bogdanm | 86:04dd9b1680ae | 135 | /** |
bogdanm | 86:04dd9b1680ae | 136 | * @} |
bogdanm | 86:04dd9b1680ae | 137 | */ |
bogdanm | 86:04dd9b1680ae | 138 | |
bogdanm | 86:04dd9b1680ae | 139 | /** @defgroup FLASH_Type_Program FLASH Type Program |
bogdanm | 86:04dd9b1680ae | 140 | * @{ |
bogdanm | 86:04dd9b1680ae | 141 | */ |
Kojto | 122:f9eeca106725 | 142 | #define FLASH_TYPEPROGRAM_HALFWORD ((uint32_t)0x01U) /*!<Program a half-word (16-bit) at a specified address.*/ |
Kojto | 122:f9eeca106725 | 143 | #define FLASH_TYPEPROGRAM_WORD ((uint32_t)0x02U) /*!<Program a word (32-bit) at a specified address.*/ |
Kojto | 122:f9eeca106725 | 144 | #define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03U) /*!<Program a double word (64-bit) at a specified address*/ |
bogdanm | 86:04dd9b1680ae | 145 | |
bogdanm | 86:04dd9b1680ae | 146 | /** |
bogdanm | 86:04dd9b1680ae | 147 | * @} |
bogdanm | 86:04dd9b1680ae | 148 | */ |
bogdanm | 86:04dd9b1680ae | 149 | |
bogdanm | 92:4fc01daae5a5 | 150 | /** @defgroup FLASH_Latency FLASH Latency |
bogdanm | 86:04dd9b1680ae | 151 | * @{ |
Kojto | 122:f9eeca106725 | 152 | */ |
Kojto | 122:f9eeca106725 | 153 | #define FLASH_LATENCY_0 ((uint32_t)0x00000000U) /*!< FLASH Zero Latency cycle */ |
Kojto | 122:f9eeca106725 | 154 | #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_0 /*!< FLASH One Latency cycle */ |
Kojto | 122:f9eeca106725 | 155 | #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_1 /*!< FLASH Two Latency cycles */ |
bogdanm | 86:04dd9b1680ae | 156 | |
bogdanm | 86:04dd9b1680ae | 157 | /** |
bogdanm | 86:04dd9b1680ae | 158 | * @} |
bogdanm | 86:04dd9b1680ae | 159 | */ |
bogdanm | 86:04dd9b1680ae | 160 | |
bogdanm | 86:04dd9b1680ae | 161 | |
bogdanm | 92:4fc01daae5a5 | 162 | /** @defgroup FLASH_Flag_definition FLASH Flag definition |
bogdanm | 86:04dd9b1680ae | 163 | * @{ |
bogdanm | 86:04dd9b1680ae | 164 | */ |
bogdanm | 86:04dd9b1680ae | 165 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
bogdanm | 86:04dd9b1680ae | 166 | #define FLASH_FLAG_PGERR FLASH_SR_PGERR /*!< FLASH Programming error flag */ |
bogdanm | 86:04dd9b1680ae | 167 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
bogdanm | 86:04dd9b1680ae | 168 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */ |
bogdanm | 86:04dd9b1680ae | 169 | /** |
bogdanm | 86:04dd9b1680ae | 170 | * @} |
bogdanm | 86:04dd9b1680ae | 171 | */ |
bogdanm | 86:04dd9b1680ae | 172 | |
bogdanm | 92:4fc01daae5a5 | 173 | /** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition |
bogdanm | 86:04dd9b1680ae | 174 | * @{ |
bogdanm | 86:04dd9b1680ae | 175 | */ |
bogdanm | 86:04dd9b1680ae | 176 | #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */ |
bogdanm | 86:04dd9b1680ae | 177 | #define FLASH_IT_ERR FLASH_CR_ERRIE /*!< Error Interrupt source */ |
bogdanm | 86:04dd9b1680ae | 178 | /** |
bogdanm | 86:04dd9b1680ae | 179 | * @} |
bogdanm | 86:04dd9b1680ae | 180 | */ |
bogdanm | 86:04dd9b1680ae | 181 | |
bogdanm | 86:04dd9b1680ae | 182 | /** |
bogdanm | 86:04dd9b1680ae | 183 | * @} |
bogdanm | 86:04dd9b1680ae | 184 | */ |
bogdanm | 86:04dd9b1680ae | 185 | |
bogdanm | 86:04dd9b1680ae | 186 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 187 | |
bogdanm | 92:4fc01daae5a5 | 188 | /** @defgroup FLASH_Exported_Macros FLASH Exported Macros |
bogdanm | 86:04dd9b1680ae | 189 | * @brief macros to control FLASH features |
bogdanm | 86:04dd9b1680ae | 190 | * @{ |
bogdanm | 86:04dd9b1680ae | 191 | */ |
bogdanm | 86:04dd9b1680ae | 192 | |
Kojto | 122:f9eeca106725 | 193 | /** @defgroup FLASH_Half_Cycle FLASH Half Cycle |
Kojto | 122:f9eeca106725 | 194 | * @brief macros to handle FLASH half cycle |
Kojto | 122:f9eeca106725 | 195 | * @{ |
Kojto | 122:f9eeca106725 | 196 | */ |
bogdanm | 86:04dd9b1680ae | 197 | |
bogdanm | 86:04dd9b1680ae | 198 | /** |
bogdanm | 86:04dd9b1680ae | 199 | * @brief Enable the FLASH half cycle access. |
bogdanm | 86:04dd9b1680ae | 200 | * @retval None |
bogdanm | 86:04dd9b1680ae | 201 | */ |
bogdanm | 86:04dd9b1680ae | 202 | #define __HAL_FLASH_HALF_CYCLE_ACCESS_ENABLE() (FLASH->ACR |= FLASH_ACR_HLFCYA) |
bogdanm | 86:04dd9b1680ae | 203 | |
bogdanm | 86:04dd9b1680ae | 204 | /** |
bogdanm | 86:04dd9b1680ae | 205 | * @brief Disable the FLASH half cycle access. |
bogdanm | 86:04dd9b1680ae | 206 | * @retval None |
bogdanm | 86:04dd9b1680ae | 207 | */ |
bogdanm | 86:04dd9b1680ae | 208 | #define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA)) |
bogdanm | 86:04dd9b1680ae | 209 | |
Kojto | 122:f9eeca106725 | 210 | /** |
Kojto | 122:f9eeca106725 | 211 | * @} |
Kojto | 122:f9eeca106725 | 212 | */ |
Kojto | 122:f9eeca106725 | 213 | |
Kojto | 122:f9eeca106725 | 214 | /** @defgroup FLASH_EM_Latency FLASH Latency |
Kojto | 122:f9eeca106725 | 215 | * @brief macros to handle FLASH Latency |
Kojto | 122:f9eeca106725 | 216 | * @{ |
Kojto | 122:f9eeca106725 | 217 | */ |
Kojto | 122:f9eeca106725 | 218 | |
Kojto | 122:f9eeca106725 | 219 | /** |
Kojto | 122:f9eeca106725 | 220 | * @brief Set the FLASH Latency. |
Kojto | 122:f9eeca106725 | 221 | * @param __LATENCY__ FLASH Latency |
Kojto | 122:f9eeca106725 | 222 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 223 | * @arg @ref FLASH_LATENCY_0 FLASH Zero Latency cycle |
Kojto | 122:f9eeca106725 | 224 | * @arg @ref FLASH_LATENCY_1 FLASH One Latency cycle |
Kojto | 122:f9eeca106725 | 225 | * @arg @ref FLASH_LATENCY_2 FLASH Two Latency cycles |
Kojto | 122:f9eeca106725 | 226 | * @retval None |
Kojto | 122:f9eeca106725 | 227 | */ |
Kojto | 122:f9eeca106725 | 228 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__)) |
Kojto | 122:f9eeca106725 | 229 | |
Kojto | 122:f9eeca106725 | 230 | |
Kojto | 122:f9eeca106725 | 231 | /** |
Kojto | 122:f9eeca106725 | 232 | * @brief Get the FLASH Latency. |
Kojto | 122:f9eeca106725 | 233 | * @retval FLASH Latency |
Kojto | 122:f9eeca106725 | 234 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 235 | * @arg @ref FLASH_LATENCY_0 FLASH Zero Latency cycle |
Kojto | 122:f9eeca106725 | 236 | * @arg @ref FLASH_LATENCY_1 FLASH One Latency cycle |
Kojto | 122:f9eeca106725 | 237 | * @arg @ref FLASH_LATENCY_2 FLASH Two Latency cycles |
Kojto | 122:f9eeca106725 | 238 | */ |
Kojto | 122:f9eeca106725 | 239 | #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)) |
Kojto | 122:f9eeca106725 | 240 | |
Kojto | 122:f9eeca106725 | 241 | /** |
Kojto | 122:f9eeca106725 | 242 | * @} |
Kojto | 122:f9eeca106725 | 243 | */ |
Kojto | 122:f9eeca106725 | 244 | |
Kojto | 122:f9eeca106725 | 245 | /** @defgroup FLASH_Prefetch FLASH Prefetch |
Kojto | 122:f9eeca106725 | 246 | * @brief macros to handle FLASH Prefetch buffer |
Kojto | 122:f9eeca106725 | 247 | * @{ |
Kojto | 122:f9eeca106725 | 248 | */ |
Kojto | 122:f9eeca106725 | 249 | /** |
Kojto | 122:f9eeca106725 | 250 | * @brief Enable the FLASH prefetch buffer. |
Kojto | 122:f9eeca106725 | 251 | * @retval None |
Kojto | 122:f9eeca106725 | 252 | */ |
Kojto | 122:f9eeca106725 | 253 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE) |
Kojto | 122:f9eeca106725 | 254 | |
Kojto | 122:f9eeca106725 | 255 | /** |
Kojto | 122:f9eeca106725 | 256 | * @brief Disable the FLASH prefetch buffer. |
Kojto | 122:f9eeca106725 | 257 | * @retval None |
Kojto | 122:f9eeca106725 | 258 | */ |
Kojto | 122:f9eeca106725 | 259 | #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE)) |
Kojto | 122:f9eeca106725 | 260 | |
Kojto | 122:f9eeca106725 | 261 | /** |
Kojto | 122:f9eeca106725 | 262 | * @} |
Kojto | 122:f9eeca106725 | 263 | */ |
Kojto | 122:f9eeca106725 | 264 | |
Kojto | 122:f9eeca106725 | 265 | /** @defgroup FLASH_Interrupt FLASH Interrupts |
bogdanm | 86:04dd9b1680ae | 266 | * @brief macros to handle FLASH interrupts |
bogdanm | 86:04dd9b1680ae | 267 | * @{ |
bogdanm | 86:04dd9b1680ae | 268 | */ |
bogdanm | 86:04dd9b1680ae | 269 | |
bogdanm | 86:04dd9b1680ae | 270 | /** |
bogdanm | 86:04dd9b1680ae | 271 | * @brief Enable the specified FLASH interrupt. |
Kojto | 122:f9eeca106725 | 272 | * @param __INTERRUPT__ FLASH interrupt |
bogdanm | 86:04dd9b1680ae | 273 | * This parameter can be any combination of the following values: |
Kojto | 122:f9eeca106725 | 274 | * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt |
Kojto | 122:f9eeca106725 | 275 | * @arg @ref FLASH_IT_ERR Error Interrupt |
bogdanm | 86:04dd9b1680ae | 276 | * @retval none |
bogdanm | 86:04dd9b1680ae | 277 | */ |
Kojto | 122:f9eeca106725 | 278 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) SET_BIT((FLASH->CR), (__INTERRUPT__)) |
bogdanm | 86:04dd9b1680ae | 279 | |
bogdanm | 86:04dd9b1680ae | 280 | /** |
bogdanm | 86:04dd9b1680ae | 281 | * @brief Disable the specified FLASH interrupt. |
Kojto | 122:f9eeca106725 | 282 | * @param __INTERRUPT__ FLASH interrupt |
bogdanm | 86:04dd9b1680ae | 283 | * This parameter can be any combination of the following values: |
Kojto | 122:f9eeca106725 | 284 | * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt |
Kojto | 122:f9eeca106725 | 285 | * @arg @ref FLASH_IT_ERR Error Interrupt |
bogdanm | 86:04dd9b1680ae | 286 | * @retval none |
bogdanm | 86:04dd9b1680ae | 287 | */ |
Kojto | 122:f9eeca106725 | 288 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) CLEAR_BIT((FLASH->CR), (uint32_t)(__INTERRUPT__)) |
bogdanm | 86:04dd9b1680ae | 289 | |
bogdanm | 86:04dd9b1680ae | 290 | /** |
bogdanm | 86:04dd9b1680ae | 291 | * @brief Get the specified FLASH flag status. |
Kojto | 122:f9eeca106725 | 292 | * @param __FLAG__ specifies the FLASH flag to check. |
bogdanm | 86:04dd9b1680ae | 293 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 294 | * @arg @ref FLASH_FLAG_BSY FLASH Busy flag |
Kojto | 122:f9eeca106725 | 295 | * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag |
Kojto | 122:f9eeca106725 | 296 | * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag |
Kojto | 122:f9eeca106725 | 297 | * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag |
bogdanm | 86:04dd9b1680ae | 298 | * @retval The new state of __FLAG__ (SET or RESET). |
bogdanm | 86:04dd9b1680ae | 299 | */ |
Kojto | 122:f9eeca106725 | 300 | #define __HAL_FLASH_GET_FLAG(__FLAG__) (((FLASH->SR) & (__FLAG__)) == (__FLAG__)) |
bogdanm | 86:04dd9b1680ae | 301 | |
bogdanm | 86:04dd9b1680ae | 302 | /** |
bogdanm | 86:04dd9b1680ae | 303 | * @brief Clear the specified FLASH flag. |
Kojto | 122:f9eeca106725 | 304 | * @param __FLAG__ specifies the FLASH flags to clear. |
bogdanm | 86:04dd9b1680ae | 305 | * This parameter can be any combination of the following values: |
Kojto | 122:f9eeca106725 | 306 | * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag |
Kojto | 122:f9eeca106725 | 307 | * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag |
Kojto | 122:f9eeca106725 | 308 | * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag |
bogdanm | 86:04dd9b1680ae | 309 | * @retval none |
bogdanm | 86:04dd9b1680ae | 310 | */ |
Kojto | 122:f9eeca106725 | 311 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) ((FLASH->SR) = (__FLAG__)) |
bogdanm | 86:04dd9b1680ae | 312 | |
bogdanm | 86:04dd9b1680ae | 313 | /** |
bogdanm | 86:04dd9b1680ae | 314 | * @} |
Kojto | 122:f9eeca106725 | 315 | */ |
bogdanm | 92:4fc01daae5a5 | 316 | |
bogdanm | 92:4fc01daae5a5 | 317 | /** |
bogdanm | 92:4fc01daae5a5 | 318 | * @} |
bogdanm | 86:04dd9b1680ae | 319 | */ |
bogdanm | 86:04dd9b1680ae | 320 | |
bogdanm | 92:4fc01daae5a5 | 321 | /* Include FLASH HAL Extended module */ |
bogdanm | 86:04dd9b1680ae | 322 | #include "stm32f3xx_hal_flash_ex.h" |
bogdanm | 86:04dd9b1680ae | 323 | |
bogdanm | 86:04dd9b1680ae | 324 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 325 | /** @addtogroup FLASH_Exported_Functions |
bogdanm | 86:04dd9b1680ae | 326 | * @{ |
bogdanm | 92:4fc01daae5a5 | 327 | */ |
bogdanm | 92:4fc01daae5a5 | 328 | |
Kojto | 122:f9eeca106725 | 329 | /** @addtogroup FLASH_Exported_Functions_Group1 |
bogdanm | 92:4fc01daae5a5 | 330 | * @{ |
bogdanm | 92:4fc01daae5a5 | 331 | */ |
bogdanm | 86:04dd9b1680ae | 332 | /* IO operation functions *****************************************************/ |
bogdanm | 86:04dd9b1680ae | 333 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
bogdanm | 86:04dd9b1680ae | 334 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
bogdanm | 86:04dd9b1680ae | 335 | |
Kojto | 122:f9eeca106725 | 336 | /* FLASH IRQ handler function */ |
Kojto | 122:f9eeca106725 | 337 | void HAL_FLASH_IRQHandler(void); |
bogdanm | 86:04dd9b1680ae | 338 | /* Callbacks in non blocking modes */ |
bogdanm | 86:04dd9b1680ae | 339 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
bogdanm | 86:04dd9b1680ae | 340 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
bogdanm | 86:04dd9b1680ae | 341 | |
bogdanm | 92:4fc01daae5a5 | 342 | /** |
bogdanm | 92:4fc01daae5a5 | 343 | * @} |
bogdanm | 92:4fc01daae5a5 | 344 | */ |
bogdanm | 92:4fc01daae5a5 | 345 | |
Kojto | 122:f9eeca106725 | 346 | /** @addtogroup FLASH_Exported_Functions_Group2 |
bogdanm | 92:4fc01daae5a5 | 347 | * @{ |
bogdanm | 92:4fc01daae5a5 | 348 | */ |
bogdanm | 86:04dd9b1680ae | 349 | /* Peripheral Control functions ***********************************************/ |
bogdanm | 86:04dd9b1680ae | 350 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
bogdanm | 86:04dd9b1680ae | 351 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
bogdanm | 86:04dd9b1680ae | 352 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
bogdanm | 86:04dd9b1680ae | 353 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
bogdanm | 86:04dd9b1680ae | 354 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
bogdanm | 86:04dd9b1680ae | 355 | |
bogdanm | 92:4fc01daae5a5 | 356 | /** |
bogdanm | 92:4fc01daae5a5 | 357 | * @} |
bogdanm | 92:4fc01daae5a5 | 358 | */ |
bogdanm | 92:4fc01daae5a5 | 359 | |
Kojto | 122:f9eeca106725 | 360 | /** @addtogroup FLASH_Exported_Functions_Group3 |
bogdanm | 92:4fc01daae5a5 | 361 | * @{ |
bogdanm | 92:4fc01daae5a5 | 362 | */ |
bogdanm | 86:04dd9b1680ae | 363 | /* Peripheral State and Error functions ***************************************/ |
Kojto | 122:f9eeca106725 | 364 | uint32_t HAL_FLASH_GetError(void); |
bogdanm | 86:04dd9b1680ae | 365 | |
bogdanm | 86:04dd9b1680ae | 366 | /** |
bogdanm | 86:04dd9b1680ae | 367 | * @} |
bogdanm | 86:04dd9b1680ae | 368 | */ |
bogdanm | 86:04dd9b1680ae | 369 | |
bogdanm | 86:04dd9b1680ae | 370 | /** |
bogdanm | 86:04dd9b1680ae | 371 | * @} |
bogdanm | 86:04dd9b1680ae | 372 | */ |
bogdanm | 86:04dd9b1680ae | 373 | |
Kojto | 122:f9eeca106725 | 374 | /* Private function -------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 375 | /** @addtogroup FLASH_Private_Functions |
bogdanm | 92:4fc01daae5a5 | 376 | * @{ |
bogdanm | 92:4fc01daae5a5 | 377 | */ |
bogdanm | 92:4fc01daae5a5 | 378 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); |
bogdanm | 92:4fc01daae5a5 | 379 | |
bogdanm | 92:4fc01daae5a5 | 380 | /** |
bogdanm | 92:4fc01daae5a5 | 381 | * @} |
bogdanm | 92:4fc01daae5a5 | 382 | */ |
bogdanm | 92:4fc01daae5a5 | 383 | |
bogdanm | 92:4fc01daae5a5 | 384 | /** |
bogdanm | 92:4fc01daae5a5 | 385 | * @} |
bogdanm | 92:4fc01daae5a5 | 386 | */ |
bogdanm | 92:4fc01daae5a5 | 387 | |
bogdanm | 86:04dd9b1680ae | 388 | /** |
bogdanm | 86:04dd9b1680ae | 389 | * @} |
bogdanm | 86:04dd9b1680ae | 390 | */ |
bogdanm | 86:04dd9b1680ae | 391 | |
bogdanm | 86:04dd9b1680ae | 392 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 393 | } |
bogdanm | 86:04dd9b1680ae | 394 | #endif |
bogdanm | 86:04dd9b1680ae | 395 | |
bogdanm | 86:04dd9b1680ae | 396 | #endif /* __STM32F3xx_HAL_FLASH_H */ |
bogdanm | 86:04dd9b1680ae | 397 | |
bogdanm | 86:04dd9b1680ae | 398 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Kojto | 122:f9eeca106725 | 399 |