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