/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
fblanc
Date:
Fri Dec 05 15:42:32 2014 +0000
Revision:
93:9dd889aeda0e
Parent:
86:04dd9b1680ae
substitute line 894 extern } by }; /TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h

Who changed what in which revision?

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