mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
109:9296ab0bfc11
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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