cc y / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Fri Oct 02 07:35:07 2015 +0200
Revision:
108:34e6b704fe68
Child:
110:165afa46840b
Release 108  of the mbed library

Changes:
- new platforms - ELMO_F411RE, WIZNET_7500P, ARM_MPS2_BEID
- EFM32 - bugfixes in rtc, serial
- Cortex A cmsis - update files
- STML4 - RAM fixes

Who changed what in which revision?

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