The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_NUCLEO_L152RE/stm32l1xx_hal_flash.h@99:7f6c6de930c0, 2015-05-03 (annotated)
- Committer:
- Mikchel
- Date:
- Sun May 03 16:04:42 2015 +0000
- Revision:
- 99:7f6c6de930c0
- Parent:
- 90:cb3d968589d8
12
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 90:cb3d968589d8 | 1 | /** |
Kojto | 90:cb3d968589d8 | 2 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 3 | * @file stm32l1xx_hal_flash.h |
Kojto | 90:cb3d968589d8 | 4 | * @author MCD Application Team |
Kojto | 90:cb3d968589d8 | 5 | * @version V1.0.0 |
Kojto | 90:cb3d968589d8 | 6 | * @date 5-September-2014 |
Kojto | 90:cb3d968589d8 | 7 | * @brief Header file of Flash HAL module. |
Kojto | 90:cb3d968589d8 | 8 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 9 | * @attention |
Kojto | 90:cb3d968589d8 | 10 | * |
Kojto | 90:cb3d968589d8 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Kojto | 90:cb3d968589d8 | 12 | * |
Kojto | 90:cb3d968589d8 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 90:cb3d968589d8 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 90:cb3d968589d8 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 90:cb3d968589d8 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 90:cb3d968589d8 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 90:cb3d968589d8 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 90:cb3d968589d8 | 19 | * and/or other materials provided with the distribution. |
Kojto | 90:cb3d968589d8 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 90:cb3d968589d8 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 90:cb3d968589d8 | 22 | * without specific prior written permission. |
Kojto | 90:cb3d968589d8 | 23 | * |
Kojto | 90:cb3d968589d8 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 90:cb3d968589d8 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 90:cb3d968589d8 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 90:cb3d968589d8 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 90:cb3d968589d8 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 90:cb3d968589d8 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 90:cb3d968589d8 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 90:cb3d968589d8 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 90:cb3d968589d8 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 90:cb3d968589d8 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 90:cb3d968589d8 | 34 | * |
Kojto | 90:cb3d968589d8 | 35 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 36 | */ |
Kojto | 90:cb3d968589d8 | 37 | |
Kojto | 90:cb3d968589d8 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 39 | #ifndef __STM32L1xx_HAL_FLASH_H |
Kojto | 90:cb3d968589d8 | 40 | #define __STM32L1xx_HAL_FLASH_H |
Kojto | 90:cb3d968589d8 | 41 | |
Kojto | 90:cb3d968589d8 | 42 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 43 | extern "C" { |
Kojto | 90:cb3d968589d8 | 44 | #endif |
Kojto | 90:cb3d968589d8 | 45 | |
Kojto | 90:cb3d968589d8 | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 47 | #include "stm32l1xx_hal_def.h" |
Kojto | 90:cb3d968589d8 | 48 | |
Kojto | 90:cb3d968589d8 | 49 | /** @addtogroup STM32L1xx_HAL_Driver |
Kojto | 90:cb3d968589d8 | 50 | * @{ |
Kojto | 90:cb3d968589d8 | 51 | */ |
Kojto | 90:cb3d968589d8 | 52 | |
Kojto | 90:cb3d968589d8 | 53 | /** @addtogroup FLASH |
Kojto | 90:cb3d968589d8 | 54 | * @{ |
Kojto | 90:cb3d968589d8 | 55 | */ |
Kojto | 90:cb3d968589d8 | 56 | |
Kojto | 90:cb3d968589d8 | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 58 | |
Kojto | 90:cb3d968589d8 | 59 | /** @defgroup FLASH_Exported_Types FLASH Exported Types |
Kojto | 90:cb3d968589d8 | 60 | * @{ |
Kojto | 90:cb3d968589d8 | 61 | */ |
Kojto | 90:cb3d968589d8 | 62 | |
Kojto | 90:cb3d968589d8 | 63 | /** |
Kojto | 90:cb3d968589d8 | 64 | * @brief FLASH Error structure definition |
Kojto | 90:cb3d968589d8 | 65 | */ |
Kojto | 90:cb3d968589d8 | 66 | typedef enum |
Kojto | 90:cb3d968589d8 | 67 | { |
Kojto | 90:cb3d968589d8 | 68 | FLASH_ERROR_SIZE = 0x01, |
Kojto | 90:cb3d968589d8 | 69 | FLASH_ERROR_OPTV = 0x02, |
Kojto | 90:cb3d968589d8 | 70 | FLASH_ERROR_OPTVUSR = 0x04, |
Kojto | 90:cb3d968589d8 | 71 | FLASH_ERROR_PGA = 0x08, |
Kojto | 90:cb3d968589d8 | 72 | FLASH_ERROR_WRP = 0x10, |
Kojto | 90:cb3d968589d8 | 73 | FLASH_ERROR_RD = 0x20, |
Kojto | 90:cb3d968589d8 | 74 | FLASH_ERROR_OPERATION = 0x40 |
Kojto | 90:cb3d968589d8 | 75 | }FLASH_ErrorTypeDef; |
Kojto | 90:cb3d968589d8 | 76 | |
Kojto | 90:cb3d968589d8 | 77 | |
Kojto | 90:cb3d968589d8 | 78 | /** |
Kojto | 90:cb3d968589d8 | 79 | * @brief FLASH Procedure structure definition |
Kojto | 90:cb3d968589d8 | 80 | */ |
Kojto | 90:cb3d968589d8 | 81 | typedef enum |
Kojto | 90:cb3d968589d8 | 82 | { |
Kojto | 90:cb3d968589d8 | 83 | FLASH_PROC_NONE = 0, |
Kojto | 90:cb3d968589d8 | 84 | FLASH_PROC_PAGEERASE, |
Kojto | 90:cb3d968589d8 | 85 | FLASH_PROC_PROGRAM |
Kojto | 90:cb3d968589d8 | 86 | } FLASH_ProcedureTypeDef; |
Kojto | 90:cb3d968589d8 | 87 | |
Kojto | 90:cb3d968589d8 | 88 | /** |
Kojto | 90:cb3d968589d8 | 89 | * @brief FLASH handle Structure definition |
Kojto | 90:cb3d968589d8 | 90 | */ |
Kojto | 90:cb3d968589d8 | 91 | typedef struct |
Kojto | 90:cb3d968589d8 | 92 | { |
Kojto | 90:cb3d968589d8 | 93 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*Internal variable to indicate which procedure is ongoing or not in IT context*/ |
Kojto | 90:cb3d968589d8 | 94 | |
Kojto | 90:cb3d968589d8 | 95 | __IO uint32_t NbPagesToErase; /*Internal variable to save the remaining sectors to erase in IT context*/ |
Kojto | 90:cb3d968589d8 | 96 | |
Kojto | 90:cb3d968589d8 | 97 | __IO uint32_t Page; /*Internal variable to define the current sector which is erasing*/ |
Kojto | 90:cb3d968589d8 | 98 | |
Kojto | 90:cb3d968589d8 | 99 | __IO uint32_t Address; /*Internal variable to save address selected for program*/ |
Kojto | 90:cb3d968589d8 | 100 | |
Kojto | 90:cb3d968589d8 | 101 | HAL_LockTypeDef Lock; /* FLASH locking object */ |
Kojto | 90:cb3d968589d8 | 102 | |
Kojto | 90:cb3d968589d8 | 103 | __IO FLASH_ErrorTypeDef ErrorCode; /* FLASH error code */ |
Kojto | 90:cb3d968589d8 | 104 | |
Kojto | 90:cb3d968589d8 | 105 | }FLASH_ProcessTypeDef; |
Kojto | 90:cb3d968589d8 | 106 | |
Kojto | 90:cb3d968589d8 | 107 | /** |
Kojto | 90:cb3d968589d8 | 108 | * @} |
Kojto | 90:cb3d968589d8 | 109 | */ |
Kojto | 90:cb3d968589d8 | 110 | |
Kojto | 90:cb3d968589d8 | 111 | /** @addtogroup FLASH_Internal_Variables |
Kojto | 90:cb3d968589d8 | 112 | * @{ |
Kojto | 90:cb3d968589d8 | 113 | */ |
Kojto | 90:cb3d968589d8 | 114 | |
Kojto | 90:cb3d968589d8 | 115 | /** |
Kojto | 90:cb3d968589d8 | 116 | * @brief Variable used for Program/Erase sectors under interruption. |
Kojto | 90:cb3d968589d8 | 117 | * Put as extern as used also in flash_ex.c. |
Kojto | 90:cb3d968589d8 | 118 | */ |
Kojto | 90:cb3d968589d8 | 119 | extern FLASH_ProcessTypeDef ProcFlash; |
Kojto | 90:cb3d968589d8 | 120 | |
Kojto | 90:cb3d968589d8 | 121 | /** |
Kojto | 90:cb3d968589d8 | 122 | * @} |
Kojto | 90:cb3d968589d8 | 123 | */ |
Kojto | 90:cb3d968589d8 | 124 | |
Kojto | 90:cb3d968589d8 | 125 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 126 | |
Kojto | 90:cb3d968589d8 | 127 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants |
Kojto | 90:cb3d968589d8 | 128 | * @{ |
Kojto | 90:cb3d968589d8 | 129 | */ |
Kojto | 90:cb3d968589d8 | 130 | |
Kojto | 90:cb3d968589d8 | 131 | #define HAL_FLASH_TIMEOUT_VALUE ((uint32_t)50000) /* 50 s */ |
Kojto | 90:cb3d968589d8 | 132 | |
Kojto | 90:cb3d968589d8 | 133 | #define FLASH_PAGE_SIZE ((uint32_t)256) |
Kojto | 90:cb3d968589d8 | 134 | |
Kojto | 90:cb3d968589d8 | 135 | /** @defgroup FLASH_Type_Program FLASH Type Program |
Kojto | 90:cb3d968589d8 | 136 | * @{ |
Kojto | 90:cb3d968589d8 | 137 | */ |
Kojto | 90:cb3d968589d8 | 138 | #define TYPEPROGRAM_WORD ((uint32_t)0x02) /*!< Program a word (32-bit) at a specified address */ |
Kojto | 90:cb3d968589d8 | 139 | |
Kojto | 90:cb3d968589d8 | 140 | #define IS_TYPEPROGRAMFLASH(_VALUE_) (((_VALUE_) == TYPEPROGRAM_WORD)) |
Kojto | 90:cb3d968589d8 | 141 | |
Kojto | 90:cb3d968589d8 | 142 | /** |
Kojto | 90:cb3d968589d8 | 143 | * @} |
Kojto | 90:cb3d968589d8 | 144 | */ |
Kojto | 90:cb3d968589d8 | 145 | |
Kojto | 90:cb3d968589d8 | 146 | /** @defgroup FLASH_Latency FLASH Latency |
Kojto | 90:cb3d968589d8 | 147 | * @{ |
Kojto | 90:cb3d968589d8 | 148 | */ |
Kojto | 90:cb3d968589d8 | 149 | #define FLASH_LATENCY_0 ((uint8_t)0x00) /*!< FLASH Zero Latency cycle */ |
Kojto | 90:cb3d968589d8 | 150 | #define FLASH_LATENCY_1 ((uint8_t)0x01) /*!< FLASH One Latency cycle */ |
Kojto | 90:cb3d968589d8 | 151 | |
Kojto | 90:cb3d968589d8 | 152 | #define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \ |
Kojto | 90:cb3d968589d8 | 153 | ((__LATENCY__) == FLASH_LATENCY_1)) |
Kojto | 90:cb3d968589d8 | 154 | /** |
Kojto | 90:cb3d968589d8 | 155 | * @} |
Kojto | 90:cb3d968589d8 | 156 | */ |
Kojto | 90:cb3d968589d8 | 157 | |
Kojto | 90:cb3d968589d8 | 158 | /** @defgroup FLASH_Interrupts FLASH Interrupts |
Kojto | 90:cb3d968589d8 | 159 | * @{ |
Kojto | 90:cb3d968589d8 | 160 | */ |
Kojto | 90:cb3d968589d8 | 161 | |
Kojto | 90:cb3d968589d8 | 162 | #define FLASH_IT_EOP FLASH_PECR_EOPIE /*!< End of programming interrupt source */ |
Kojto | 90:cb3d968589d8 | 163 | #define FLASH_IT_ERR FLASH_PECR_ERRIE /*!< Error interrupt source */ |
Kojto | 90:cb3d968589d8 | 164 | /** |
Kojto | 90:cb3d968589d8 | 165 | * @} |
Kojto | 90:cb3d968589d8 | 166 | */ |
Kojto | 90:cb3d968589d8 | 167 | |
Kojto | 90:cb3d968589d8 | 168 | /** @defgroup FLASH_Flags FLASH Flags |
Kojto | 90:cb3d968589d8 | 169 | * @{ |
Kojto | 90:cb3d968589d8 | 170 | */ |
Kojto | 90:cb3d968589d8 | 171 | |
Kojto | 90:cb3d968589d8 | 172 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
Kojto | 90:cb3d968589d8 | 173 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Programming flag */ |
Kojto | 90:cb3d968589d8 | 174 | #define FLASH_FLAG_ENDHV FLASH_SR_ENDHV /*!< FLASH End of High Voltage flag */ |
Kojto | 90:cb3d968589d8 | 175 | #define FLASH_FLAG_READY FLASH_SR_READY /*!< FLASH Ready flag after low power mode */ |
Kojto | 90:cb3d968589d8 | 176 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
Kojto | 90:cb3d968589d8 | 177 | #define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */ |
Kojto | 90:cb3d968589d8 | 178 | #define FLASH_FLAG_SIZERR FLASH_SR_SIZERR /*!< FLASH Size error flag */ |
Kojto | 90:cb3d968589d8 | 179 | #define FLASH_FLAG_OPTVERR FLASH_SR_OPTVERR /*!< FLASH Option Validity error flag */ |
Kojto | 90:cb3d968589d8 | 180 | |
Kojto | 90:cb3d968589d8 | 181 | /** |
Kojto | 90:cb3d968589d8 | 182 | * @} |
Kojto | 90:cb3d968589d8 | 183 | */ |
Kojto | 90:cb3d968589d8 | 184 | |
Kojto | 90:cb3d968589d8 | 185 | /** @defgroup FLASH_Keys FLASH Keys |
Kojto | 90:cb3d968589d8 | 186 | * @{ |
Kojto | 90:cb3d968589d8 | 187 | */ |
Kojto | 90:cb3d968589d8 | 188 | |
Kojto | 90:cb3d968589d8 | 189 | #define FLASH_PDKEY1 ((uint32_t)0x04152637) /*!< Flash power down key1 */ |
Kojto | 90:cb3d968589d8 | 190 | #define FLASH_PDKEY2 ((uint32_t)0xFAFBFCFD) /*!< Flash power down key2: used with FLASH_PDKEY1 |
Kojto | 90:cb3d968589d8 | 191 | to unlock the RUN_PD bit in FLASH_ACR */ |
Kojto | 90:cb3d968589d8 | 192 | |
Kojto | 90:cb3d968589d8 | 193 | #define FLASH_PEKEY1 ((uint32_t)0x89ABCDEF) /*!< Flash program erase key1 */ |
Kojto | 90:cb3d968589d8 | 194 | #define FLASH_PEKEY2 ((uint32_t)0x02030405) /*!< Flash program erase key: used with FLASH_PEKEY2 |
Kojto | 90:cb3d968589d8 | 195 | to unlock the write access to the FLASH_PECR register and |
Kojto | 90:cb3d968589d8 | 196 | data EEPROM */ |
Kojto | 90:cb3d968589d8 | 197 | |
Kojto | 90:cb3d968589d8 | 198 | #define FLASH_PRGKEY1 ((uint32_t)0x8C9DAEBF) /*!< Flash program memory key1 */ |
Kojto | 90:cb3d968589d8 | 199 | #define FLASH_PRGKEY2 ((uint32_t)0x13141516) /*!< Flash program memory key2: used with FLASH_PRGKEY2 |
Kojto | 90:cb3d968589d8 | 200 | to unlock the program memory */ |
Kojto | 90:cb3d968589d8 | 201 | |
Kojto | 90:cb3d968589d8 | 202 | #define FLASH_OPTKEY1 ((uint32_t)0xFBEAD9C8) /*!< Flash option key1 */ |
Kojto | 90:cb3d968589d8 | 203 | #define FLASH_OPTKEY2 ((uint32_t)0x24252627) /*!< Flash option key2: used with FLASH_OPTKEY1 to |
Kojto | 90:cb3d968589d8 | 204 | unlock the write access to the option byte block */ |
Kojto | 90:cb3d968589d8 | 205 | /** |
Kojto | 90:cb3d968589d8 | 206 | * @} |
Kojto | 90:cb3d968589d8 | 207 | */ |
Kojto | 90:cb3d968589d8 | 208 | |
Kojto | 90:cb3d968589d8 | 209 | |
Kojto | 90:cb3d968589d8 | 210 | |
Kojto | 90:cb3d968589d8 | 211 | #if defined ( __ICCARM__ ) |
Kojto | 90:cb3d968589d8 | 212 | #define InterruptType_ACTLR_DISMCYCINT_Msk IntType_ACTLR_DISMCYCINT_Msk |
Kojto | 90:cb3d968589d8 | 213 | #endif |
Kojto | 90:cb3d968589d8 | 214 | |
Kojto | 90:cb3d968589d8 | 215 | /** |
Kojto | 90:cb3d968589d8 | 216 | * @} |
Kojto | 90:cb3d968589d8 | 217 | */ |
Kojto | 90:cb3d968589d8 | 218 | |
Kojto | 90:cb3d968589d8 | 219 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 220 | |
Kojto | 90:cb3d968589d8 | 221 | /** @defgroup FLASH_Exported_Macros FLASH Exported Macros |
Kojto | 90:cb3d968589d8 | 222 | * @{ |
Kojto | 90:cb3d968589d8 | 223 | */ |
Kojto | 90:cb3d968589d8 | 224 | |
Kojto | 90:cb3d968589d8 | 225 | /** @defgroup FLASH_Interrupt FLASH Interrupts |
Kojto | 90:cb3d968589d8 | 226 | * @brief macros to handle FLASH interrupts |
Kojto | 90:cb3d968589d8 | 227 | * @{ |
Kojto | 90:cb3d968589d8 | 228 | */ |
Kojto | 90:cb3d968589d8 | 229 | |
Kojto | 90:cb3d968589d8 | 230 | /** |
Kojto | 90:cb3d968589d8 | 231 | * @brief Enable the specified FLASH interrupt. |
Kojto | 90:cb3d968589d8 | 232 | * @param __INTERRUPT__ : FLASH interrupt |
Kojto | 90:cb3d968589d8 | 233 | * This parameter can be any combination of the following values: |
Kojto | 90:cb3d968589d8 | 234 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
Kojto | 90:cb3d968589d8 | 235 | * @arg FLASH_IT_ERR: Error Interrupt |
Kojto | 90:cb3d968589d8 | 236 | * @retval none |
Kojto | 90:cb3d968589d8 | 237 | */ |
Kojto | 90:cb3d968589d8 | 238 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) ((FLASH->PECR) |= (__INTERRUPT__)) |
Kojto | 90:cb3d968589d8 | 239 | |
Kojto | 90:cb3d968589d8 | 240 | /** |
Kojto | 90:cb3d968589d8 | 241 | * @brief Disable the specified FLASH interrupt. |
Kojto | 90:cb3d968589d8 | 242 | * @param __INTERRUPT__ : FLASH interrupt |
Kojto | 90:cb3d968589d8 | 243 | * This parameter can be any combination of the following values: |
Kojto | 90:cb3d968589d8 | 244 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
Kojto | 90:cb3d968589d8 | 245 | * @arg FLASH_IT_ERR: Error Interrupt |
Kojto | 90:cb3d968589d8 | 246 | * @retval none |
Kojto | 90:cb3d968589d8 | 247 | */ |
Kojto | 90:cb3d968589d8 | 248 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) ((FLASH->PECR) &= ~(uint32_t)(__INTERRUPT__)) |
Kojto | 90:cb3d968589d8 | 249 | |
Kojto | 90:cb3d968589d8 | 250 | /** |
Kojto | 90:cb3d968589d8 | 251 | * @brief Get the specified FLASH flag status. |
Kojto | 90:cb3d968589d8 | 252 | * @param __FLAG__: specifies the FLASH flag to check. |
Kojto | 90:cb3d968589d8 | 253 | * This parameter can be one of the following values: |
Kojto | 90:cb3d968589d8 | 254 | * @arg FLASH_FLAG_BSY : FLASH Busy flag |
Kojto | 90:cb3d968589d8 | 255 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
Kojto | 90:cb3d968589d8 | 256 | * @arg FLASH_FLAG_ENDHV : FLASH End of High Voltage flag |
Kojto | 90:cb3d968589d8 | 257 | * @arg FLASH_FLAG_READY: FLASH Ready flag after low power mode |
Kojto | 90:cb3d968589d8 | 258 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
Kojto | 90:cb3d968589d8 | 259 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
Kojto | 90:cb3d968589d8 | 260 | * @arg FLASH_FLAG_SIZERR: FLASH Size error flag |
Kojto | 90:cb3d968589d8 | 261 | * @arg FLASH_FLAG_OPTVERR: FLASH Option validity error error flag |
Kojto | 90:cb3d968589d8 | 262 | * @arg FLASH_FLAG_OPTVERRUSR : FLASH Option UserValidity (available only Cat.3, Cat.4 and Cat.5 devices) |
Kojto | 90:cb3d968589d8 | 263 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) (available only Cat.2 and Cat.3 devices) |
Kojto | 90:cb3d968589d8 | 264 | * @retval The new state of __FLAG__ (SET or RESET). |
Kojto | 90:cb3d968589d8 | 265 | */ |
Kojto | 90:cb3d968589d8 | 266 | #define __HAL_FLASH_GET_FLAG(__FLAG__) (((FLASH->SR) & (__FLAG__)) == (__FLAG__)) |
Kojto | 90:cb3d968589d8 | 267 | |
Kojto | 90:cb3d968589d8 | 268 | /** |
Kojto | 90:cb3d968589d8 | 269 | * @brief Clear the specified FLASH flag. |
Kojto | 90:cb3d968589d8 | 270 | * @param __FLAG__: specifies the FLASH flags to clear. |
Kojto | 90:cb3d968589d8 | 271 | * This parameter can be any combination of the following values: |
Kojto | 90:cb3d968589d8 | 272 | * @arg FLASH_FLAG_BSY : FLASH Busy flag |
Kojto | 90:cb3d968589d8 | 273 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
Kojto | 90:cb3d968589d8 | 274 | * @arg FLASH_FLAG_ENDHV : FLASH End of High Voltage flag |
Kojto | 90:cb3d968589d8 | 275 | * @arg FLASH_FLAG_READY: FLASH Ready flag after low power mode |
Kojto | 90:cb3d968589d8 | 276 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
Kojto | 90:cb3d968589d8 | 277 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
Kojto | 90:cb3d968589d8 | 278 | * @arg FLASH_FLAG_SIZERR: FLASH Size error flag |
Kojto | 90:cb3d968589d8 | 279 | * @arg FLASH_FLAG_OPTVERR: FLASH Option validity error error flag |
Kojto | 90:cb3d968589d8 | 280 | * @arg FLASH_FLAG_OPTVERRUSR : FLASH Option UserValidity (available only Cat.3, Cat.4 and Cat.5 devices) |
Kojto | 90:cb3d968589d8 | 281 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) (available only Cat.2 and Cat.3 devices) |
Kojto | 90:cb3d968589d8 | 282 | * @retval none |
Kojto | 90:cb3d968589d8 | 283 | */ |
Kojto | 90:cb3d968589d8 | 284 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) ((FLASH->SR) = (__FLAG__)) |
Kojto | 90:cb3d968589d8 | 285 | |
Kojto | 90:cb3d968589d8 | 286 | /** |
Kojto | 90:cb3d968589d8 | 287 | * @} |
Kojto | 90:cb3d968589d8 | 288 | */ |
Kojto | 90:cb3d968589d8 | 289 | |
Kojto | 90:cb3d968589d8 | 290 | /** |
Kojto | 90:cb3d968589d8 | 291 | * @} |
Kojto | 90:cb3d968589d8 | 292 | */ |
Kojto | 90:cb3d968589d8 | 293 | |
Kojto | 90:cb3d968589d8 | 294 | /* Include FLASH HAL Extension module */ |
Kojto | 90:cb3d968589d8 | 295 | #include "stm32l1xx_hal_flash_ex.h" |
Kojto | 90:cb3d968589d8 | 296 | #include "stm32l1xx_hal_flash_ramfunc.h" |
Kojto | 90:cb3d968589d8 | 297 | |
Kojto | 90:cb3d968589d8 | 298 | /* Exported functions ------------------------------------------------------- */ |
Kojto | 90:cb3d968589d8 | 299 | |
Kojto | 90:cb3d968589d8 | 300 | /** @addtogroup FLASH_Exported_Functions |
Kojto | 90:cb3d968589d8 | 301 | * @{ |
Kojto | 90:cb3d968589d8 | 302 | */ |
Kojto | 90:cb3d968589d8 | 303 | |
Kojto | 90:cb3d968589d8 | 304 | /** @addtogroup FLASH_Exported_Functions_Group1 |
Kojto | 90:cb3d968589d8 | 305 | * @{ |
Kojto | 90:cb3d968589d8 | 306 | */ |
Kojto | 90:cb3d968589d8 | 307 | |
Kojto | 90:cb3d968589d8 | 308 | /** |
Kojto | 90:cb3d968589d8 | 309 | * @brief FLASH memory functions that can be executed from FLASH. |
Kojto | 90:cb3d968589d8 | 310 | */ |
Kojto | 90:cb3d968589d8 | 311 | /* Program operation functions ***********************************************/ |
Kojto | 90:cb3d968589d8 | 312 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
Kojto | 90:cb3d968589d8 | 313 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
Kojto | 90:cb3d968589d8 | 314 | |
Kojto | 90:cb3d968589d8 | 315 | /* FLASH IRQ handler function */ |
Kojto | 90:cb3d968589d8 | 316 | void HAL_FLASH_IRQHandler(void); |
Kojto | 90:cb3d968589d8 | 317 | |
Kojto | 90:cb3d968589d8 | 318 | /* Callbacks in non blocking modes */ |
Kojto | 90:cb3d968589d8 | 319 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
Kojto | 90:cb3d968589d8 | 320 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
Kojto | 90:cb3d968589d8 | 321 | |
Kojto | 90:cb3d968589d8 | 322 | /** |
Kojto | 90:cb3d968589d8 | 323 | * @} |
Kojto | 90:cb3d968589d8 | 324 | */ |
Kojto | 90:cb3d968589d8 | 325 | |
Kojto | 90:cb3d968589d8 | 326 | /** @addtogroup FLASH_Exported_Functions_Group2 |
Kojto | 90:cb3d968589d8 | 327 | * @{ |
Kojto | 90:cb3d968589d8 | 328 | */ |
Kojto | 90:cb3d968589d8 | 329 | |
Kojto | 90:cb3d968589d8 | 330 | /* FLASH Memory Programming functions *****************************************/ |
Kojto | 90:cb3d968589d8 | 331 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
Kojto | 90:cb3d968589d8 | 332 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
Kojto | 90:cb3d968589d8 | 333 | |
Kojto | 90:cb3d968589d8 | 334 | /* Option Bytes Programming functions *****************************************/ |
Kojto | 90:cb3d968589d8 | 335 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
Kojto | 90:cb3d968589d8 | 336 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
Kojto | 90:cb3d968589d8 | 337 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
Kojto | 90:cb3d968589d8 | 338 | |
Kojto | 90:cb3d968589d8 | 339 | /** |
Kojto | 90:cb3d968589d8 | 340 | * @} |
Kojto | 90:cb3d968589d8 | 341 | */ |
Kojto | 90:cb3d968589d8 | 342 | |
Kojto | 90:cb3d968589d8 | 343 | /** @addtogroup FLASH_Exported_Functions_Group3 |
Kojto | 90:cb3d968589d8 | 344 | * @{ |
Kojto | 90:cb3d968589d8 | 345 | */ |
Kojto | 90:cb3d968589d8 | 346 | |
Kojto | 90:cb3d968589d8 | 347 | /* Peripheral State methods **************************************************/ |
Kojto | 90:cb3d968589d8 | 348 | FLASH_ErrorTypeDef HAL_FLASH_GetError(void); |
Kojto | 90:cb3d968589d8 | 349 | |
Kojto | 90:cb3d968589d8 | 350 | /** |
Kojto | 90:cb3d968589d8 | 351 | * @} |
Kojto | 90:cb3d968589d8 | 352 | */ |
Kojto | 90:cb3d968589d8 | 353 | |
Kojto | 90:cb3d968589d8 | 354 | /** |
Kojto | 90:cb3d968589d8 | 355 | * @} |
Kojto | 90:cb3d968589d8 | 356 | */ |
Kojto | 90:cb3d968589d8 | 357 | |
Kojto | 90:cb3d968589d8 | 358 | /** @addtogroup FLASH_Internal_Functions |
Kojto | 90:cb3d968589d8 | 359 | * @{ |
Kojto | 90:cb3d968589d8 | 360 | */ |
Kojto | 90:cb3d968589d8 | 361 | |
Kojto | 90:cb3d968589d8 | 362 | /** |
Kojto | 90:cb3d968589d8 | 363 | * @brief Function used internally by HAL FLASH driver. |
Kojto | 90:cb3d968589d8 | 364 | */ |
Kojto | 90:cb3d968589d8 | 365 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); |
Kojto | 90:cb3d968589d8 | 366 | |
Kojto | 90:cb3d968589d8 | 367 | /** |
Kojto | 90:cb3d968589d8 | 368 | * @} |
Kojto | 90:cb3d968589d8 | 369 | */ |
Kojto | 90:cb3d968589d8 | 370 | |
Kojto | 90:cb3d968589d8 | 371 | /** |
Kojto | 90:cb3d968589d8 | 372 | * @} |
Kojto | 90:cb3d968589d8 | 373 | */ |
Kojto | 90:cb3d968589d8 | 374 | |
Kojto | 90:cb3d968589d8 | 375 | /** |
Kojto | 90:cb3d968589d8 | 376 | * @} |
Kojto | 90:cb3d968589d8 | 377 | */ |
Kojto | 90:cb3d968589d8 | 378 | |
Kojto | 90:cb3d968589d8 | 379 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 380 | } |
Kojto | 90:cb3d968589d8 | 381 | #endif |
Kojto | 90:cb3d968589d8 | 382 | |
Kojto | 90:cb3d968589d8 | 383 | #endif /* __STM32L1xx_HAL_FLASH_H */ |
Kojto | 90:cb3d968589d8 | 384 | |
Kojto | 90:cb3d968589d8 | 385 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |