Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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