mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
110:165afa46840b
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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