The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
Mikchel
Date:
Sun May 03 16:04:42 2015 +0000
Revision:
99:7f6c6de930c0
Parent:
92:4fc01daae5a5
12

Who changed what in which revision?

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