STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_hal_flash_ex.h 00004 * @author MCD Application Team 00005 * @brief Header file of FLASH HAL Extension module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef __STM32F4xx_HAL_FLASH_EX_H 00022 #define __STM32F4xx_HAL_FLASH_EX_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f4xx_hal_def.h" 00030 00031 /** @addtogroup STM32F4xx_HAL_Driver 00032 * @{ 00033 */ 00034 00035 /** @addtogroup FLASHEx 00036 * @{ 00037 */ 00038 00039 /* Exported types ------------------------------------------------------------*/ 00040 /** @defgroup FLASHEx_Exported_Types FLASH Exported Types 00041 * @{ 00042 */ 00043 00044 /** 00045 * @brief FLASH Erase structure definition 00046 */ 00047 typedef struct 00048 { 00049 uint32_t TypeErase; /*!< Mass erase or sector Erase. 00050 This parameter can be a value of @ref FLASHEx_Type_Erase */ 00051 00052 uint32_t Banks; /*!< Select banks to erase when Mass erase is enabled. 00053 This parameter must be a value of @ref FLASHEx_Banks */ 00054 00055 uint32_t Sector; /*!< Initial FLASH sector to erase when Mass erase is disabled 00056 This parameter must be a value of @ref FLASHEx_Sectors */ 00057 00058 uint32_t NbSectors; /*!< Number of sectors to be erased. 00059 This parameter must be a value between 1 and (max number of sectors - value of Initial sector)*/ 00060 00061 uint32_t VoltageRange;/*!< The device voltage range which defines the erase parallelism 00062 This parameter must be a value of @ref FLASHEx_Voltage_Range */ 00063 00064 } FLASH_EraseInitTypeDef; 00065 00066 /** 00067 * @brief FLASH Option Bytes Program structure definition 00068 */ 00069 typedef struct 00070 { 00071 uint32_t OptionType; /*!< Option byte to be configured. 00072 This parameter can be a value of @ref FLASHEx_Option_Type */ 00073 00074 uint32_t WRPState; /*!< Write protection activation or deactivation. 00075 This parameter can be a value of @ref FLASHEx_WRP_State */ 00076 00077 uint32_t WRPSector; /*!< Specifies the sector(s) to be write protected. 00078 The value of this parameter depend on device used within the same series */ 00079 00080 uint32_t Banks; /*!< Select banks for WRP activation/deactivation of all sectors. 00081 This parameter must be a value of @ref FLASHEx_Banks */ 00082 00083 uint32_t RDPLevel; /*!< Set the read protection level. 00084 This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */ 00085 00086 uint32_t BORLevel; /*!< Set the BOR Level. 00087 This parameter can be a value of @ref FLASHEx_BOR_Reset_Level */ 00088 00089 uint8_t USERConfig; /*!< Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */ 00090 00091 } FLASH_OBProgramInitTypeDef; 00092 00093 /** 00094 * @brief FLASH Advanced Option Bytes Program structure definition 00095 */ 00096 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00097 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00098 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 00099 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 00100 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00101 typedef struct 00102 { 00103 uint32_t OptionType; /*!< Option byte to be configured for extension. 00104 This parameter can be a value of @ref FLASHEx_Advanced_Option_Type */ 00105 00106 uint32_t PCROPState; /*!< PCROP activation or deactivation. 00107 This parameter can be a value of @ref FLASHEx_PCROP_State */ 00108 00109 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 00110 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00111 uint16_t Sectors; /*!< specifies the sector(s) set for PCROP. 00112 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ 00113 #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx ||\ 00114 STM32F412Cx || STM32F413xx || STM32F423xx */ 00115 00116 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 00117 uint32_t Banks; /*!< Select banks for PCROP activation/deactivation of all sectors. 00118 This parameter must be a value of @ref FLASHEx_Banks */ 00119 00120 uint16_t SectorsBank1; /*!< Specifies the sector(s) set for PCROP for Bank1. 00121 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ 00122 00123 uint16_t SectorsBank2; /*!< Specifies the sector(s) set for PCROP for Bank2. 00124 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ 00125 00126 uint8_t BootConfig; /*!< Specifies Option bytes for boot config. 00127 This parameter can be a value of @ref FLASHEx_Dual_Boot */ 00128 00129 #endif /*STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 00130 }FLASH_AdvOBProgramInitTypeDef; 00131 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || 00132 STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00133 /** 00134 * @} 00135 */ 00136 00137 /* Exported constants --------------------------------------------------------*/ 00138 00139 /** @defgroup FLASHEx_Exported_Constants FLASH Exported Constants 00140 * @{ 00141 */ 00142 00143 /** @defgroup FLASHEx_Type_Erase FLASH Type Erase 00144 * @{ 00145 */ 00146 #define FLASH_TYPEERASE_SECTORS 0x00000000U /*!< Sectors erase only */ 00147 #define FLASH_TYPEERASE_MASSERASE 0x00000001U /*!< Flash Mass erase activation */ 00148 /** 00149 * @} 00150 */ 00151 00152 /** @defgroup FLASHEx_Voltage_Range FLASH Voltage Range 00153 * @{ 00154 */ 00155 #define FLASH_VOLTAGE_RANGE_1 0x00000000U /*!< Device operating range: 1.8V to 2.1V */ 00156 #define FLASH_VOLTAGE_RANGE_2 0x00000001U /*!< Device operating range: 2.1V to 2.7V */ 00157 #define FLASH_VOLTAGE_RANGE_3 0x00000002U /*!< Device operating range: 2.7V to 3.6V */ 00158 #define FLASH_VOLTAGE_RANGE_4 0x00000003U /*!< Device operating range: 2.7V to 3.6V + External Vpp */ 00159 /** 00160 * @} 00161 */ 00162 00163 /** @defgroup FLASHEx_WRP_State FLASH WRP State 00164 * @{ 00165 */ 00166 #define OB_WRPSTATE_DISABLE 0x00000000U /*!< Disable the write protection of the desired bank 1 sectors */ 00167 #define OB_WRPSTATE_ENABLE 0x00000001U /*!< Enable the write protection of the desired bank 1 sectors */ 00168 /** 00169 * @} 00170 */ 00171 00172 /** @defgroup FLASHEx_Option_Type FLASH Option Type 00173 * @{ 00174 */ 00175 #define OPTIONBYTE_WRP 0x00000001U /*!< WRP option byte configuration */ 00176 #define OPTIONBYTE_RDP 0x00000002U /*!< RDP option byte configuration */ 00177 #define OPTIONBYTE_USER 0x00000004U /*!< USER option byte configuration */ 00178 #define OPTIONBYTE_BOR 0x00000008U /*!< BOR option byte configuration */ 00179 /** 00180 * @} 00181 */ 00182 00183 /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASH Option Bytes Read Protection 00184 * @{ 00185 */ 00186 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA) 00187 #define OB_RDP_LEVEL_1 ((uint8_t)0x55) 00188 #define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2 00189 it s no more possible to go back to level 1 or 0 */ 00190 /** 00191 * @} 00192 */ 00193 00194 /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASH Option Bytes IWatchdog 00195 * @{ 00196 */ 00197 #define OB_IWDG_SW ((uint8_t)0x20) /*!< Software IWDG selected */ 00198 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */ 00199 /** 00200 * @} 00201 */ 00202 00203 /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASH Option Bytes nRST_STOP 00204 * @{ 00205 */ 00206 #define OB_STOP_NO_RST ((uint8_t)0x40) /*!< No reset generated when entering in STOP */ 00207 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */ 00208 /** 00209 * @} 00210 */ 00211 00212 00213 /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASH Option Bytes nRST_STDBY 00214 * @{ 00215 */ 00216 #define OB_STDBY_NO_RST ((uint8_t)0x80) /*!< No reset generated when entering in STANDBY */ 00217 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */ 00218 /** 00219 * @} 00220 */ 00221 00222 /** @defgroup FLASHEx_BOR_Reset_Level FLASH BOR Reset Level 00223 * @{ 00224 */ 00225 #define OB_BOR_LEVEL3 ((uint8_t)0x00) /*!< Supply voltage ranges from 2.70 to 3.60 V */ 00226 #define OB_BOR_LEVEL2 ((uint8_t)0x04) /*!< Supply voltage ranges from 2.40 to 2.70 V */ 00227 #define OB_BOR_LEVEL1 ((uint8_t)0x08) /*!< Supply voltage ranges from 2.10 to 2.40 V */ 00228 #define OB_BOR_OFF ((uint8_t)0x0C) /*!< Supply voltage ranges from 1.62 to 2.10 V */ 00229 /** 00230 * @} 00231 */ 00232 00233 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00234 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00235 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 00236 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 00237 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00238 /** @defgroup FLASHEx_PCROP_State FLASH PCROP State 00239 * @{ 00240 */ 00241 #define OB_PCROP_STATE_DISABLE 0x00000000U /*!< Disable PCROP */ 00242 #define OB_PCROP_STATE_ENABLE 0x00000001U /*!< Enable PCROP */ 00243 /** 00244 * @} 00245 */ 00246 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ 00247 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ 00248 STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00249 00250 /** @defgroup FLASHEx_Advanced_Option_Type FLASH Advanced Option Type 00251 * @{ 00252 */ 00253 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00254 defined(STM32F469xx) || defined(STM32F479xx) 00255 #define OPTIONBYTE_PCROP 0x00000001U /*!< PCROP option byte configuration */ 00256 #define OPTIONBYTE_BOOTCONFIG 0x00000002U /*!< BOOTConfig option byte configuration */ 00257 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 00258 00259 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00260 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 00261 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ 00262 defined(STM32F423xx) 00263 #define OPTIONBYTE_PCROP 0x00000001U /*!<PCROP option byte configuration */ 00264 #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || 00265 STM32F413xx || STM32F423xx */ 00266 /** 00267 * @} 00268 */ 00269 00270 /** @defgroup FLASH_Latency FLASH Latency 00271 * @{ 00272 */ 00273 /*------------------------- STM32F42xxx/STM32F43xxx/STM32F446xx/STM32F469xx/STM32F479xx ----------------------*/ 00274 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00275 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) 00276 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */ 00277 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */ 00278 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */ 00279 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */ 00280 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */ 00281 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */ 00282 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */ 00283 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */ 00284 #define FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH Eight Latency cycles */ 00285 #define FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH Nine Latency cycles */ 00286 #define FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH Ten Latency cycles */ 00287 #define FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH Eleven Latency cycles */ 00288 #define FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH Twelve Latency cycles */ 00289 #define FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH Thirteen Latency cycles */ 00290 #define FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH Fourteen Latency cycles */ 00291 #define FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH Fifteen Latency cycles */ 00292 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ 00293 /*--------------------------------------------------------------------------------------------------------------*/ 00294 00295 /*-------------------------- STM32F40xxx/STM32F41xxx/STM32F401xx/STM32F411xx/STM32F423xx -----------------------*/ 00296 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 00297 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00298 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ 00299 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00300 00301 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */ 00302 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */ 00303 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */ 00304 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */ 00305 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */ 00306 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */ 00307 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */ 00308 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */ 00309 #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || 00310 STM32F413xx || STM32F423xx */ 00311 /*--------------------------------------------------------------------------------------------------------------*/ 00312 00313 /** 00314 * @} 00315 */ 00316 00317 00318 /** @defgroup FLASHEx_Banks FLASH Banks 00319 * @{ 00320 */ 00321 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00322 defined(STM32F469xx) || defined(STM32F479xx) 00323 #define FLASH_BANK_1 1U /*!< Bank 1 */ 00324 #define FLASH_BANK_2 2U /*!< Bank 2 */ 00325 #define FLASH_BANK_BOTH ((uint32_t)FLASH_BANK_1 | FLASH_BANK_2) /*!< Bank1 and Bank2 */ 00326 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00327 00328 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 00329 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00330 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 00331 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ 00332 defined(STM32F423xx) 00333 #define FLASH_BANK_1 1U /*!< Bank 1 */ 00334 #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx 00335 STM32F413xx || STM32F423xx */ 00336 /** 00337 * @} 00338 */ 00339 00340 /** @defgroup FLASHEx_MassErase_bit FLASH Mass Erase bit 00341 * @{ 00342 */ 00343 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00344 defined(STM32F469xx) || defined(STM32F479xx) 00345 #define FLASH_MER_BIT (FLASH_CR_MER1 | FLASH_CR_MER2) /*!< 2 MER bits here to clear */ 00346 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00347 00348 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 00349 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00350 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 00351 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ 00352 defined(STM32F423xx) 00353 #define FLASH_MER_BIT (FLASH_CR_MER) /*!< only 1 MER Bit */ 00354 #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx 00355 STM32F413xx || STM32F423xx */ 00356 /** 00357 * @} 00358 */ 00359 00360 /** @defgroup FLASHEx_Sectors FLASH Sectors 00361 * @{ 00362 */ 00363 /*-------------------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx ------------------------------------*/ 00364 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00365 defined(STM32F469xx) || defined(STM32F479xx) 00366 #define FLASH_SECTOR_0 0U /*!< Sector Number 0 */ 00367 #define FLASH_SECTOR_1 1U /*!< Sector Number 1 */ 00368 #define FLASH_SECTOR_2 2U /*!< Sector Number 2 */ 00369 #define FLASH_SECTOR_3 3U /*!< Sector Number 3 */ 00370 #define FLASH_SECTOR_4 4U /*!< Sector Number 4 */ 00371 #define FLASH_SECTOR_5 5U /*!< Sector Number 5 */ 00372 #define FLASH_SECTOR_6 6U /*!< Sector Number 6 */ 00373 #define FLASH_SECTOR_7 7U /*!< Sector Number 7 */ 00374 #define FLASH_SECTOR_8 8U /*!< Sector Number 8 */ 00375 #define FLASH_SECTOR_9 9U /*!< Sector Number 9 */ 00376 #define FLASH_SECTOR_10 10U /*!< Sector Number 10 */ 00377 #define FLASH_SECTOR_11 11U /*!< Sector Number 11 */ 00378 #define FLASH_SECTOR_12 12U /*!< Sector Number 12 */ 00379 #define FLASH_SECTOR_13 13U /*!< Sector Number 13 */ 00380 #define FLASH_SECTOR_14 14U /*!< Sector Number 14 */ 00381 #define FLASH_SECTOR_15 15U /*!< Sector Number 15 */ 00382 #define FLASH_SECTOR_16 16U /*!< Sector Number 16 */ 00383 #define FLASH_SECTOR_17 17U /*!< Sector Number 17 */ 00384 #define FLASH_SECTOR_18 18U /*!< Sector Number 18 */ 00385 #define FLASH_SECTOR_19 19U /*!< Sector Number 19 */ 00386 #define FLASH_SECTOR_20 20U /*!< Sector Number 20 */ 00387 #define FLASH_SECTOR_21 21U /*!< Sector Number 21 */ 00388 #define FLASH_SECTOR_22 22U /*!< Sector Number 22 */ 00389 #define FLASH_SECTOR_23 23U /*!< Sector Number 23 */ 00390 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00391 /*-----------------------------------------------------------------------------------------------------*/ 00392 00393 /*-------------------------------------- STM32F413xx/STM32F423xx --------------------------------------*/ 00394 #if defined(STM32F413xx) || defined(STM32F423xx) 00395 #define FLASH_SECTOR_0 0U /*!< Sector Number 0 */ 00396 #define FLASH_SECTOR_1 1U /*!< Sector Number 1 */ 00397 #define FLASH_SECTOR_2 2U /*!< Sector Number 2 */ 00398 #define FLASH_SECTOR_3 3U /*!< Sector Number 3 */ 00399 #define FLASH_SECTOR_4 4U /*!< Sector Number 4 */ 00400 #define FLASH_SECTOR_5 5U /*!< Sector Number 5 */ 00401 #define FLASH_SECTOR_6 6U /*!< Sector Number 6 */ 00402 #define FLASH_SECTOR_7 7U /*!< Sector Number 7 */ 00403 #define FLASH_SECTOR_8 8U /*!< Sector Number 8 */ 00404 #define FLASH_SECTOR_9 9U /*!< Sector Number 9 */ 00405 #define FLASH_SECTOR_10 10U /*!< Sector Number 10 */ 00406 #define FLASH_SECTOR_11 11U /*!< Sector Number 11 */ 00407 #define FLASH_SECTOR_12 12U /*!< Sector Number 12 */ 00408 #define FLASH_SECTOR_13 13U /*!< Sector Number 13 */ 00409 #define FLASH_SECTOR_14 14U /*!< Sector Number 14 */ 00410 #define FLASH_SECTOR_15 15U /*!< Sector Number 15 */ 00411 #endif /* STM32F413xx || STM32F423xx */ 00412 /*-----------------------------------------------------------------------------------------------------*/ 00413 00414 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/ 00415 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 00416 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 00417 #define FLASH_SECTOR_0 0U /*!< Sector Number 0 */ 00418 #define FLASH_SECTOR_1 1U /*!< Sector Number 1 */ 00419 #define FLASH_SECTOR_2 2U /*!< Sector Number 2 */ 00420 #define FLASH_SECTOR_3 3U /*!< Sector Number 3 */ 00421 #define FLASH_SECTOR_4 4U /*!< Sector Number 4 */ 00422 #define FLASH_SECTOR_5 5U /*!< Sector Number 5 */ 00423 #define FLASH_SECTOR_6 6U /*!< Sector Number 6 */ 00424 #define FLASH_SECTOR_7 7U /*!< Sector Number 7 */ 00425 #define FLASH_SECTOR_8 8U /*!< Sector Number 8 */ 00426 #define FLASH_SECTOR_9 9U /*!< Sector Number 9 */ 00427 #define FLASH_SECTOR_10 10U /*!< Sector Number 10 */ 00428 #define FLASH_SECTOR_11 11U /*!< Sector Number 11 */ 00429 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 00430 /*-----------------------------------------------------------------------------------------------------*/ 00431 00432 /*--------------------------------------------- STM32F401xC -------------------------------------------*/ 00433 #if defined(STM32F401xC) 00434 #define FLASH_SECTOR_0 0U /*!< Sector Number 0 */ 00435 #define FLASH_SECTOR_1 1U /*!< Sector Number 1 */ 00436 #define FLASH_SECTOR_2 2U /*!< Sector Number 2 */ 00437 #define FLASH_SECTOR_3 3U /*!< Sector Number 3 */ 00438 #define FLASH_SECTOR_4 4U /*!< Sector Number 4 */ 00439 #define FLASH_SECTOR_5 5U /*!< Sector Number 5 */ 00440 #endif /* STM32F401xC */ 00441 /*-----------------------------------------------------------------------------------------------------*/ 00442 00443 /*--------------------------------------------- STM32F410xx -------------------------------------------*/ 00444 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 00445 #define FLASH_SECTOR_0 0U /*!< Sector Number 0 */ 00446 #define FLASH_SECTOR_1 1U /*!< Sector Number 1 */ 00447 #define FLASH_SECTOR_2 2U /*!< Sector Number 2 */ 00448 #define FLASH_SECTOR_3 3U /*!< Sector Number 3 */ 00449 #define FLASH_SECTOR_4 4U /*!< Sector Number 4 */ 00450 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ 00451 /*-----------------------------------------------------------------------------------------------------*/ 00452 00453 /*---------------------------------- STM32F401xE/STM32F411xE/STM32F446xx ------------------------------*/ 00454 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 00455 #define FLASH_SECTOR_0 0U /*!< Sector Number 0 */ 00456 #define FLASH_SECTOR_1 1U /*!< Sector Number 1 */ 00457 #define FLASH_SECTOR_2 2U /*!< Sector Number 2 */ 00458 #define FLASH_SECTOR_3 3U /*!< Sector Number 3 */ 00459 #define FLASH_SECTOR_4 4U /*!< Sector Number 4 */ 00460 #define FLASH_SECTOR_5 5U /*!< Sector Number 5 */ 00461 #define FLASH_SECTOR_6 6U /*!< Sector Number 6 */ 00462 #define FLASH_SECTOR_7 7U /*!< Sector Number 7 */ 00463 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */ 00464 /*-----------------------------------------------------------------------------------------------------*/ 00465 00466 /** 00467 * @} 00468 */ 00469 00470 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection 00471 * @{ 00472 */ 00473 /*--------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx -------------------------*/ 00474 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00475 defined(STM32F469xx) || defined(STM32F479xx) 00476 #define OB_WRP_SECTOR_0 0x00000001U /*!< Write protection of Sector0 */ 00477 #define OB_WRP_SECTOR_1 0x00000002U /*!< Write protection of Sector1 */ 00478 #define OB_WRP_SECTOR_2 0x00000004U /*!< Write protection of Sector2 */ 00479 #define OB_WRP_SECTOR_3 0x00000008U /*!< Write protection of Sector3 */ 00480 #define OB_WRP_SECTOR_4 0x00000010U /*!< Write protection of Sector4 */ 00481 #define OB_WRP_SECTOR_5 0x00000020U /*!< Write protection of Sector5 */ 00482 #define OB_WRP_SECTOR_6 0x00000040U /*!< Write protection of Sector6 */ 00483 #define OB_WRP_SECTOR_7 0x00000080U /*!< Write protection of Sector7 */ 00484 #define OB_WRP_SECTOR_8 0x00000100U /*!< Write protection of Sector8 */ 00485 #define OB_WRP_SECTOR_9 0x00000200U /*!< Write protection of Sector9 */ 00486 #define OB_WRP_SECTOR_10 0x00000400U /*!< Write protection of Sector10 */ 00487 #define OB_WRP_SECTOR_11 0x00000800U /*!< Write protection of Sector11 */ 00488 #define OB_WRP_SECTOR_12 0x00000001U << 12U /*!< Write protection of Sector12 */ 00489 #define OB_WRP_SECTOR_13 0x00000002U << 12U /*!< Write protection of Sector13 */ 00490 #define OB_WRP_SECTOR_14 0x00000004U << 12U /*!< Write protection of Sector14 */ 00491 #define OB_WRP_SECTOR_15 0x00000008U << 12U /*!< Write protection of Sector15 */ 00492 #define OB_WRP_SECTOR_16 0x00000010U << 12U /*!< Write protection of Sector16 */ 00493 #define OB_WRP_SECTOR_17 0x00000020U << 12U /*!< Write protection of Sector17 */ 00494 #define OB_WRP_SECTOR_18 0x00000040U << 12U /*!< Write protection of Sector18 */ 00495 #define OB_WRP_SECTOR_19 0x00000080U << 12U /*!< Write protection of Sector19 */ 00496 #define OB_WRP_SECTOR_20 0x00000100U << 12U /*!< Write protection of Sector20 */ 00497 #define OB_WRP_SECTOR_21 0x00000200U << 12U /*!< Write protection of Sector21 */ 00498 #define OB_WRP_SECTOR_22 0x00000400U << 12U /*!< Write protection of Sector22 */ 00499 #define OB_WRP_SECTOR_23 0x00000800U << 12U /*!< Write protection of Sector23 */ 00500 #define OB_WRP_SECTOR_All 0x00000FFFU << 12U /*!< Write protection of all Sectors */ 00501 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00502 /*-----------------------------------------------------------------------------------------------------*/ 00503 00504 /*--------------------------------------- STM32F413xx/STM32F423xx -------------------------------------*/ 00505 #if defined(STM32F413xx) || defined(STM32F423xx) 00506 #define OB_WRP_SECTOR_0 0x00000001U /*!< Write protection of Sector0 */ 00507 #define OB_WRP_SECTOR_1 0x00000002U /*!< Write protection of Sector1 */ 00508 #define OB_WRP_SECTOR_2 0x00000004U /*!< Write protection of Sector2 */ 00509 #define OB_WRP_SECTOR_3 0x00000008U /*!< Write protection of Sector3 */ 00510 #define OB_WRP_SECTOR_4 0x00000010U /*!< Write protection of Sector4 */ 00511 #define OB_WRP_SECTOR_5 0x00000020U /*!< Write protection of Sector5 */ 00512 #define OB_WRP_SECTOR_6 0x00000040U /*!< Write protection of Sector6 */ 00513 #define OB_WRP_SECTOR_7 0x00000080U /*!< Write protection of Sector7 */ 00514 #define OB_WRP_SECTOR_8 0x00000100U /*!< Write protection of Sector8 */ 00515 #define OB_WRP_SECTOR_9 0x00000200U /*!< Write protection of Sector9 */ 00516 #define OB_WRP_SECTOR_10 0x00000400U /*!< Write protection of Sector10 */ 00517 #define OB_WRP_SECTOR_11 0x00000800U /*!< Write protection of Sector11 */ 00518 #define OB_WRP_SECTOR_12 0x00001000U /*!< Write protection of Sector12 */ 00519 #define OB_WRP_SECTOR_13 0x00002000U /*!< Write protection of Sector13 */ 00520 #define OB_WRP_SECTOR_14 0x00004000U /*!< Write protection of Sector14 */ 00521 #define OB_WRP_SECTOR_15 0x00004000U /*!< Write protection of Sector15 */ 00522 #define OB_WRP_SECTOR_All 0x00007FFFU /*!< Write protection of all Sectors */ 00523 #endif /* STM32F413xx || STM32F423xx */ 00524 /*-----------------------------------------------------------------------------------------------------*/ 00525 00526 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/ 00527 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 00528 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 00529 #define OB_WRP_SECTOR_0 0x00000001U /*!< Write protection of Sector0 */ 00530 #define OB_WRP_SECTOR_1 0x00000002U /*!< Write protection of Sector1 */ 00531 #define OB_WRP_SECTOR_2 0x00000004U /*!< Write protection of Sector2 */ 00532 #define OB_WRP_SECTOR_3 0x00000008U /*!< Write protection of Sector3 */ 00533 #define OB_WRP_SECTOR_4 0x00000010U /*!< Write protection of Sector4 */ 00534 #define OB_WRP_SECTOR_5 0x00000020U /*!< Write protection of Sector5 */ 00535 #define OB_WRP_SECTOR_6 0x00000040U /*!< Write protection of Sector6 */ 00536 #define OB_WRP_SECTOR_7 0x00000080U /*!< Write protection of Sector7 */ 00537 #define OB_WRP_SECTOR_8 0x00000100U /*!< Write protection of Sector8 */ 00538 #define OB_WRP_SECTOR_9 0x00000200U /*!< Write protection of Sector9 */ 00539 #define OB_WRP_SECTOR_10 0x00000400U /*!< Write protection of Sector10 */ 00540 #define OB_WRP_SECTOR_11 0x00000800U /*!< Write protection of Sector11 */ 00541 #define OB_WRP_SECTOR_All 0x00000FFFU /*!< Write protection of all Sectors */ 00542 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 00543 /*-----------------------------------------------------------------------------------------------------*/ 00544 00545 /*--------------------------------------------- STM32F401xC -------------------------------------------*/ 00546 #if defined(STM32F401xC) 00547 #define OB_WRP_SECTOR_0 0x00000001U /*!< Write protection of Sector0 */ 00548 #define OB_WRP_SECTOR_1 0x00000002U /*!< Write protection of Sector1 */ 00549 #define OB_WRP_SECTOR_2 0x00000004U /*!< Write protection of Sector2 */ 00550 #define OB_WRP_SECTOR_3 0x00000008U /*!< Write protection of Sector3 */ 00551 #define OB_WRP_SECTOR_4 0x00000010U /*!< Write protection of Sector4 */ 00552 #define OB_WRP_SECTOR_5 0x00000020U /*!< Write protection of Sector5 */ 00553 #define OB_WRP_SECTOR_All 0x00000FFFU /*!< Write protection of all Sectors */ 00554 #endif /* STM32F401xC */ 00555 /*-----------------------------------------------------------------------------------------------------*/ 00556 00557 /*--------------------------------------------- STM32F410xx -------------------------------------------*/ 00558 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 00559 #define OB_WRP_SECTOR_0 0x00000001U /*!< Write protection of Sector0 */ 00560 #define OB_WRP_SECTOR_1 0x00000002U /*!< Write protection of Sector1 */ 00561 #define OB_WRP_SECTOR_2 0x00000004U /*!< Write protection of Sector2 */ 00562 #define OB_WRP_SECTOR_3 0x00000008U /*!< Write protection of Sector3 */ 00563 #define OB_WRP_SECTOR_4 0x00000010U /*!< Write protection of Sector4 */ 00564 #define OB_WRP_SECTOR_All 0x00000FFFU /*!< Write protection of all Sectors */ 00565 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ 00566 /*-----------------------------------------------------------------------------------------------------*/ 00567 00568 /*---------------------------------- STM32F401xE/STM32F411xE/STM32F446xx ------------------------------*/ 00569 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 00570 #define OB_WRP_SECTOR_0 0x00000001U /*!< Write protection of Sector0 */ 00571 #define OB_WRP_SECTOR_1 0x00000002U /*!< Write protection of Sector1 */ 00572 #define OB_WRP_SECTOR_2 0x00000004U /*!< Write protection of Sector2 */ 00573 #define OB_WRP_SECTOR_3 0x00000008U /*!< Write protection of Sector3 */ 00574 #define OB_WRP_SECTOR_4 0x00000010U /*!< Write protection of Sector4 */ 00575 #define OB_WRP_SECTOR_5 0x00000020U /*!< Write protection of Sector5 */ 00576 #define OB_WRP_SECTOR_6 0x00000040U /*!< Write protection of Sector6 */ 00577 #define OB_WRP_SECTOR_7 0x00000080U /*!< Write protection of Sector7 */ 00578 #define OB_WRP_SECTOR_All 0x00000FFFU /*!< Write protection of all Sectors */ 00579 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */ 00580 /*-----------------------------------------------------------------------------------------------------*/ 00581 /** 00582 * @} 00583 */ 00584 00585 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASH Option Bytes PC ReadWrite Protection 00586 * @{ 00587 */ 00588 /*-------------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx ---------------------------*/ 00589 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00590 defined(STM32F469xx) || defined(STM32F479xx) 00591 #define OB_PCROP_SECTOR_0 0x00000001U /*!< PC Read/Write protection of Sector0 */ 00592 #define OB_PCROP_SECTOR_1 0x00000002U /*!< PC Read/Write protection of Sector1 */ 00593 #define OB_PCROP_SECTOR_2 0x00000004U /*!< PC Read/Write protection of Sector2 */ 00594 #define OB_PCROP_SECTOR_3 0x00000008U /*!< PC Read/Write protection of Sector3 */ 00595 #define OB_PCROP_SECTOR_4 0x00000010U /*!< PC Read/Write protection of Sector4 */ 00596 #define OB_PCROP_SECTOR_5 0x00000020U /*!< PC Read/Write protection of Sector5 */ 00597 #define OB_PCROP_SECTOR_6 0x00000040U /*!< PC Read/Write protection of Sector6 */ 00598 #define OB_PCROP_SECTOR_7 0x00000080U /*!< PC Read/Write protection of Sector7 */ 00599 #define OB_PCROP_SECTOR_8 0x00000100U /*!< PC Read/Write protection of Sector8 */ 00600 #define OB_PCROP_SECTOR_9 0x00000200U /*!< PC Read/Write protection of Sector9 */ 00601 #define OB_PCROP_SECTOR_10 0x00000400U /*!< PC Read/Write protection of Sector10 */ 00602 #define OB_PCROP_SECTOR_11 0x00000800U /*!< PC Read/Write protection of Sector11 */ 00603 #define OB_PCROP_SECTOR_12 0x00000001U /*!< PC Read/Write protection of Sector12 */ 00604 #define OB_PCROP_SECTOR_13 0x00000002U /*!< PC Read/Write protection of Sector13 */ 00605 #define OB_PCROP_SECTOR_14 0x00000004U /*!< PC Read/Write protection of Sector14 */ 00606 #define OB_PCROP_SECTOR_15 0x00000008U /*!< PC Read/Write protection of Sector15 */ 00607 #define OB_PCROP_SECTOR_16 0x00000010U /*!< PC Read/Write protection of Sector16 */ 00608 #define OB_PCROP_SECTOR_17 0x00000020U /*!< PC Read/Write protection of Sector17 */ 00609 #define OB_PCROP_SECTOR_18 0x00000040U /*!< PC Read/Write protection of Sector18 */ 00610 #define OB_PCROP_SECTOR_19 0x00000080U /*!< PC Read/Write protection of Sector19 */ 00611 #define OB_PCROP_SECTOR_20 0x00000100U /*!< PC Read/Write protection of Sector20 */ 00612 #define OB_PCROP_SECTOR_21 0x00000200U /*!< PC Read/Write protection of Sector21 */ 00613 #define OB_PCROP_SECTOR_22 0x00000400U /*!< PC Read/Write protection of Sector22 */ 00614 #define OB_PCROP_SECTOR_23 0x00000800U /*!< PC Read/Write protection of Sector23 */ 00615 #define OB_PCROP_SECTOR_All 0x00000FFFU /*!< PC Read/Write protection of all Sectors */ 00616 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00617 /*-----------------------------------------------------------------------------------------------------*/ 00618 00619 /*------------------------------------- STM32F413xx/STM32F423xx ---------------------------------------*/ 00620 #if defined(STM32F413xx) || defined(STM32F423xx) 00621 #define OB_PCROP_SECTOR_0 0x00000001U /*!< PC Read/Write protection of Sector0 */ 00622 #define OB_PCROP_SECTOR_1 0x00000002U /*!< PC Read/Write protection of Sector1 */ 00623 #define OB_PCROP_SECTOR_2 0x00000004U /*!< PC Read/Write protection of Sector2 */ 00624 #define OB_PCROP_SECTOR_3 0x00000008U /*!< PC Read/Write protection of Sector3 */ 00625 #define OB_PCROP_SECTOR_4 0x00000010U /*!< PC Read/Write protection of Sector4 */ 00626 #define OB_PCROP_SECTOR_5 0x00000020U /*!< PC Read/Write protection of Sector5 */ 00627 #define OB_PCROP_SECTOR_6 0x00000040U /*!< PC Read/Write protection of Sector6 */ 00628 #define OB_PCROP_SECTOR_7 0x00000080U /*!< PC Read/Write protection of Sector7 */ 00629 #define OB_PCROP_SECTOR_8 0x00000100U /*!< PC Read/Write protection of Sector8 */ 00630 #define OB_PCROP_SECTOR_9 0x00000200U /*!< PC Read/Write protection of Sector9 */ 00631 #define OB_PCROP_SECTOR_10 0x00000400U /*!< PC Read/Write protection of Sector10 */ 00632 #define OB_PCROP_SECTOR_11 0x00000800U /*!< PC Read/Write protection of Sector11 */ 00633 #define OB_PCROP_SECTOR_12 0x00001000U /*!< PC Read/Write protection of Sector12 */ 00634 #define OB_PCROP_SECTOR_13 0x00002000U /*!< PC Read/Write protection of Sector13 */ 00635 #define OB_PCROP_SECTOR_14 0x00004000U /*!< PC Read/Write protection of Sector14 */ 00636 #define OB_PCROP_SECTOR_15 0x00004000U /*!< PC Read/Write protection of Sector15 */ 00637 #define OB_PCROP_SECTOR_All 0x00007FFFU /*!< PC Read/Write protection of all Sectors */ 00638 #endif /* STM32F413xx || STM32F423xx */ 00639 /*-----------------------------------------------------------------------------------------------------*/ 00640 00641 /*--------------------------------------------- STM32F401xC -------------------------------------------*/ 00642 #if defined(STM32F401xC) 00643 #define OB_PCROP_SECTOR_0 0x00000001U /*!< PC Read/Write protection of Sector0 */ 00644 #define OB_PCROP_SECTOR_1 0x00000002U /*!< PC Read/Write protection of Sector1 */ 00645 #define OB_PCROP_SECTOR_2 0x00000004U /*!< PC Read/Write protection of Sector2 */ 00646 #define OB_PCROP_SECTOR_3 0x00000008U /*!< PC Read/Write protection of Sector3 */ 00647 #define OB_PCROP_SECTOR_4 0x00000010U /*!< PC Read/Write protection of Sector4 */ 00648 #define OB_PCROP_SECTOR_5 0x00000020U /*!< PC Read/Write protection of Sector5 */ 00649 #define OB_PCROP_SECTOR_All 0x00000FFFU /*!< PC Read/Write protection of all Sectors */ 00650 #endif /* STM32F401xC */ 00651 /*-----------------------------------------------------------------------------------------------------*/ 00652 00653 /*--------------------------------------------- STM32F410xx -------------------------------------------*/ 00654 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 00655 #define OB_PCROP_SECTOR_0 0x00000001U /*!< PC Read/Write protection of Sector0 */ 00656 #define OB_PCROP_SECTOR_1 0x00000002U /*!< PC Read/Write protection of Sector1 */ 00657 #define OB_PCROP_SECTOR_2 0x00000004U /*!< PC Read/Write protection of Sector2 */ 00658 #define OB_PCROP_SECTOR_3 0x00000008U /*!< PC Read/Write protection of Sector3 */ 00659 #define OB_PCROP_SECTOR_4 0x00000010U /*!< PC Read/Write protection of Sector4 */ 00660 #define OB_PCROP_SECTOR_All 0x00000FFFU /*!< PC Read/Write protection of all Sectors */ 00661 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ 00662 /*-----------------------------------------------------------------------------------------------------*/ 00663 00664 /*-------------- STM32F401xE/STM32F411xE/STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx/STM32F446xx --*/ 00665 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 00666 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 00667 #define OB_PCROP_SECTOR_0 0x00000001U /*!< PC Read/Write protection of Sector0 */ 00668 #define OB_PCROP_SECTOR_1 0x00000002U /*!< PC Read/Write protection of Sector1 */ 00669 #define OB_PCROP_SECTOR_2 0x00000004U /*!< PC Read/Write protection of Sector2 */ 00670 #define OB_PCROP_SECTOR_3 0x00000008U /*!< PC Read/Write protection of Sector3 */ 00671 #define OB_PCROP_SECTOR_4 0x00000010U /*!< PC Read/Write protection of Sector4 */ 00672 #define OB_PCROP_SECTOR_5 0x00000020U /*!< PC Read/Write protection of Sector5 */ 00673 #define OB_PCROP_SECTOR_6 0x00000040U /*!< PC Read/Write protection of Sector6 */ 00674 #define OB_PCROP_SECTOR_7 0x00000080U /*!< PC Read/Write protection of Sector7 */ 00675 #define OB_PCROP_SECTOR_All 0x00000FFFU /*!< PC Read/Write protection of all Sectors */ 00676 #endif /* STM32F401xE || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 00677 /*-----------------------------------------------------------------------------------------------------*/ 00678 00679 /** 00680 * @} 00681 */ 00682 00683 /** @defgroup FLASHEx_Dual_Boot FLASH Dual Boot 00684 * @{ 00685 */ 00686 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00687 defined(STM32F469xx) || defined(STM32F479xx) 00688 #define OB_DUAL_BOOT_ENABLE ((uint8_t)0x10) /*!< Dual Bank Boot Enable */ 00689 #define OB_DUAL_BOOT_DISABLE ((uint8_t)0x00) /*!< Dual Bank Boot Disable, always boot on User Flash */ 00690 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00691 /** 00692 * @} 00693 */ 00694 00695 /** @defgroup FLASHEx_Selection_Protection_Mode FLASH Selection Protection Mode 00696 * @{ 00697 */ 00698 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00699 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00700 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 00701 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 00702 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00703 #define OB_PCROP_DESELECTED ((uint8_t)0x00) /*!< Disabled PcROP, nWPRi bits used for Write Protection on sector i */ 00704 #define OB_PCROP_SELECTED ((uint8_t)0x80) /*!< Enable PcROP, nWPRi bits used for PCRoP Protection on sector i */ 00705 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ 00706 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ 00707 STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00708 /** 00709 * @} 00710 */ 00711 00712 /** 00713 * @} 00714 */ 00715 00716 /* Exported macro ------------------------------------------------------------*/ 00717 00718 /* Exported functions --------------------------------------------------------*/ 00719 /** @addtogroup FLASHEx_Exported_Functions 00720 * @{ 00721 */ 00722 00723 /** @addtogroup FLASHEx_Exported_Functions_Group1 00724 * @{ 00725 */ 00726 /* Extension Program operation functions *************************************/ 00727 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError); 00728 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); 00729 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); 00730 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); 00731 00732 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00733 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00734 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 00735 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 00736 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00737 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); 00738 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); 00739 HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void); 00740 HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void); 00741 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ 00742 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ 00743 STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00744 00745 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00746 defined(STM32F469xx) || defined(STM32F479xx) 00747 uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); 00748 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00749 /** 00750 * @} 00751 */ 00752 00753 /** 00754 * @} 00755 */ 00756 /* Private types -------------------------------------------------------------*/ 00757 /* Private variables ---------------------------------------------------------*/ 00758 /* Private constants ---------------------------------------------------------*/ 00759 /** @defgroup FLASHEx_Private_Constants FLASH Private Constants 00760 * @{ 00761 */ 00762 /*--------------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx---------------------*/ 00763 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 00764 #define FLASH_SECTOR_TOTAL 24U 00765 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 00766 00767 /*-------------------------------------- STM32F413xx/STM32F423xx ---------------------------------------*/ 00768 #if defined(STM32F413xx) || defined(STM32F423xx) 00769 #define FLASH_SECTOR_TOTAL 16U 00770 #endif /* STM32F413xx || STM32F423xx */ 00771 00772 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/ 00773 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 00774 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 00775 #define FLASH_SECTOR_TOTAL 12U 00776 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 00777 00778 /*--------------------------------------------- STM32F401xC -------------------------------------------*/ 00779 #if defined(STM32F401xC) 00780 #define FLASH_SECTOR_TOTAL 6U 00781 #endif /* STM32F401xC */ 00782 00783 /*--------------------------------------------- STM32F410xx -------------------------------------------*/ 00784 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 00785 #define FLASH_SECTOR_TOTAL 5U 00786 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ 00787 00788 /*--------------------------------- STM32F401xE/STM32F411xE/STM32F412xG/STM32F446xx -------------------*/ 00789 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 00790 #define FLASH_SECTOR_TOTAL 8U 00791 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */ 00792 00793 /** 00794 * @brief OPTCR1 register byte 2 (Bits[23:16]) base address 00795 */ 00796 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 00797 #define OPTCR1_BYTE2_ADDRESS 0x40023C1AU 00798 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 00799 00800 /** 00801 * @} 00802 */ 00803 00804 /* Private macros ------------------------------------------------------------*/ 00805 /** @defgroup FLASHEx_Private_Macros FLASH Private Macros 00806 * @{ 00807 */ 00808 00809 /** @defgroup FLASHEx_IS_FLASH_Definitions FLASH Private macros to check input parameters 00810 * @{ 00811 */ 00812 00813 #define IS_FLASH_TYPEERASE(VALUE)(((VALUE) == FLASH_TYPEERASE_SECTORS) || \ 00814 ((VALUE) == FLASH_TYPEERASE_MASSERASE)) 00815 00816 #define IS_VOLTAGERANGE(RANGE)(((RANGE) == FLASH_VOLTAGE_RANGE_1) || \ 00817 ((RANGE) == FLASH_VOLTAGE_RANGE_2) || \ 00818 ((RANGE) == FLASH_VOLTAGE_RANGE_3) || \ 00819 ((RANGE) == FLASH_VOLTAGE_RANGE_4)) 00820 00821 #define IS_WRPSTATE(VALUE)(((VALUE) == OB_WRPSTATE_DISABLE) || \ 00822 ((VALUE) == OB_WRPSTATE_ENABLE)) 00823 00824 #define IS_OPTIONBYTE(VALUE)(((VALUE) <= (OPTIONBYTE_WRP|OPTIONBYTE_RDP|OPTIONBYTE_USER|OPTIONBYTE_BOR))) 00825 00826 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\ 00827 ((LEVEL) == OB_RDP_LEVEL_1) ||\ 00828 ((LEVEL) == OB_RDP_LEVEL_2)) 00829 00830 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW)) 00831 00832 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST)) 00833 00834 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST)) 00835 00836 #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\ 00837 ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF)) 00838 00839 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00840 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00841 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 00842 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 00843 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00844 #define IS_PCROPSTATE(VALUE)(((VALUE) == OB_PCROP_STATE_DISABLE) || \ 00845 ((VALUE) == OB_PCROP_STATE_ENABLE)) 00846 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ 00847 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ 00848 STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00849 00850 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 00851 defined(STM32F469xx) || defined(STM32F479xx) 00852 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP) || \ 00853 ((VALUE) == OPTIONBYTE_BOOTCONFIG)) 00854 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 00855 00856 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00857 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 00858 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ 00859 defined(STM32F423xx) 00860 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP)) 00861 #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx ||\ 00862 STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00863 00864 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ 00865 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) 00866 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \ 00867 ((LATENCY) == FLASH_LATENCY_1) || \ 00868 ((LATENCY) == FLASH_LATENCY_2) || \ 00869 ((LATENCY) == FLASH_LATENCY_3) || \ 00870 ((LATENCY) == FLASH_LATENCY_4) || \ 00871 ((LATENCY) == FLASH_LATENCY_5) || \ 00872 ((LATENCY) == FLASH_LATENCY_6) || \ 00873 ((LATENCY) == FLASH_LATENCY_7) || \ 00874 ((LATENCY) == FLASH_LATENCY_8) || \ 00875 ((LATENCY) == FLASH_LATENCY_9) || \ 00876 ((LATENCY) == FLASH_LATENCY_10) || \ 00877 ((LATENCY) == FLASH_LATENCY_11) || \ 00878 ((LATENCY) == FLASH_LATENCY_12) || \ 00879 ((LATENCY) == FLASH_LATENCY_13) || \ 00880 ((LATENCY) == FLASH_LATENCY_14) || \ 00881 ((LATENCY) == FLASH_LATENCY_15)) 00882 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ 00883 00884 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 00885 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00886 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ 00887 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00888 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \ 00889 ((LATENCY) == FLASH_LATENCY_1) || \ 00890 ((LATENCY) == FLASH_LATENCY_2) || \ 00891 ((LATENCY) == FLASH_LATENCY_3) || \ 00892 ((LATENCY) == FLASH_LATENCY_4) || \ 00893 ((LATENCY) == FLASH_LATENCY_5) || \ 00894 ((LATENCY) == FLASH_LATENCY_6) || \ 00895 ((LATENCY) == FLASH_LATENCY_7)) 00896 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F412Zx || STM32F412Vx ||\ 00897 STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00898 00899 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 00900 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \ 00901 ((BANK) == FLASH_BANK_2) || \ 00902 ((BANK) == FLASH_BANK_BOTH)) 00903 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ 00904 00905 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ 00906 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 00907 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 00908 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ 00909 defined(STM32F423xx) 00910 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1)) 00911 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx ||\ 00912 STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 00913 00914 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 00915 #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 00916 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 00917 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ 00918 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\ 00919 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\ 00920 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\ 00921 ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\ 00922 ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15) ||\ 00923 ((SECTOR) == FLASH_SECTOR_16) || ((SECTOR) == FLASH_SECTOR_17) ||\ 00924 ((SECTOR) == FLASH_SECTOR_18) || ((SECTOR) == FLASH_SECTOR_19) ||\ 00925 ((SECTOR) == FLASH_SECTOR_20) || ((SECTOR) == FLASH_SECTOR_21) ||\ 00926 ((SECTOR) == FLASH_SECTOR_22) || ((SECTOR) == FLASH_SECTOR_23)) 00927 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 00928 00929 #if defined(STM32F413xx) || defined(STM32F423xx) 00930 #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 00931 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 00932 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ 00933 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\ 00934 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\ 00935 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\ 00936 ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\ 00937 ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15)) 00938 #endif /* STM32F413xx || STM32F423xx */ 00939 00940 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ 00941 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 00942 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 00943 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 00944 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ 00945 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\ 00946 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\ 00947 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11)) 00948 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 00949 00950 #if defined(STM32F401xC) 00951 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 00952 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 00953 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5)) 00954 #endif /* STM32F401xC */ 00955 00956 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 00957 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 00958 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 00959 ((SECTOR) == FLASH_SECTOR_4)) 00960 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ 00961 00962 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) 00963 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ 00964 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ 00965 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ 00966 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7)) 00967 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */ 00968 00969 #define IS_FLASH_ADDRESS(ADDRESS) ((((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_END)) || \ 00970 (((ADDRESS) >= FLASH_OTP_BASE) && ((ADDRESS) <= FLASH_OTP_END))) 00971 00972 #define IS_FLASH_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL)) 00973 00974 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 00975 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFF000000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 00976 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 00977 00978 #if defined(STM32F413xx) || defined(STM32F423xx) 00979 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 00980 #endif /* STM32F413xx || STM32F423xx */ 00981 00982 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) 00983 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 00984 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ 00985 00986 #if defined(STM32F401xC) 00987 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 00988 #endif /* STM32F401xC */ 00989 00990 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 00991 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 00992 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ 00993 00994 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ 00995 defined(STM32F412Rx) || defined(STM32F412Cx) 00996 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 00997 #endif /* STM32F401xE || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 00998 00999 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) 01000 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 01001 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 01002 01003 #if defined(STM32F413xx) || defined(STM32F423xx) 01004 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 01005 #endif /* STM32F413xx || STM32F423xx */ 01006 01007 #if defined(STM32F401xC) 01008 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 01009 #endif /* STM32F401xC */ 01010 01011 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) 01012 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 01013 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ 01014 01015 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ 01016 defined(STM32F412Rx) || defined(STM32F412Cx) 01017 #define IS_OB_PCROP(SECTOR)((((SECTOR) & 0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) 01018 #endif /* STM32F401xE || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 01019 01020 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 01021 defined(STM32F469xx) || defined(STM32F479xx) 01022 #define IS_OB_BOOT(BOOT) (((BOOT) == OB_DUAL_BOOT_ENABLE) || ((BOOT) == OB_DUAL_BOOT_DISABLE)) 01023 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ 01024 01025 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 01026 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ 01027 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ 01028 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ 01029 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 01030 #define IS_OB_PCROP_SELECT(PCROP) (((PCROP) == OB_PCROP_SELECTED) || ((PCROP) == OB_PCROP_DESELECTED)) 01031 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ 01032 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ 01033 STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ 01034 /** 01035 * @} 01036 */ 01037 01038 /** 01039 * @} 01040 */ 01041 01042 /* Private functions ---------------------------------------------------------*/ 01043 /** @defgroup FLASHEx_Private_Functions FLASH Private Functions 01044 * @{ 01045 */ 01046 void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange); 01047 void FLASH_FlushCaches(void); 01048 /** 01049 * @} 01050 */ 01051 01052 /** 01053 * @} 01054 */ 01055 01056 /** 01057 * @} 01058 */ 01059 01060 #ifdef __cplusplus 01061 } 01062 #endif 01063 01064 #endif /* __STM32F4xx_HAL_FLASH_EX_H */ 01065 01066 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/