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:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
108:34e6b704fe68
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx_hal_flash_ex.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
Kojto 108:34e6b704fe68 5 * @version V1.3.0
Kojto 108:34e6b704fe68 6 * @date 26-June-2015
Kojto 108:34e6b704fe68 7 * @brief Header file of Flash HAL Extended module.
bogdanm 85:024bf7f99721 8 ******************************************************************************
bogdanm 85:024bf7f99721 9 * @attention
bogdanm 85:024bf7f99721 10 *
Kojto 108:34e6b704fe68 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 12 *
bogdanm 85:024bf7f99721 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 14 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 16 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 19 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 21 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 22 * without specific prior written permission.
bogdanm 85:024bf7f99721 23 *
bogdanm 85:024bf7f99721 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 34 *
bogdanm 85:024bf7f99721 35 ******************************************************************************
bogdanm 85:024bf7f99721 36 */
bogdanm 85:024bf7f99721 37
bogdanm 85:024bf7f99721 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 39 #ifndef __STM32F0xx_HAL_FLASH_EX_H
bogdanm 85:024bf7f99721 40 #define __STM32F0xx_HAL_FLASH_EX_H
bogdanm 85:024bf7f99721 41
bogdanm 85:024bf7f99721 42 #ifdef __cplusplus
bogdanm 85:024bf7f99721 43 extern "C" {
bogdanm 85:024bf7f99721 44 #endif
bogdanm 85:024bf7f99721 45
bogdanm 85:024bf7f99721 46 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 47 #include "stm32f0xx_hal_def.h"
bogdanm 85:024bf7f99721 48
bogdanm 85:024bf7f99721 49 /** @addtogroup STM32F0xx_HAL_Driver
bogdanm 85:024bf7f99721 50 * @{
bogdanm 85:024bf7f99721 51 */
bogdanm 85:024bf7f99721 52
bogdanm 85:024bf7f99721 53 /** @addtogroup FLASHEx
bogdanm 85:024bf7f99721 54 * @{
bogdanm 85:024bf7f99721 55 */
bogdanm 85:024bf7f99721 56
Kojto 108:34e6b704fe68 57 /** @addtogroup FLASHEx_Private_Macros
Kojto 108:34e6b704fe68 58 * @{
Kojto 108:34e6b704fe68 59 */
Kojto 108:34e6b704fe68 60 #define IS_FLASH_TYPEERASE(VALUE) (((VALUE) == FLASH_TYPEERASE_PAGES) || \
Kojto 108:34e6b704fe68 61 ((VALUE) == FLASH_TYPEERASE_MASSERASE))
Kojto 108:34e6b704fe68 62
Kojto 108:34e6b704fe68 63 #define IS_OPTIONBYTE(VALUE) ((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA))
Kojto 108:34e6b704fe68 64
Kojto 108:34e6b704fe68 65 #define IS_WRPSTATE(VALUE) (((VALUE) == OB_WRPSTATE_DISABLE) || \
Kojto 108:34e6b704fe68 66 ((VALUE) == OB_WRPSTATE_ENABLE))
Kojto 108:34e6b704fe68 67
Kojto 108:34e6b704fe68 68 #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == OB_DATA_ADDRESS_DATA0) || ((ADDRESS) == OB_DATA_ADDRESS_DATA1))
Kojto 108:34e6b704fe68 69
Kojto 108:34e6b704fe68 70 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
Kojto 108:34e6b704fe68 71 ((LEVEL) == OB_RDP_LEVEL_1))/*||\
Kojto 108:34e6b704fe68 72 ((LEVEL) == OB_RDP_LEVEL_2))*/
Kojto 108:34e6b704fe68 73
Kojto 108:34e6b704fe68 74 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
Kojto 108:34e6b704fe68 75
Kojto 108:34e6b704fe68 76 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
Kojto 108:34e6b704fe68 77
Kojto 108:34e6b704fe68 78 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
Kojto 108:34e6b704fe68 79
Kojto 108:34e6b704fe68 80 #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET))
Kojto 108:34e6b704fe68 81
Kojto 108:34e6b704fe68 82 #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF))
Kojto 108:34e6b704fe68 83
Kojto 108:34e6b704fe68 84 #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_RAM_PARITY_CHECK_SET) || ((PARITY) == OB_RAM_PARITY_CHECK_RESET))
Kojto 108:34e6b704fe68 85
Kojto 108:34e6b704fe68 86 #if defined(FLASH_OBR_BOOT_SEL)
Kojto 108:34e6b704fe68 87 #define IS_OB_BOOT_SEL(BOOT_SEL) (((BOOT_SEL) == OB_BOOT_SEL_RESET) || ((BOOT_SEL) == OB_BOOT_SEL_SET))
Kojto 108:34e6b704fe68 88 #define IS_OB_BOOT0(BOOT0) (((BOOT0) == OB_BOOT0_RESET) || ((BOOT0) == OB_BOOT0_SET))
Kojto 108:34e6b704fe68 89 #endif /* FLASH_OBR_BOOT_SEL */
Kojto 108:34e6b704fe68 90
Kojto 108:34e6b704fe68 91 #define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= FLASH_BANK1_END)
Kojto 108:34e6b704fe68 92
Kojto 108:34e6b704fe68 93 #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000))
Kojto 108:34e6b704fe68 94
Kojto 108:34e6b704fe68 95 #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_BANK1_END))
Kojto 108:34e6b704fe68 96
Kojto 108:34e6b704fe68 97 /**
Kojto 108:34e6b704fe68 98 * @}
Kojto 108:34e6b704fe68 99 */
bogdanm 85:024bf7f99721 100 /* Exported types ------------------------------------------------------------*/
Kojto 108:34e6b704fe68 101 /** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types
Kojto 108:34e6b704fe68 102 * @{
Kojto 108:34e6b704fe68 103 */
Kojto 108:34e6b704fe68 104 /**
Kojto 108:34e6b704fe68 105 * @brief FLASH Erase structure definition
Kojto 108:34e6b704fe68 106 */
Kojto 108:34e6b704fe68 107 typedef struct
Kojto 108:34e6b704fe68 108 {
Kojto 108:34e6b704fe68 109 uint32_t TypeErase; /*!< TypeErase: Mass erase or page erase.
Kojto 108:34e6b704fe68 110 This parameter can be a value of @ref FLASHEx_Type_Erase */
Kojto 108:34e6b704fe68 111
Kojto 108:34e6b704fe68 112 uint32_t PageAddress; /*!< PageAdress: Initial FLASH page address to erase when mass erase is disabled
Kojto 108:34e6b704fe68 113 This parameter must be a number between Min_Data = FLASH_BASE and Max_Data = FLASH_BANK1_END */
Kojto 108:34e6b704fe68 114
Kojto 108:34e6b704fe68 115 uint32_t NbPages; /*!< NbPages: Number of pagess to be erased.
Kojto 108:34e6b704fe68 116 This parameter must be a value between Min_Data = 1 and Max_Data = (max number of pages - value of initial page)*/
Kojto 108:34e6b704fe68 117
Kojto 108:34e6b704fe68 118 } FLASH_EraseInitTypeDef;
Kojto 108:34e6b704fe68 119
Kojto 108:34e6b704fe68 120 /**
Kojto 108:34e6b704fe68 121 * @brief FLASH Options bytes program structure definition
Kojto 108:34e6b704fe68 122 */
Kojto 108:34e6b704fe68 123 typedef struct
Kojto 108:34e6b704fe68 124 {
Kojto 108:34e6b704fe68 125 uint32_t OptionType; /*!< OptionType: Option byte to be configured.
Kojto 108:34e6b704fe68 126 This parameter can be a value of @ref FLASHEx_OB_Type */
Kojto 108:34e6b704fe68 127
Kojto 108:34e6b704fe68 128 uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
Kojto 108:34e6b704fe68 129 This parameter can be a value of @ref FLASHEx_OB_WRP_State */
Kojto 108:34e6b704fe68 130
Kojto 108:34e6b704fe68 131 uint32_t WRPPage; /*!< WRPPage: specifies the page(s) to be write protected
Kojto 108:34e6b704fe68 132 This parameter can be a value of @ref FLASHEx_OB_Write_Protection */
Kojto 108:34e6b704fe68 133
Kojto 108:34e6b704fe68 134 uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level..
Kojto 108:34e6b704fe68 135 This parameter can be a value of @ref FLASHEx_OB_Read_Protection */
Kojto 108:34e6b704fe68 136
Kojto 108:34e6b704fe68 137 uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
Kojto 108:34e6b704fe68 138 IWDG / STOP / STDBY / BOOT1 / VDDA_ANALOG / SRAM_PARITY
Kojto 108:34e6b704fe68 139 This parameter can be a combination of @ref FLASHEx_OB_Watchdog, @ref FLASHEx_OB_nRST_STOP,
Kojto 108:34e6b704fe68 140 @ref FLASHEx_OB_nRST_STDBY, @ref FLASHEx_OB_BOOT1, @ref FLASHEx_OB_VDDA_Analog_Monitoring and
Kojto 108:34e6b704fe68 141 @ref FLASHEx_OB_RAM_Parity_Check_Enable */
Kojto 108:34e6b704fe68 142
Kojto 108:34e6b704fe68 143 uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be programmed
Kojto 108:34e6b704fe68 144 This parameter can be a value of @ref FLASHEx_OB_Data_Address */
Kojto 108:34e6b704fe68 145
Kojto 108:34e6b704fe68 146 uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA
Kojto 108:34e6b704fe68 147 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
Kojto 108:34e6b704fe68 148 } FLASH_OBProgramInitTypeDef;
Kojto 108:34e6b704fe68 149 /**
Kojto 108:34e6b704fe68 150 * @}
Kojto 108:34e6b704fe68 151 */
Kojto 108:34e6b704fe68 152
bogdanm 92:4fc01daae5a5 153 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 154 /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
bogdanm 85:024bf7f99721 155 * @{
bogdanm 85:024bf7f99721 156 */
bogdanm 92:4fc01daae5a5 157 /** @defgroup FLASHEx_Page_Size FLASHEx Page Size
bogdanm 85:024bf7f99721 158 * @{
bogdanm 85:024bf7f99721 159 */
Kojto 108:34e6b704fe68 160 #if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) \
Kojto 108:34e6b704fe68 161 || defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F070x6)
bogdanm 85:024bf7f99721 162 #define FLASH_PAGE_SIZE 0x400
Kojto 93:e188a91d3eaa 163 #endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx || STM32F070x6 */
bogdanm 85:024bf7f99721 164
Kojto 108:34e6b704fe68 165 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) \
Kojto 108:34e6b704fe68 166 || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
bogdanm 85:024bf7f99721 167 #define FLASH_PAGE_SIZE 0x800
Kojto 93:e188a91d3eaa 168 #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC */
bogdanm 85:024bf7f99721 169
bogdanm 85:024bf7f99721 170 /**
bogdanm 85:024bf7f99721 171 * @}
bogdanm 85:024bf7f99721 172 */
Kojto 108:34e6b704fe68 173
Kojto 108:34e6b704fe68 174 /** @defgroup FLASHEx_Type_Erase FLASH Type Erase
Kojto 108:34e6b704fe68 175 * @{
Kojto 108:34e6b704fe68 176 */
Kojto 108:34e6b704fe68 177 #define FLASH_TYPEERASE_PAGES ((uint32_t)0x00) /*!<Pages erase only*/
Kojto 108:34e6b704fe68 178 #define FLASH_TYPEERASE_MASSERASE ((uint32_t)0x01) /*!<Flash mass erase activation*/
bogdanm 85:024bf7f99721 179
Kojto 108:34e6b704fe68 180 /**
Kojto 108:34e6b704fe68 181 * @}
Kojto 108:34e6b704fe68 182 */
Kojto 108:34e6b704fe68 183
Kojto 108:34e6b704fe68 184 /** @defgroup FLASHEx_OB_Type FLASH Option Bytes Type
bogdanm 85:024bf7f99721 185 * @{
bogdanm 85:024bf7f99721 186 */
Kojto 108:34e6b704fe68 187 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/
Kojto 108:34e6b704fe68 188 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/
Kojto 108:34e6b704fe68 189 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!<USER option byte configuration*/
Kojto 108:34e6b704fe68 190 #define OPTIONBYTE_DATA ((uint32_t)0x08) /*!<DATA option byte configuration*/
bogdanm 85:024bf7f99721 191
Kojto 108:34e6b704fe68 192 /**
Kojto 108:34e6b704fe68 193 * @}
Kojto 108:34e6b704fe68 194 */
Kojto 108:34e6b704fe68 195
Kojto 108:34e6b704fe68 196
Kojto 108:34e6b704fe68 197 /** @defgroup FLASHEx_OB_WRP_State FLASH WRP State
Kojto 108:34e6b704fe68 198 * @{
Kojto 108:34e6b704fe68 199 */
Kojto 108:34e6b704fe68 200 #define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/
Kojto 108:34e6b704fe68 201 #define OB_WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired pagess*/
Kojto 108:34e6b704fe68 202
bogdanm 85:024bf7f99721 203 /**
bogdanm 85:024bf7f99721 204 * @}
bogdanm 85:024bf7f99721 205 */
bogdanm 85:024bf7f99721 206
bogdanm 92:4fc01daae5a5 207 /** @defgroup FLASHEx_OB_Write_Protection FLASHEx OB Write Protection
bogdanm 85:024bf7f99721 208 * @{
bogdanm 85:024bf7f99721 209 */
Kojto 108:34e6b704fe68 210 #if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) \
Kojto 108:34e6b704fe68 211 || defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F070x6)
bogdanm 85:024bf7f99721 212 #define OB_WRP_PAGES0TO3 ((uint32_t)0x00000001) /* Write protection of page 0 to 3 */
bogdanm 85:024bf7f99721 213 #define OB_WRP_PAGES4TO7 ((uint32_t)0x00000002) /* Write protection of page 4 to 7 */
bogdanm 85:024bf7f99721 214 #define OB_WRP_PAGES8TO11 ((uint32_t)0x00000004) /* Write protection of page 8 to 11 */
bogdanm 85:024bf7f99721 215 #define OB_WRP_PAGES12TO15 ((uint32_t)0x00000008) /* Write protection of page 12 to 15 */
bogdanm 85:024bf7f99721 216 #define OB_WRP_PAGES16TO19 ((uint32_t)0x00000010) /* Write protection of page 16 to 19 */
bogdanm 85:024bf7f99721 217 #define OB_WRP_PAGES20TO23 ((uint32_t)0x00000020) /* Write protection of page 20 to 23 */
bogdanm 85:024bf7f99721 218 #define OB_WRP_PAGES24TO27 ((uint32_t)0x00000040) /* Write protection of page 24 to 27 */
bogdanm 85:024bf7f99721 219 #define OB_WRP_PAGES28TO31 ((uint32_t)0x00000080) /* Write protection of page 28 to 31 */
bogdanm 85:024bf7f99721 220 #if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
bogdanm 85:024bf7f99721 221 #define OB_WRP_PAGES32TO35 ((uint32_t)0x00000100) /* Write protection of page 32 to 35 */
bogdanm 85:024bf7f99721 222 #define OB_WRP_PAGES36TO39 ((uint32_t)0x00000200) /* Write protection of page 36 to 39 */
bogdanm 85:024bf7f99721 223 #define OB_WRP_PAGES40TO43 ((uint32_t)0x00000400) /* Write protection of page 40 to 43 */
bogdanm 85:024bf7f99721 224 #define OB_WRP_PAGES44TO47 ((uint32_t)0x00000800) /* Write protection of page 44 to 47 */
bogdanm 85:024bf7f99721 225 #define OB_WRP_PAGES48TO51 ((uint32_t)0x00001000) /* Write protection of page 48 to 51 */
bogdanm 85:024bf7f99721 226 #define OB_WRP_PAGES52TO57 ((uint32_t)0x00002000) /* Write protection of page 52 to 57 */
bogdanm 85:024bf7f99721 227 #define OB_WRP_PAGES56TO59 ((uint32_t)0x00004000) /* Write protection of page 56 to 59 */
bogdanm 85:024bf7f99721 228 #define OB_WRP_PAGES60TO63 ((uint32_t)0x00008000) /* Write protection of page 60 to 63 */
bogdanm 85:024bf7f99721 229 #endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
bogdanm 85:024bf7f99721 230
Kojto 108:34e6b704fe68 231 #if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) \
Kojto 108:34e6b704fe68 232 || defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F070x6)
bogdanm 85:024bf7f99721 233 #define OB_WRP_PAGES0TO31MASK ((uint32_t)0x000000FF)
Kojto 108:34e6b704fe68 234 #endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F058xx || STM32F070x6 */
Kojto 108:34e6b704fe68 235
bogdanm 85:024bf7f99721 236 #if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
bogdanm 85:024bf7f99721 237 #define OB_WRP_PAGES32TO63MASK ((uint32_t)0x0000FF00)
bogdanm 85:024bf7f99721 238 #endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
bogdanm 85:024bf7f99721 239
Kojto 93:e188a91d3eaa 240 #if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F038xx)|| defined(STM32F070x6)
bogdanm 85:024bf7f99721 241 #define OB_WRP_ALLPAGES ((uint32_t)0x000000FF) /*!< Write protection of all pages */
Kojto 93:e188a91d3eaa 242 #endif /* STM32F030x6 || STM32F031x6 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F070x6 */
bogdanm 85:024bf7f99721 243
bogdanm 85:024bf7f99721 244 #if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
bogdanm 85:024bf7f99721 245 #define OB_WRP_ALLPAGES ((uint32_t)0x0000FFFF) /*!< Write protection of all pages */
bogdanm 85:024bf7f99721 246 #endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
Kojto 93:e188a91d3eaa 247 #endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F058xx || STM32F070x6 */
bogdanm 85:024bf7f99721 248
Kojto 108:34e6b704fe68 249 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) \
Kojto 108:34e6b704fe68 250 || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
bogdanm 85:024bf7f99721 251 #define OB_WRP_PAGES0TO1 ((uint32_t)0x00000001) /* Write protection of page 0 to 1 */
bogdanm 85:024bf7f99721 252 #define OB_WRP_PAGES2TO3 ((uint32_t)0x00000002) /* Write protection of page 2 to 3 */
bogdanm 85:024bf7f99721 253 #define OB_WRP_PAGES4TO5 ((uint32_t)0x00000004) /* Write protection of page 4 to 5 */
bogdanm 85:024bf7f99721 254 #define OB_WRP_PAGES6TO7 ((uint32_t)0x00000008) /* Write protection of page 6 to 7 */
bogdanm 85:024bf7f99721 255 #define OB_WRP_PAGES8TO9 ((uint32_t)0x00000010) /* Write protection of page 8 to 9 */
bogdanm 85:024bf7f99721 256 #define OB_WRP_PAGES10TO11 ((uint32_t)0x00000020) /* Write protection of page 10 to 11 */
bogdanm 85:024bf7f99721 257 #define OB_WRP_PAGES12TO13 ((uint32_t)0x00000040) /* Write protection of page 12 to 13 */
bogdanm 85:024bf7f99721 258 #define OB_WRP_PAGES14TO15 ((uint32_t)0x00000080) /* Write protection of page 14 to 15 */
bogdanm 85:024bf7f99721 259 #define OB_WRP_PAGES16TO17 ((uint32_t)0x00000100) /* Write protection of page 16 to 17 */
bogdanm 85:024bf7f99721 260 #define OB_WRP_PAGES18TO19 ((uint32_t)0x00000200) /* Write protection of page 18 to 19 */
bogdanm 85:024bf7f99721 261 #define OB_WRP_PAGES20TO21 ((uint32_t)0x00000400) /* Write protection of page 20 to 21 */
bogdanm 85:024bf7f99721 262 #define OB_WRP_PAGES22TO23 ((uint32_t)0x00000800) /* Write protection of page 22 to 23 */
bogdanm 85:024bf7f99721 263 #define OB_WRP_PAGES24TO25 ((uint32_t)0x00001000) /* Write protection of page 24 to 25 */
bogdanm 85:024bf7f99721 264 #define OB_WRP_PAGES26TO27 ((uint32_t)0x00002000) /* Write protection of page 26 to 27 */
bogdanm 85:024bf7f99721 265 #define OB_WRP_PAGES28TO29 ((uint32_t)0x00004000) /* Write protection of page 28 to 29 */
bogdanm 85:024bf7f99721 266 #define OB_WRP_PAGES30TO31 ((uint32_t)0x00008000) /* Write protection of page 30 to 31 */
bogdanm 85:024bf7f99721 267 #define OB_WRP_PAGES32TO33 ((uint32_t)0x00010000) /* Write protection of page 32 to 33 */
bogdanm 85:024bf7f99721 268 #define OB_WRP_PAGES34TO35 ((uint32_t)0x00020000) /* Write protection of page 34 to 35 */
bogdanm 85:024bf7f99721 269 #define OB_WRP_PAGES36TO37 ((uint32_t)0x00040000) /* Write protection of page 36 to 37 */
bogdanm 85:024bf7f99721 270 #define OB_WRP_PAGES38TO39 ((uint32_t)0x00080000) /* Write protection of page 38 to 39 */
bogdanm 85:024bf7f99721 271 #define OB_WRP_PAGES40TO41 ((uint32_t)0x00100000) /* Write protection of page 40 to 41 */
bogdanm 85:024bf7f99721 272 #define OB_WRP_PAGES42TO43 ((uint32_t)0x00200000) /* Write protection of page 42 to 43 */
bogdanm 85:024bf7f99721 273 #define OB_WRP_PAGES44TO45 ((uint32_t)0x00400000) /* Write protection of page 44 to 45 */
bogdanm 85:024bf7f99721 274 #define OB_WRP_PAGES46TO47 ((uint32_t)0x00800000) /* Write protection of page 46 to 47 */
bogdanm 85:024bf7f99721 275 #define OB_WRP_PAGES48TO49 ((uint32_t)0x01000000) /* Write protection of page 48 to 49 */
bogdanm 85:024bf7f99721 276 #define OB_WRP_PAGES50TO51 ((uint32_t)0x02000000) /* Write protection of page 50 to 51 */
bogdanm 85:024bf7f99721 277 #define OB_WRP_PAGES52TO53 ((uint32_t)0x04000000) /* Write protection of page 52 to 53 */
bogdanm 85:024bf7f99721 278 #define OB_WRP_PAGES54TO55 ((uint32_t)0x08000000) /* Write protection of page 54 to 55 */
bogdanm 85:024bf7f99721 279 #define OB_WRP_PAGES56TO57 ((uint32_t)0x10000000) /* Write protection of page 56 to 57 */
bogdanm 85:024bf7f99721 280 #define OB_WRP_PAGES58TO59 ((uint32_t)0x20000000) /* Write protection of page 58 to 59 */
bogdanm 85:024bf7f99721 281 #define OB_WRP_PAGES60TO61 ((uint32_t)0x40000000) /* Write protection of page 60 to 61 */
Kojto 93:e188a91d3eaa 282 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
bogdanm 85:024bf7f99721 283 #define OB_WRP_PAGES62TO63 ((uint32_t)0x80000000) /* Write protection of page 62 to 63 */
Kojto 93:e188a91d3eaa 284 #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */
Kojto 93:e188a91d3eaa 285 #if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
bogdanm 92:4fc01daae5a5 286 #define OB_WRP_PAGES62TO127 ((uint32_t)0x80000000) /* Write protection of page 62 to 127 */
Kojto 93:e188a91d3eaa 287 #endif /* STM32F091xC || STM32F098xx || STM32F030xC */
bogdanm 85:024bf7f99721 288
Kojto 108:34e6b704fe68 289 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) \
Kojto 108:34e6b704fe68 290 || defined(STM32F091xC) || defined(STM32F098xx)|| defined(STM32F030xC)
bogdanm 85:024bf7f99721 291 #define OB_WRP_PAGES0TO15MASK ((uint32_t)0x000000FF)
bogdanm 85:024bf7f99721 292 #define OB_WRP_PAGES16TO31MASK ((uint32_t)0x0000FF00)
bogdanm 85:024bf7f99721 293 #define OB_WRP_PAGES32TO47MASK ((uint32_t)0x00FF0000)
Kojto 108:34e6b704fe68 294 #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC */
Kojto 108:34e6b704fe68 295
Kojto 93:e188a91d3eaa 296 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
bogdanm 85:024bf7f99721 297 #define OB_WRP_PAGES48TO63MASK ((uint32_t)0xFF000000)
Kojto 93:e188a91d3eaa 298 #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */
Kojto 93:e188a91d3eaa 299 #if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
bogdanm 92:4fc01daae5a5 300 #define OB_WRP_PAGES48TO127MASK ((uint32_t)0xFF000000)
Kojto 93:e188a91d3eaa 301 #endif /* STM32F091xC || STM32F098xx || STM32F030xC */
bogdanm 85:024bf7f99721 302
bogdanm 85:024bf7f99721 303 #define OB_WRP_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all pages */
Kojto 93:e188a91d3eaa 304 #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070xB */
bogdanm 85:024bf7f99721 305
bogdanm 85:024bf7f99721 306 /**
bogdanm 85:024bf7f99721 307 * @}
bogdanm 85:024bf7f99721 308 */
bogdanm 85:024bf7f99721 309
Kojto 108:34e6b704fe68 310 /** @defgroup FLASHEx_OB_Read_Protection FLASH OB Read Protection
Kojto 108:34e6b704fe68 311 * @{
Kojto 108:34e6b704fe68 312 */
Kojto 108:34e6b704fe68 313 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
Kojto 108:34e6b704fe68 314 #define OB_RDP_LEVEL_1 ((uint8_t)0xBB)
Kojto 108:34e6b704fe68 315 #define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2
Kojto 108:34e6b704fe68 316 it's no more possible to go back to level 1 or 0 */
Kojto 108:34e6b704fe68 317 /**
Kojto 108:34e6b704fe68 318 * @}
Kojto 108:34e6b704fe68 319 */
Kojto 108:34e6b704fe68 320
Kojto 108:34e6b704fe68 321 /** @defgroup FLASHEx_OB_Watchdog FLASH OB Watchdog
Kojto 108:34e6b704fe68 322 * @{
Kojto 108:34e6b704fe68 323 */
Kojto 108:34e6b704fe68 324 #define OB_IWDG_SW ((uint8_t)0x01) /*!< Software WDG selected */
Kojto 108:34e6b704fe68 325 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware WDG selected */
Kojto 108:34e6b704fe68 326 /**
Kojto 108:34e6b704fe68 327 * @}
Kojto 108:34e6b704fe68 328 */
Kojto 108:34e6b704fe68 329
Kojto 108:34e6b704fe68 330 /** @defgroup FLASHEx_OB_nRST_STOP FLASH OB nRST STOP
Kojto 108:34e6b704fe68 331 * @{
Kojto 108:34e6b704fe68 332 */
Kojto 108:34e6b704fe68 333 #define OB_STOP_NO_RST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */
Kojto 108:34e6b704fe68 334 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
Kojto 108:34e6b704fe68 335 /**
Kojto 108:34e6b704fe68 336 * @}
Kojto 108:34e6b704fe68 337 */
Kojto 108:34e6b704fe68 338
Kojto 108:34e6b704fe68 339 /** @defgroup FLASHEx_OB_nRST_STDBY FLASH OB nRST STDBY
Kojto 108:34e6b704fe68 340 * @{
Kojto 108:34e6b704fe68 341 */
Kojto 108:34e6b704fe68 342 #define OB_STDBY_NO_RST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */
Kojto 108:34e6b704fe68 343 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
Kojto 108:34e6b704fe68 344 /**
Kojto 108:34e6b704fe68 345 * @}
Kojto 108:34e6b704fe68 346 */
Kojto 108:34e6b704fe68 347
Kojto 108:34e6b704fe68 348 /** @defgroup FLASHEx_OB_BOOT1 FLASH OB BOOT1
Kojto 108:34e6b704fe68 349 * @{
Kojto 108:34e6b704fe68 350 */
Kojto 108:34e6b704fe68 351 #define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */
Kojto 108:34e6b704fe68 352 #define OB_BOOT1_SET ((uint8_t)0x10) /*!< BOOT1 Set */
Kojto 108:34e6b704fe68 353 /**
Kojto 108:34e6b704fe68 354 * @}
Kojto 108:34e6b704fe68 355 */
Kojto 108:34e6b704fe68 356
Kojto 108:34e6b704fe68 357 /** @defgroup FLASHEx_OB_VDDA_Analog_Monitoring FLASH OB VDDA Analog Monitoring
Kojto 108:34e6b704fe68 358 * @{
Kojto 108:34e6b704fe68 359 */
Kojto 108:34e6b704fe68 360 #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */
Kojto 108:34e6b704fe68 361 #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00) /*!< Analog monitoring on VDDA Power source OFF */
Kojto 108:34e6b704fe68 362 /**
Kojto 108:34e6b704fe68 363 * @}
Kojto 108:34e6b704fe68 364 */
Kojto 108:34e6b704fe68 365
Kojto 108:34e6b704fe68 366 /** @defgroup FLASHEx_OB_RAM_Parity_Check_Enable FLASH OB RAM Parity Check Enable
Kojto 108:34e6b704fe68 367 * @{
Kojto 108:34e6b704fe68 368 */
Kojto 108:34e6b704fe68 369 #define OB_RAM_PARITY_CHECK_SET ((uint8_t)0x00) /*!< RAM parity check enable set */
Kojto 108:34e6b704fe68 370 #define OB_RAM_PARITY_CHECK_RESET ((uint8_t)0x40) /*!< RAM parity check enable reset */
Kojto 108:34e6b704fe68 371 /**
Kojto 108:34e6b704fe68 372 * @}
Kojto 108:34e6b704fe68 373 */
Kojto 108:34e6b704fe68 374 #if defined(FLASH_OBR_BOOT_SEL)
bogdanm 92:4fc01daae5a5 375 /** @defgroup FLASHEx_OB_BOOT_SEL FLASHEx OB BOOT SEL
bogdanm 85:024bf7f99721 376 * @{
bogdanm 85:024bf7f99721 377 */
bogdanm 85:024bf7f99721 378 #define OB_BOOT_SEL_RESET ((uint8_t)0x00) /*!< BOOT_SEL Reset */
bogdanm 85:024bf7f99721 379 #define OB_BOOT_SEL_SET ((uint8_t)0x80) /*!< BOOT_SEL Set */
bogdanm 85:024bf7f99721 380 /**
bogdanm 85:024bf7f99721 381 * @}
bogdanm 85:024bf7f99721 382 */
bogdanm 85:024bf7f99721 383
bogdanm 92:4fc01daae5a5 384 /** @defgroup FLASHEx_OB_BOOT0 FLASHEx OB BOOT0
bogdanm 85:024bf7f99721 385 * @{
bogdanm 85:024bf7f99721 386 */
bogdanm 85:024bf7f99721 387 #define OB_BOOT0_RESET ((uint8_t)0x00) /*!< BOOT0 Reset */
bogdanm 85:024bf7f99721 388 #define OB_BOOT0_SET ((uint8_t)0x08) /*!< BOOT0 Set */
bogdanm 85:024bf7f99721 389 /**
bogdanm 85:024bf7f99721 390 * @}
bogdanm 85:024bf7f99721 391 */
Kojto 108:34e6b704fe68 392 #endif /* FLASH_OBR_BOOT_SEL */
Kojto 108:34e6b704fe68 393
Kojto 108:34e6b704fe68 394 /** @defgroup FLASHEx_OB_Data_Address Option Byte Data Address
Kojto 108:34e6b704fe68 395 * @{
Kojto 108:34e6b704fe68 396 */
Kojto 108:34e6b704fe68 397 #define OB_DATA_ADDRESS_DATA0 ((uint32_t)0x1FFFF804)
Kojto 108:34e6b704fe68 398 #define OB_DATA_ADDRESS_DATA1 ((uint32_t)0x1FFFF806)
Kojto 108:34e6b704fe68 399 /**
Kojto 108:34e6b704fe68 400 * @}
Kojto 108:34e6b704fe68 401 */
bogdanm 85:024bf7f99721 402
bogdanm 85:024bf7f99721 403 /**
bogdanm 85:024bf7f99721 404 * @}
bogdanm 85:024bf7f99721 405 */
bogdanm 85:024bf7f99721 406
bogdanm 85:024bf7f99721 407 /* Exported macro ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 408
bogdanm 85:024bf7f99721 409 /* Exported functions --------------------------------------------------------*/
Kojto 108:34e6b704fe68 410 /** @addtogroup FLASHEx_Exported_Functions
bogdanm 92:4fc01daae5a5 411 * @{
bogdanm 92:4fc01daae5a5 412 */
bogdanm 92:4fc01daae5a5 413
Kojto 108:34e6b704fe68 414 /** @addtogroup FLASHEx_Exported_Functions_Group1
bogdanm 92:4fc01daae5a5 415 * @{
bogdanm 92:4fc01daae5a5 416 */
bogdanm 85:024bf7f99721 417 /* IO operation functions *****************************************************/
bogdanm 85:024bf7f99721 418 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
bogdanm 85:024bf7f99721 419 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
bogdanm 85:024bf7f99721 420
bogdanm 92:4fc01daae5a5 421 /**
bogdanm 92:4fc01daae5a5 422 * @}
bogdanm 92:4fc01daae5a5 423 */
bogdanm 92:4fc01daae5a5 424
Kojto 108:34e6b704fe68 425 /** @addtogroup FLASHEx_Exported_Functions_Group2
bogdanm 92:4fc01daae5a5 426 * @{
bogdanm 92:4fc01daae5a5 427 */
bogdanm 85:024bf7f99721 428 /* Peripheral Control functions ***********************************************/
bogdanm 85:024bf7f99721 429 HAL_StatusTypeDef HAL_FLASHEx_OBErase(void);
bogdanm 85:024bf7f99721 430 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
bogdanm 85:024bf7f99721 431 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
bogdanm 85:024bf7f99721 432
bogdanm 85:024bf7f99721 433 /**
bogdanm 85:024bf7f99721 434 * @}
bogdanm 85:024bf7f99721 435 */
bogdanm 85:024bf7f99721 436
bogdanm 85:024bf7f99721 437 /**
bogdanm 85:024bf7f99721 438 * @}
bogdanm 85:024bf7f99721 439 */
bogdanm 92:4fc01daae5a5 440
bogdanm 92:4fc01daae5a5 441 /**
bogdanm 92:4fc01daae5a5 442 * @}
bogdanm 92:4fc01daae5a5 443 */
bogdanm 92:4fc01daae5a5 444
bogdanm 92:4fc01daae5a5 445 /**
bogdanm 92:4fc01daae5a5 446 * @}
bogdanm 92:4fc01daae5a5 447 */
bogdanm 92:4fc01daae5a5 448
bogdanm 85:024bf7f99721 449 #ifdef __cplusplus
bogdanm 85:024bf7f99721 450 }
bogdanm 85:024bf7f99721 451 #endif
bogdanm 85:024bf7f99721 452
bogdanm 85:024bf7f99721 453 #endif /* __STM32F0xx_HAL_FLASH_EX_H */
bogdanm 85:024bf7f99721 454
bogdanm 85:024bf7f99721 455 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 456