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

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Nov 25 13:21:40 2015 +0000
Revision:
110:165afa46840b
Parent:
106:ba1f97679dad
Release 110  of the mbed library

Changes:
- new platforms - STM32F410R, DISCO_F429ZI, DISCO_F469NI
- Nucleo L476 - gcc and uvision template
- k22,k64f targets - ADC channels A addition
- EFM32 - bugfixes in sleep, serial and spi
- Delta DFCM NNN40 - pinnames update

Who changed what in which revision?

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