Ricardo Benitez / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Mar 02 09:58:28 2016 +0100
Revision:
115:87f2f5183dfb
Child:
116:c0f6e94411f5
Release 115 of the mbed library

Changes:
- new targets - NUCLEO_F746ZG
- Bugfix - STM32F7 + STM32L4 - RTC init fix
- Bugfix - STM32L4 Set NVIC_RAM_VECTOR_ADDRESS to 0x10000000
- B96B_F446VE - CAN addition
- Changed target name from NZ32SC151 to NZ32_SC151

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 115:87f2f5183dfb 1 /**
Kojto 115:87f2f5183dfb 2 ******************************************************************************
Kojto 115:87f2f5183dfb 3 * @file stm32f7xx_hal_flash_ex.h
Kojto 115:87f2f5183dfb 4 * @author MCD Application Team
Kojto 115:87f2f5183dfb 5 * @version V1.0.1
Kojto 115:87f2f5183dfb 6 * @date 25-June-2015
Kojto 115:87f2f5183dfb 7 * @brief Header file of FLASH HAL Extension module.
Kojto 115:87f2f5183dfb 8 ******************************************************************************
Kojto 115:87f2f5183dfb 9 * @attention
Kojto 115:87f2f5183dfb 10 *
Kojto 115:87f2f5183dfb 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 115:87f2f5183dfb 12 *
Kojto 115:87f2f5183dfb 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 115:87f2f5183dfb 14 * are permitted provided that the following conditions are met:
Kojto 115:87f2f5183dfb 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 115:87f2f5183dfb 16 * this list of conditions and the following disclaimer.
Kojto 115:87f2f5183dfb 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 115:87f2f5183dfb 18 * this list of conditions and the following disclaimer in the documentation
Kojto 115:87f2f5183dfb 19 * and/or other materials provided with the distribution.
Kojto 115:87f2f5183dfb 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 115:87f2f5183dfb 21 * may be used to endorse or promote products derived from this software
Kojto 115:87f2f5183dfb 22 * without specific prior written permission.
Kojto 115:87f2f5183dfb 23 *
Kojto 115:87f2f5183dfb 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 115:87f2f5183dfb 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 115:87f2f5183dfb 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 115:87f2f5183dfb 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 115:87f2f5183dfb 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 115:87f2f5183dfb 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 115:87f2f5183dfb 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 115:87f2f5183dfb 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 115:87f2f5183dfb 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 115:87f2f5183dfb 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 115:87f2f5183dfb 34 *
Kojto 115:87f2f5183dfb 35 ******************************************************************************
Kojto 115:87f2f5183dfb 36 */
Kojto 115:87f2f5183dfb 37
Kojto 115:87f2f5183dfb 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 115:87f2f5183dfb 39 #ifndef __STM32F7xx_HAL_FLASH_EX_H
Kojto 115:87f2f5183dfb 40 #define __STM32F7xx_HAL_FLASH_EX_H
Kojto 115:87f2f5183dfb 41
Kojto 115:87f2f5183dfb 42 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 43 extern "C" {
Kojto 115:87f2f5183dfb 44 #endif
Kojto 115:87f2f5183dfb 45
Kojto 115:87f2f5183dfb 46 /* Includes ------------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 47 #include "stm32f7xx_hal_def.h"
Kojto 115:87f2f5183dfb 48
Kojto 115:87f2f5183dfb 49 /** @addtogroup STM32F7xx_HAL_Driver
Kojto 115:87f2f5183dfb 50 * @{
Kojto 115:87f2f5183dfb 51 */
Kojto 115:87f2f5183dfb 52
Kojto 115:87f2f5183dfb 53 /** @addtogroup FLASHEx
Kojto 115:87f2f5183dfb 54 * @{
Kojto 115:87f2f5183dfb 55 */
Kojto 115:87f2f5183dfb 56
Kojto 115:87f2f5183dfb 57 /* Exported types ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 58 /** @defgroup FLASHEx_Exported_Types FLASH Exported Types
Kojto 115:87f2f5183dfb 59 * @{
Kojto 115:87f2f5183dfb 60 */
Kojto 115:87f2f5183dfb 61
Kojto 115:87f2f5183dfb 62 /**
Kojto 115:87f2f5183dfb 63 * @brief FLASH Erase structure definition
Kojto 115:87f2f5183dfb 64 */
Kojto 115:87f2f5183dfb 65 typedef struct
Kojto 115:87f2f5183dfb 66 {
Kojto 115:87f2f5183dfb 67 uint32_t TypeErase; /*!< Mass erase or sector Erase.
Kojto 115:87f2f5183dfb 68 This parameter can be a value of @ref FLASHEx_Type_Erase */
Kojto 115:87f2f5183dfb 69
Kojto 115:87f2f5183dfb 70 uint32_t Sector; /*!< Initial FLASH sector to erase when Mass erase is disabled
Kojto 115:87f2f5183dfb 71 This parameter must be a value of @ref FLASHEx_Sectors */
Kojto 115:87f2f5183dfb 72
Kojto 115:87f2f5183dfb 73 uint32_t NbSectors; /*!< Number of sectors to be erased.
Kojto 115:87f2f5183dfb 74 This parameter must be a value between 1 and (max number of sectors - value of Initial sector)*/
Kojto 115:87f2f5183dfb 75
Kojto 115:87f2f5183dfb 76 uint32_t VoltageRange;/*!< The device voltage range which defines the erase parallelism
Kojto 115:87f2f5183dfb 77 This parameter must be a value of @ref FLASHEx_Voltage_Range */
Kojto 115:87f2f5183dfb 78
Kojto 115:87f2f5183dfb 79 } FLASH_EraseInitTypeDef;
Kojto 115:87f2f5183dfb 80
Kojto 115:87f2f5183dfb 81 /**
Kojto 115:87f2f5183dfb 82 * @brief FLASH Option Bytes Program structure definition
Kojto 115:87f2f5183dfb 83 */
Kojto 115:87f2f5183dfb 84 typedef struct
Kojto 115:87f2f5183dfb 85 {
Kojto 115:87f2f5183dfb 86 uint32_t OptionType; /*!< Option byte to be configured.
Kojto 115:87f2f5183dfb 87 This parameter can be a value of @ref FLASHEx_Option_Type */
Kojto 115:87f2f5183dfb 88
Kojto 115:87f2f5183dfb 89 uint32_t WRPState; /*!< Write protection activation or deactivation.
Kojto 115:87f2f5183dfb 90 This parameter can be a value of @ref FLASHEx_WRP_State */
Kojto 115:87f2f5183dfb 91
Kojto 115:87f2f5183dfb 92 uint32_t WRPSector; /*!< Specifies the sector(s) to be write protected.
Kojto 115:87f2f5183dfb 93 The value of this parameter depend on device used within the same series */
Kojto 115:87f2f5183dfb 94
Kojto 115:87f2f5183dfb 95 uint32_t RDPLevel; /*!< Set the read protection level.
Kojto 115:87f2f5183dfb 96 This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */
Kojto 115:87f2f5183dfb 97
Kojto 115:87f2f5183dfb 98 uint32_t BORLevel; /*!< Set the BOR Level.
Kojto 115:87f2f5183dfb 99 This parameter can be a value of @ref FLASHEx_BOR_Reset_Level */
Kojto 115:87f2f5183dfb 100
Kojto 115:87f2f5183dfb 101 uint32_t USERConfig; /*!< Program the FLASH User Option Byte: WWDG_SW / IWDG_SW / RST_STOP / RST_STDBY /
Kojto 115:87f2f5183dfb 102 IWDG_FREEZE_STOP / IWDG_FREEZE_SANDBY. */
Kojto 115:87f2f5183dfb 103
Kojto 115:87f2f5183dfb 104 uint32_t BootAddr0; /*!< Boot base address when Boot pin = 0.
Kojto 115:87f2f5183dfb 105 This parameter can be a value of @ref FLASHEx_Boot_Address */
Kojto 115:87f2f5183dfb 106
Kojto 115:87f2f5183dfb 107 uint32_t BootAddr1; /*!< Boot base address when Boot pin = 1.
Kojto 115:87f2f5183dfb 108 This parameter can be a value of @ref FLASHEx_Boot_Address */
Kojto 115:87f2f5183dfb 109
Kojto 115:87f2f5183dfb 110 } FLASH_OBProgramInitTypeDef;
Kojto 115:87f2f5183dfb 111
Kojto 115:87f2f5183dfb 112 /**
Kojto 115:87f2f5183dfb 113 * @}
Kojto 115:87f2f5183dfb 114 */
Kojto 115:87f2f5183dfb 115 /* Exported constants --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 116
Kojto 115:87f2f5183dfb 117 /** @defgroup FLASHEx_Exported_Constants FLASH Exported Constants
Kojto 115:87f2f5183dfb 118 * @{
Kojto 115:87f2f5183dfb 119 */
Kojto 115:87f2f5183dfb 120
Kojto 115:87f2f5183dfb 121 /** @defgroup FLASHEx_Type_Erase FLASH Type Erase
Kojto 115:87f2f5183dfb 122 * @{
Kojto 115:87f2f5183dfb 123 */
Kojto 115:87f2f5183dfb 124 #define FLASH_TYPEERASE_SECTORS ((uint32_t)0x00) /*!< Sectors erase only */
Kojto 115:87f2f5183dfb 125 #define FLASH_TYPEERASE_MASSERASE ((uint32_t)0x01) /*!< Flash Mass erase activation */
Kojto 115:87f2f5183dfb 126 /**
Kojto 115:87f2f5183dfb 127 * @}
Kojto 115:87f2f5183dfb 128 */
Kojto 115:87f2f5183dfb 129
Kojto 115:87f2f5183dfb 130 /** @defgroup FLASHEx_Voltage_Range FLASH Voltage Range
Kojto 115:87f2f5183dfb 131 * @{
Kojto 115:87f2f5183dfb 132 */
Kojto 115:87f2f5183dfb 133 #define FLASH_VOLTAGE_RANGE_1 ((uint32_t)0x00) /*!< Device operating range: 1.8V to 2.1V */
Kojto 115:87f2f5183dfb 134 #define FLASH_VOLTAGE_RANGE_2 ((uint32_t)0x01) /*!< Device operating range: 2.1V to 2.7V */
Kojto 115:87f2f5183dfb 135 #define FLASH_VOLTAGE_RANGE_3 ((uint32_t)0x02) /*!< Device operating range: 2.7V to 3.6V */
Kojto 115:87f2f5183dfb 136 #define FLASH_VOLTAGE_RANGE_4 ((uint32_t)0x03) /*!< Device operating range: 2.7V to 3.6V + External Vpp */
Kojto 115:87f2f5183dfb 137 /**
Kojto 115:87f2f5183dfb 138 * @}
Kojto 115:87f2f5183dfb 139 */
Kojto 115:87f2f5183dfb 140
Kojto 115:87f2f5183dfb 141 /** @defgroup FLASHEx_WRP_State FLASH WRP State
Kojto 115:87f2f5183dfb 142 * @{
Kojto 115:87f2f5183dfb 143 */
Kojto 115:87f2f5183dfb 144 #define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!< Disable the write protection of the desired bank 1 sectors */
Kojto 115:87f2f5183dfb 145 #define OB_WRPSTATE_ENABLE ((uint32_t)0x01) /*!< Enable the write protection of the desired bank 1 sectors */
Kojto 115:87f2f5183dfb 146 /**
Kojto 115:87f2f5183dfb 147 * @}
Kojto 115:87f2f5183dfb 148 */
Kojto 115:87f2f5183dfb 149
Kojto 115:87f2f5183dfb 150 /** @defgroup FLASHEx_Option_Type FLASH Option Type
Kojto 115:87f2f5183dfb 151 * @{
Kojto 115:87f2f5183dfb 152 */
Kojto 115:87f2f5183dfb 153 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!< WRP option byte configuration */
Kojto 115:87f2f5183dfb 154 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!< RDP option byte configuration */
Kojto 115:87f2f5183dfb 155 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!< USER option byte configuration */
Kojto 115:87f2f5183dfb 156 #define OPTIONBYTE_BOR ((uint32_t)0x08) /*!< BOR option byte configuration */
Kojto 115:87f2f5183dfb 157 #define OPTIONBYTE_BOOTADDR_0 ((uint32_t)0x10) /*!< Boot 0 Address configuration */
Kojto 115:87f2f5183dfb 158 #define OPTIONBYTE_BOOTADDR_1 ((uint32_t)0x20) /*!< Boot 1 Address configuration */
Kojto 115:87f2f5183dfb 159 /**
Kojto 115:87f2f5183dfb 160 * @}
Kojto 115:87f2f5183dfb 161 */
Kojto 115:87f2f5183dfb 162
Kojto 115:87f2f5183dfb 163 /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASH Option Bytes Read Protection
Kojto 115:87f2f5183dfb 164 * @{
Kojto 115:87f2f5183dfb 165 */
Kojto 115:87f2f5183dfb 166 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
Kojto 115:87f2f5183dfb 167 #define OB_RDP_LEVEL_1 ((uint8_t)0x55)
Kojto 115:87f2f5183dfb 168 #define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2
Kojto 115:87f2f5183dfb 169 it s no more possible to go back to level 1 or 0 */
Kojto 115:87f2f5183dfb 170 /**
Kojto 115:87f2f5183dfb 171 * @}
Kojto 115:87f2f5183dfb 172 */
Kojto 115:87f2f5183dfb 173
Kojto 115:87f2f5183dfb 174 /** @defgroup FLASHEx_Option_Bytes_WWatchdog FLASH Option Bytes WWatchdog
Kojto 115:87f2f5183dfb 175 * @{
Kojto 115:87f2f5183dfb 176 */
Kojto 115:87f2f5183dfb 177 #define OB_WWDG_SW ((uint32_t)0x10) /*!< Software WWDG selected */
Kojto 115:87f2f5183dfb 178 #define OB_WWDG_HW ((uint32_t)0x00) /*!< Hardware WWDG selected */
Kojto 115:87f2f5183dfb 179 /**
Kojto 115:87f2f5183dfb 180 * @}
Kojto 115:87f2f5183dfb 181 */
Kojto 115:87f2f5183dfb 182
Kojto 115:87f2f5183dfb 183
Kojto 115:87f2f5183dfb 184 /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASH Option Bytes IWatchdog
Kojto 115:87f2f5183dfb 185 * @{
Kojto 115:87f2f5183dfb 186 */
Kojto 115:87f2f5183dfb 187 #define OB_IWDG_SW ((uint32_t)0x20) /*!< Software IWDG selected */
Kojto 115:87f2f5183dfb 188 #define OB_IWDG_HW ((uint32_t)0x00) /*!< Hardware IWDG selected */
Kojto 115:87f2f5183dfb 189 /**
Kojto 115:87f2f5183dfb 190 * @}
Kojto 115:87f2f5183dfb 191 */
Kojto 115:87f2f5183dfb 192
Kojto 115:87f2f5183dfb 193 /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASH Option Bytes nRST_STOP
Kojto 115:87f2f5183dfb 194 * @{
Kojto 115:87f2f5183dfb 195 */
Kojto 115:87f2f5183dfb 196 #define OB_STOP_NO_RST ((uint32_t)0x40) /*!< No reset generated when entering in STOP */
Kojto 115:87f2f5183dfb 197 #define OB_STOP_RST ((uint32_t)0x00) /*!< Reset generated when entering in STOP */
Kojto 115:87f2f5183dfb 198 /**
Kojto 115:87f2f5183dfb 199 * @}
Kojto 115:87f2f5183dfb 200 */
Kojto 115:87f2f5183dfb 201
Kojto 115:87f2f5183dfb 202 /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASH Option Bytes nRST_STDBY
Kojto 115:87f2f5183dfb 203 * @{
Kojto 115:87f2f5183dfb 204 */
Kojto 115:87f2f5183dfb 205 #define OB_STDBY_NO_RST ((uint32_t)0x80) /*!< No reset generated when entering in STANDBY */
Kojto 115:87f2f5183dfb 206 #define OB_STDBY_RST ((uint32_t)0x00) /*!< Reset generated when entering in STANDBY */
Kojto 115:87f2f5183dfb 207 /**
Kojto 115:87f2f5183dfb 208 * @}
Kojto 115:87f2f5183dfb 209 */
Kojto 115:87f2f5183dfb 210
Kojto 115:87f2f5183dfb 211 /** @defgroup FLASHEx_Option_Bytes_IWDG_FREEZE_STOP FLASH IWDG Counter Freeze in STOP
Kojto 115:87f2f5183dfb 212 * @{
Kojto 115:87f2f5183dfb 213 */
Kojto 115:87f2f5183dfb 214 #define OB_IWDG_STOP_FREEZE ((uint32_t)0x00000000) /*!< Freeze IWDG counter in STOP mode */
Kojto 115:87f2f5183dfb 215 #define OB_IWDG_STOP_ACTIVE ((uint32_t)0x40000000) /*!< IWDG counter active in STOP mode */
Kojto 115:87f2f5183dfb 216 /**
Kojto 115:87f2f5183dfb 217 * @}
Kojto 115:87f2f5183dfb 218 */
Kojto 115:87f2f5183dfb 219
Kojto 115:87f2f5183dfb 220 /** @defgroup FLASHEx_Option_Bytes_IWDG_FREEZE_SANDBY FLASH IWDG Counter Freeze in STANDBY
Kojto 115:87f2f5183dfb 221 * @{
Kojto 115:87f2f5183dfb 222 */
Kojto 115:87f2f5183dfb 223 #define OB_IWDG_STDBY_FREEZE ((uint32_t)0x00000000) /*!< Freeze IWDG counter in STANDBY mode */
Kojto 115:87f2f5183dfb 224 #define OB_IWDG_STDBY_ACTIVE ((uint32_t)0x40000000) /*!< IWDG counter active in STANDBY mode */
Kojto 115:87f2f5183dfb 225 /**
Kojto 115:87f2f5183dfb 226 * @}
Kojto 115:87f2f5183dfb 227 */
Kojto 115:87f2f5183dfb 228
Kojto 115:87f2f5183dfb 229 /** @defgroup FLASHEx_BOR_Reset_Level FLASH BOR Reset Level
Kojto 115:87f2f5183dfb 230 * @{
Kojto 115:87f2f5183dfb 231 */
Kojto 115:87f2f5183dfb 232 #define OB_BOR_LEVEL3 ((uint32_t)0x00) /*!< Supply voltage ranges from 2.70 to 3.60 V */
Kojto 115:87f2f5183dfb 233 #define OB_BOR_LEVEL2 ((uint32_t)0x04) /*!< Supply voltage ranges from 2.40 to 2.70 V */
Kojto 115:87f2f5183dfb 234 #define OB_BOR_LEVEL1 ((uint32_t)0x08) /*!< Supply voltage ranges from 2.10 to 2.40 V */
Kojto 115:87f2f5183dfb 235 #define OB_BOR_OFF ((uint32_t)0x0C) /*!< Supply voltage ranges from 1.62 to 2.10 V */
Kojto 115:87f2f5183dfb 236
Kojto 115:87f2f5183dfb 237 /**
Kojto 115:87f2f5183dfb 238 * @}
Kojto 115:87f2f5183dfb 239 */
Kojto 115:87f2f5183dfb 240
Kojto 115:87f2f5183dfb 241 /** @defgroup FLASHEx_Boot_Address FLASH Boot Address
Kojto 115:87f2f5183dfb 242 * @{
Kojto 115:87f2f5183dfb 243 */
Kojto 115:87f2f5183dfb 244 #define OB_BOOTADDR_ITCM_RAM ((uint32_t)0x0000) /*!< Boot from ITCM RAM (0x00000000) */
Kojto 115:87f2f5183dfb 245 #define OB_BOOTADDR_SYSTEM ((uint32_t)0x0040) /*!< Boot from System memory bootloader (0x00100000) */
Kojto 115:87f2f5183dfb 246 #define OB_BOOTADDR_ITCM_FLASH ((uint32_t)0x0080) /*!< Boot from Flash on ITCM interface (0x00200000) */
Kojto 115:87f2f5183dfb 247 #define OB_BOOTADDR_AXIM_FLASH ((uint32_t)0x2000) /*!< Boot from Flash on AXIM interface (0x08000000) */
Kojto 115:87f2f5183dfb 248 #define OB_BOOTADDR_DTCM_RAM ((uint32_t)0x8000) /*!< Boot from DTCM RAM (0x20000000) */
Kojto 115:87f2f5183dfb 249 #define OB_BOOTADDR_SRAM1 ((uint32_t)0x8004) /*!< Boot from SRAM1 (0x20010000) */
Kojto 115:87f2f5183dfb 250 #define OB_BOOTADDR_SRAM2 ((uint32_t)0x8013) /*!< Boot from SRAM2 (0x2004C000) */
Kojto 115:87f2f5183dfb 251
Kojto 115:87f2f5183dfb 252 /**
Kojto 115:87f2f5183dfb 253 * @}
Kojto 115:87f2f5183dfb 254 */
Kojto 115:87f2f5183dfb 255
Kojto 115:87f2f5183dfb 256 /** @defgroup FLASH_Latency FLASH Latency
Kojto 115:87f2f5183dfb 257 * @{
Kojto 115:87f2f5183dfb 258 */
Kojto 115:87f2f5183dfb 259 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */
Kojto 115:87f2f5183dfb 260 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */
Kojto 115:87f2f5183dfb 261 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */
Kojto 115:87f2f5183dfb 262 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */
Kojto 115:87f2f5183dfb 263 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */
Kojto 115:87f2f5183dfb 264 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */
Kojto 115:87f2f5183dfb 265 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */
Kojto 115:87f2f5183dfb 266 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */
Kojto 115:87f2f5183dfb 267 #define FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH Eight Latency cycles */
Kojto 115:87f2f5183dfb 268 #define FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH Nine Latency cycles */
Kojto 115:87f2f5183dfb 269 #define FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH Ten Latency cycles */
Kojto 115:87f2f5183dfb 270 #define FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH Eleven Latency cycles */
Kojto 115:87f2f5183dfb 271 #define FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH Twelve Latency cycles */
Kojto 115:87f2f5183dfb 272 #define FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH Thirteen Latency cycles */
Kojto 115:87f2f5183dfb 273 #define FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH Fourteen Latency cycles */
Kojto 115:87f2f5183dfb 274 #define FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH Fifteen Latency cycles */
Kojto 115:87f2f5183dfb 275 /**
Kojto 115:87f2f5183dfb 276 * @}
Kojto 115:87f2f5183dfb 277 */
Kojto 115:87f2f5183dfb 278
Kojto 115:87f2f5183dfb 279 /** @defgroup FLASHEx_MassErase_bit FLASH Mass Erase bit
Kojto 115:87f2f5183dfb 280 * @{
Kojto 115:87f2f5183dfb 281 */
Kojto 115:87f2f5183dfb 282 #define FLASH_MER_BIT (FLASH_CR_MER) /*!< MER bit to clear */
Kojto 115:87f2f5183dfb 283 /**
Kojto 115:87f2f5183dfb 284 * @}
Kojto 115:87f2f5183dfb 285 */
Kojto 115:87f2f5183dfb 286
Kojto 115:87f2f5183dfb 287 /** @defgroup FLASHEx_Sectors FLASH Sectors
Kojto 115:87f2f5183dfb 288 * @{
Kojto 115:87f2f5183dfb 289 */
Kojto 115:87f2f5183dfb 290 #define FLASH_SECTOR_0 ((uint32_t)0) /*!< Sector Number 0 */
Kojto 115:87f2f5183dfb 291 #define FLASH_SECTOR_1 ((uint32_t)1) /*!< Sector Number 1 */
Kojto 115:87f2f5183dfb 292 #define FLASH_SECTOR_2 ((uint32_t)2) /*!< Sector Number 2 */
Kojto 115:87f2f5183dfb 293 #define FLASH_SECTOR_3 ((uint32_t)3) /*!< Sector Number 3 */
Kojto 115:87f2f5183dfb 294 #define FLASH_SECTOR_4 ((uint32_t)4) /*!< Sector Number 4 */
Kojto 115:87f2f5183dfb 295 #define FLASH_SECTOR_5 ((uint32_t)5) /*!< Sector Number 5 */
Kojto 115:87f2f5183dfb 296 #define FLASH_SECTOR_6 ((uint32_t)6) /*!< Sector Number 6 */
Kojto 115:87f2f5183dfb 297 #define FLASH_SECTOR_7 ((uint32_t)7) /*!< Sector Number 7 */
Kojto 115:87f2f5183dfb 298
Kojto 115:87f2f5183dfb 299 /**
Kojto 115:87f2f5183dfb 300 * @}
Kojto 115:87f2f5183dfb 301 */
Kojto 115:87f2f5183dfb 302
Kojto 115:87f2f5183dfb 303 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection
Kojto 115:87f2f5183dfb 304 * @{
Kojto 115:87f2f5183dfb 305 */
Kojto 115:87f2f5183dfb 306 #define OB_WRP_SECTOR_0 ((uint32_t)0x00010000) /*!< Write protection of Sector0 */
Kojto 115:87f2f5183dfb 307 #define OB_WRP_SECTOR_1 ((uint32_t)0x00020000) /*!< Write protection of Sector1 */
Kojto 115:87f2f5183dfb 308 #define OB_WRP_SECTOR_2 ((uint32_t)0x00040000) /*!< Write protection of Sector2 */
Kojto 115:87f2f5183dfb 309 #define OB_WRP_SECTOR_3 ((uint32_t)0x00080000) /*!< Write protection of Sector3 */
Kojto 115:87f2f5183dfb 310 #define OB_WRP_SECTOR_4 ((uint32_t)0x00100000) /*!< Write protection of Sector4 */
Kojto 115:87f2f5183dfb 311 #define OB_WRP_SECTOR_5 ((uint32_t)0x00200000) /*!< Write protection of Sector5 */
Kojto 115:87f2f5183dfb 312 #define OB_WRP_SECTOR_6 ((uint32_t)0x00400000) /*!< Write protection of Sector6 */
Kojto 115:87f2f5183dfb 313 #define OB_WRP_SECTOR_7 ((uint32_t)0x00800000) /*!< Write protection of Sector7 */
Kojto 115:87f2f5183dfb 314 #define OB_WRP_SECTOR_All ((uint32_t)0x00FF0000) /*!< Write protection of all Sectors */
Kojto 115:87f2f5183dfb 315
Kojto 115:87f2f5183dfb 316
Kojto 115:87f2f5183dfb 317
Kojto 115:87f2f5183dfb 318 /**
Kojto 115:87f2f5183dfb 319 * @}
Kojto 115:87f2f5183dfb 320 */
Kojto 115:87f2f5183dfb 321
Kojto 115:87f2f5183dfb 322 /**
Kojto 115:87f2f5183dfb 323 * @}
Kojto 115:87f2f5183dfb 324 */
Kojto 115:87f2f5183dfb 325
Kojto 115:87f2f5183dfb 326 /* Exported macro ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 327 /* Exported functions --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 328 /** @addtogroup FLASHEx_Exported_Functions
Kojto 115:87f2f5183dfb 329 * @{
Kojto 115:87f2f5183dfb 330 */
Kojto 115:87f2f5183dfb 331
Kojto 115:87f2f5183dfb 332 /** @addtogroup FLASHEx_Exported_Functions_Group1
Kojto 115:87f2f5183dfb 333 * @{
Kojto 115:87f2f5183dfb 334 */
Kojto 115:87f2f5183dfb 335 /* Extension Program operation functions *************************************/
Kojto 115:87f2f5183dfb 336 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError);
Kojto 115:87f2f5183dfb 337 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
Kojto 115:87f2f5183dfb 338 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 115:87f2f5183dfb 339 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 115:87f2f5183dfb 340
Kojto 115:87f2f5183dfb 341 /**
Kojto 115:87f2f5183dfb 342 * @}
Kojto 115:87f2f5183dfb 343 */
Kojto 115:87f2f5183dfb 344
Kojto 115:87f2f5183dfb 345 /**
Kojto 115:87f2f5183dfb 346 * @}
Kojto 115:87f2f5183dfb 347 */
Kojto 115:87f2f5183dfb 348 /* Private types -------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 349 /* Private variables ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 350 /* Private constants ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 351 /** @defgroup FLASHEx_Private_Constants FLASH Private Constants
Kojto 115:87f2f5183dfb 352 * @{
Kojto 115:87f2f5183dfb 353 */
Kojto 115:87f2f5183dfb 354 #define FLASH_SECTOR_TOTAL 8
Kojto 115:87f2f5183dfb 355 /**
Kojto 115:87f2f5183dfb 356 * @}
Kojto 115:87f2f5183dfb 357 */
Kojto 115:87f2f5183dfb 358
Kojto 115:87f2f5183dfb 359 /* Private macros ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 360 /** @defgroup FLASHEx_Private_Macros FLASH Private Macros
Kojto 115:87f2f5183dfb 361 * @{
Kojto 115:87f2f5183dfb 362 */
Kojto 115:87f2f5183dfb 363
Kojto 115:87f2f5183dfb 364 /** @defgroup FLASHEx_IS_FLASH_Definitions FLASH Private macros to check input parameters
Kojto 115:87f2f5183dfb 365 * @{
Kojto 115:87f2f5183dfb 366 */
Kojto 115:87f2f5183dfb 367
Kojto 115:87f2f5183dfb 368 #define IS_FLASH_TYPEERASE(VALUE)(((VALUE) == FLASH_TYPEERASE_SECTORS) || \
Kojto 115:87f2f5183dfb 369 ((VALUE) == FLASH_TYPEERASE_MASSERASE))
Kojto 115:87f2f5183dfb 370
Kojto 115:87f2f5183dfb 371 #define IS_VOLTAGERANGE(RANGE)(((RANGE) == FLASH_VOLTAGE_RANGE_1) || \
Kojto 115:87f2f5183dfb 372 ((RANGE) == FLASH_VOLTAGE_RANGE_2) || \
Kojto 115:87f2f5183dfb 373 ((RANGE) == FLASH_VOLTAGE_RANGE_3) || \
Kojto 115:87f2f5183dfb 374 ((RANGE) == FLASH_VOLTAGE_RANGE_4))
Kojto 115:87f2f5183dfb 375
Kojto 115:87f2f5183dfb 376 #define IS_WRPSTATE(VALUE)(((VALUE) == OB_WRPSTATE_DISABLE) || \
Kojto 115:87f2f5183dfb 377 ((VALUE) == OB_WRPSTATE_ENABLE))
Kojto 115:87f2f5183dfb 378
Kojto 115:87f2f5183dfb 379 #define IS_OPTIONBYTE(VALUE)(((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER |\
Kojto 115:87f2f5183dfb 380 OPTIONBYTE_BOR | OPTIONBYTE_BOOTADDR_0 | OPTIONBYTE_BOOTADDR_1)))
Kojto 115:87f2f5183dfb 381
Kojto 115:87f2f5183dfb 382 #define IS_OB_BOOT_ADDRESS(ADDRESS) (((ADDRESS) == OB_BOOTADDR_ITCM_RAM) || \
Kojto 115:87f2f5183dfb 383 ((ADDRESS) == OB_BOOTADDR_SYSTEM) || \
Kojto 115:87f2f5183dfb 384 ((ADDRESS) == OB_BOOTADDR_ITCM_FLASH) || \
Kojto 115:87f2f5183dfb 385 ((ADDRESS) == OB_BOOTADDR_AXIM_FLASH) || \
Kojto 115:87f2f5183dfb 386 ((ADDRESS) == OB_BOOTADDR_DTCM_RAM) || \
Kojto 115:87f2f5183dfb 387 ((ADDRESS) == OB_BOOTADDR_SRAM1) || \
Kojto 115:87f2f5183dfb 388 ((ADDRESS) == OB_BOOTADDR_SRAM2))
Kojto 115:87f2f5183dfb 389
Kojto 115:87f2f5183dfb 390 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
Kojto 115:87f2f5183dfb 391 ((LEVEL) == OB_RDP_LEVEL_1) ||\
Kojto 115:87f2f5183dfb 392 ((LEVEL) == OB_RDP_LEVEL_2))
Kojto 115:87f2f5183dfb 393
Kojto 115:87f2f5183dfb 394 #define IS_OB_WWDG_SOURCE(SOURCE) (((SOURCE) == OB_WWDG_SW) || ((SOURCE) == OB_WWDG_HW))
Kojto 115:87f2f5183dfb 395
Kojto 115:87f2f5183dfb 396 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
Kojto 115:87f2f5183dfb 397
Kojto 115:87f2f5183dfb 398 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
Kojto 115:87f2f5183dfb 399
Kojto 115:87f2f5183dfb 400 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
Kojto 115:87f2f5183dfb 401
Kojto 115:87f2f5183dfb 402 #define IS_OB_IWDG_STOP_FREEZE(FREEZE) (((FREEZE) == OB_IWDG_STOP_FREEZE) || ((FREEZE) == OB_IWDG_STOP_ACTIVE))
Kojto 115:87f2f5183dfb 403
Kojto 115:87f2f5183dfb 404 #define IS_OB_IWDG_STDBY_FREEZE(FREEZE) (((FREEZE) == OB_IWDG_STDBY_FREEZE) || ((FREEZE) == OB_IWDG_STDBY_ACTIVE))
Kojto 115:87f2f5183dfb 405
Kojto 115:87f2f5183dfb 406 #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\
Kojto 115:87f2f5183dfb 407 ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF))
Kojto 115:87f2f5183dfb 408
Kojto 115:87f2f5183dfb 409 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
Kojto 115:87f2f5183dfb 410 ((LATENCY) == FLASH_LATENCY_1) || \
Kojto 115:87f2f5183dfb 411 ((LATENCY) == FLASH_LATENCY_2) || \
Kojto 115:87f2f5183dfb 412 ((LATENCY) == FLASH_LATENCY_3) || \
Kojto 115:87f2f5183dfb 413 ((LATENCY) == FLASH_LATENCY_4) || \
Kojto 115:87f2f5183dfb 414 ((LATENCY) == FLASH_LATENCY_5) || \
Kojto 115:87f2f5183dfb 415 ((LATENCY) == FLASH_LATENCY_6) || \
Kojto 115:87f2f5183dfb 416 ((LATENCY) == FLASH_LATENCY_7) || \
Kojto 115:87f2f5183dfb 417 ((LATENCY) == FLASH_LATENCY_8) || \
Kojto 115:87f2f5183dfb 418 ((LATENCY) == FLASH_LATENCY_9) || \
Kojto 115:87f2f5183dfb 419 ((LATENCY) == FLASH_LATENCY_10) || \
Kojto 115:87f2f5183dfb 420 ((LATENCY) == FLASH_LATENCY_11) || \
Kojto 115:87f2f5183dfb 421 ((LATENCY) == FLASH_LATENCY_12) || \
Kojto 115:87f2f5183dfb 422 ((LATENCY) == FLASH_LATENCY_13) || \
Kojto 115:87f2f5183dfb 423 ((LATENCY) == FLASH_LATENCY_14) || \
Kojto 115:87f2f5183dfb 424 ((LATENCY) == FLASH_LATENCY_15))
Kojto 115:87f2f5183dfb 425
Kojto 115:87f2f5183dfb 426 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
Kojto 115:87f2f5183dfb 427 ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
Kojto 115:87f2f5183dfb 428 ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
Kojto 115:87f2f5183dfb 429 ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7))
Kojto 115:87f2f5183dfb 430
Kojto 115:87f2f5183dfb 431
Kojto 115:87f2f5183dfb 432 #define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_END))
Kojto 115:87f2f5183dfb 433
Kojto 115:87f2f5183dfb 434 #define IS_FLASH_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL))
Kojto 115:87f2f5183dfb 435
Kojto 115:87f2f5183dfb 436 #define IS_OB_WRP_SECTOR(SECTOR) ((((SECTOR) & (uint32_t)0xFF00FFFF) == 0x00000000) && ((SECTOR) != 0x00000000))
Kojto 115:87f2f5183dfb 437 /**
Kojto 115:87f2f5183dfb 438 * @}
Kojto 115:87f2f5183dfb 439 */
Kojto 115:87f2f5183dfb 440
Kojto 115:87f2f5183dfb 441 /**
Kojto 115:87f2f5183dfb 442 * @}
Kojto 115:87f2f5183dfb 443 */
Kojto 115:87f2f5183dfb 444
Kojto 115:87f2f5183dfb 445 /* Private functions ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 446 /** @defgroup FLASHEx_Private_Functions FLASH Private Functions
Kojto 115:87f2f5183dfb 447 * @{
Kojto 115:87f2f5183dfb 448 */
Kojto 115:87f2f5183dfb 449 void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange);
Kojto 115:87f2f5183dfb 450 /**
Kojto 115:87f2f5183dfb 451 * @}
Kojto 115:87f2f5183dfb 452 */
Kojto 115:87f2f5183dfb 453
Kojto 115:87f2f5183dfb 454 /**
Kojto 115:87f2f5183dfb 455 * @}
Kojto 115:87f2f5183dfb 456 */
Kojto 115:87f2f5183dfb 457
Kojto 115:87f2f5183dfb 458 /**
Kojto 115:87f2f5183dfb 459 * @}
Kojto 115:87f2f5183dfb 460 */
Kojto 115:87f2f5183dfb 461
Kojto 115:87f2f5183dfb 462 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 463 }
Kojto 115:87f2f5183dfb 464 #endif
Kojto 115:87f2f5183dfb 465
Kojto 115:87f2f5183dfb 466 #endif /* __STM32F7xx_HAL_FLASH_EX_H */
Kojto 115:87f2f5183dfb 467
Kojto 115:87f2f5183dfb 468 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/