Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
110:165afa46840b
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 101:7cff1c4259d7 1 /**
Kojto 101:7cff1c4259d7 2 ******************************************************************************
Kojto 101:7cff1c4259d7 3 * @file stm32f4xx_hal_flash_ex.h
Kojto 101:7cff1c4259d7 4 * @author MCD Application Team
Kojto 110:165afa46840b 5 * @version V1.4.1
Kojto 110:165afa46840b 6 * @date 09-October-2015
Kojto 101:7cff1c4259d7 7 * @brief Header file of FLASH HAL Extension module.
Kojto 101:7cff1c4259d7 8 ******************************************************************************
Kojto 101:7cff1c4259d7 9 * @attention
Kojto 101:7cff1c4259d7 10 *
Kojto 101:7cff1c4259d7 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 101:7cff1c4259d7 12 *
Kojto 101:7cff1c4259d7 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 101:7cff1c4259d7 14 * are permitted provided that the following conditions are met:
Kojto 101:7cff1c4259d7 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 101:7cff1c4259d7 16 * this list of conditions and the following disclaimer.
Kojto 101:7cff1c4259d7 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 101:7cff1c4259d7 18 * this list of conditions and the following disclaimer in the documentation
Kojto 101:7cff1c4259d7 19 * and/or other materials provided with the distribution.
Kojto 101:7cff1c4259d7 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 101:7cff1c4259d7 21 * may be used to endorse or promote products derived from this software
Kojto 101:7cff1c4259d7 22 * without specific prior written permission.
Kojto 101:7cff1c4259d7 23 *
Kojto 101:7cff1c4259d7 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 101:7cff1c4259d7 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 101:7cff1c4259d7 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 101:7cff1c4259d7 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 101:7cff1c4259d7 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 101:7cff1c4259d7 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 101:7cff1c4259d7 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 101:7cff1c4259d7 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 101:7cff1c4259d7 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 101:7cff1c4259d7 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 101:7cff1c4259d7 34 *
Kojto 101:7cff1c4259d7 35 ******************************************************************************
Kojto 101:7cff1c4259d7 36 */
Kojto 101:7cff1c4259d7 37
Kojto 101:7cff1c4259d7 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 101:7cff1c4259d7 39 #ifndef __STM32F4xx_HAL_FLASH_EX_H
Kojto 101:7cff1c4259d7 40 #define __STM32F4xx_HAL_FLASH_EX_H
Kojto 101:7cff1c4259d7 41
Kojto 101:7cff1c4259d7 42 #ifdef __cplusplus
Kojto 101:7cff1c4259d7 43 extern "C" {
Kojto 101:7cff1c4259d7 44 #endif
Kojto 101:7cff1c4259d7 45
Kojto 101:7cff1c4259d7 46 /* Includes ------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 47 #include "stm32f4xx_hal_def.h"
Kojto 101:7cff1c4259d7 48
Kojto 101:7cff1c4259d7 49 /** @addtogroup STM32F4xx_HAL_Driver
Kojto 101:7cff1c4259d7 50 * @{
Kojto 101:7cff1c4259d7 51 */
Kojto 101:7cff1c4259d7 52
Kojto 101:7cff1c4259d7 53 /** @addtogroup FLASHEx
Kojto 101:7cff1c4259d7 54 * @{
Kojto 101:7cff1c4259d7 55 */
Kojto 101:7cff1c4259d7 56
Kojto 101:7cff1c4259d7 57 /* Exported types ------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 58 /** @defgroup FLASHEx_Exported_Types FLASH Exported Types
Kojto 101:7cff1c4259d7 59 * @{
Kojto 101:7cff1c4259d7 60 */
Kojto 101:7cff1c4259d7 61
Kojto 101:7cff1c4259d7 62 /**
Kojto 101:7cff1c4259d7 63 * @brief FLASH Erase structure definition
Kojto 101:7cff1c4259d7 64 */
Kojto 101:7cff1c4259d7 65 typedef struct
Kojto 101:7cff1c4259d7 66 {
Kojto 101:7cff1c4259d7 67 uint32_t TypeErase; /*!< Mass erase or sector Erase.
Kojto 101:7cff1c4259d7 68 This parameter can be a value of @ref FLASHEx_Type_Erase */
Kojto 101:7cff1c4259d7 69
Kojto 101:7cff1c4259d7 70 uint32_t Banks; /*!< Select banks to erase when Mass erase is enabled.
Kojto 101:7cff1c4259d7 71 This parameter must be a value of @ref FLASHEx_Banks */
Kojto 101:7cff1c4259d7 72
Kojto 101:7cff1c4259d7 73 uint32_t Sector; /*!< Initial FLASH sector to erase when Mass erase is disabled
Kojto 101:7cff1c4259d7 74 This parameter must be a value of @ref FLASHEx_Sectors */
Kojto 101:7cff1c4259d7 75
Kojto 101:7cff1c4259d7 76 uint32_t NbSectors; /*!< Number of sectors to be erased.
Kojto 101:7cff1c4259d7 77 This parameter must be a value between 1 and (max number of sectors - value of Initial sector)*/
Kojto 101:7cff1c4259d7 78
Kojto 101:7cff1c4259d7 79 uint32_t VoltageRange;/*!< The device voltage range which defines the erase parallelism
Kojto 101:7cff1c4259d7 80 This parameter must be a value of @ref FLASHEx_Voltage_Range */
Kojto 101:7cff1c4259d7 81
Kojto 101:7cff1c4259d7 82 } FLASH_EraseInitTypeDef;
Kojto 101:7cff1c4259d7 83
Kojto 101:7cff1c4259d7 84 /**
Kojto 101:7cff1c4259d7 85 * @brief FLASH Option Bytes Program structure definition
Kojto 101:7cff1c4259d7 86 */
Kojto 101:7cff1c4259d7 87 typedef struct
Kojto 101:7cff1c4259d7 88 {
Kojto 101:7cff1c4259d7 89 uint32_t OptionType; /*!< Option byte to be configured.
Kojto 101:7cff1c4259d7 90 This parameter can be a value of @ref FLASHEx_Option_Type */
Kojto 101:7cff1c4259d7 91
Kojto 101:7cff1c4259d7 92 uint32_t WRPState; /*!< Write protection activation or deactivation.
Kojto 101:7cff1c4259d7 93 This parameter can be a value of @ref FLASHEx_WRP_State */
Kojto 101:7cff1c4259d7 94
Kojto 101:7cff1c4259d7 95 uint32_t WRPSector; /*!< Specifies the sector(s) to be write protected.
Kojto 101:7cff1c4259d7 96 The value of this parameter depend on device used within the same series */
Kojto 101:7cff1c4259d7 97
Kojto 101:7cff1c4259d7 98 uint32_t Banks; /*!< Select banks for WRP activation/deactivation of all sectors.
Kojto 101:7cff1c4259d7 99 This parameter must be a value of @ref FLASHEx_Banks */
Kojto 101:7cff1c4259d7 100
Kojto 101:7cff1c4259d7 101 uint32_t RDPLevel; /*!< Set the read protection level.
Kojto 101:7cff1c4259d7 102 This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */
Kojto 101:7cff1c4259d7 103
Kojto 101:7cff1c4259d7 104 uint32_t BORLevel; /*!< Set the BOR Level.
Kojto 101:7cff1c4259d7 105 This parameter can be a value of @ref FLASHEx_BOR_Reset_Level */
Kojto 101:7cff1c4259d7 106
Kojto 101:7cff1c4259d7 107 uint8_t USERConfig; /*!< Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */
Kojto 101:7cff1c4259d7 108
Kojto 101:7cff1c4259d7 109 } FLASH_OBProgramInitTypeDef;
Kojto 101:7cff1c4259d7 110
Kojto 101:7cff1c4259d7 111 /**
Kojto 101:7cff1c4259d7 112 * @brief FLASH Advanced Option Bytes Program structure definition
Kojto 101:7cff1c4259d7 113 */
Kojto 110:165afa46840b 114 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 115 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 116 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
Kojto 110:165afa46840b 117 defined(STM32F479xx)
Kojto 101:7cff1c4259d7 118 typedef struct
Kojto 101:7cff1c4259d7 119 {
Kojto 101:7cff1c4259d7 120 uint32_t OptionType; /*!< Option byte to be configured for extension.
Kojto 101:7cff1c4259d7 121 This parameter can be a value of @ref FLASHEx_Advanced_Option_Type */
Kojto 101:7cff1c4259d7 122
Kojto 101:7cff1c4259d7 123 uint32_t PCROPState; /*!< PCROP activation or deactivation.
Kojto 101:7cff1c4259d7 124 This parameter can be a value of @ref FLASHEx_PCROP_State */
Kojto 101:7cff1c4259d7 125
Kojto 110:165afa46840b 126 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 127 uint16_t Sectors; /*!< specifies the sector(s) set for PCROP.
Kojto 101:7cff1c4259d7 128 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */
Kojto 110:165afa46840b 129 #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 130
Kojto 110:165afa46840b 131 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 132 uint32_t Banks; /*!< Select banks for PCROP activation/deactivation of all sectors.
Kojto 101:7cff1c4259d7 133 This parameter must be a value of @ref FLASHEx_Banks */
Kojto 101:7cff1c4259d7 134
Kojto 101:7cff1c4259d7 135 uint16_t SectorsBank1; /*!< Specifies the sector(s) set for PCROP for Bank1.
Kojto 101:7cff1c4259d7 136 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */
Kojto 101:7cff1c4259d7 137
Kojto 101:7cff1c4259d7 138 uint16_t SectorsBank2; /*!< Specifies the sector(s) set for PCROP for Bank2.
Kojto 101:7cff1c4259d7 139 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */
Kojto 101:7cff1c4259d7 140
Kojto 101:7cff1c4259d7 141 uint8_t BootConfig; /*!< Specifies Option bytes for boot config.
Kojto 101:7cff1c4259d7 142 This parameter can be a value of @ref FLASHEx_Dual_Boot */
Kojto 101:7cff1c4259d7 143
Kojto 110:165afa46840b 144 #endif /*STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 145 } FLASH_AdvOBProgramInitTypeDef;
Kojto 110:165afa46840b 146 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 147 /**
Kojto 101:7cff1c4259d7 148 * @}
Kojto 101:7cff1c4259d7 149 */
Kojto 101:7cff1c4259d7 150
Kojto 101:7cff1c4259d7 151 /* Exported constants --------------------------------------------------------*/
Kojto 101:7cff1c4259d7 152
Kojto 101:7cff1c4259d7 153 /** @defgroup FLASHEx_Exported_Constants FLASH Exported Constants
Kojto 101:7cff1c4259d7 154 * @{
Kojto 101:7cff1c4259d7 155 */
Kojto 101:7cff1c4259d7 156
Kojto 101:7cff1c4259d7 157 /** @defgroup FLASHEx_Type_Erase FLASH Type Erase
Kojto 101:7cff1c4259d7 158 * @{
Kojto 101:7cff1c4259d7 159 */
Kojto 101:7cff1c4259d7 160 #define FLASH_TYPEERASE_SECTORS ((uint32_t)0x00) /*!< Sectors erase only */
Kojto 101:7cff1c4259d7 161 #define FLASH_TYPEERASE_MASSERASE ((uint32_t)0x01) /*!< Flash Mass erase activation */
Kojto 101:7cff1c4259d7 162 /**
Kojto 101:7cff1c4259d7 163 * @}
Kojto 101:7cff1c4259d7 164 */
Kojto 101:7cff1c4259d7 165
Kojto 101:7cff1c4259d7 166 /** @defgroup FLASHEx_Voltage_Range FLASH Voltage Range
Kojto 101:7cff1c4259d7 167 * @{
Kojto 101:7cff1c4259d7 168 */
Kojto 101:7cff1c4259d7 169 #define FLASH_VOLTAGE_RANGE_1 ((uint32_t)0x00) /*!< Device operating range: 1.8V to 2.1V */
Kojto 101:7cff1c4259d7 170 #define FLASH_VOLTAGE_RANGE_2 ((uint32_t)0x01) /*!< Device operating range: 2.1V to 2.7V */
Kojto 101:7cff1c4259d7 171 #define FLASH_VOLTAGE_RANGE_3 ((uint32_t)0x02) /*!< Device operating range: 2.7V to 3.6V */
Kojto 101:7cff1c4259d7 172 #define FLASH_VOLTAGE_RANGE_4 ((uint32_t)0x03) /*!< Device operating range: 2.7V to 3.6V + External Vpp */
Kojto 101:7cff1c4259d7 173 /**
Kojto 101:7cff1c4259d7 174 * @}
Kojto 101:7cff1c4259d7 175 */
Kojto 101:7cff1c4259d7 176
Kojto 101:7cff1c4259d7 177 /** @defgroup FLASHEx_WRP_State FLASH WRP State
Kojto 101:7cff1c4259d7 178 * @{
Kojto 101:7cff1c4259d7 179 */
Kojto 101:7cff1c4259d7 180 #define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!< Disable the write protection of the desired bank 1 sectors */
Kojto 101:7cff1c4259d7 181 #define OB_WRPSTATE_ENABLE ((uint32_t)0x01) /*!< Enable the write protection of the desired bank 1 sectors */
Kojto 101:7cff1c4259d7 182 /**
Kojto 101:7cff1c4259d7 183 * @}
Kojto 101:7cff1c4259d7 184 */
Kojto 101:7cff1c4259d7 185
Kojto 101:7cff1c4259d7 186 /** @defgroup FLASHEx_Option_Type FLASH Option Type
Kojto 101:7cff1c4259d7 187 * @{
Kojto 101:7cff1c4259d7 188 */
Kojto 101:7cff1c4259d7 189 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!< WRP option byte configuration */
Kojto 101:7cff1c4259d7 190 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!< RDP option byte configuration */
Kojto 101:7cff1c4259d7 191 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!< USER option byte configuration */
Kojto 101:7cff1c4259d7 192 #define OPTIONBYTE_BOR ((uint32_t)0x08) /*!< BOR option byte configuration */
Kojto 101:7cff1c4259d7 193 /**
Kojto 101:7cff1c4259d7 194 * @}
Kojto 101:7cff1c4259d7 195 */
Kojto 101:7cff1c4259d7 196
Kojto 101:7cff1c4259d7 197 /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASH Option Bytes Read Protection
Kojto 101:7cff1c4259d7 198 * @{
Kojto 101:7cff1c4259d7 199 */
Kojto 101:7cff1c4259d7 200 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
Kojto 101:7cff1c4259d7 201 #define OB_RDP_LEVEL_1 ((uint8_t)0x55)
Kojto 106:ba1f97679dad 202 #define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2
Kojto 106:ba1f97679dad 203 it s no more possible to go back to level 1 or 0 */
Kojto 101:7cff1c4259d7 204 /**
Kojto 101:7cff1c4259d7 205 * @}
Kojto 101:7cff1c4259d7 206 */
Kojto 101:7cff1c4259d7 207
Kojto 101:7cff1c4259d7 208 /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASH Option Bytes IWatchdog
Kojto 101:7cff1c4259d7 209 * @{
Kojto 101:7cff1c4259d7 210 */
Kojto 101:7cff1c4259d7 211 #define OB_IWDG_SW ((uint8_t)0x20) /*!< Software IWDG selected */
Kojto 101:7cff1c4259d7 212 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */
Kojto 101:7cff1c4259d7 213 /**
Kojto 101:7cff1c4259d7 214 * @}
Kojto 101:7cff1c4259d7 215 */
Kojto 101:7cff1c4259d7 216
Kojto 101:7cff1c4259d7 217 /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASH Option Bytes nRST_STOP
Kojto 101:7cff1c4259d7 218 * @{
Kojto 101:7cff1c4259d7 219 */
Kojto 101:7cff1c4259d7 220 #define OB_STOP_NO_RST ((uint8_t)0x40) /*!< No reset generated when entering in STOP */
Kojto 101:7cff1c4259d7 221 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
Kojto 101:7cff1c4259d7 222 /**
Kojto 101:7cff1c4259d7 223 * @}
Kojto 101:7cff1c4259d7 224 */
Kojto 101:7cff1c4259d7 225
Kojto 101:7cff1c4259d7 226
Kojto 101:7cff1c4259d7 227 /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASH Option Bytes nRST_STDBY
Kojto 101:7cff1c4259d7 228 * @{
Kojto 101:7cff1c4259d7 229 */
Kojto 101:7cff1c4259d7 230 #define OB_STDBY_NO_RST ((uint8_t)0x80) /*!< No reset generated when entering in STANDBY */
Kojto 101:7cff1c4259d7 231 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
Kojto 101:7cff1c4259d7 232 /**
Kojto 101:7cff1c4259d7 233 * @}
Kojto 101:7cff1c4259d7 234 */
Kojto 101:7cff1c4259d7 235
Kojto 101:7cff1c4259d7 236 /** @defgroup FLASHEx_BOR_Reset_Level FLASH BOR Reset Level
Kojto 101:7cff1c4259d7 237 * @{
Kojto 101:7cff1c4259d7 238 */
Kojto 101:7cff1c4259d7 239 #define OB_BOR_LEVEL3 ((uint8_t)0x00) /*!< Supply voltage ranges from 2.70 to 3.60 V */
Kojto 101:7cff1c4259d7 240 #define OB_BOR_LEVEL2 ((uint8_t)0x04) /*!< Supply voltage ranges from 2.40 to 2.70 V */
Kojto 101:7cff1c4259d7 241 #define OB_BOR_LEVEL1 ((uint8_t)0x08) /*!< Supply voltage ranges from 2.10 to 2.40 V */
Kojto 101:7cff1c4259d7 242 #define OB_BOR_OFF ((uint8_t)0x0C) /*!< Supply voltage ranges from 1.62 to 2.10 V */
Kojto 101:7cff1c4259d7 243 /**
Kojto 101:7cff1c4259d7 244 * @}
Kojto 101:7cff1c4259d7 245 */
Kojto 101:7cff1c4259d7 246
Kojto 101:7cff1c4259d7 247 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 248 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 249 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
Kojto 110:165afa46840b 250 defined(STM32F479xx)
Kojto 101:7cff1c4259d7 251 /** @defgroup FLASHEx_PCROP_State FLASH PCROP State
Kojto 101:7cff1c4259d7 252 * @{
Kojto 101:7cff1c4259d7 253 */
Kojto 101:7cff1c4259d7 254 #define OB_PCROP_STATE_DISABLE ((uint32_t)0x00) /*!< Disable PCROP */
Kojto 101:7cff1c4259d7 255 #define OB_PCROP_STATE_ENABLE ((uint32_t)0x01) /*!< Enable PCROP */
Kojto 101:7cff1c4259d7 256 /**
Kojto 101:7cff1c4259d7 257 * @}
Kojto 101:7cff1c4259d7 258 */
Kojto 110:165afa46840b 259 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\
Kojto 110:165afa46840b 260 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 261
Kojto 101:7cff1c4259d7 262 /** @defgroup FLASHEx_Advanced_Option_Type FLASH Advanced Option Type
Kojto 101:7cff1c4259d7 263 * @{
Kojto 101:7cff1c4259d7 264 */
Kojto 110:165afa46840b 265 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 266 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 267 #define OPTIONBYTE_PCROP ((uint32_t)0x01) /*!< PCROP option byte configuration */
Kojto 101:7cff1c4259d7 268 #define OPTIONBYTE_BOOTCONFIG ((uint32_t)0x02) /*!< BOOTConfig option byte configuration */
Kojto 110:165afa46840b 269 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 270
Kojto 110:165afa46840b 271 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 272 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 273 #define OPTIONBYTE_PCROP ((uint32_t)0x01) /*!<PCROP option byte configuration */
Kojto 110:165afa46840b 274 #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 275 /**
Kojto 101:7cff1c4259d7 276 * @}
Kojto 101:7cff1c4259d7 277 */
Kojto 101:7cff1c4259d7 278
Kojto 101:7cff1c4259d7 279 /** @defgroup FLASH_Latency FLASH Latency
Kojto 101:7cff1c4259d7 280 * @{
Kojto 101:7cff1c4259d7 281 */
Kojto 110:165afa46840b 282 /*------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx ----------------------*/
Kojto 110:165afa46840b 283 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 284 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 285 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */
Kojto 101:7cff1c4259d7 286 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */
Kojto 101:7cff1c4259d7 287 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */
Kojto 101:7cff1c4259d7 288 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */
Kojto 101:7cff1c4259d7 289 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */
Kojto 101:7cff1c4259d7 290 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */
Kojto 101:7cff1c4259d7 291 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */
Kojto 101:7cff1c4259d7 292 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */
Kojto 101:7cff1c4259d7 293 #define FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH Eight Latency cycles */
Kojto 101:7cff1c4259d7 294 #define FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH Nine Latency cycles */
Kojto 101:7cff1c4259d7 295 #define FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH Ten Latency cycles */
Kojto 101:7cff1c4259d7 296 #define FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH Eleven Latency cycles */
Kojto 101:7cff1c4259d7 297 #define FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH Twelve Latency cycles */
Kojto 101:7cff1c4259d7 298 #define FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH Thirteen Latency cycles */
Kojto 101:7cff1c4259d7 299 #define FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH Fourteen Latency cycles */
Kojto 101:7cff1c4259d7 300 #define FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH Fifteen Latency cycles */
Kojto 110:165afa46840b 301 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 302 /*--------------------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 303
Kojto 101:7cff1c4259d7 304 /*-------------------------- STM32F40xxx/STM32F41xxx/STM32F401xx/STM32F411xx -----------------------------------*/
Kojto 110:165afa46840b 305 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
Kojto 110:165afa46840b 306 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 307 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 308
Kojto 101:7cff1c4259d7 309 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */
Kojto 101:7cff1c4259d7 310 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */
Kojto 101:7cff1c4259d7 311 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */
Kojto 101:7cff1c4259d7 312 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */
Kojto 101:7cff1c4259d7 313 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */
Kojto 101:7cff1c4259d7 314 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */
Kojto 101:7cff1c4259d7 315 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */
Kojto 101:7cff1c4259d7 316 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */
Kojto 110:165afa46840b 317 #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 318 /*--------------------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 319
Kojto 101:7cff1c4259d7 320 /**
Kojto 101:7cff1c4259d7 321 * @}
Kojto 101:7cff1c4259d7 322 */
Kojto 101:7cff1c4259d7 323
Kojto 101:7cff1c4259d7 324
Kojto 101:7cff1c4259d7 325 /** @defgroup FLASHEx_Banks FLASH Banks
Kojto 101:7cff1c4259d7 326 * @{
Kojto 101:7cff1c4259d7 327 */
Kojto 110:165afa46840b 328 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 329 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 330 #define FLASH_BANK_1 ((uint32_t)1) /*!< Bank 1 */
Kojto 101:7cff1c4259d7 331 #define FLASH_BANK_2 ((uint32_t)2) /*!< Bank 2 */
Kojto 101:7cff1c4259d7 332 #define FLASH_BANK_BOTH ((uint32_t)FLASH_BANK_1 | FLASH_BANK_2) /*!< Bank1 and Bank2 */
Kojto 110:165afa46840b 333 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 334
Kojto 101:7cff1c4259d7 335 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
Kojto 110:165afa46840b 336 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 337 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 338 #define FLASH_BANK_1 ((uint32_t)1) /*!< Bank 1 */
Kojto 110:165afa46840b 339 #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 340 /**
Kojto 101:7cff1c4259d7 341 * @}
Kojto 101:7cff1c4259d7 342 */
Kojto 101:7cff1c4259d7 343
Kojto 101:7cff1c4259d7 344 /** @defgroup FLASHEx_MassErase_bit FLASH Mass Erase bit
Kojto 101:7cff1c4259d7 345 * @{
Kojto 101:7cff1c4259d7 346 */
Kojto 110:165afa46840b 347 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 348 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 349 #define FLASH_MER_BIT (FLASH_CR_MER1 | FLASH_CR_MER2) /*!< 2 MER bits here to clear */
Kojto 110:165afa46840b 350 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 351
Kojto 101:7cff1c4259d7 352 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
Kojto 110:165afa46840b 353 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 354 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 355 #define FLASH_MER_BIT (FLASH_CR_MER) /*!< only 1 MER Bit */
Kojto 110:165afa46840b 356 #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 357 /**
Kojto 101:7cff1c4259d7 358 * @}
Kojto 101:7cff1c4259d7 359 */
Kojto 101:7cff1c4259d7 360
Kojto 101:7cff1c4259d7 361 /** @defgroup FLASHEx_Sectors FLASH Sectors
Kojto 101:7cff1c4259d7 362 * @{
Kojto 101:7cff1c4259d7 363 */
Kojto 110:165afa46840b 364 /*-------------------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx ------------------------------------*/
Kojto 110:165afa46840b 365 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 366 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 367 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 101:7cff1c4259d7 368 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 101:7cff1c4259d7 369 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 101:7cff1c4259d7 370 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 101:7cff1c4259d7 371 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 101:7cff1c4259d7 372 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 101:7cff1c4259d7 373 #define FLASH_SECTOR_6 ((uint32_t)6) /*!< Sector Number 6 */
Kojto 101:7cff1c4259d7 374 #define FLASH_SECTOR_7 ((uint32_t)7) /*!< Sector Number 7 */
Kojto 101:7cff1c4259d7 375 #define FLASH_SECTOR_8 ((uint32_t)8) /*!< Sector Number 8 */
Kojto 101:7cff1c4259d7 376 #define FLASH_SECTOR_9 ((uint32_t)9) /*!< Sector Number 9 */
Kojto 101:7cff1c4259d7 377 #define FLASH_SECTOR_10 ((uint32_t)10) /*!< Sector Number 10 */
Kojto 101:7cff1c4259d7 378 #define FLASH_SECTOR_11 ((uint32_t)11) /*!< Sector Number 11 */
Kojto 101:7cff1c4259d7 379 #define FLASH_SECTOR_12 ((uint32_t)12) /*!< Sector Number 12 */
Kojto 101:7cff1c4259d7 380 #define FLASH_SECTOR_13 ((uint32_t)13) /*!< Sector Number 13 */
Kojto 101:7cff1c4259d7 381 #define FLASH_SECTOR_14 ((uint32_t)14) /*!< Sector Number 14 */
Kojto 101:7cff1c4259d7 382 #define FLASH_SECTOR_15 ((uint32_t)15) /*!< Sector Number 15 */
Kojto 101:7cff1c4259d7 383 #define FLASH_SECTOR_16 ((uint32_t)16) /*!< Sector Number 16 */
Kojto 101:7cff1c4259d7 384 #define FLASH_SECTOR_17 ((uint32_t)17) /*!< Sector Number 17 */
Kojto 101:7cff1c4259d7 385 #define FLASH_SECTOR_18 ((uint32_t)18) /*!< Sector Number 18 */
Kojto 101:7cff1c4259d7 386 #define FLASH_SECTOR_19 ((uint32_t)19) /*!< Sector Number 19 */
Kojto 101:7cff1c4259d7 387 #define FLASH_SECTOR_20 ((uint32_t)20) /*!< Sector Number 20 */
Kojto 101:7cff1c4259d7 388 #define FLASH_SECTOR_21 ((uint32_t)21) /*!< Sector Number 21 */
Kojto 101:7cff1c4259d7 389 #define FLASH_SECTOR_22 ((uint32_t)22) /*!< Sector Number 22 */
Kojto 101:7cff1c4259d7 390 #define FLASH_SECTOR_23 ((uint32_t)23) /*!< Sector Number 23 */
Kojto 110:165afa46840b 391 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 392 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 393
Kojto 101:7cff1c4259d7 394 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/
Kojto 110:165afa46840b 395 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
Kojto 101:7cff1c4259d7 396 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 101:7cff1c4259d7 397 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 101:7cff1c4259d7 398 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 101:7cff1c4259d7 399 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 101:7cff1c4259d7 400 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 101:7cff1c4259d7 401 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 101:7cff1c4259d7 402 #define FLASH_SECTOR_6 ((uint32_t)6) /*!< Sector Number 6 */
Kojto 101:7cff1c4259d7 403 #define FLASH_SECTOR_7 ((uint32_t)7) /*!< Sector Number 7 */
Kojto 101:7cff1c4259d7 404 #define FLASH_SECTOR_8 ((uint32_t)8) /*!< Sector Number 8 */
Kojto 101:7cff1c4259d7 405 #define FLASH_SECTOR_9 ((uint32_t)9) /*!< Sector Number 9 */
Kojto 101:7cff1c4259d7 406 #define FLASH_SECTOR_10 ((uint32_t)10) /*!< Sector Number 10 */
Kojto 101:7cff1c4259d7 407 #define FLASH_SECTOR_11 ((uint32_t)11) /*!< Sector Number 11 */
Kojto 110:165afa46840b 408 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
Kojto 101:7cff1c4259d7 409 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 410
Kojto 101:7cff1c4259d7 411 /*--------------------------------------------- STM32F401xC -------------------------------------------*/
Kojto 101:7cff1c4259d7 412 #if defined(STM32F401xC)
Kojto 101:7cff1c4259d7 413 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 101:7cff1c4259d7 414 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 101:7cff1c4259d7 415 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 101:7cff1c4259d7 416 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 101:7cff1c4259d7 417 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 101:7cff1c4259d7 418 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 101:7cff1c4259d7 419 #endif /* STM32F401xC */
Kojto 101:7cff1c4259d7 420 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 421
Kojto 110:165afa46840b 422 /*--------------------------------------------- STM32F410xx -------------------------------------------*/
Kojto 110:165afa46840b 423 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
Kojto 110:165afa46840b 424 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 110:165afa46840b 425 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 110:165afa46840b 426 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 110:165afa46840b 427 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 110:165afa46840b 428 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 110:165afa46840b 429 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
Kojto 110:165afa46840b 430 /*-----------------------------------------------------------------------------------------------------*/
Kojto 110:165afa46840b 431
Kojto 101:7cff1c4259d7 432 /*---------------------------------- STM32F401xE/STM32F411xE/STM32F446xx ------------------------------*/
Kojto 110:165afa46840b 433 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 434 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 101:7cff1c4259d7 435 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 101:7cff1c4259d7 436 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 101:7cff1c4259d7 437 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 101:7cff1c4259d7 438 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 101:7cff1c4259d7 439 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 101:7cff1c4259d7 440 #define FLASH_SECTOR_6 ((uint32_t)6) /*!< Sector Number 6 */
Kojto 101:7cff1c4259d7 441 #define FLASH_SECTOR_7 ((uint32_t)7) /*!< Sector Number 7 */
Kojto 101:7cff1c4259d7 442 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 443 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 444
Kojto 101:7cff1c4259d7 445 /**
Kojto 101:7cff1c4259d7 446 * @}
Kojto 101:7cff1c4259d7 447 */
Kojto 101:7cff1c4259d7 448
Kojto 101:7cff1c4259d7 449 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection
Kojto 101:7cff1c4259d7 450 * @{
Kojto 101:7cff1c4259d7 451 */
Kojto 110:165afa46840b 452 /*--------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx -------------------------*/
Kojto 110:165afa46840b 453 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 454 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 455 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 101:7cff1c4259d7 456 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 101:7cff1c4259d7 457 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 101:7cff1c4259d7 458 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 101:7cff1c4259d7 459 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 101:7cff1c4259d7 460 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 101:7cff1c4259d7 461 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040) /*!< Write protection of Sector6 */
Kojto 101:7cff1c4259d7 462 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080) /*!< Write protection of Sector7 */
Kojto 101:7cff1c4259d7 463 #define OB_WRP_SECTOR_8 ((uint32_t)0x00000100) /*!< Write protection of Sector8 */
Kojto 101:7cff1c4259d7 464 #define OB_WRP_SECTOR_9 ((uint32_t)0x00000200) /*!< Write protection of Sector9 */
Kojto 101:7cff1c4259d7 465 #define OB_WRP_SECTOR_10 ((uint32_t)0x00000400) /*!< Write protection of Sector10 */
Kojto 101:7cff1c4259d7 466 #define OB_WRP_SECTOR_11 ((uint32_t)0x00000800) /*!< Write protection of Sector11 */
Kojto 101:7cff1c4259d7 467 #define OB_WRP_SECTOR_12 ((uint32_t)0x00000001 << 12) /*!< Write protection of Sector12 */
Kojto 101:7cff1c4259d7 468 #define OB_WRP_SECTOR_13 ((uint32_t)0x00000002 << 12) /*!< Write protection of Sector13 */
Kojto 101:7cff1c4259d7 469 #define OB_WRP_SECTOR_14 ((uint32_t)0x00000004 << 12) /*!< Write protection of Sector14 */
Kojto 101:7cff1c4259d7 470 #define OB_WRP_SECTOR_15 ((uint32_t)0x00000008 << 12) /*!< Write protection of Sector15 */
Kojto 101:7cff1c4259d7 471 #define OB_WRP_SECTOR_16 ((uint32_t)0x00000010 << 12) /*!< Write protection of Sector16 */
Kojto 101:7cff1c4259d7 472 #define OB_WRP_SECTOR_17 ((uint32_t)0x00000020 << 12) /*!< Write protection of Sector17 */
Kojto 101:7cff1c4259d7 473 #define OB_WRP_SECTOR_18 ((uint32_t)0x00000040 << 12) /*!< Write protection of Sector18 */
Kojto 101:7cff1c4259d7 474 #define OB_WRP_SECTOR_19 ((uint32_t)0x00000080 << 12) /*!< Write protection of Sector19 */
Kojto 101:7cff1c4259d7 475 #define OB_WRP_SECTOR_20 ((uint32_t)0x00000100 << 12) /*!< Write protection of Sector20 */
Kojto 101:7cff1c4259d7 476 #define OB_WRP_SECTOR_21 ((uint32_t)0x00000200 << 12) /*!< Write protection of Sector21 */
Kojto 101:7cff1c4259d7 477 #define OB_WRP_SECTOR_22 ((uint32_t)0x00000400 << 12) /*!< Write protection of Sector22 */
Kojto 101:7cff1c4259d7 478 #define OB_WRP_SECTOR_23 ((uint32_t)0x00000800 << 12) /*!< Write protection of Sector23 */
Kojto 101:7cff1c4259d7 479 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF << 12) /*!< Write protection of all Sectors */
Kojto 110:165afa46840b 480 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 481 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 482
Kojto 101:7cff1c4259d7 483 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/
Kojto 110:165afa46840b 484 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
Kojto 101:7cff1c4259d7 485 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 101:7cff1c4259d7 486 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 101:7cff1c4259d7 487 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 101:7cff1c4259d7 488 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 101:7cff1c4259d7 489 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 101:7cff1c4259d7 490 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 101:7cff1c4259d7 491 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040) /*!< Write protection of Sector6 */
Kojto 101:7cff1c4259d7 492 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080) /*!< Write protection of Sector7 */
Kojto 101:7cff1c4259d7 493 #define OB_WRP_SECTOR_8 ((uint32_t)0x00000100) /*!< Write protection of Sector8 */
Kojto 101:7cff1c4259d7 494 #define OB_WRP_SECTOR_9 ((uint32_t)0x00000200) /*!< Write protection of Sector9 */
Kojto 101:7cff1c4259d7 495 #define OB_WRP_SECTOR_10 ((uint32_t)0x00000400) /*!< Write protection of Sector10 */
Kojto 101:7cff1c4259d7 496 #define OB_WRP_SECTOR_11 ((uint32_t)0x00000800) /*!< Write protection of Sector11 */
Kojto 101:7cff1c4259d7 497 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF) /*!< Write protection of all Sectors */
Kojto 110:165afa46840b 498 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
Kojto 101:7cff1c4259d7 499 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 500
Kojto 101:7cff1c4259d7 501 /*--------------------------------------------- STM32F401xC -------------------------------------------*/
Kojto 101:7cff1c4259d7 502 #if defined(STM32F401xC)
Kojto 101:7cff1c4259d7 503 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 101:7cff1c4259d7 504 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 101:7cff1c4259d7 505 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 101:7cff1c4259d7 506 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 101:7cff1c4259d7 507 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 101:7cff1c4259d7 508 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 101:7cff1c4259d7 509 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF) /*!< Write protection of all Sectors */
Kojto 101:7cff1c4259d7 510 #endif /* STM32F401xC */
Kojto 101:7cff1c4259d7 511 /*-----------------------------------------------------------------------------------------------------*/
Kojto 110:165afa46840b 512
Kojto 110:165afa46840b 513 /*--------------------------------------------- STM32F410xx -------------------------------------------*/
Kojto 110:165afa46840b 514 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
Kojto 110:165afa46840b 515 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 110:165afa46840b 516 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 110:165afa46840b 517 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 110:165afa46840b 518 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 110:165afa46840b 519 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 110:165afa46840b 520 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF) /*!< Write protection of all Sectors */
Kojto 110:165afa46840b 521 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
Kojto 110:165afa46840b 522 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 523
Kojto 101:7cff1c4259d7 524 /*---------------------------------- STM32F401xE/STM32F411xE/STM32F446xx ------------------------------*/
Kojto 101:7cff1c4259d7 525 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 526 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 101:7cff1c4259d7 527 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 101:7cff1c4259d7 528 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 101:7cff1c4259d7 529 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 101:7cff1c4259d7 530 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 101:7cff1c4259d7 531 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 101:7cff1c4259d7 532 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040) /*!< Write protection of Sector6 */
Kojto 101:7cff1c4259d7 533 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080) /*!< Write protection of Sector7 */
Kojto 101:7cff1c4259d7 534 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF) /*!< Write protection of all Sectors */
Kojto 101:7cff1c4259d7 535 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 536 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 537 /**
Kojto 101:7cff1c4259d7 538 * @}
Kojto 101:7cff1c4259d7 539 */
Kojto 101:7cff1c4259d7 540
Kojto 101:7cff1c4259d7 541 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASH Option Bytes PC ReadWrite Protection
Kojto 101:7cff1c4259d7 542 * @{
Kojto 101:7cff1c4259d7 543 */
Kojto 110:165afa46840b 544 /*-------------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx ---------------------------*/
Kojto 110:165afa46840b 545 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 546 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 547 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector0 */
Kojto 101:7cff1c4259d7 548 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector1 */
Kojto 101:7cff1c4259d7 549 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector2 */
Kojto 101:7cff1c4259d7 550 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector3 */
Kojto 101:7cff1c4259d7 551 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector4 */
Kojto 101:7cff1c4259d7 552 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector5 */
Kojto 101:7cff1c4259d7 553 #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040) /*!< PC Read/Write protection of Sector6 */
Kojto 101:7cff1c4259d7 554 #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080) /*!< PC Read/Write protection of Sector7 */
Kojto 101:7cff1c4259d7 555 #define OB_PCROP_SECTOR_8 ((uint32_t)0x00000100) /*!< PC Read/Write protection of Sector8 */
Kojto 101:7cff1c4259d7 556 #define OB_PCROP_SECTOR_9 ((uint32_t)0x00000200) /*!< PC Read/Write protection of Sector9 */
Kojto 101:7cff1c4259d7 557 #define OB_PCROP_SECTOR_10 ((uint32_t)0x00000400) /*!< PC Read/Write protection of Sector10 */
Kojto 101:7cff1c4259d7 558 #define OB_PCROP_SECTOR_11 ((uint32_t)0x00000800) /*!< PC Read/Write protection of Sector11 */
Kojto 101:7cff1c4259d7 559 #define OB_PCROP_SECTOR_12 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector12 */
Kojto 101:7cff1c4259d7 560 #define OB_PCROP_SECTOR_13 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector13 */
Kojto 101:7cff1c4259d7 561 #define OB_PCROP_SECTOR_14 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector14 */
Kojto 101:7cff1c4259d7 562 #define OB_PCROP_SECTOR_15 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector15 */
Kojto 101:7cff1c4259d7 563 #define OB_PCROP_SECTOR_16 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector16 */
Kojto 101:7cff1c4259d7 564 #define OB_PCROP_SECTOR_17 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector17 */
Kojto 101:7cff1c4259d7 565 #define OB_PCROP_SECTOR_18 ((uint32_t)0x00000040) /*!< PC Read/Write protection of Sector18 */
Kojto 101:7cff1c4259d7 566 #define OB_PCROP_SECTOR_19 ((uint32_t)0x00000080) /*!< PC Read/Write protection of Sector19 */
Kojto 101:7cff1c4259d7 567 #define OB_PCROP_SECTOR_20 ((uint32_t)0x00000100) /*!< PC Read/Write protection of Sector20 */
Kojto 101:7cff1c4259d7 568 #define OB_PCROP_SECTOR_21 ((uint32_t)0x00000200) /*!< PC Read/Write protection of Sector21 */
Kojto 101:7cff1c4259d7 569 #define OB_PCROP_SECTOR_22 ((uint32_t)0x00000400) /*!< PC Read/Write protection of Sector22 */
Kojto 101:7cff1c4259d7 570 #define OB_PCROP_SECTOR_23 ((uint32_t)0x00000800) /*!< PC Read/Write protection of Sector23 */
Kojto 101:7cff1c4259d7 571 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFF) /*!< PC Read/Write protection of all Sectors */
Kojto 110:165afa46840b 572 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 573 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 574
Kojto 101:7cff1c4259d7 575 /*--------------------------------------------- STM32F401xC -------------------------------------------*/
Kojto 101:7cff1c4259d7 576 #if defined(STM32F401xC)
Kojto 101:7cff1c4259d7 577 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector0 */
Kojto 101:7cff1c4259d7 578 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector1 */
Kojto 101:7cff1c4259d7 579 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector2 */
Kojto 101:7cff1c4259d7 580 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector3 */
Kojto 101:7cff1c4259d7 581 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector4 */
Kojto 101:7cff1c4259d7 582 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector5 */
Kojto 101:7cff1c4259d7 583 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFF) /*!< PC Read/Write protection of all Sectors */
Kojto 101:7cff1c4259d7 584 #endif /* STM32F401xC */
Kojto 101:7cff1c4259d7 585 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 586
Kojto 110:165afa46840b 587 /*--------------------------------------------- STM32F410xx -------------------------------------------*/
Kojto 110:165afa46840b 588 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
Kojto 110:165afa46840b 589 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector0 */
Kojto 110:165afa46840b 590 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector1 */
Kojto 110:165afa46840b 591 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector2 */
Kojto 110:165afa46840b 592 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector3 */
Kojto 110:165afa46840b 593 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector4 */
Kojto 110:165afa46840b 594 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFF) /*!< PC Read/Write protection of all Sectors */
Kojto 110:165afa46840b 595 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
Kojto 110:165afa46840b 596 /*-----------------------------------------------------------------------------------------------------*/
Kojto 110:165afa46840b 597
Kojto 110:165afa46840b 598 /*------------------------------ STM32F401xE/STM32F411xE/STM32F446xx ----------------------*/
Kojto 110:165afa46840b 599 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 600 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector0 */
Kojto 101:7cff1c4259d7 601 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector1 */
Kojto 101:7cff1c4259d7 602 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector2 */
Kojto 101:7cff1c4259d7 603 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector3 */
Kojto 101:7cff1c4259d7 604 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector4 */
Kojto 101:7cff1c4259d7 605 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector5 */
Kojto 101:7cff1c4259d7 606 #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040) /*!< PC Read/Write protection of Sector6 */
Kojto 101:7cff1c4259d7 607 #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080) /*!< PC Read/Write protection of Sector7 */
Kojto 101:7cff1c4259d7 608 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFF) /*!< PC Read/Write protection of all Sectors */
Kojto 110:165afa46840b 609 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 610 /*-----------------------------------------------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 611
Kojto 101:7cff1c4259d7 612 /**
Kojto 101:7cff1c4259d7 613 * @}
Kojto 101:7cff1c4259d7 614 */
Kojto 101:7cff1c4259d7 615
Kojto 101:7cff1c4259d7 616 /** @defgroup FLASHEx_Dual_Boot FLASH Dual Boot
Kojto 101:7cff1c4259d7 617 * @{
Kojto 101:7cff1c4259d7 618 */
Kojto 110:165afa46840b 619 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 620 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 621 #define OB_DUAL_BOOT_ENABLE ((uint8_t)0x10) /*!< Dual Bank Boot Enable */
Kojto 101:7cff1c4259d7 622 #define OB_DUAL_BOOT_DISABLE ((uint8_t)0x00) /*!< Dual Bank Boot Disable, always boot on User Flash */
Kojto 110:165afa46840b 623 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 624 /**
Kojto 101:7cff1c4259d7 625 * @}
Kojto 101:7cff1c4259d7 626 */
Kojto 101:7cff1c4259d7 627
Kojto 101:7cff1c4259d7 628 /** @defgroup FLASHEx_Selection_Protection_Mode FLASH Selection Protection Mode
Kojto 101:7cff1c4259d7 629 * @{
Kojto 101:7cff1c4259d7 630 */
Kojto 101:7cff1c4259d7 631 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 632 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 633 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
Kojto 110:165afa46840b 634 defined(STM32F479xx)
Kojto 101:7cff1c4259d7 635 #define OB_PCROP_DESELECTED ((uint8_t)0x00) /*!< Disabled PcROP, nWPRi bits used for Write Protection on sector i */
Kojto 101:7cff1c4259d7 636 #define OB_PCROP_SELECTED ((uint8_t)0x80) /*!< Enable PcROP, nWPRi bits used for PCRoP Protection on sector i */
Kojto 110:165afa46840b 637 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\
Kojto 110:165afa46840b 638 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 639 /**
Kojto 101:7cff1c4259d7 640 * @}
Kojto 101:7cff1c4259d7 641 */
Kojto 101:7cff1c4259d7 642
Kojto 101:7cff1c4259d7 643 /**
Kojto 101:7cff1c4259d7 644 * @}
Kojto 101:7cff1c4259d7 645 */
Kojto 101:7cff1c4259d7 646
Kojto 101:7cff1c4259d7 647 /* Exported macro ------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 648
Kojto 101:7cff1c4259d7 649 /* Exported functions --------------------------------------------------------*/
Kojto 101:7cff1c4259d7 650 /** @addtogroup FLASHEx_Exported_Functions
Kojto 101:7cff1c4259d7 651 * @{
Kojto 101:7cff1c4259d7 652 */
Kojto 101:7cff1c4259d7 653
Kojto 101:7cff1c4259d7 654 /** @addtogroup FLASHEx_Exported_Functions_Group1
Kojto 101:7cff1c4259d7 655 * @{
Kojto 101:7cff1c4259d7 656 */
Kojto 101:7cff1c4259d7 657 /* Extension Program operation functions *************************************/
Kojto 101:7cff1c4259d7 658 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError);
Kojto 101:7cff1c4259d7 659 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
Kojto 101:7cff1c4259d7 660 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 101:7cff1c4259d7 661 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 101:7cff1c4259d7 662
Kojto 101:7cff1c4259d7 663 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 664 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 665 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
Kojto 110:165afa46840b 666 defined(STM32F479xx)
Kojto 101:7cff1c4259d7 667 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
Kojto 101:7cff1c4259d7 668 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
Kojto 101:7cff1c4259d7 669 HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void);
Kojto 101:7cff1c4259d7 670 HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void);
Kojto 110:165afa46840b 671 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\
Kojto 110:165afa46840b 672 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 673
Kojto 110:165afa46840b 674 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 675 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 676 uint16_t HAL_FLASHEx_OB_GetBank2WRP(void);
Kojto 110:165afa46840b 677 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 678 /**
Kojto 101:7cff1c4259d7 679 * @}
Kojto 101:7cff1c4259d7 680 */
Kojto 101:7cff1c4259d7 681
Kojto 101:7cff1c4259d7 682 /**
Kojto 101:7cff1c4259d7 683 * @}
Kojto 101:7cff1c4259d7 684 */
Kojto 101:7cff1c4259d7 685 /* Private types -------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 686 /* Private variables ---------------------------------------------------------*/
Kojto 101:7cff1c4259d7 687 /* Private constants ---------------------------------------------------------*/
Kojto 101:7cff1c4259d7 688 /** @defgroup FLASHEx_Private_Constants FLASH Private Constants
Kojto 101:7cff1c4259d7 689 * @{
Kojto 101:7cff1c4259d7 690 */
Kojto 110:165afa46840b 691 /*--------------------------------- STM32F42xxx/STM32F43xxx/STM32F469xx/STM32F479xx---------------------*/
Kojto 110:165afa46840b 692 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 693 #define FLASH_SECTOR_TOTAL 24
Kojto 110:165afa46840b 694 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 695
Kojto 101:7cff1c4259d7 696 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/
Kojto 110:165afa46840b 697 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
Kojto 101:7cff1c4259d7 698 #define FLASH_SECTOR_TOTAL 12
Kojto 110:165afa46840b 699 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
Kojto 101:7cff1c4259d7 700
Kojto 101:7cff1c4259d7 701 /*--------------------------------------------- STM32F401xC -------------------------------------------*/
Kojto 101:7cff1c4259d7 702 #if defined(STM32F401xC)
Kojto 101:7cff1c4259d7 703 #define FLASH_SECTOR_TOTAL 6
Kojto 101:7cff1c4259d7 704 #endif /* STM32F401xC */
Kojto 101:7cff1c4259d7 705
Kojto 110:165afa46840b 706 /*--------------------------------------------- STM32F410xx -------------------------------------------*/
Kojto 110:165afa46840b 707 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
Kojto 110:165afa46840b 708 #define FLASH_SECTOR_TOTAL 5
Kojto 110:165afa46840b 709 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
Kojto 110:165afa46840b 710
Kojto 110:165afa46840b 711 /*--------------------------------- STM32F401xE/STM32F411xE/STM32F446xx -------------------*/
Kojto 101:7cff1c4259d7 712 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 713 #define FLASH_SECTOR_TOTAL 8
Kojto 101:7cff1c4259d7 714 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 715
Kojto 101:7cff1c4259d7 716 /**
Kojto 101:7cff1c4259d7 717 * @brief OPTCR1 register byte 2 (Bits[23:16]) base address
Kojto 101:7cff1c4259d7 718 */
Kojto 110:165afa46840b 719 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 720 #define OPTCR1_BYTE2_ADDRESS ((uint32_t)0x40023C1A)
Kojto 110:165afa46840b 721 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 722
Kojto 101:7cff1c4259d7 723 /**
Kojto 101:7cff1c4259d7 724 * @}
Kojto 101:7cff1c4259d7 725 */
Kojto 101:7cff1c4259d7 726
Kojto 101:7cff1c4259d7 727 /* Private macros ------------------------------------------------------------*/
Kojto 101:7cff1c4259d7 728 /** @defgroup FLASHEx_Private_Macros FLASH Private Macros
Kojto 101:7cff1c4259d7 729 * @{
Kojto 101:7cff1c4259d7 730 */
Kojto 101:7cff1c4259d7 731
Kojto 101:7cff1c4259d7 732 /** @defgroup FLASHEx_IS_FLASH_Definitions FLASH Private macros to check input parameters
Kojto 101:7cff1c4259d7 733 * @{
Kojto 101:7cff1c4259d7 734 */
Kojto 101:7cff1c4259d7 735
Kojto 101:7cff1c4259d7 736 #define IS_FLASH_TYPEERASE(VALUE)(((VALUE) == FLASH_TYPEERASE_SECTORS) || \
Kojto 101:7cff1c4259d7 737 ((VALUE) == FLASH_TYPEERASE_MASSERASE))
Kojto 101:7cff1c4259d7 738
Kojto 101:7cff1c4259d7 739 #define IS_VOLTAGERANGE(RANGE)(((RANGE) == FLASH_VOLTAGE_RANGE_1) || \
Kojto 101:7cff1c4259d7 740 ((RANGE) == FLASH_VOLTAGE_RANGE_2) || \
Kojto 101:7cff1c4259d7 741 ((RANGE) == FLASH_VOLTAGE_RANGE_3) || \
Kojto 101:7cff1c4259d7 742 ((RANGE) == FLASH_VOLTAGE_RANGE_4))
Kojto 101:7cff1c4259d7 743
Kojto 101:7cff1c4259d7 744 #define IS_WRPSTATE(VALUE)(((VALUE) == OB_WRPSTATE_DISABLE) || \
Kojto 101:7cff1c4259d7 745 ((VALUE) == OB_WRPSTATE_ENABLE))
Kojto 101:7cff1c4259d7 746
Kojto 101:7cff1c4259d7 747 #define IS_OPTIONBYTE(VALUE)(((VALUE) <= (OPTIONBYTE_WRP|OPTIONBYTE_RDP|OPTIONBYTE_USER|OPTIONBYTE_BOR)))
Kojto 101:7cff1c4259d7 748
Kojto 106:ba1f97679dad 749 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
Kojto 106:ba1f97679dad 750 ((LEVEL) == OB_RDP_LEVEL_1) ||\
Kojto 106:ba1f97679dad 751 ((LEVEL) == OB_RDP_LEVEL_2))
Kojto 101:7cff1c4259d7 752
Kojto 101:7cff1c4259d7 753 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
Kojto 101:7cff1c4259d7 754
Kojto 101:7cff1c4259d7 755 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
Kojto 101:7cff1c4259d7 756
Kojto 101:7cff1c4259d7 757 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
Kojto 101:7cff1c4259d7 758
Kojto 101:7cff1c4259d7 759 #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\
Kojto 101:7cff1c4259d7 760 ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF))
Kojto 101:7cff1c4259d7 761
Kojto 101:7cff1c4259d7 762 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 763 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 764 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
Kojto 110:165afa46840b 765 defined(STM32F479xx)
Kojto 101:7cff1c4259d7 766 #define IS_PCROPSTATE(VALUE)(((VALUE) == OB_PCROP_STATE_DISABLE) || \
Kojto 101:7cff1c4259d7 767 ((VALUE) == OB_PCROP_STATE_ENABLE))
Kojto 110:165afa46840b 768 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\
Kojto 110:165afa46840b 769 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 770
Kojto 110:165afa46840b 771 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 772 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 773 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP) || \
Kojto 101:7cff1c4259d7 774 ((VALUE) == OPTIONBYTE_BOOTCONFIG))
Kojto 110:165afa46840b 775 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 776
Kojto 110:165afa46840b 777 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 778 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 779 #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP))
Kojto 110:165afa46840b 780 #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 781
Kojto 110:165afa46840b 782 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
Kojto 110:165afa46840b 783 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 784 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
Kojto 101:7cff1c4259d7 785 ((LATENCY) == FLASH_LATENCY_1) || \
Kojto 101:7cff1c4259d7 786 ((LATENCY) == FLASH_LATENCY_2) || \
Kojto 101:7cff1c4259d7 787 ((LATENCY) == FLASH_LATENCY_3) || \
Kojto 101:7cff1c4259d7 788 ((LATENCY) == FLASH_LATENCY_4) || \
Kojto 101:7cff1c4259d7 789 ((LATENCY) == FLASH_LATENCY_5) || \
Kojto 101:7cff1c4259d7 790 ((LATENCY) == FLASH_LATENCY_6) || \
Kojto 101:7cff1c4259d7 791 ((LATENCY) == FLASH_LATENCY_7) || \
Kojto 101:7cff1c4259d7 792 ((LATENCY) == FLASH_LATENCY_8) || \
Kojto 101:7cff1c4259d7 793 ((LATENCY) == FLASH_LATENCY_9) || \
Kojto 101:7cff1c4259d7 794 ((LATENCY) == FLASH_LATENCY_10) || \
Kojto 101:7cff1c4259d7 795 ((LATENCY) == FLASH_LATENCY_11) || \
Kojto 101:7cff1c4259d7 796 ((LATENCY) == FLASH_LATENCY_12) || \
Kojto 101:7cff1c4259d7 797 ((LATENCY) == FLASH_LATENCY_13) || \
Kojto 101:7cff1c4259d7 798 ((LATENCY) == FLASH_LATENCY_14) || \
Kojto 101:7cff1c4259d7 799 ((LATENCY) == FLASH_LATENCY_15))
Kojto 110:165afa46840b 800 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 801
Kojto 110:165afa46840b 802 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
Kojto 110:165afa46840b 803 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 804 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 805 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
Kojto 101:7cff1c4259d7 806 ((LATENCY) == FLASH_LATENCY_1) || \
Kojto 101:7cff1c4259d7 807 ((LATENCY) == FLASH_LATENCY_2) || \
Kojto 101:7cff1c4259d7 808 ((LATENCY) == FLASH_LATENCY_3) || \
Kojto 101:7cff1c4259d7 809 ((LATENCY) == FLASH_LATENCY_4) || \
Kojto 101:7cff1c4259d7 810 ((LATENCY) == FLASH_LATENCY_5) || \
Kojto 101:7cff1c4259d7 811 ((LATENCY) == FLASH_LATENCY_6) || \
Kojto 101:7cff1c4259d7 812 ((LATENCY) == FLASH_LATENCY_7))
Kojto 110:165afa46840b 813 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 814
Kojto 110:165afa46840b 815 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 816 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \
Kojto 101:7cff1c4259d7 817 ((BANK) == FLASH_BANK_2) || \
Kojto 101:7cff1c4259d7 818 ((BANK) == FLASH_BANK_BOTH))
Kojto 110:165afa46840b 819 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 820
Kojto 101:7cff1c4259d7 821 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
Kojto 110:165afa46840b 822 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 823 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 824 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1))
Kojto 110:165afa46840b 825 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 826
Kojto 101:7cff1c4259d7 827
Kojto 110:165afa46840b 828 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 829 #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 101:7cff1c4259d7 830 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 101:7cff1c4259d7 831 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
Kojto 101:7cff1c4259d7 832 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
Kojto 101:7cff1c4259d7 833 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
Kojto 101:7cff1c4259d7 834 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\
Kojto 101:7cff1c4259d7 835 ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\
Kojto 101:7cff1c4259d7 836 ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15) ||\
Kojto 101:7cff1c4259d7 837 ((SECTOR) == FLASH_SECTOR_16) || ((SECTOR) == FLASH_SECTOR_17) ||\
Kojto 101:7cff1c4259d7 838 ((SECTOR) == FLASH_SECTOR_18) || ((SECTOR) == FLASH_SECTOR_19) ||\
Kojto 101:7cff1c4259d7 839 ((SECTOR) == FLASH_SECTOR_20) || ((SECTOR) == FLASH_SECTOR_21) ||\
Kojto 101:7cff1c4259d7 840 ((SECTOR) == FLASH_SECTOR_22) || ((SECTOR) == FLASH_SECTOR_23))
Kojto 110:165afa46840b 841 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 842
Kojto 110:165afa46840b 843 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
Kojto 101:7cff1c4259d7 844 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 101:7cff1c4259d7 845 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 101:7cff1c4259d7 846 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
Kojto 101:7cff1c4259d7 847 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
Kojto 101:7cff1c4259d7 848 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
Kojto 101:7cff1c4259d7 849 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11))
Kojto 110:165afa46840b 850 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
Kojto 101:7cff1c4259d7 851
Kojto 101:7cff1c4259d7 852 #if defined(STM32F401xC)
Kojto 101:7cff1c4259d7 853 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 101:7cff1c4259d7 854 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 101:7cff1c4259d7 855 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5))
Kojto 101:7cff1c4259d7 856 #endif /* STM32F401xC */
Kojto 101:7cff1c4259d7 857
Kojto 110:165afa46840b 858 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
Kojto 110:165afa46840b 859 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 110:165afa46840b 860 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 110:165afa46840b 861 ((SECTOR) == FLASH_SECTOR_4))
Kojto 110:165afa46840b 862 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
Kojto 110:165afa46840b 863
Kojto 101:7cff1c4259d7 864 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 101:7cff1c4259d7 865 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 101:7cff1c4259d7 866 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 101:7cff1c4259d7 867 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
Kojto 101:7cff1c4259d7 868 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7))
Kojto 101:7cff1c4259d7 869 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 870
Kojto 101:7cff1c4259d7 871 #define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_END))
Kojto 101:7cff1c4259d7 872 #define IS_FLASH_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL))
Kojto 101:7cff1c4259d7 873
Kojto 110:165afa46840b 874 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 875 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFF000000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 110:165afa46840b 876 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 877
Kojto 101:7cff1c4259d7 878 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
Kojto 101:7cff1c4259d7 879 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 101:7cff1c4259d7 880 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
Kojto 101:7cff1c4259d7 881
Kojto 101:7cff1c4259d7 882 #if defined(STM32F401xC)
Kojto 101:7cff1c4259d7 883 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 101:7cff1c4259d7 884 #endif /* STM32F401xC */
Kojto 101:7cff1c4259d7 885
Kojto 110:165afa46840b 886 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
Kojto 101:7cff1c4259d7 887 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 110:165afa46840b 888 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
Kojto 110:165afa46840b 889
Kojto 110:165afa46840b 890 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 110:165afa46840b 891 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 110:165afa46840b 892 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 893
Kojto 110:165afa46840b 894 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
Kojto 101:7cff1c4259d7 895 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 110:165afa46840b 896 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 897
Kojto 101:7cff1c4259d7 898 #if defined(STM32F401xC)
Kojto 101:7cff1c4259d7 899 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 101:7cff1c4259d7 900 #endif /* STM32F401xC */
Kojto 101:7cff1c4259d7 901
Kojto 110:165afa46840b 902 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
Kojto 101:7cff1c4259d7 903 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 110:165afa46840b 904 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
Kojto 101:7cff1c4259d7 905
Kojto 110:165afa46840b 906 #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx)
Kojto 110:165afa46840b 907 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 110:165afa46840b 908 #endif /* STM32F401xE || STM32F411xE || STM32F446xx */
Kojto 101:7cff1c4259d7 909
Kojto 101:7cff1c4259d7 910 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 911 defined(STM32F469xx) || defined(STM32F479xx)
Kojto 110:165afa46840b 912 #define IS_OB_BOOT(BOOT) (((BOOT) == OB_DUAL_BOOT_ENABLE) || ((BOOT) == OB_DUAL_BOOT_DISABLE))
Kojto 110:165afa46840b 913 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
Kojto 110:165afa46840b 914
Kojto 110:165afa46840b 915 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 110:165afa46840b 916 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\
Kojto 110:165afa46840b 917 defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\
Kojto 110:165afa46840b 918 defined(STM32F479xx)
Kojto 101:7cff1c4259d7 919 #define IS_OB_PCROP_SELECT(PCROP) (((PCROP) == OB_PCROP_SELECTED) || ((PCROP) == OB_PCROP_DESELECTED))
Kojto 110:165afa46840b 920 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\
Kojto 110:165afa46840b 921 STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
Kojto 101:7cff1c4259d7 922 /**
Kojto 101:7cff1c4259d7 923 * @}
Kojto 101:7cff1c4259d7 924 */
Kojto 101:7cff1c4259d7 925
Kojto 101:7cff1c4259d7 926 /**
Kojto 101:7cff1c4259d7 927 * @}
Kojto 101:7cff1c4259d7 928 */
Kojto 101:7cff1c4259d7 929
Kojto 101:7cff1c4259d7 930 /* Private functions ---------------------------------------------------------*/
Kojto 101:7cff1c4259d7 931 /** @defgroup FLASHEx_Private_Functions FLASH Private Functions
Kojto 101:7cff1c4259d7 932 * @{
Kojto 101:7cff1c4259d7 933 */
Kojto 101:7cff1c4259d7 934 void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange);
Kojto 101:7cff1c4259d7 935 /**
Kojto 101:7cff1c4259d7 936 * @}
Kojto 101:7cff1c4259d7 937 */
Kojto 101:7cff1c4259d7 938
Kojto 101:7cff1c4259d7 939 /**
Kojto 101:7cff1c4259d7 940 * @}
Kojto 101:7cff1c4259d7 941 */
Kojto 101:7cff1c4259d7 942
Kojto 101:7cff1c4259d7 943 /**
Kojto 101:7cff1c4259d7 944 * @}
Kojto 101:7cff1c4259d7 945 */
Kojto 101:7cff1c4259d7 946
Kojto 101:7cff1c4259d7 947 #ifdef __cplusplus
Kojto 101:7cff1c4259d7 948 }
Kojto 101:7cff1c4259d7 949 #endif
Kojto 101:7cff1c4259d7 950
Kojto 101:7cff1c4259d7 951 #endif /* __STM32F4xx_HAL_FLASH_EX_H */
Kojto 101:7cff1c4259d7 952
Kojto 101:7cff1c4259d7 953 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/