1 /** 2 ****************************************************************************** 3 * @file stm32l0xx_hal_flash_ex.h 4 * @author MCD Application Team 5 * @brief Header file of Flash HAL Extended module. 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 10 * All rights reserved.</center></h2> 11 * 12 * This software component is licensed by ST under BSD 3-Clause license, 13 * the "License"; You may not use this file except in compliance with the 14 * License. You may obtain a copy of the License at: 15 * opensource.org/licenses/BSD-3-Clause 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef __STM32L0xx_HAL_FLASH_EX_H 22 #define __STM32L0xx_HAL_FLASH_EX_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32l0xx_hal_def.h" 30 31 /** @addtogroup STM32L0xx_HAL_Driver 32 * @{ 33 */ 34 35 /** @addtogroup FLASHEx 36 * @{ 37 */ 38 39 /** @addtogroup FLASHEx_Private_Constants 40 * @{ 41 */ 42 #define FLASH_SIZE_DATA_REGISTER FLASHSIZE_BASE 43 44 #define FLASH_NBPAGES_MAX (FLASH_SIZE / FLASH_PAGE_SIZE) 45 46 #define WRP_MASK_LOW (0x0000FFFFU) 47 #define WRP_MASK_HIGH (0xFFFF0000U) 48 49 /** 50 * @} 51 */ 52 53 /** @addtogroup FLASHEx_Private_Macros 54 * @{ 55 */ 56 57 #define IS_FLASH_TYPEERASE(__VALUE__) (((__VALUE__) == FLASH_TYPEERASE_PAGES)) 58 59 #define IS_OPTIONBYTE(__VALUE__) (((__VALUE__) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | \ 60 OPTIONBYTE_USER | OPTIONBYTE_BOR | OPTIONBYTE_BOOT_BIT1))) 61 62 #define IS_WRPSTATE(__VALUE__) (((__VALUE__) == OB_WRPSTATE_DISABLE) || \ 63 ((__VALUE__) == OB_WRPSTATE_ENABLE)) 64 65 #define IS_OB_WRP(__PAGE__) (((__PAGE__) != 0x0000000U)) 66 67 #define IS_OB_RDP(__LEVEL__) (((__LEVEL__) == OB_RDP_LEVEL_0) ||\ 68 ((__LEVEL__) == OB_RDP_LEVEL_1) ||\ 69 ((__LEVEL__) == OB_RDP_LEVEL_2)) 70 71 #define IS_OB_BOR_LEVEL(__LEVEL__) (((__LEVEL__) == OB_BOR_OFF) || \ 72 ((__LEVEL__) == OB_BOR_LEVEL1) || \ 73 ((__LEVEL__) == OB_BOR_LEVEL2) || \ 74 ((__LEVEL__) == OB_BOR_LEVEL3) || \ 75 ((__LEVEL__) == OB_BOR_LEVEL4) || \ 76 ((__LEVEL__) == OB_BOR_LEVEL5)) 77 78 #define IS_OB_IWDG_SOURCE(__SOURCE__) (((__SOURCE__) == OB_IWDG_SW) || ((__SOURCE__) == OB_IWDG_HW)) 79 80 #define IS_OB_STOP_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STOP_NORST) || ((__SOURCE__) == OB_STOP_RST)) 81 82 #define IS_OB_STDBY_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STDBY_NORST) || ((__SOURCE__) == OB_STDBY_RST)) 83 84 #if defined(FLASH_OPTR_WPRMOD) && defined(FLASH_OPTR_BFB2) 85 86 #define IS_OBEX(__VALUE__) (((__VALUE__) <= (OPTIONBYTE_PCROP | OPTIONBYTE_BOOTCONFIG)) && ((__VALUE__) != 0U)) 87 88 #elif defined(FLASH_OPTR_WPRMOD) && !defined(FLASH_OPTR_BFB2) 89 90 #define IS_OBEX(__VALUE__) ((__VALUE__) == OPTIONBYTE_PCROP) 91 92 #elif !defined(FLASH_OPTR_WPRMOD) && defined(FLASH_OPTR_BFB2) 93 94 #define IS_OBEX(__VALUE__) ((__VALUE__) == OPTIONBYTE_BOOTCONFIG) 95 96 #endif /* FLASH_OPTR_WPRMOD && FLASH_OPTR_BFB2 */ 97 98 #if defined(FLASH_OPTR_WPRMOD) 99 100 #define IS_PCROPSTATE(__VALUE__) (((__VALUE__) == OB_PCROP_STATE_DISABLE) || \ 101 ((__VALUE__) == OB_PCROP_STATE_ENABLE)) 102 103 #define IS_OB_PCROP(__PAGE__) (((__PAGE__) != 0x0000000U)) 104 #endif /* FLASH_OPTR_WPRMOD */ 105 106 #if defined(FLASH_OPTR_BFB2) 107 108 #define IS_OB_BOOT_BANK(__BANK__) (((__BANK__) == OB_BOOT_BANK2) || ((__BANK__) == OB_BOOT_BANK1)) 109 110 #endif /* FLASH_OPTR_BFB2 */ 111 112 #define IS_OB_BOOT1(__BOOT_BIT1__) (((__BOOT_BIT1__) == OB_BOOT_BIT1_RESET) || ((__BOOT_BIT1__) == OB_BOOT_BIT1_SET)) 113 #define IS_TYPEPROGRAMDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEPROGRAMDATA_BYTE) || \ 114 ((__VALUE__) == FLASH_TYPEPROGRAMDATA_HALFWORD) || \ 115 ((__VALUE__) == FLASH_TYPEPROGRAMDATA_WORD)) 116 117 118 /** @defgroup FLASHEx_Address FLASHEx Address 119 * @{ 120 */ 121 122 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) 123 124 #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END)) 125 #define IS_FLASH_DATA_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK1_END)) 126 #define IS_FLASH_DATA_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BANK2_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END)) 127 #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE))) 128 #define IS_FLASH_PROGRAM_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + (FLASH_SIZE >> 1)))) 129 #define IS_FLASH_PROGRAM_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BANK2_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE))) 130 #else 131 #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_END)) 132 #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE))) 133 #endif 134 135 #define IS_NBPAGES(__PAGES__) (((__PAGES__) >= 1) && ((__PAGES__) <= FLASH_NBPAGES_MAX)) 136 137 /** 138 * @} 139 */ 140 141 /** 142 * @} 143 */ 144 /* Exported types ------------------------------------------------------------*/ 145 146 /** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types 147 * @{ 148 */ 149 150 /** 151 * @brief FLASH Erase structure definition 152 */ 153 typedef struct 154 { 155 uint32_t TypeErase; /*!< TypeErase: Page Erase only. 156 This parameter can be a value of @ref FLASHEx_Type_Erase */ 157 158 uint32_t PageAddress; /*!< PageAddress: Initial FLASH address to be erased 159 This parameter must be a value belonging to FLASH Programm address (depending on the devices) */ 160 161 uint32_t NbPages; /*!< NbPages: Number of pages to be erased. 162 This parameter must be a value between 1 and (max number of pages - value of Initial page)*/ 163 164 } FLASH_EraseInitTypeDef; 165 166 /** 167 * @brief FLASH Option Bytes PROGRAM structure definition 168 */ 169 typedef struct 170 { 171 uint32_t OptionType; /*!< OptionType: Option byte to be configured. 172 This parameter can be a value of @ref FLASHEx_Option_Type */ 173 174 uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation. 175 This parameter can be a value of @ref FLASHEx_WRP_State */ 176 177 uint32_t WRPSector; /*!< WRPSector: This bitfield specifies the sector (s) which are write protected. 178 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection */ 179 180 #if defined(STM32L071xx) || defined(STM32L072xx) || defined(STM32L073xx) || defined(STM32L081xx) || defined(STM32L082xx) || defined(STM32L083xx) 181 uint32_t WRPSector2; /*!< WRPSector2 : This bitfield specifies the sector(s) upper Sector31 which are write protected. 182 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection2 */ 183 #endif 184 185 uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level. 186 This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */ 187 188 uint8_t BORLevel; /*!< BORLevel: Set the BOR Level. 189 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOR_Level */ 190 191 uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. 192 This parameter can be a combination of @ref FLASHEx_Option_Bytes_IWatchdog, 193 @ref FLASHEx_Option_Bytes_nRST_STOP and @ref FLASHEx_Option_Bytes_nRST_STDBY*/ 194 195 uint8_t BOOTBit1Config; /*!< BOOT1Config: Together with input pad Boot0, this bit selects the boot source, flash, ram or system memory 196 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOTBit1 */ 197 } FLASH_OBProgramInitTypeDef; 198 199 #if defined(FLASH_OPTR_WPRMOD) || defined(FLASH_OPTR_BFB2) 200 /** 201 * @brief FLASH Advanced Option Bytes Program structure definition 202 */ 203 typedef struct 204 { 205 uint32_t OptionType; /*!< OptionType: Option byte to be configured for extension . 206 This parameter can be a value of @ref FLASHEx_OptionAdv_Type */ 207 208 #if defined(FLASH_OPTR_WPRMOD) 209 uint32_t PCROPState; /*!< PCROPState: PCROP activation or deactivation. 210 This parameter can be a value of @ref FLASHEx_PCROP_State */ 211 212 uint32_t PCROPSector; /*!< PCROPSector : This bitfield specifies the sector(s) which are read/write protected. 213 This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ 214 215 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) 216 uint32_t PCROPSector2; /*!< PCROPSector : This bitfield specifies the sector(s) upper Sector31 which are read/write protected. 217 This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 */ 218 #endif /* STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */ 219 #endif /* FLASH_OPTR_WPRMOD */ 220 221 #if defined(FLASH_OPTR_BFB2) 222 uint16_t BootConfig; /*!< BootConfig: specifies Option bytes for boot config 223 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOT */ 224 #endif /* FLASH_OPTR_BFB2*/ 225 } FLASH_AdvOBProgramInitTypeDef; 226 227 /** 228 * @} 229 */ 230 #endif /* FLASH_OPTR_WPRMOD || FLASH_OPTR_BFB2 */ 231 232 /* Exported constants --------------------------------------------------------*/ 233 234 235 /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants 236 * @{ 237 */ 238 239 /** @defgroup FLASHEx_Type_Erase FLASHEx_Type_Erase 240 * @{ 241 */ 242 #define FLASH_TYPEERASE_PAGES ((uint32_t)0x00U) /*!<Page erase only*/ 243 244 /** 245 * @} 246 */ 247 248 /** @defgroup FLASHEx_Option_Type FLASHEx Option Type 249 * @{ 250 */ 251 #define OPTIONBYTE_WRP ((uint32_t)0x01U) /*!<WRP option byte configuration*/ 252 #define OPTIONBYTE_RDP ((uint32_t)0x02U) /*!<RDP option byte configuration*/ 253 #define OPTIONBYTE_USER ((uint32_t)0x04U) /*!<USER option byte configuration*/ 254 #define OPTIONBYTE_BOR ((uint32_t)0x08U) /*!<BOR option byte configuration*/ 255 #define OPTIONBYTE_BOOT_BIT1 ((uint32_t)0x10U) /*!< BOOT PIN1 option byte configuration*/ 256 257 /** 258 * @} 259 */ 260 261 /** @defgroup FLASHEx_WRP_State FLASHEx WRP State 262 * @{ 263 */ 264 #define OB_WRPSTATE_DISABLE ((uint32_t)0x00U) /*!<Disable the write protection of the desired sectors*/ 265 #define OB_WRPSTATE_ENABLE ((uint32_t)0x01U) /*!<Enable the write protection of the desired sectors*/ 266 267 /** 268 * @} 269 */ 270 271 #if defined (STM32L011xx) || defined (STM32L021xx) || defined (STM32L031xx) || defined (STM32L041xx) 272 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection 273 * @{ 274 */ 275 #define OB_WRP_Pages0to31 ((uint32_t)0x00000001U) /* Write protection of Sector0 */ 276 #define OB_WRP_Pages32to63 ((uint32_t)0x00000002U) /* Write protection of Sector1 */ 277 #define OB_WRP_Pages64to95 ((uint32_t)0x00000004U) /* Write protection of Sector2 */ 278 #define OB_WRP_Pages96to127 ((uint32_t)0x00000008U) /* Write protection of Sector3 */ 279 #define OB_WRP_Pages128to159 ((uint32_t)0x00000010U) /* Write protection of Sector4 */ 280 #define OB_WRP_Pages160to191 ((uint32_t)0x00000020U) /* Write protection of Sector5 */ 281 #define OB_WRP_Pages192to223 ((uint32_t)0x00000040U) /* Write protection of Sector6 */ 282 #define OB_WRP_Pages224to255 ((uint32_t)0x00000080U) /* Write protection of Sector7 */ 283 #define OB_WRP_AllPages ((uint32_t)0x000000FFU) /*!< Write protection of all Sectors */ 284 /** 285 * @} 286 */ 287 #elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx) 288 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection 289 * @{ 290 */ 291 #define OB_WRP_Pages0to31 ((uint32_t)0x00000001U) /* Write protection of Sector0 */ 292 #define OB_WRP_Pages32to63 ((uint32_t)0x00000002U) /* Write protection of Sector1 */ 293 #define OB_WRP_Pages64to95 ((uint32_t)0x00000004U) /* Write protection of Sector2 */ 294 #define OB_WRP_Pages96to127 ((uint32_t)0x00000008U) /* Write protection of Sector3 */ 295 #define OB_WRP_Pages128to159 ((uint32_t)0x00000010U) /* Write protection of Sector4 */ 296 #define OB_WRP_Pages160to191 ((uint32_t)0x00000020U) /* Write protection of Sector5 */ 297 #define OB_WRP_Pages192to223 ((uint32_t)0x00000040U) /* Write protection of Sector6 */ 298 #define OB_WRP_Pages224to255 ((uint32_t)0x00000080U) /* Write protection of Sector7 */ 299 #define OB_WRP_Pages256to287 ((uint32_t)0x00000100U) /* Write protection of Sector8 */ 300 #define OB_WRP_Pages288to319 ((uint32_t)0x00000200U) /* Write protection of Sector9 */ 301 #define OB_WRP_Pages320to351 ((uint32_t)0x00000400U) /* Write protection of Sector10 */ 302 #define OB_WRP_Pages352to383 ((uint32_t)0x00000800U) /* Write protection of Sector11 */ 303 #define OB_WRP_Pages384to415 ((uint32_t)0x00001000U) /* Write protection of Sector12 */ 304 #define OB_WRP_Pages416to447 ((uint32_t)0x00002000U) /* Write protection of Sector13 */ 305 #define OB_WRP_Pages448to479 ((uint32_t)0x00004000U) /* Write protection of Sector14 */ 306 #define OB_WRP_Pages480to511 ((uint32_t)0x00008000U) /* Write protection of Sector15 */ 307 #define OB_WRP_AllPages ((uint32_t)0x0000FFFFU) /*!< Write protection of all Sectors */ 308 /** 309 * @} 310 */ 311 312 #elif defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) 313 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write ProtectionP 314 * @{ 315 */ 316 #define OB_WRP_Pages0to31 ((uint32_t)0x00000001U) /* Write protection of Sector0 */ 317 #define OB_WRP_Pages32to63 ((uint32_t)0x00000002U) /* Write protection of Sector1 */ 318 #define OB_WRP_Pages64to95 ((uint32_t)0x00000004U) /* Write protection of Sector2 */ 319 #define OB_WRP_Pages96to127 ((uint32_t)0x00000008U) /* Write protection of Sector3 */ 320 #define OB_WRP_Pages128to159 ((uint32_t)0x00000010U) /* Write protection of Sector4 */ 321 #define OB_WRP_Pages160to191 ((uint32_t)0x00000020U) /* Write protection of Sector5 */ 322 #define OB_WRP_Pages192to223 ((uint32_t)0x00000040U) /* Write protection of Sector6 */ 323 #define OB_WRP_Pages224to255 ((uint32_t)0x00000080U) /* Write protection of Sector7 */ 324 #define OB_WRP_Pages256to287 ((uint32_t)0x00000100U) /* Write protection of Sector8 */ 325 #define OB_WRP_Pages288to319 ((uint32_t)0x00000200U) /* Write protection of Sector9 */ 326 #define OB_WRP_Pages320to351 ((uint32_t)0x00000400U) /* Write protection of Sector10 */ 327 #define OB_WRP_Pages352to383 ((uint32_t)0x00000800U) /* Write protection of Sector11 */ 328 #define OB_WRP_Pages384to415 ((uint32_t)0x00001000U) /* Write protection of Sector12 */ 329 #define OB_WRP_Pages416to447 ((uint32_t)0x00002000U) /* Write protection of Sector13 */ 330 #define OB_WRP_Pages448to479 ((uint32_t)0x00004000U) /* Write protection of Sector14 */ 331 #define OB_WRP_Pages480to511 ((uint32_t)0x00008000U) /* Write protection of Sector15 */ 332 #define OB_WRP_Pages512to543 ((uint32_t)0x00010000U) /* Write protection of Sector16 */ 333 #define OB_WRP_Pages544to575 ((uint32_t)0x00020000U) /* Write protection of Sector17 */ 334 #define OB_WRP_Pages576to607 ((uint32_t)0x00040000U) /* Write protection of Sector18 */ 335 #define OB_WRP_Pages608to639 ((uint32_t)0x00080000U) /* Write protection of Sector19 */ 336 #define OB_WRP_Pages640to671 ((uint32_t)0x00100000U) /* Write protection of Sector20 */ 337 #define OB_WRP_Pages672to703 ((uint32_t)0x00200000U) /* Write protection of Sector21 */ 338 #define OB_WRP_Pages704to735 ((uint32_t)0x00400000U) /* Write protection of Sector22 */ 339 #define OB_WRP_Pages736to767 ((uint32_t)0x00800000U) /* Write protection of Sector23 */ 340 #define OB_WRP_Pages768to799 ((uint32_t)0x01000000U) /* Write protection of Sector24 */ 341 #define OB_WRP_Pages800to831 ((uint32_t)0x02000000U) /* Write protection of Sector25 */ 342 #define OB_WRP_Pages832to863 ((uint32_t)0x04000000U) /* Write protection of Sector26 */ 343 #define OB_WRP_Pages864to895 ((uint32_t)0x08000000U) /* Write protection of Sector27 */ 344 #define OB_WRP_Pages896to927 ((uint32_t)0x10000000U) /* Write protection of Sector28 */ 345 #define OB_WRP_Pages928to959 ((uint32_t)0x20000000U) /* Write protection of Sector29 */ 346 #define OB_WRP_Pages960to991 ((uint32_t)0x40000000U) /* Write protection of Sector30 */ 347 #define OB_WRP_Pages992to1023 ((uint32_t)0x80000000U) /* Write protection of Sector31 */ 348 #define OB_WRP_AllPages ((uint32_t)0xFFFFFFFFU) /*!<Write protection of all Sectors */ 349 /** 350 * @} 351 */ 352 353 /** @defgroup FLASHEx_Option_Bytes_Write_Protection2 FLASH Option Bytes Write Protection 354 * @{ 355 */ 356 #define OB_WRP2_Pages1024to1055 ((uint32_t)0x00000001U) /* Write protection of Sector32 */ 357 #define OB_WRP2_Pages1056to1087 ((uint32_t)0x00000002U) /* Write protection of Sector33 */ 358 #define OB_WRP2_Pages1088to1119 ((uint32_t)0x00000004U) /* Write protection of Sector34 */ 359 #define OB_WRP2_Pages1120to1151 ((uint32_t)0x00000008U) /* Write protection of Sector35 */ 360 #define OB_WRP2_Pages1152to1183 ((uint32_t)0x00000010U) /* Write protection of Sector36 */ 361 #define OB_WRP2_Pages1184to1215 ((uint32_t)0x00000020U) /* Write protection of Sector37 */ 362 #define OB_WRP2_Pages1216to1247 ((uint32_t)0x00000040U) /* Write protection of Sector38 */ 363 #define OB_WRP2_Pages1248to1279 ((uint32_t)0x00000080U) /* Write protection of Sector39 */ 364 #define OB_WRP2_Pages1280to1311 ((uint32_t)0x00000100U) /* Write protection of Sector40 */ 365 #define OB_WRP2_Pages1312to1343 ((uint32_t)0x00000200U) /* Write protection of Sector41 */ 366 #define OB_WRP2_Pages1344to1375 ((uint32_t)0x00000400U) /* Write protection of Sector42 */ 367 #define OB_WRP2_Pages1376to1407 ((uint32_t)0x00000800U) /* Write protection of Sector43 */ 368 #define OB_WRP2_Pages1408to1439 ((uint32_t)0x00001000U) /* Write protection of Sector44 */ 369 #define OB_WRP2_Pages1440to1471 ((uint32_t)0x00002000U) /* Write protection of Sector45 */ 370 #define OB_WRP2_Pages1472to1503 ((uint32_t)0x00004000U) /* Write protection of Sector46 */ 371 #define OB_WRP2_Pages1504to1535 ((uint32_t)0x00008000U) /* Write protection of Sector47 */ 372 #define OB_WRP2_AllPages ((uint32_t)0x0000FFFFU) /*!< Write protection of all Sectors WRP2 */ 373 /** 374 * @} 375 */ 376 #endif /* STM32L071xx || STM32L072xx || (STM32L073xx) || (STM32L081xx) || (STM32L082xx) || (STM32L083xx) */ 377 378 /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASHEx Option Bytes Read Protection 379 * @{ 380 */ 381 #define OB_RDP_LEVEL_0 ((uint8_t)0xAAU) 382 #define OB_RDP_LEVEL_1 ((uint8_t)0xBBU) 383 #define OB_RDP_LEVEL_2 ((uint8_t)0xCCU) /* Warning: When enabling read protection level 2 384 it is no more possible to go back to level 1 or 0 */ 385 386 /** 387 * @} 388 */ 389 390 /** @defgroup FLASHEx_Option_Bytes_BOR_Level FLASHEx Option Bytes BOR Level 391 * @{ 392 */ 393 394 #define OB_BOR_OFF ((uint8_t)0x00U) /*!< BOR is disabled at power down, the reset is asserted when the VDD 395 power supply reaches the PDR(Power Down Reset) threshold (1.5V) */ 396 #define OB_BOR_LEVEL1 ((uint8_t)0x08U) /*!< BOR Reset threshold levels for 1.7V - 1.8V VDD power supply */ 397 #define OB_BOR_LEVEL2 ((uint8_t)0x09U) /*!< BOR Reset threshold levels for 1.9V - 2.0V VDD power supply */ 398 #define OB_BOR_LEVEL3 ((uint8_t)0x0AU) /*!< BOR Reset threshold levels for 2.3V - 2.4V VDD power supply */ 399 #define OB_BOR_LEVEL4 ((uint8_t)0x0BU) /*!< BOR Reset threshold levels for 2.55V - 2.65V VDD power supply */ 400 #define OB_BOR_LEVEL5 ((uint8_t)0x0CU) /*!< BOR Reset threshold levels for 2.8V - 2.9V VDD power supply */ 401 402 /** 403 * @} 404 */ 405 406 /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASHEx Option Bytes IWatchdog 407 * @{ 408 */ 409 410 #define OB_IWDG_SW ((uint8_t)0x10U) /*!< Software WDG selected */ 411 #define OB_IWDG_HW ((uint8_t)0x00U) /*!< Hardware WDG selected */ 412 413 /** 414 * @} 415 */ 416 417 /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASHEx Option Bytes nRST_STOP 418 * @{ 419 */ 420 421 #define OB_STOP_NORST ((uint8_t)0x20U) /*!< No reset generated when entering in STOP */ 422 #define OB_STOP_RST ((uint8_t)0x00U) /*!< Reset generated when entering in STOP */ 423 /** 424 * @} 425 */ 426 427 /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASHEx Option Bytes nRST_STDBY 428 * @{ 429 */ 430 431 #define OB_STDBY_NORST ((uint8_t)0x40U) /*!< No reset generated when entering in STANDBY */ 432 #define OB_STDBY_RST ((uint8_t)0x00U) /*!< Reset generated when entering in STANDBY */ 433 434 /** 435 * @} 436 */ 437 438 #if defined(FLASH_OPTR_WPRMOD) 439 440 /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type 441 * @{ 442 */ 443 444 #define OPTIONBYTE_PCROP ((uint32_t)0x01U) /*!<PCROP option byte configuration*/ 445 446 /** 447 * @} 448 */ 449 450 #endif /* FLASH_OPTR_WPRMOD */ 451 452 #if defined(FLASH_OPTR_BFB2) 453 454 /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type 455 * @{ 456 */ 457 458 #define OPTIONBYTE_BOOTCONFIG ((uint32_t)0x02U) /*!<BOOTConfig option byte configuration*/ 459 460 /** 461 * @} 462 */ 463 464 #endif /* FLASH_OPTR_BFB2 */ 465 466 #if defined(FLASH_OPTR_WPRMOD) 467 468 /** @defgroup FLASHEx_PCROP_State FLASHEx PCROP State 469 * @{ 470 */ 471 #define OB_PCROP_STATE_DISABLE ((uint32_t)0x00U) /*!<Disable PCROP for selected sectors */ 472 #define OB_PCROP_STATE_ENABLE ((uint32_t)0x01U) /*!<Enable PCROP for selected sectors */ 473 474 /** 475 * @} 476 */ 477 478 /** @defgroup FLASHEx_Selection_Protection_Mode FLASHEx Selection Protection Mode 479 * @{ 480 */ 481 #define OB_PCROP_DESELECTED ((uint16_t)0x0000U) /*!< Disabled PCROP, nWPRi bits used for Write Protection on sector i */ 482 #define OB_PCROP_SELECTED ((uint16_t)FLASH_OPTR_WPRMOD) /*!< Enable PCROP, nWPRi bits used for PCRoP Protection on sector i */ 483 484 /** 485 * @} 486 */ 487 #endif /* FLASH_OPTR_WPRMOD */ 488 489 #if defined (STM32L011xx) || defined (STM32L021xx) || defined (STM32L031xx) || defined (STM32L041xx) 490 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASHEx Option Bytes PC Read/Write Protection 491 * @{ 492 */ 493 #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector0 */ 494 #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector1 */ 495 #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector2 */ 496 #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector3 */ 497 #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector4 */ 498 #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector5 */ 499 #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector6 */ 500 #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector7 */ 501 #define OB_PCROP_AllPages ((uint32_t)0x000000FFU) /*!< PC Read/Write protection of all Sectors */ 502 /** 503 * @} 504 */ 505 #elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx) 506 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASHEx Option Bytes PC Read/Write Protection 507 * @{ 508 */ 509 #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector0 */ 510 #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector1 */ 511 #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector2 */ 512 #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector3 */ 513 #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector4 */ 514 #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector5 */ 515 #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector6 */ 516 #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector7 */ 517 #define OB_PCROP_Pages256to287 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector8 */ 518 #define OB_PCROP_Pages288to319 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector9 */ 519 #define OB_PCROP_Pages320to351 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector10 */ 520 #define OB_PCROP_Pages352to383 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector11 */ 521 #define OB_PCROP_Pages384to415 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector12 */ 522 #define OB_PCROP_Pages416to447 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector13 */ 523 #define OB_PCROP_Pages448to479 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector14 */ 524 #define OB_PCROP_Pages480to511 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector15 */ 525 #define OB_PCROP_AllPages ((uint32_t)0x0000FFFFU) /*!< PC Read/Write protection of all Sectors */ 526 /** 527 * @} 528 */ 529 #endif 530 531 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) 532 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASH Option Bytes PC Read/Write Protection 533 * @{ 534 */ 535 #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector0 */ 536 #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector1 */ 537 #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector2 */ 538 #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector3 */ 539 #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector4 */ 540 #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector5 */ 541 #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector6 */ 542 #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector7 */ 543 #define OB_PCROP_Pages256to287 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector8 */ 544 #define OB_PCROP_Pages288to319 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector9 */ 545 #define OB_PCROP_Pages320to351 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector10 */ 546 #define OB_PCROP_Pages352to383 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector11 */ 547 #define OB_PCROP_Pages384to415 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector12 */ 548 #define OB_PCROP_Pages416to447 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector13 */ 549 #define OB_PCROP_Pages448to479 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector14 */ 550 #define OB_PCROP_Pages480to511 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector15 */ 551 #define OB_PCROP_Pages512to543 ((uint32_t)0x00010000U) /* PC Read/Write protection of Sector16 */ 552 #define OB_PCROP_Pages544to575 ((uint32_t)0x00020000U) /* PC Read/Write protection of Sector17 */ 553 #define OB_PCROP_Pages576to607 ((uint32_t)0x00040000U) /* PC Read/Write protection of Sector18 */ 554 #define OB_PCROP_Pages608to639 ((uint32_t)0x00080000U) /* PC Read/Write protection of Sector19 */ 555 #define OB_PCROP_Pages640to671 ((uint32_t)0x00100000U) /* PC Read/Write protection of Sector20 */ 556 #define OB_PCROP_Pages672to703 ((uint32_t)0x00200000U) /* PC Read/Write protection of Sector21 */ 557 #define OB_PCROP_Pages704to735 ((uint32_t)0x00400000U) /* PC Read/Write protection of Sector22 */ 558 #define OB_PCROP_Pages736to767 ((uint32_t)0x00800000U) /* PC Read/Write protection of Sector23 */ 559 #define OB_PCROP_Pages768to799 ((uint32_t)0x01000000U) /* PC Read/Write protection of Sector24 */ 560 #define OB_PCROP_Pages800to831 ((uint32_t)0x02000000U) /* PC Read/Write protection of Sector25 */ 561 #define OB_PCROP_Pages832to863 ((uint32_t)0x04000000U) /* PC Read/Write protection of Sector26 */ 562 #define OB_PCROP_Pages864to895 ((uint32_t)0x08000000U) /* PC Read/Write protection of Sector27 */ 563 #define OB_PCROP_Pages896to927 ((uint32_t)0x10000000U) /* PC Read/Write protection of Sector28 */ 564 #define OB_PCROP_Pages928to959 ((uint32_t)0x20000000U) /* PC Read/Write protection of Sector29 */ 565 #define OB_PCROP_Pages960to991 ((uint32_t)0x40000000U) /* PC Read/Write protection of Sector30 */ 566 #define OB_PCROP_Pages992to1023 ((uint32_t)0x80000000U) /* PC Read/Write protection of Sector31 */ 567 #define OB_PCROP_AllPages ((uint32_t)0xFFFFFFFFU) /*!<PC Read/Write protection of all Sectors */ 568 /** 569 * @} 570 */ 571 572 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 FLASH Option Bytes PC Read/Write Protection (Sector 2) 573 * @{ 574 */ 575 #define OB_PCROP2_Pages1024to1055 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector32 */ 576 #define OB_PCROP2_Pages1056to1087 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector33 */ 577 #define OB_PCROP2_Pages1088to1119 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector34 */ 578 #define OB_PCROP2_Pages1120to1151 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector35 */ 579 #define OB_PCROP2_Pages1152to1183 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector36 */ 580 #define OB_PCROP2_Pages1184to1215 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector37 */ 581 #define OB_PCROP2_Pages1216to1247 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector38 */ 582 #define OB_PCROP2_Pages1248to1279 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector39 */ 583 #define OB_PCROP2_Pages1280to1311 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector40 */ 584 #define OB_PCROP2_Pages1312to1343 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector41 */ 585 #define OB_PCROP2_Pages1344to1375 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector42 */ 586 #define OB_PCROP2_Pages1376to1407 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector43 */ 587 #define OB_PCROP2_Pages1408to1439 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector44 */ 588 #define OB_PCROP2_Pages1440to1471 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector45 */ 589 #define OB_PCROP2_Pages1472to1503 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector46 */ 590 #define OB_PCROP2_Pages1504to1535 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector47 */ 591 #define OB_PCROP2_AllPages ((uint32_t)0x0000FFFFU) /*!< PC Read/Write protection of all Sectors PCROP2 */ 592 /** 593 * @} 594 */ 595 #endif /* STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */ 596 597 /** @defgroup FLASHEx_Option_Bytes_BOOTBit1 FLASH Option Bytes BOOT Bit1 Setup 598 * @{ 599 */ 600 #define OB_BOOT_BIT1_RESET (uint8_t)(0x00U) /*!< BOOT Bit 1 Reset */ 601 #define OB_BOOT_BIT1_SET (uint8_t)(0x01U) /*!< BOOT Bit 1 Set */ 602 /** 603 * @} 604 */ 605 606 /** @defgroup FLASHEx_Type_Program_Data FLASHEx Type Program Data 607 * @{ 608 */ 609 #define FLASH_TYPEPROGRAMDATA_BYTE ((uint32_t)0x00U) /*!<Program byte (8-bit) at a specified address.*/ 610 #define FLASH_TYPEPROGRAMDATA_HALFWORD ((uint32_t)0x01U) /*!<Program a half-word (16-bit) at a specified address.*/ 611 #define FLASH_TYPEPROGRAMDATA_WORD ((uint32_t)0x02U) /*!<Program a word (32-bit) at a specified address.*/ 612 613 /** 614 * @} 615 */ 616 617 #if defined(FLASH_OPTR_BFB2) 618 619 /** @defgroup FLASHEx_Option_Bytes_BOOT FLASHEx Option Bytes BOOT 620 * @{ 621 */ 622 623 #define OB_BOOT_BANK1 ((uint8_t)0x00U) /*!< At startup, if boot pin 0 and BOOT1 bit are set in boot from user Flash position 624 and this parameter is selected the device will boot from Bank 1 (Default)*/ 625 #define OB_BOOT_BANK2 ((uint8_t)(FLASH_OPTR_BFB2 >> 16)) /*!< At startup, if boot pin 0 and BOOT1 bit are set in boot from user Flash position 626 and this parameter is selected the device will boot from Bank 2 */ 627 628 /** 629 * @} 630 */ 631 #endif /* FLASH_OPTR_BFB2 */ 632 633 /** 634 * @} 635 */ 636 637 /* Exported macro ------------------------------------------------------------*/ 638 639 /** @defgroup FLASHEx_Exported_Macros FLASHEx Exported Macros 640 * @{ 641 */ 642 643 /** 644 * @brief Set the FLASH Latency. 645 * @param __LATENCY__ FLASH Latency 646 * This parameter can be one of the following values: 647 * @arg @ref FLASH_LATENCY_0 FLASH Zero Latency cycle 648 * @arg @ref FLASH_LATENCY_1 FLASH One Latency cycle 649 * @retval none 650 */ 651 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) \ 652 MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(__LATENCY__)) 653 654 /** 655 * @brief Get the FLASH Latency. 656 * @retval FLASH Latency 657 * This parameter can be one of the following values: 658 * @arg @ref FLASH_LATENCY_0 FLASH Zero Latency cycle 659 * @arg @ref FLASH_LATENCY_1 FLASH One Latency cycle 660 */ 661 #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)) 662 663 /** 664 * @brief Enable the FLASH prefetch buffer. 665 * @retval none 666 */ 667 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRFTEN) 668 669 /** 670 * @brief Disable the FLASH prefetch buffer. 671 * @retval none 672 */ 673 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRFTEN) 674 675 /** 676 * @brief Enable the FLASH Buffer cache. 677 * @retval none 678 */ 679 #define __HAL_FLASH_BUFFER_CACHE_ENABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF) 680 681 /** 682 * @brief Disable the FLASH Buffer cache. 683 * @retval none 684 */ 685 #define __HAL_FLASH_BUFFER_CACHE_DISABLE() SET_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF) 686 687 /** 688 * @brief Enable the FLASH preread buffer. 689 * @retval none 690 */ 691 #define __HAL_FLASH_PREREAD_BUFFER_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRE_READ) 692 693 /** 694 * @brief Disable the FLASH preread buffer. 695 * @retval none 696 */ 697 #define __HAL_FLASH_PREREAD_BUFFER_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRE_READ) 698 699 /** 700 * @brief Enable the FLASH power down during Sleep mode 701 * @retval none 702 */ 703 #define __HAL_FLASH_SLEEP_POWERDOWN_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD) 704 705 /** 706 * @brief Disable the FLASH power down during Sleep mode 707 * @retval none 708 */ 709 #define __HAL_FLASH_SLEEP_POWERDOWN_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD) 710 711 /** 712 * @brief Enable the Flash Run power down mode. 713 * @note Writing this bit to 0 this bit, automatically the keys are 714 * loss and a new unlock sequence is necessary to re-write it to 1. 715 */ 716 #define __HAL_FLASH_POWER_DOWN_ENABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ 717 FLASH->PDKEYR = FLASH_PDKEY2; \ 718 SET_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ 719 } while (0) 720 721 /** 722 * @brief Disable the Flash Run power down mode. 723 * @note Writing this bit to 0 this bit, automatically the keys are 724 * loss and a new unlock sequence is necessary to re-write it to 1. 725 */ 726 #define __HAL_FLASH_POWER_DOWN_DISABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ 727 FLASH->PDKEYR = FLASH_PDKEY2; \ 728 CLEAR_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ 729 } while (0) 730 731 /** 732 * @} 733 */ 734 735 /* Exported functions --------------------------------------------------------*/ 736 737 /** @addtogroup FLASHEx_Exported_Functions 738 * @{ 739 */ 740 741 /** @addtogroup FLASHEx_Exported_Functions_Group1 742 * @{ 743 */ 744 745 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError); 746 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); 747 748 /** 749 * @} 750 */ 751 752 /** @addtogroup FLASHEx_Exported_Functions_Group2 753 * @{ 754 */ 755 756 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); 757 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); 758 759 #if defined(FLASH_OPTR_WPRMOD) || defined(FLASH_OPTR_BFB2) 760 761 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); 762 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); 763 764 #endif /* FLASH_OPTR_WPRMOD || FLASH_OPTR_BFB2 */ 765 766 #if defined(FLASH_OPTR_WPRMOD) 767 768 HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void); 769 HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void); 770 771 #endif /* FLASH_OPTR_WPRMOD */ 772 773 /** 774 * @} 775 */ 776 777 /** @addtogroup FLASHEx_Exported_Functions_Group3 778 * @{ 779 */ 780 781 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Unlock(void); 782 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Lock(void); 783 784 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Erase(uint32_t Address); 785 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data); 786 void HAL_FLASHEx_DATAEEPROM_EnableFixedTimeProgram(void); 787 void HAL_FLASHEx_DATAEEPROM_DisableFixedTimeProgram(void); 788 789 /** 790 * @} 791 */ 792 793 /** 794 * @} 795 */ 796 797 /** 798 * @} 799 */ 800 801 /** 802 * @} 803 */ 804 805 #ifdef __cplusplus 806 } 807 #endif 808 809 #endif /* __STM32L0xx_HAL_FLASH_EX_H */ 810 811 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 812