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 Sep 02 14:17:43 2015 +0100
Revision:
106:ba1f97679dad
Parent:
99:dbbf35b96557
Child:
110:165afa46840b
Release 106  of the mbed library

Changes:
- new platform - Nucleo F446RE
- STM32F4 Cube driver update v2.3.2
- ST cmsis driver v2.3.2
- nordic bugfix gcc linker start address
- lpc11u68 - bugfix for serial ports

Who changed what in which revision?

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