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:
Tue Feb 03 15:31:20 2015 +0000
Revision:
93:e188a91d3eaa
Child:
99:dbbf35b96557
Release 93 of the mbed library

Main changes:

- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)

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 93:e188a91d3eaa 5 * @version V1.1.0
Kojto 93:e188a91d3eaa 6 * @date 19-June-2014
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 93:e188a91d3eaa 11 * <h2><center>&copy; COPYRIGHT(c) 2014 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 93:e188a91d3eaa 58
Kojto 93:e188a91d3eaa 59 /**
Kojto 93:e188a91d3eaa 60 * @brief FLASH Erase structure definition
Kojto 93:e188a91d3eaa 61 */
Kojto 93:e188a91d3eaa 62 typedef struct
Kojto 93:e188a91d3eaa 63 {
Kojto 93:e188a91d3eaa 64 uint32_t TypeErase; /*!< Mass erase or sector Erase.
Kojto 93:e188a91d3eaa 65 This parameter can be a value of @ref FLASHEx_Type_Erase */
Kojto 93:e188a91d3eaa 66
Kojto 93:e188a91d3eaa 67 uint32_t Banks; /*!< Select banks to erase when Mass erase is enabled.
Kojto 93:e188a91d3eaa 68 This parameter must be a value of @ref FLASHEx_Banks */
Kojto 93:e188a91d3eaa 69
Kojto 93:e188a91d3eaa 70 uint32_t Sector; /*!< Initial FLASH sector to erase when Mass erase is disabled
Kojto 93:e188a91d3eaa 71 This parameter must be a value of @ref FLASHEx_Sectors */
Kojto 93:e188a91d3eaa 72
Kojto 93:e188a91d3eaa 73 uint32_t NbSectors; /*!< Number of sectors to be erased.
Kojto 93:e188a91d3eaa 74 This parameter must be a value between 1 and (max number of sectors - value of Initial sector)*/
Kojto 93:e188a91d3eaa 75
Kojto 93:e188a91d3eaa 76 uint32_t VoltageRange;/*!< The device voltage range which defines the erase parallelism
Kojto 93:e188a91d3eaa 77 This parameter must be a value of @ref FLASHEx_Voltage_Range */
Kojto 93:e188a91d3eaa 78
Kojto 93:e188a91d3eaa 79 } FLASH_EraseInitTypeDef;
Kojto 93:e188a91d3eaa 80
Kojto 93:e188a91d3eaa 81 /**
Kojto 93:e188a91d3eaa 82 * @brief FLASH Option Bytes Program structure definition
Kojto 93:e188a91d3eaa 83 */
Kojto 93:e188a91d3eaa 84 typedef struct
Kojto 93:e188a91d3eaa 85 {
Kojto 93:e188a91d3eaa 86 uint32_t OptionType; /*!< Option byte to be configured.
Kojto 93:e188a91d3eaa 87 This parameter can be a value of @ref FLASHEx_Option_Type */
Kojto 93:e188a91d3eaa 88
Kojto 93:e188a91d3eaa 89 uint32_t WRPState; /*!< Write protection activation or deactivation.
Kojto 93:e188a91d3eaa 90 This parameter can be a value of @ref FLASHEx_WRP_State */
Kojto 93:e188a91d3eaa 91
Kojto 93:e188a91d3eaa 92 uint32_t WRPSector; /*!< Specifies the sector(s) to be write protected.
Kojto 93:e188a91d3eaa 93 The value of this parameter depend on device used within the same series */
Kojto 93:e188a91d3eaa 94
Kojto 93:e188a91d3eaa 95 uint32_t Banks; /*!< Select banks for WRP activation/deactivation of all sectors.
Kojto 93:e188a91d3eaa 96 This parameter must be a value of @ref FLASHEx_Banks */
Kojto 93:e188a91d3eaa 97
Kojto 93:e188a91d3eaa 98 uint32_t RDPLevel; /*!< Set the read protection level.
Kojto 93:e188a91d3eaa 99 This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */
Kojto 93:e188a91d3eaa 100
Kojto 93:e188a91d3eaa 101 uint32_t BORLevel; /*!< Set the BOR Level.
Kojto 93:e188a91d3eaa 102 This parameter can be a value of @ref FLASHEx_BOR_Reset_Level */
Kojto 93:e188a91d3eaa 103
Kojto 93:e188a91d3eaa 104 uint8_t USERConfig; /*!< Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */
Kojto 93:e188a91d3eaa 105
Kojto 93:e188a91d3eaa 106 } FLASH_OBProgramInitTypeDef;
Kojto 93:e188a91d3eaa 107
Kojto 93:e188a91d3eaa 108 /**
Kojto 93:e188a91d3eaa 109 * @brief FLASH Advanced Option Bytes Program structure definition
Kojto 93:e188a91d3eaa 110 */
Kojto 93:e188a91d3eaa 111 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
Kojto 93:e188a91d3eaa 112 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 113 typedef struct
Kojto 93:e188a91d3eaa 114 {
Kojto 93:e188a91d3eaa 115 uint32_t OptionType; /*!< Option byte to be configured for extension.
Kojto 93:e188a91d3eaa 116 This parameter can be a value of @ref FLASHEx_Advanced_Option_Type */
Kojto 93:e188a91d3eaa 117
Kojto 93:e188a91d3eaa 118 uint32_t PCROPState; /*!< PCROP activation or deactivation.
Kojto 93:e188a91d3eaa 119 This parameter can be a value of @ref FLASHEx_PCROP_State */
Kojto 93:e188a91d3eaa 120
Kojto 93:e188a91d3eaa 121 #if defined (STM32F401xC) || defined (STM32F401xE) || defined (STM32F411xE)
Kojto 93:e188a91d3eaa 122 uint16_t Sectors; /*!< specifies the sector(s) set for PCROP.
Kojto 93:e188a91d3eaa 123 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */
Kojto 93:e188a91d3eaa 124 #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 125
Kojto 93:e188a91d3eaa 126 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
Kojto 93:e188a91d3eaa 127 uint32_t Banks; /*!< Select banks for PCROP activation/deactivation of all sectors.
Kojto 93:e188a91d3eaa 128 This parameter must be a value of @ref FLASHEx_Banks */
Kojto 93:e188a91d3eaa 129
Kojto 93:e188a91d3eaa 130 uint16_t SectorsBank1; /*!< Specifies the sector(s) set for PCROP for Bank1.
Kojto 93:e188a91d3eaa 131 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */
Kojto 93:e188a91d3eaa 132
Kojto 93:e188a91d3eaa 133 uint16_t SectorsBank2; /*!< Specifies the sector(s) set for PCROP for Bank2.
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 uint8_t BootConfig; /*!< Specifies Option bytes for boot config.
Kojto 93:e188a91d3eaa 137 This parameter can be a value of @ref FLASHEx_Dual_Boot */
Kojto 93:e188a91d3eaa 138
Kojto 93:e188a91d3eaa 139 #endif /*STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
Kojto 93:e188a91d3eaa 140 } FLASH_AdvOBProgramInitTypeDef;
Kojto 93:e188a91d3eaa 141 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 142
Kojto 93:e188a91d3eaa 143 /* Exported constants --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 144
Kojto 93:e188a91d3eaa 145 /** @defgroup FLASHEx_Exported_Constants FLASH Exported Constants
Kojto 93:e188a91d3eaa 146 * @{
Kojto 93:e188a91d3eaa 147 */
Kojto 93:e188a91d3eaa 148
Kojto 93:e188a91d3eaa 149 /** @defgroup FLASHEx_Type_Erase FLASH Type Erase
Kojto 93:e188a91d3eaa 150 * @{
Kojto 93:e188a91d3eaa 151 */
Kojto 93:e188a91d3eaa 152 #define TYPEERASE_SECTORS ((uint32_t)0x00) /*!< Sectors erase only */
Kojto 93:e188a91d3eaa 153 #define TYPEERASE_MASSERASE ((uint32_t)0x01) /*!< Flash Mass erase activation */
Kojto 93:e188a91d3eaa 154
Kojto 93:e188a91d3eaa 155 #define IS_TYPEERASE(VALUE)(((VALUE) == TYPEERASE_SECTORS) || \
Kojto 93:e188a91d3eaa 156 ((VALUE) == TYPEERASE_MASSERASE))
Kojto 93:e188a91d3eaa 157
Kojto 93:e188a91d3eaa 158 /**
Kojto 93:e188a91d3eaa 159 * @}
Kojto 93:e188a91d3eaa 160 */
Kojto 93:e188a91d3eaa 161
Kojto 93:e188a91d3eaa 162 /** @defgroup FLASHEx_Voltage_Range FLASH Voltage Range
Kojto 93:e188a91d3eaa 163 * @{
Kojto 93:e188a91d3eaa 164 */
Kojto 93:e188a91d3eaa 165 #define VOLTAGE_RANGE_1 ((uint32_t)0x00) /*!< Device operating range: 1.8V to 2.1V */
Kojto 93:e188a91d3eaa 166 #define VOLTAGE_RANGE_2 ((uint32_t)0x01) /*!< Device operating range: 2.1V to 2.7V */
Kojto 93:e188a91d3eaa 167 #define VOLTAGE_RANGE_3 ((uint32_t)0x02) /*!< Device operating range: 2.7V to 3.6V */
Kojto 93:e188a91d3eaa 168 #define VOLTAGE_RANGE_4 ((uint32_t)0x03) /*!< Device operating range: 2.7V to 3.6V + External Vpp */
Kojto 93:e188a91d3eaa 169
Kojto 93:e188a91d3eaa 170 #define IS_VOLTAGERANGE(RANGE)(((RANGE) == VOLTAGE_RANGE_1) || \
Kojto 93:e188a91d3eaa 171 ((RANGE) == VOLTAGE_RANGE_2) || \
Kojto 93:e188a91d3eaa 172 ((RANGE) == VOLTAGE_RANGE_3) || \
Kojto 93:e188a91d3eaa 173 ((RANGE) == VOLTAGE_RANGE_4))
Kojto 93:e188a91d3eaa 174
Kojto 93:e188a91d3eaa 175 /**
Kojto 93:e188a91d3eaa 176 * @}
Kojto 93:e188a91d3eaa 177 */
Kojto 93:e188a91d3eaa 178
Kojto 93:e188a91d3eaa 179 /** @defgroup FLASHEx_WRP_State FLASH WRP State
Kojto 93:e188a91d3eaa 180 * @{
Kojto 93:e188a91d3eaa 181 */
Kojto 93:e188a91d3eaa 182 #define WRPSTATE_DISABLE ((uint32_t)0x00) /*!< Disable the write protection of the desired bank 1 sectors */
Kojto 93:e188a91d3eaa 183 #define WRPSTATE_ENABLE ((uint32_t)0x01) /*!< Enable the write protection of the desired bank 1 sectors */
Kojto 93:e188a91d3eaa 184
Kojto 93:e188a91d3eaa 185 #define IS_WRPSTATE(VALUE)(((VALUE) == WRPSTATE_DISABLE) || \
Kojto 93:e188a91d3eaa 186 ((VALUE) == WRPSTATE_ENABLE))
Kojto 93:e188a91d3eaa 187
Kojto 93:e188a91d3eaa 188 /**
Kojto 93:e188a91d3eaa 189 * @}
Kojto 93:e188a91d3eaa 190 */
Kojto 93:e188a91d3eaa 191
Kojto 93:e188a91d3eaa 192 /** @defgroup FLASHEx_Option_Type FLASH Option Type
Kojto 93:e188a91d3eaa 193 * @{
Kojto 93:e188a91d3eaa 194 */
Kojto 93:e188a91d3eaa 195 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!< WRP option byte configuration */
Kojto 93:e188a91d3eaa 196 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!< RDP option byte configuration */
Kojto 93:e188a91d3eaa 197 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!< USER option byte configuration */
Kojto 93:e188a91d3eaa 198 #define OPTIONBYTE_BOR ((uint32_t)0x08) /*!< BOR option byte configuration */
Kojto 93:e188a91d3eaa 199
Kojto 93:e188a91d3eaa 200 #define IS_OPTIONBYTE(VALUE)(((VALUE) < (OPTIONBYTE_WRP|OPTIONBYTE_RDP|OPTIONBYTE_USER|OPTIONBYTE_BOR)))
Kojto 93:e188a91d3eaa 201
Kojto 93:e188a91d3eaa 202 /**
Kojto 93:e188a91d3eaa 203 * @}
Kojto 93:e188a91d3eaa 204 */
Kojto 93:e188a91d3eaa 205
Kojto 93:e188a91d3eaa 206 /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASH Option Bytes Read Protection
Kojto 93:e188a91d3eaa 207 * @{
Kojto 93:e188a91d3eaa 208 */
Kojto 93:e188a91d3eaa 209 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
Kojto 93:e188a91d3eaa 210 #define OB_RDP_LEVEL_1 ((uint8_t)0x55)
Kojto 93:e188a91d3eaa 211 /*#define OB_RDP_LEVEL_2 ((uint8_t)0xCC)*/ /*!< Warning: When enabling read protection level 2
Kojto 93:e188a91d3eaa 212 it s no more possible to go back to level 1 or 0 */
Kojto 93:e188a91d3eaa 213 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
Kojto 93:e188a91d3eaa 214 ((LEVEL) == OB_RDP_LEVEL_1))/*||\
Kojto 93:e188a91d3eaa 215 ((LEVEL) == OB_RDP_LEVEL_2))*/
Kojto 93:e188a91d3eaa 216 /**
Kojto 93:e188a91d3eaa 217 * @}
Kojto 93:e188a91d3eaa 218 */
Kojto 93:e188a91d3eaa 219
Kojto 93:e188a91d3eaa 220 /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASH Option Bytes IWatchdog
Kojto 93:e188a91d3eaa 221 * @{
Kojto 93:e188a91d3eaa 222 */
Kojto 93:e188a91d3eaa 223 #define OB_IWDG_SW ((uint8_t)0x20) /*!< Software IWDG selected */
Kojto 93:e188a91d3eaa 224 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */
Kojto 93:e188a91d3eaa 225 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
Kojto 93:e188a91d3eaa 226 /**
Kojto 93:e188a91d3eaa 227 * @}
Kojto 93:e188a91d3eaa 228 */
Kojto 93:e188a91d3eaa 229
Kojto 93:e188a91d3eaa 230 /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASH Option Bytes nRST_STOP
Kojto 93:e188a91d3eaa 231 * @{
Kojto 93:e188a91d3eaa 232 */
Kojto 93:e188a91d3eaa 233 #define OB_STOP_NO_RST ((uint8_t)0x40) /*!< No reset generated when entering in STOP */
Kojto 93:e188a91d3eaa 234 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
Kojto 93:e188a91d3eaa 235 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
Kojto 93:e188a91d3eaa 236 /**
Kojto 93:e188a91d3eaa 237 * @}
Kojto 93:e188a91d3eaa 238 */
Kojto 93:e188a91d3eaa 239
Kojto 93:e188a91d3eaa 240
Kojto 93:e188a91d3eaa 241 /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASH Option Bytes nRST_STDBY
Kojto 93:e188a91d3eaa 242 * @{
Kojto 93:e188a91d3eaa 243 */
Kojto 93:e188a91d3eaa 244 #define OB_STDBY_NO_RST ((uint8_t)0x80) /*!< No reset generated when entering in STANDBY */
Kojto 93:e188a91d3eaa 245 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
Kojto 93:e188a91d3eaa 246 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
Kojto 93:e188a91d3eaa 247 /**
Kojto 93:e188a91d3eaa 248 * @}
Kojto 93:e188a91d3eaa 249 */
Kojto 93:e188a91d3eaa 250
Kojto 93:e188a91d3eaa 251 /** @defgroup FLASHEx_BOR_Reset_Level FLASH BOR Reset Level
Kojto 93:e188a91d3eaa 252 * @{
Kojto 93:e188a91d3eaa 253 */
Kojto 93:e188a91d3eaa 254 #define OB_BOR_LEVEL3 ((uint8_t)0x00) /*!< Supply voltage ranges from 2.70 to 3.60 V */
Kojto 93:e188a91d3eaa 255 #define OB_BOR_LEVEL2 ((uint8_t)0x04) /*!< Supply voltage ranges from 2.40 to 2.70 V */
Kojto 93:e188a91d3eaa 256 #define OB_BOR_LEVEL1 ((uint8_t)0x08) /*!< Supply voltage ranges from 2.10 to 2.40 V */
Kojto 93:e188a91d3eaa 257 #define OB_BOR_OFF ((uint8_t)0x0C) /*!< Supply voltage ranges from 1.62 to 2.10 V */
Kojto 93:e188a91d3eaa 258 #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\
Kojto 93:e188a91d3eaa 259 ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF))
Kojto 93:e188a91d3eaa 260 /**
Kojto 93:e188a91d3eaa 261 * @}
Kojto 93:e188a91d3eaa 262 */
Kojto 93:e188a91d3eaa 263
Kojto 93:e188a91d3eaa 264 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 93:e188a91d3eaa 265 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 266 /** @defgroup FLASHEx_PCROP_State FLASH PCROP State
Kojto 93:e188a91d3eaa 267 * @{
Kojto 93:e188a91d3eaa 268 */
Kojto 93:e188a91d3eaa 269 #define PCROPSTATE_DISABLE ((uint32_t)0x00) /*!< Disable PCROP */
Kojto 93:e188a91d3eaa 270 #define PCROPSTATE_ENABLE ((uint32_t)0x01) /*!< Enable PCROP */
Kojto 93:e188a91d3eaa 271
Kojto 93:e188a91d3eaa 272 #define IS_PCROPSTATE(VALUE)(((VALUE) == PCROPSTATE_DISABLE) || \
Kojto 93:e188a91d3eaa 273 ((VALUE) == PCROPSTATE_ENABLE))
Kojto 93:e188a91d3eaa 274
Kojto 93:e188a91d3eaa 275 /**
Kojto 93:e188a91d3eaa 276 * @}
Kojto 93:e188a91d3eaa 277 */
Kojto 93:e188a91d3eaa 278 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 279
Kojto 93:e188a91d3eaa 280 /** @defgroup FLASHEx_Advanced_Option_Type FLASH Advanced Option Type
Kojto 93:e188a91d3eaa 281 * @{
Kojto 93:e188a91d3eaa 282 */
Kojto 93:e188a91d3eaa 283 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
Kojto 93:e188a91d3eaa 284 #define OBEX_PCROP ((uint32_t)0x01) /*!< PCROP option byte configuration */
Kojto 93:e188a91d3eaa 285 #define OBEX_BOOTCONFIG ((uint32_t)0x02) /*!< BOOTConfig option byte configuration */
Kojto 93:e188a91d3eaa 286
Kojto 93:e188a91d3eaa 287 #define IS_OBEX(VALUE)(((VALUE) == OBEX_PCROP) || \
Kojto 93:e188a91d3eaa 288 ((VALUE) == OBEX_BOOTCONFIG))
Kojto 93:e188a91d3eaa 289
Kojto 93:e188a91d3eaa 290 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
Kojto 93:e188a91d3eaa 291
Kojto 93:e188a91d3eaa 292 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 293 #define OBEX_PCROP ((uint32_t)0x01) /*!<PCROP option byte configuration */
Kojto 93:e188a91d3eaa 294
Kojto 93:e188a91d3eaa 295 #define IS_OBEX(VALUE)(((VALUE) == OBEX_PCROP))
Kojto 93:e188a91d3eaa 296
Kojto 93:e188a91d3eaa 297 #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 298 /**
Kojto 93:e188a91d3eaa 299 * @}
Kojto 93:e188a91d3eaa 300 */
Kojto 93:e188a91d3eaa 301
Kojto 93:e188a91d3eaa 302 /** @defgroup FLASH_Latency FLASH Latency
Kojto 93:e188a91d3eaa 303 * @{
Kojto 93:e188a91d3eaa 304 */
Kojto 93:e188a91d3eaa 305 /*------------------------------------------- STM32F42xxx/STM32F43xxx------------------------------------------*/
Kojto 93:e188a91d3eaa 306 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 307 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */
Kojto 93:e188a91d3eaa 308 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */
Kojto 93:e188a91d3eaa 309 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */
Kojto 93:e188a91d3eaa 310 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */
Kojto 93:e188a91d3eaa 311 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */
Kojto 93:e188a91d3eaa 312 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */
Kojto 93:e188a91d3eaa 313 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */
Kojto 93:e188a91d3eaa 314 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */
Kojto 93:e188a91d3eaa 315 #define FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH Eight Latency cycles */
Kojto 93:e188a91d3eaa 316 #define FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH Nine Latency cycles */
Kojto 93:e188a91d3eaa 317 #define FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH Ten Latency cycles */
Kojto 93:e188a91d3eaa 318 #define FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH Eleven Latency cycles */
Kojto 93:e188a91d3eaa 319 #define FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH Twelve Latency cycles */
Kojto 93:e188a91d3eaa 320 #define FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH Thirteen Latency cycles */
Kojto 93:e188a91d3eaa 321 #define FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH Fourteen Latency cycles */
Kojto 93:e188a91d3eaa 322 #define FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH Fifteen Latency cycles */
Kojto 93:e188a91d3eaa 323
Kojto 93:e188a91d3eaa 324
Kojto 93:e188a91d3eaa 325 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
Kojto 93:e188a91d3eaa 326 ((LATENCY) == FLASH_LATENCY_1) || \
Kojto 93:e188a91d3eaa 327 ((LATENCY) == FLASH_LATENCY_2) || \
Kojto 93:e188a91d3eaa 328 ((LATENCY) == FLASH_LATENCY_3) || \
Kojto 93:e188a91d3eaa 329 ((LATENCY) == FLASH_LATENCY_4) || \
Kojto 93:e188a91d3eaa 330 ((LATENCY) == FLASH_LATENCY_5) || \
Kojto 93:e188a91d3eaa 331 ((LATENCY) == FLASH_LATENCY_6) || \
Kojto 93:e188a91d3eaa 332 ((LATENCY) == FLASH_LATENCY_7) || \
Kojto 93:e188a91d3eaa 333 ((LATENCY) == FLASH_LATENCY_8) || \
Kojto 93:e188a91d3eaa 334 ((LATENCY) == FLASH_LATENCY_9) || \
Kojto 93:e188a91d3eaa 335 ((LATENCY) == FLASH_LATENCY_10) || \
Kojto 93:e188a91d3eaa 336 ((LATENCY) == FLASH_LATENCY_11) || \
Kojto 93:e188a91d3eaa 337 ((LATENCY) == FLASH_LATENCY_12) || \
Kojto 93:e188a91d3eaa 338 ((LATENCY) == FLASH_LATENCY_13) || \
Kojto 93:e188a91d3eaa 339 ((LATENCY) == FLASH_LATENCY_14) || \
Kojto 93:e188a91d3eaa 340 ((LATENCY) == FLASH_LATENCY_15))
Kojto 93:e188a91d3eaa 341 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 342 /*--------------------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 343
Kojto 93:e188a91d3eaa 344 /*-------------------------- STM32F40xxx/STM32F41xxx/STM32F401xx/STM32F411xx -----------------------------------*/
Kojto 93:e188a91d3eaa 345 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
Kojto 93:e188a91d3eaa 346 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 347
Kojto 93:e188a91d3eaa 348 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */
Kojto 93:e188a91d3eaa 349 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */
Kojto 93:e188a91d3eaa 350 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */
Kojto 93:e188a91d3eaa 351 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */
Kojto 93:e188a91d3eaa 352 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */
Kojto 93:e188a91d3eaa 353 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */
Kojto 93:e188a91d3eaa 354 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */
Kojto 93:e188a91d3eaa 355 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */
Kojto 93:e188a91d3eaa 356
Kojto 93:e188a91d3eaa 357
Kojto 93:e188a91d3eaa 358 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
Kojto 93:e188a91d3eaa 359 ((LATENCY) == FLASH_LATENCY_1) || \
Kojto 93:e188a91d3eaa 360 ((LATENCY) == FLASH_LATENCY_2) || \
Kojto 93:e188a91d3eaa 361 ((LATENCY) == FLASH_LATENCY_3) || \
Kojto 93:e188a91d3eaa 362 ((LATENCY) == FLASH_LATENCY_4) || \
Kojto 93:e188a91d3eaa 363 ((LATENCY) == FLASH_LATENCY_5) || \
Kojto 93:e188a91d3eaa 364 ((LATENCY) == FLASH_LATENCY_6) || \
Kojto 93:e188a91d3eaa 365 ((LATENCY) == FLASH_LATENCY_7))
Kojto 93:e188a91d3eaa 366 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 367 /*--------------------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 368
Kojto 93:e188a91d3eaa 369 /**
Kojto 93:e188a91d3eaa 370 * @}
Kojto 93:e188a91d3eaa 371 */
Kojto 93:e188a91d3eaa 372
Kojto 93:e188a91d3eaa 373
Kojto 93:e188a91d3eaa 374 /** @defgroup FLASHEx_Banks FLASH Banks
Kojto 93:e188a91d3eaa 375 * @{
Kojto 93:e188a91d3eaa 376 */
Kojto 93:e188a91d3eaa 377 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 378 #define FLASH_BANK_1 ((uint32_t)1) /*!< Bank 1 */
Kojto 93:e188a91d3eaa 379 #define FLASH_BANK_2 ((uint32_t)2) /*!< Bank 2 */
Kojto 93:e188a91d3eaa 380 #define FLASH_BANK_BOTH ((uint32_t)FLASH_BANK_1 | FLASH_BANK_2) /*!< Bank1 and Bank2 */
Kojto 93:e188a91d3eaa 381
Kojto 93:e188a91d3eaa 382 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \
Kojto 93:e188a91d3eaa 383 ((BANK) == FLASH_BANK_2) || \
Kojto 93:e188a91d3eaa 384 ((BANK) == FLASH_BANK_BOTH))
Kojto 93:e188a91d3eaa 385 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 386
Kojto 93:e188a91d3eaa 387 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
Kojto 93:e188a91d3eaa 388 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 389 #define FLASH_BANK_1 ((uint32_t)1) /*!< Bank 1 */
Kojto 93:e188a91d3eaa 390
Kojto 93:e188a91d3eaa 391 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1))
Kojto 93:e188a91d3eaa 392 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 393 /**
Kojto 93:e188a91d3eaa 394 * @}
Kojto 93:e188a91d3eaa 395 */
Kojto 93:e188a91d3eaa 396
Kojto 93:e188a91d3eaa 397 /** @defgroup FLASHEx_MassErase_bit FLASH Mass Erase bit
Kojto 93:e188a91d3eaa 398 * @{
Kojto 93:e188a91d3eaa 399 */
Kojto 93:e188a91d3eaa 400 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 401 #define FLASH_MER_BIT (FLASH_CR_MER1 | FLASH_CR_MER2) /*!< 2 MER bits here to clear */
Kojto 93:e188a91d3eaa 402 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 403
Kojto 93:e188a91d3eaa 404 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
Kojto 93:e188a91d3eaa 405 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 406 #define FLASH_MER_BIT (FLASH_CR_MER) /*!< only 1 MER Bit */
Kojto 93:e188a91d3eaa 407 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 408 /**
Kojto 93:e188a91d3eaa 409 * @}
Kojto 93:e188a91d3eaa 410 */
Kojto 93:e188a91d3eaa 411
Kojto 93:e188a91d3eaa 412 /** @defgroup FLASHEx_Sectors FLASH Sectors
Kojto 93:e188a91d3eaa 413 * @{
Kojto 93:e188a91d3eaa 414 */
Kojto 93:e188a91d3eaa 415 /*------------------------------------------ STM32F42xxx/STM32F43xxx--------------------------------------*/
Kojto 93:e188a91d3eaa 416 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 417 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 93:e188a91d3eaa 418 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 93:e188a91d3eaa 419 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 93:e188a91d3eaa 420 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 93:e188a91d3eaa 421 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 93:e188a91d3eaa 422 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 93:e188a91d3eaa 423 #define FLASH_SECTOR_6 ((uint32_t)6) /*!< Sector Number 6 */
Kojto 93:e188a91d3eaa 424 #define FLASH_SECTOR_7 ((uint32_t)7) /*!< Sector Number 7 */
Kojto 93:e188a91d3eaa 425 #define FLASH_SECTOR_8 ((uint32_t)8) /*!< Sector Number 8 */
Kojto 93:e188a91d3eaa 426 #define FLASH_SECTOR_9 ((uint32_t)9) /*!< Sector Number 9 */
Kojto 93:e188a91d3eaa 427 #define FLASH_SECTOR_10 ((uint32_t)10) /*!< Sector Number 10 */
Kojto 93:e188a91d3eaa 428 #define FLASH_SECTOR_11 ((uint32_t)11) /*!< Sector Number 11 */
Kojto 93:e188a91d3eaa 429 #define FLASH_SECTOR_12 ((uint32_t)12) /*!< Sector Number 12 */
Kojto 93:e188a91d3eaa 430 #define FLASH_SECTOR_13 ((uint32_t)13) /*!< Sector Number 13 */
Kojto 93:e188a91d3eaa 431 #define FLASH_SECTOR_14 ((uint32_t)14) /*!< Sector Number 14 */
Kojto 93:e188a91d3eaa 432 #define FLASH_SECTOR_15 ((uint32_t)15) /*!< Sector Number 15 */
Kojto 93:e188a91d3eaa 433 #define FLASH_SECTOR_16 ((uint32_t)16) /*!< Sector Number 16 */
Kojto 93:e188a91d3eaa 434 #define FLASH_SECTOR_17 ((uint32_t)17) /*!< Sector Number 17 */
Kojto 93:e188a91d3eaa 435 #define FLASH_SECTOR_18 ((uint32_t)18) /*!< Sector Number 18 */
Kojto 93:e188a91d3eaa 436 #define FLASH_SECTOR_19 ((uint32_t)19) /*!< Sector Number 19 */
Kojto 93:e188a91d3eaa 437 #define FLASH_SECTOR_20 ((uint32_t)20) /*!< Sector Number 20 */
Kojto 93:e188a91d3eaa 438 #define FLASH_SECTOR_21 ((uint32_t)21) /*!< Sector Number 21 */
Kojto 93:e188a91d3eaa 439 #define FLASH_SECTOR_22 ((uint32_t)22) /*!< Sector Number 22 */
Kojto 93:e188a91d3eaa 440 #define FLASH_SECTOR_23 ((uint32_t)23) /*!< Sector Number 23 */
Kojto 93:e188a91d3eaa 441
Kojto 93:e188a91d3eaa 442 #define FLASH_SECTOR_TOTAL 24
Kojto 93:e188a91d3eaa 443
Kojto 93:e188a91d3eaa 444 #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 93:e188a91d3eaa 445 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 93:e188a91d3eaa 446 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
Kojto 93:e188a91d3eaa 447 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
Kojto 93:e188a91d3eaa 448 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
Kojto 93:e188a91d3eaa 449 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\
Kojto 93:e188a91d3eaa 450 ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\
Kojto 93:e188a91d3eaa 451 ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15) ||\
Kojto 93:e188a91d3eaa 452 ((SECTOR) == FLASH_SECTOR_16) || ((SECTOR) == FLASH_SECTOR_17) ||\
Kojto 93:e188a91d3eaa 453 ((SECTOR) == FLASH_SECTOR_18) || ((SECTOR) == FLASH_SECTOR_19) ||\
Kojto 93:e188a91d3eaa 454 ((SECTOR) == FLASH_SECTOR_20) || ((SECTOR) == FLASH_SECTOR_21) ||\
Kojto 93:e188a91d3eaa 455 ((SECTOR) == FLASH_SECTOR_22) || ((SECTOR) == FLASH_SECTOR_23))
Kojto 93:e188a91d3eaa 456 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 457 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 458
Kojto 93:e188a91d3eaa 459 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/
Kojto 93:e188a91d3eaa 460 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
Kojto 93:e188a91d3eaa 461 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 93:e188a91d3eaa 462 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 93:e188a91d3eaa 463 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 93:e188a91d3eaa 464 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 93:e188a91d3eaa 465 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 93:e188a91d3eaa 466 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 93:e188a91d3eaa 467 #define FLASH_SECTOR_6 ((uint32_t)6) /*!< Sector Number 6 */
Kojto 93:e188a91d3eaa 468 #define FLASH_SECTOR_7 ((uint32_t)7) /*!< Sector Number 7 */
Kojto 93:e188a91d3eaa 469 #define FLASH_SECTOR_8 ((uint32_t)8) /*!< Sector Number 8 */
Kojto 93:e188a91d3eaa 470 #define FLASH_SECTOR_9 ((uint32_t)9) /*!< Sector Number 9 */
Kojto 93:e188a91d3eaa 471 #define FLASH_SECTOR_10 ((uint32_t)10) /*!< Sector Number 10 */
Kojto 93:e188a91d3eaa 472 #define FLASH_SECTOR_11 ((uint32_t)11) /*!< Sector Number 11 */
Kojto 93:e188a91d3eaa 473
Kojto 93:e188a91d3eaa 474 #define FLASH_SECTOR_TOTAL 12
Kojto 93:e188a91d3eaa 475
Kojto 93:e188a91d3eaa 476 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 93:e188a91d3eaa 477 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 93:e188a91d3eaa 478 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
Kojto 93:e188a91d3eaa 479 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
Kojto 93:e188a91d3eaa 480 ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
Kojto 93:e188a91d3eaa 481 ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11))
Kojto 93:e188a91d3eaa 482 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
Kojto 93:e188a91d3eaa 483 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 484
Kojto 93:e188a91d3eaa 485 /*--------------------------------------------- STM32F401xC -------------------------------------------*/
Kojto 93:e188a91d3eaa 486 #if defined(STM32F401xC)
Kojto 93:e188a91d3eaa 487 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 93:e188a91d3eaa 488 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 93:e188a91d3eaa 489 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 93:e188a91d3eaa 490 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 93:e188a91d3eaa 491 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 93:e188a91d3eaa 492 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 93:e188a91d3eaa 493
Kojto 93:e188a91d3eaa 494 #define FLASH_SECTOR_TOTAL 6
Kojto 93:e188a91d3eaa 495
Kojto 93:e188a91d3eaa 496 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 93:e188a91d3eaa 497 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 93:e188a91d3eaa 498 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5))
Kojto 93:e188a91d3eaa 499 #endif /* STM32F401xC */
Kojto 93:e188a91d3eaa 500 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 501
Kojto 93:e188a91d3eaa 502 /*--------------------------------------- STM32F401xE/STM32F411xE -------------------------------------*/
Kojto 93:e188a91d3eaa 503 #if defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 504 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 93:e188a91d3eaa 505 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 93:e188a91d3eaa 506 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 93:e188a91d3eaa 507 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 93:e188a91d3eaa 508 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 93:e188a91d3eaa 509 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 93:e188a91d3eaa 510 #define FLASH_SECTOR_6 ((uint32_t)6) /*!< Sector Number 6 */
Kojto 93:e188a91d3eaa 511 #define FLASH_SECTOR_7 ((uint32_t)7) /*!< Sector Number 7 */
Kojto 93:e188a91d3eaa 512
Kojto 93:e188a91d3eaa 513 #define FLASH_SECTOR_TOTAL 8
Kojto 93:e188a91d3eaa 514
Kojto 93:e188a91d3eaa 515 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 93:e188a91d3eaa 516 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 93:e188a91d3eaa 517 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
Kojto 93:e188a91d3eaa 518 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7))
Kojto 93:e188a91d3eaa 519 #endif /* STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 520 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 521 #define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) < FLASH_END))
Kojto 93:e188a91d3eaa 522 #define IS_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL))
Kojto 93:e188a91d3eaa 523
Kojto 93:e188a91d3eaa 524 /**
Kojto 93:e188a91d3eaa 525 * @}
Kojto 93:e188a91d3eaa 526 */
Kojto 93:e188a91d3eaa 527
Kojto 93:e188a91d3eaa 528 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection
Kojto 93:e188a91d3eaa 529 * @{
Kojto 93:e188a91d3eaa 530 */
Kojto 93:e188a91d3eaa 531 /*----------------------------------------- STM32F42xxx/STM32F43xxx-------------------------------------*/
Kojto 93:e188a91d3eaa 532 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 533 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 93:e188a91d3eaa 534 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 93:e188a91d3eaa 535 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 93:e188a91d3eaa 536 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 93:e188a91d3eaa 537 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 93:e188a91d3eaa 538 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 93:e188a91d3eaa 539 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040) /*!< Write protection of Sector6 */
Kojto 93:e188a91d3eaa 540 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080) /*!< Write protection of Sector7 */
Kojto 93:e188a91d3eaa 541 #define OB_WRP_SECTOR_8 ((uint32_t)0x00000100) /*!< Write protection of Sector8 */
Kojto 93:e188a91d3eaa 542 #define OB_WRP_SECTOR_9 ((uint32_t)0x00000200) /*!< Write protection of Sector9 */
Kojto 93:e188a91d3eaa 543 #define OB_WRP_SECTOR_10 ((uint32_t)0x00000400) /*!< Write protection of Sector10 */
Kojto 93:e188a91d3eaa 544 #define OB_WRP_SECTOR_11 ((uint32_t)0x00000800) /*!< Write protection of Sector11 */
Kojto 93:e188a91d3eaa 545 #define OB_WRP_SECTOR_12 ((uint32_t)0x00000001 << 12) /*!< Write protection of Sector12 */
Kojto 93:e188a91d3eaa 546 #define OB_WRP_SECTOR_13 ((uint32_t)0x00000002 << 12) /*!< Write protection of Sector13 */
Kojto 93:e188a91d3eaa 547 #define OB_WRP_SECTOR_14 ((uint32_t)0x00000004 << 12) /*!< Write protection of Sector14 */
Kojto 93:e188a91d3eaa 548 #define OB_WRP_SECTOR_15 ((uint32_t)0x00000008 << 12) /*!< Write protection of Sector15 */
Kojto 93:e188a91d3eaa 549 #define OB_WRP_SECTOR_16 ((uint32_t)0x00000010 << 12) /*!< Write protection of Sector16 */
Kojto 93:e188a91d3eaa 550 #define OB_WRP_SECTOR_17 ((uint32_t)0x00000020 << 12) /*!< Write protection of Sector17 */
Kojto 93:e188a91d3eaa 551 #define OB_WRP_SECTOR_18 ((uint32_t)0x00000040 << 12) /*!< Write protection of Sector18 */
Kojto 93:e188a91d3eaa 552 #define OB_WRP_SECTOR_19 ((uint32_t)0x00000080 << 12) /*!< Write protection of Sector19 */
Kojto 93:e188a91d3eaa 553 #define OB_WRP_SECTOR_20 ((uint32_t)0x00000100 << 12) /*!< Write protection of Sector20 */
Kojto 93:e188a91d3eaa 554 #define OB_WRP_SECTOR_21 ((uint32_t)0x00000200 << 12) /*!< Write protection of Sector21 */
Kojto 93:e188a91d3eaa 555 #define OB_WRP_SECTOR_22 ((uint32_t)0x00000400 << 12) /*!< Write protection of Sector22 */
Kojto 93:e188a91d3eaa 556 #define OB_WRP_SECTOR_23 ((uint32_t)0x00000800 << 12) /*!< Write protection of Sector23 */
Kojto 93:e188a91d3eaa 557 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF << 12) /*!< Write protection of all Sectors */
Kojto 93:e188a91d3eaa 558
Kojto 93:e188a91d3eaa 559 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFF000000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 93:e188a91d3eaa 560 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 561 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 562
Kojto 93:e188a91d3eaa 563 /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/
Kojto 93:e188a91d3eaa 564 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
Kojto 93:e188a91d3eaa 565 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 93:e188a91d3eaa 566 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 93:e188a91d3eaa 567 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 93:e188a91d3eaa 568 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 93:e188a91d3eaa 569 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 93:e188a91d3eaa 570 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 93:e188a91d3eaa 571 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040) /*!< Write protection of Sector6 */
Kojto 93:e188a91d3eaa 572 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080) /*!< Write protection of Sector7 */
Kojto 93:e188a91d3eaa 573 #define OB_WRP_SECTOR_8 ((uint32_t)0x00000100) /*!< Write protection of Sector8 */
Kojto 93:e188a91d3eaa 574 #define OB_WRP_SECTOR_9 ((uint32_t)0x00000200) /*!< Write protection of Sector9 */
Kojto 93:e188a91d3eaa 575 #define OB_WRP_SECTOR_10 ((uint32_t)0x00000400) /*!< Write protection of Sector10 */
Kojto 93:e188a91d3eaa 576 #define OB_WRP_SECTOR_11 ((uint32_t)0x00000800) /*!< Write protection of Sector11 */
Kojto 93:e188a91d3eaa 577 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF) /*!< Write protection of all Sectors */
Kojto 93:e188a91d3eaa 578
Kojto 93:e188a91d3eaa 579 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 93:e188a91d3eaa 580 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
Kojto 93:e188a91d3eaa 581 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 582
Kojto 93:e188a91d3eaa 583 /*--------------------------------------------- STM32F401xC -------------------------------------------*/
Kojto 93:e188a91d3eaa 584 #if defined(STM32F401xC)
Kojto 93:e188a91d3eaa 585 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 93:e188a91d3eaa 586 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 93:e188a91d3eaa 587 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 93:e188a91d3eaa 588 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 93:e188a91d3eaa 589 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 93:e188a91d3eaa 590 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 93:e188a91d3eaa 591 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF) /*!< Write protection of all Sectors */
Kojto 93:e188a91d3eaa 592
Kojto 93:e188a91d3eaa 593 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 93:e188a91d3eaa 594 #endif /* STM32F401xC */
Kojto 93:e188a91d3eaa 595 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 596
Kojto 93:e188a91d3eaa 597 /*--------------------------------------- STM32F401xE/STM32F411xE -------------------------------------*/
Kojto 93:e188a91d3eaa 598 #if defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 599 #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001) /*!< Write protection of Sector0 */
Kojto 93:e188a91d3eaa 600 #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002) /*!< Write protection of Sector1 */
Kojto 93:e188a91d3eaa 601 #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004) /*!< Write protection of Sector2 */
Kojto 93:e188a91d3eaa 602 #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008) /*!< Write protection of Sector3 */
Kojto 93:e188a91d3eaa 603 #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010) /*!< Write protection of Sector4 */
Kojto 93:e188a91d3eaa 604 #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020) /*!< Write protection of Sector5 */
Kojto 93:e188a91d3eaa 605 #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040) /*!< Write protection of Sector6 */
Kojto 93:e188a91d3eaa 606 #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080) /*!< Write protection of Sector7 */
Kojto 93:e188a91d3eaa 607 #define OB_WRP_SECTOR_All ((uint32_t)0x00000FFF) /*!< Write protection of all Sectors */
Kojto 93:e188a91d3eaa 608
Kojto 93:e188a91d3eaa 609 #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 93:e188a91d3eaa 610 #endif /* STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 611 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 612 /**
Kojto 93:e188a91d3eaa 613 * @}
Kojto 93:e188a91d3eaa 614 */
Kojto 93:e188a91d3eaa 615
Kojto 93:e188a91d3eaa 616 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASH Option Bytes PC ReadWrite Protection
Kojto 93:e188a91d3eaa 617 * @{
Kojto 93:e188a91d3eaa 618 */
Kojto 93:e188a91d3eaa 619 /*----------------------------------------- STM32F42xxx/STM32F43xxx-------------------------------------*/
Kojto 93:e188a91d3eaa 620 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 621 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector0 */
Kojto 93:e188a91d3eaa 622 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector1 */
Kojto 93:e188a91d3eaa 623 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector2 */
Kojto 93:e188a91d3eaa 624 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector3 */
Kojto 93:e188a91d3eaa 625 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector4 */
Kojto 93:e188a91d3eaa 626 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector5 */
Kojto 93:e188a91d3eaa 627 #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040) /*!< PC Read/Write protection of Sector6 */
Kojto 93:e188a91d3eaa 628 #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080) /*!< PC Read/Write protection of Sector7 */
Kojto 93:e188a91d3eaa 629 #define OB_PCROP_SECTOR_8 ((uint32_t)0x00000100) /*!< PC Read/Write protection of Sector8 */
Kojto 93:e188a91d3eaa 630 #define OB_PCROP_SECTOR_9 ((uint32_t)0x00000200) /*!< PC Read/Write protection of Sector9 */
Kojto 93:e188a91d3eaa 631 #define OB_PCROP_SECTOR_10 ((uint32_t)0x00000400) /*!< PC Read/Write protection of Sector10 */
Kojto 93:e188a91d3eaa 632 #define OB_PCROP_SECTOR_11 ((uint32_t)0x00000800) /*!< PC Read/Write protection of Sector11 */
Kojto 93:e188a91d3eaa 633 #define OB_PCROP_SECTOR_12 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector12 */
Kojto 93:e188a91d3eaa 634 #define OB_PCROP_SECTOR_13 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector13 */
Kojto 93:e188a91d3eaa 635 #define OB_PCROP_SECTOR_14 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector14 */
Kojto 93:e188a91d3eaa 636 #define OB_PCROP_SECTOR_15 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector15 */
Kojto 93:e188a91d3eaa 637 #define OB_PCROP_SECTOR_16 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector16 */
Kojto 93:e188a91d3eaa 638 #define OB_PCROP_SECTOR_17 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector17 */
Kojto 93:e188a91d3eaa 639 #define OB_PCROP_SECTOR_18 ((uint32_t)0x00000040) /*!< PC Read/Write protection of Sector18 */
Kojto 93:e188a91d3eaa 640 #define OB_PCROP_SECTOR_19 ((uint32_t)0x00000080) /*!< PC Read/Write protection of Sector19 */
Kojto 93:e188a91d3eaa 641 #define OB_PCROP_SECTOR_20 ((uint32_t)0x00000100) /*!< PC Read/Write protection of Sector20 */
Kojto 93:e188a91d3eaa 642 #define OB_PCROP_SECTOR_21 ((uint32_t)0x00000200) /*!< PC Read/Write protection of Sector21 */
Kojto 93:e188a91d3eaa 643 #define OB_PCROP_SECTOR_22 ((uint32_t)0x00000400) /*!< PC Read/Write protection of Sector22 */
Kojto 93:e188a91d3eaa 644 #define OB_PCROP_SECTOR_23 ((uint32_t)0x00000800) /*!< PC Read/Write protection of Sector23 */
Kojto 93:e188a91d3eaa 645 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFF) /*!< PC Read/Write protection of all Sectors */
Kojto 93:e188a91d3eaa 646
Kojto 93:e188a91d3eaa 647 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 93:e188a91d3eaa 648 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 649 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 650
Kojto 93:e188a91d3eaa 651 /*--------------------------------------------- STM32F401xC -------------------------------------------*/
Kojto 93:e188a91d3eaa 652 #if defined(STM32F401xC)
Kojto 93:e188a91d3eaa 653 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector0 */
Kojto 93:e188a91d3eaa 654 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector1 */
Kojto 93:e188a91d3eaa 655 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector2 */
Kojto 93:e188a91d3eaa 656 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector3 */
Kojto 93:e188a91d3eaa 657 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector4 */
Kojto 93:e188a91d3eaa 658 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector5 */
Kojto 93:e188a91d3eaa 659 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFF) /*!< PC Read/Write protection of all Sectors */
Kojto 93:e188a91d3eaa 660
Kojto 93:e188a91d3eaa 661 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 93:e188a91d3eaa 662 #endif /* STM32F401xC */
Kojto 93:e188a91d3eaa 663 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 664
Kojto 93:e188a91d3eaa 665 /*--------------------------------------- STM32F401xE/STM32F411xE -------------------------------------*/
Kojto 93:e188a91d3eaa 666 #if defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 667 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001) /*!< PC Read/Write protection of Sector0 */
Kojto 93:e188a91d3eaa 668 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002) /*!< PC Read/Write protection of Sector1 */
Kojto 93:e188a91d3eaa 669 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004) /*!< PC Read/Write protection of Sector2 */
Kojto 93:e188a91d3eaa 670 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008) /*!< PC Read/Write protection of Sector3 */
Kojto 93:e188a91d3eaa 671 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010) /*!< PC Read/Write protection of Sector4 */
Kojto 93:e188a91d3eaa 672 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020) /*!< PC Read/Write protection of Sector5 */
Kojto 93:e188a91d3eaa 673 #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040) /*!< PC Read/Write protection of Sector6 */
Kojto 93:e188a91d3eaa 674 #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080) /*!< PC Read/Write protection of Sector7 */
Kojto 93:e188a91d3eaa 675 #define OB_PCROP_SECTOR_All ((uint32_t)0x00000FFF) /*!< PC Read/Write protection of all Sectors */
Kojto 93:e188a91d3eaa 676
Kojto 93:e188a91d3eaa 677 #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 93:e188a91d3eaa 678 #endif /* STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 679 /*-----------------------------------------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 680
Kojto 93:e188a91d3eaa 681 /**
Kojto 93:e188a91d3eaa 682 * @}
Kojto 93:e188a91d3eaa 683 */
Kojto 93:e188a91d3eaa 684
Kojto 93:e188a91d3eaa 685 /** @defgroup FLASHEx_Dual_Boot FLASH Dual Boot
Kojto 93:e188a91d3eaa 686 * @{
Kojto 93:e188a91d3eaa 687 */
Kojto 93:e188a91d3eaa 688 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 689 #define OB_DUAL_BOOT_ENABLE ((uint8_t)0x10) /*!< Dual Bank Boot Enable */
Kojto 93:e188a91d3eaa 690 #define OB_DUAL_BOOT_DISABLE ((uint8_t)0x00) /*!< Dual Bank Boot Disable, always boot on User Flash */
Kojto 93:e188a91d3eaa 691 #define IS_OB_BOOT(BOOT) (((BOOT) == OB_DUAL_BOOT_ENABLE) || ((BOOT) == OB_DUAL_BOOT_DISABLE))
Kojto 93:e188a91d3eaa 692 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 693 /**
Kojto 93:e188a91d3eaa 694 * @}
Kojto 93:e188a91d3eaa 695 */
Kojto 93:e188a91d3eaa 696
Kojto 93:e188a91d3eaa 697 /** @defgroup FLASHEx_Selection_Protection_Mode FLASH Selection Protection Mode
Kojto 93:e188a91d3eaa 698 * @{
Kojto 93:e188a91d3eaa 699 */
Kojto 93:e188a91d3eaa 700 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 93:e188a91d3eaa 701 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 702 #define OB_PCROP_DESELECTED ((uint8_t)0x00) /*!< Disabled PcROP, nWPRi bits used for Write Protection on sector i */
Kojto 93:e188a91d3eaa 703 #define OB_PCROP_SELECTED ((uint8_t)0x80) /*!< Enable PcROP, nWPRi bits used for PCRoP Protection on sector i */
Kojto 93:e188a91d3eaa 704 #define IS_OB_PCROP_SELECT(PCROP) (((PCROP) == OB_PCROP_SELECTED) || ((PCROP) == OB_PCROP_DESELECTED))
Kojto 93:e188a91d3eaa 705 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 706 /**
Kojto 93:e188a91d3eaa 707 * @}
Kojto 93:e188a91d3eaa 708 */
Kojto 93:e188a91d3eaa 709
Kojto 93:e188a91d3eaa 710 /**
Kojto 93:e188a91d3eaa 711 * @brief OPTCR1 register byte 2 (Bits[23:16]) base address
Kojto 93:e188a91d3eaa 712 */
Kojto 93:e188a91d3eaa 713 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 714 #define OPTCR1_BYTE2_ADDRESS ((uint32_t)0x40023C1A)
Kojto 93:e188a91d3eaa 715 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 716
Kojto 93:e188a91d3eaa 717 /**
Kojto 93:e188a91d3eaa 718 * @}
Kojto 93:e188a91d3eaa 719 */
Kojto 93:e188a91d3eaa 720
Kojto 93:e188a91d3eaa 721 /* Exported macro ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 722
Kojto 93:e188a91d3eaa 723 /* Exported functions --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 724
Kojto 93:e188a91d3eaa 725 /* Extension Program operation functions *************************************/
Kojto 93:e188a91d3eaa 726 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError);
Kojto 93:e188a91d3eaa 727 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
Kojto 93:e188a91d3eaa 728 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 93:e188a91d3eaa 729 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 93:e188a91d3eaa 730
Kojto 93:e188a91d3eaa 731 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
Kojto 93:e188a91d3eaa 732 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
Kojto 93:e188a91d3eaa 733 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
Kojto 93:e188a91d3eaa 734 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
Kojto 93:e188a91d3eaa 735 HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void);
Kojto 93:e188a91d3eaa 736 HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void);
Kojto 93:e188a91d3eaa 737 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F411xE */
Kojto 93:e188a91d3eaa 738
Kojto 93:e188a91d3eaa 739 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
Kojto 93:e188a91d3eaa 740 uint16_t HAL_FLASHEx_OB_GetBank2WRP(void);
Kojto 93:e188a91d3eaa 741 #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx */
Kojto 93:e188a91d3eaa 742
Kojto 93:e188a91d3eaa 743 void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange);
Kojto 93:e188a91d3eaa 744
Kojto 93:e188a91d3eaa 745 /**
Kojto 93:e188a91d3eaa 746 * @}
Kojto 93:e188a91d3eaa 747 */
Kojto 93:e188a91d3eaa 748
Kojto 93:e188a91d3eaa 749 /**
Kojto 93:e188a91d3eaa 750 * @}
Kojto 93:e188a91d3eaa 751 */
Kojto 93:e188a91d3eaa 752
Kojto 93:e188a91d3eaa 753 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 754 }
Kojto 93:e188a91d3eaa 755 #endif
Kojto 93:e188a91d3eaa 756
Kojto 93:e188a91d3eaa 757 #endif /* __STM32F4xx_HAL_FLASH_EX_H */
Kojto 93:e188a91d3eaa 758
Kojto 93:e188a91d3eaa 759 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/