Modified version of the mbed library for use with the Nucleo boards.

Dependents:   EEPROMWrite Full-Project

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Sep 28 20:15:09 2015 +0100
Revision:
634:ac7d6880524d
Parent:
632:7687fb9c4f91
Synchronized with git revision 9b7d23d47153c298a6d24de9a415202705889d11

Full URL: https://github.com/mbedmicro/mbed/commit/9b7d23d47153c298a6d24de9a415202705889d11/

Revert "[NUCLEO_F303K8] add support of the STM32F303K8"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 237:f3da66175598 1 /**
mbed_official 237:f3da66175598 2 ******************************************************************************
mbed_official 237:f3da66175598 3 * @file stm32f3xx_hal_flash.h
mbed_official 237:f3da66175598 4 * @author MCD Application Team
mbed_official 634:ac7d6880524d 5 * @version V1.1.0
mbed_official 634:ac7d6880524d 6 * @date 12-Sept-2014
mbed_official 237:f3da66175598 7 * @brief Header file of Flash HAL module.
mbed_official 237:f3da66175598 8 ******************************************************************************
mbed_official 237:f3da66175598 9 * @attention
mbed_official 237:f3da66175598 10 *
mbed_official 634:ac7d6880524d 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 237:f3da66175598 12 *
mbed_official 237:f3da66175598 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 237:f3da66175598 14 * are permitted provided that the following conditions are met:
mbed_official 237:f3da66175598 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 237:f3da66175598 16 * this list of conditions and the following disclaimer.
mbed_official 237:f3da66175598 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 237:f3da66175598 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 237:f3da66175598 19 * and/or other materials provided with the distribution.
mbed_official 237:f3da66175598 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 237:f3da66175598 21 * may be used to endorse or promote products derived from this software
mbed_official 237:f3da66175598 22 * without specific prior written permission.
mbed_official 237:f3da66175598 23 *
mbed_official 237:f3da66175598 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 237:f3da66175598 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 237:f3da66175598 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 237:f3da66175598 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 237:f3da66175598 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 237:f3da66175598 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 237:f3da66175598 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 237:f3da66175598 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 237:f3da66175598 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 237:f3da66175598 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 237:f3da66175598 34 *
mbed_official 237:f3da66175598 35 ******************************************************************************
mbed_official 237:f3da66175598 36 */
mbed_official 237:f3da66175598 37
mbed_official 237:f3da66175598 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 237:f3da66175598 39 #ifndef __STM32F3xx_HAL_FLASH_H
mbed_official 237:f3da66175598 40 #define __STM32F3xx_HAL_FLASH_H
mbed_official 237:f3da66175598 41
mbed_official 237:f3da66175598 42 #ifdef __cplusplus
mbed_official 237:f3da66175598 43 extern "C" {
mbed_official 237:f3da66175598 44 #endif
mbed_official 237:f3da66175598 45
mbed_official 237:f3da66175598 46 /* Includes ------------------------------------------------------------------*/
mbed_official 237:f3da66175598 47 #include "stm32f3xx_hal_def.h"
mbed_official 237:f3da66175598 48
mbed_official 237:f3da66175598 49 /** @addtogroup STM32F3xx_HAL_Driver
mbed_official 237:f3da66175598 50 * @{
mbed_official 237:f3da66175598 51 */
mbed_official 237:f3da66175598 52
mbed_official 375:3d36234a1087 53 /** @addtogroup FLASH FLASH HAL module driver
mbed_official 237:f3da66175598 54 * @{
mbed_official 237:f3da66175598 55 */
mbed_official 237:f3da66175598 56
mbed_official 237:f3da66175598 57 /* Exported types ------------------------------------------------------------*/
mbed_official 375:3d36234a1087 58 /** @defgroup FLASH_Exported_Types FLASH Exported Types
mbed_official 237:f3da66175598 59 * @{
mbed_official 237:f3da66175598 60 */
mbed_official 237:f3da66175598 61
mbed_official 237:f3da66175598 62 /**
mbed_official 237:f3da66175598 63 * @brief FLASH Error source
mbed_official 237:f3da66175598 64 */
mbed_official 237:f3da66175598 65 typedef enum
mbed_official 237:f3da66175598 66 {
mbed_official 237:f3da66175598 67 FLASH_ERROR_PG = 0x01,
mbed_official 237:f3da66175598 68 FLASH_ERROR_WRP = 0x02
mbed_official 237:f3da66175598 69 } FLASH_ErrorTypeDef;
mbed_official 237:f3da66175598 70
mbed_official 237:f3da66175598 71 /**
mbed_official 237:f3da66175598 72 * @brief FLASH Erase structure definition
mbed_official 237:f3da66175598 73 */
mbed_official 237:f3da66175598 74 typedef struct
mbed_official 237:f3da66175598 75 {
mbed_official 237:f3da66175598 76 uint32_t TypeErase; /*!< TypeErase: Mass erase or page erase.
mbed_official 237:f3da66175598 77 This parameter can be a value of @ref FLASH_Type_Erase */
mbed_official 237:f3da66175598 78
mbed_official 237:f3da66175598 79 uint32_t PageAddress; /*!< PageAdress: Initial FLASH page address to erase when mass erase is disabled
mbed_official 237:f3da66175598 80 This parameter must be a value of @ref FLASHEx_Address */
mbed_official 237:f3da66175598 81
mbed_official 237:f3da66175598 82 uint32_t NbPages; /*!< NbPages: Number of pagess to be erased.
mbed_official 237:f3da66175598 83 This parameter must be a value between 1 and (max number of pages - value of initial page)*/
mbed_official 237:f3da66175598 84
mbed_official 237:f3da66175598 85 } FLASH_EraseInitTypeDef;
mbed_official 237:f3da66175598 86
mbed_official 237:f3da66175598 87 /**
mbed_official 237:f3da66175598 88 * @brief FLASH Options bytes program structure definition
mbed_official 237:f3da66175598 89 */
mbed_official 237:f3da66175598 90 typedef struct
mbed_official 237:f3da66175598 91 {
mbed_official 237:f3da66175598 92 uint32_t OptionType; /*!< OptionType: Option byte to be configured.
mbed_official 237:f3da66175598 93 This parameter can be a value of @ref FLASH_OB_Type */
mbed_official 237:f3da66175598 94
mbed_official 237:f3da66175598 95 uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
mbed_official 237:f3da66175598 96 This parameter can be a value of @ref FLASH_OB_WRP_State */
mbed_official 237:f3da66175598 97
mbed_official 237:f3da66175598 98 uint32_t WRPPage; /*!< WRPSector: specifies the page(s) to be write protected
mbed_official 237:f3da66175598 99 This parameter can be a value of @ref FLASHEx_OB_Write_Protection */
mbed_official 237:f3da66175598 100
mbed_official 237:f3da66175598 101 uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level..
mbed_official 237:f3da66175598 102 This parameter can be a value of @ref FLASH_OB_Read_Protection */
mbed_official 237:f3da66175598 103
mbed_official 237:f3da66175598 104 uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
mbed_official 237:f3da66175598 105 IWDG / STOP / STDBY / BOOT1 / VDDA_ANALOG / SRAM_PARITY / SDADC12_VDD_MONITOR
mbed_official 237:f3da66175598 106 This parameter can be a combination of @ref FLASH_OB_IWatchdog, @ref FLASH_OB_nRST_STOP,
mbed_official 237:f3da66175598 107 @ref FLASH_OB_nRST_STDBY, @ref FLASH_OB_BOOT1, @ref FLASH_OB_VDDA_Analog_Monitoring,
mbed_official 237:f3da66175598 108 @ref FLASH_OB_SRAM_Parity_Enable and @ref FLASH_OB_SDADC12_VDD_MONITOR */
mbed_official 237:f3da66175598 109
mbed_official 237:f3da66175598 110 uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be prgrammed
mbed_official 237:f3da66175598 111 This parameter can be a value of @ref FLASH_OB_Data_Address */
mbed_official 237:f3da66175598 112
mbed_official 237:f3da66175598 113 uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA
mbed_official 237:f3da66175598 114 This parameter can have any value */
mbed_official 237:f3da66175598 115
mbed_official 237:f3da66175598 116 } FLASH_OBProgramInitTypeDef;
mbed_official 237:f3da66175598 117
mbed_official 237:f3da66175598 118 /**
mbed_official 237:f3da66175598 119 * @brief FLASH Procedure structure definition
mbed_official 237:f3da66175598 120 */
mbed_official 237:f3da66175598 121 typedef enum
mbed_official 237:f3da66175598 122 {
mbed_official 237:f3da66175598 123 FLASH_PROC_NONE = 0,
mbed_official 237:f3da66175598 124 FLASH_PROC_PAGEERASE = 1,
mbed_official 237:f3da66175598 125 FLASH_PROC_MASSERASE = 2,
mbed_official 237:f3da66175598 126 FLASH_PROC_PROGRAMHALFWORD = 3,
mbed_official 237:f3da66175598 127 FLASH_PROC_PROGRAMWORD = 4,
mbed_official 237:f3da66175598 128 FLASH_PROC_PROGRAMDOUBLEWORD = 5
mbed_official 237:f3da66175598 129 } FLASH_ProcedureTypeDef;
mbed_official 237:f3da66175598 130
mbed_official 237:f3da66175598 131 /**
mbed_official 237:f3da66175598 132 * @brief FLASH handle Structure definition
mbed_official 237:f3da66175598 133 */
mbed_official 237:f3da66175598 134 typedef struct
mbed_official 237:f3da66175598 135 {
mbed_official 237:f3da66175598 136 __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */
mbed_official 237:f3da66175598 137
mbed_official 237:f3da66175598 138 __IO uint32_t DataRemaining; /* Internal variable to save the remaining pages to erase or half-word to program in IT context */
mbed_official 237:f3da66175598 139
mbed_official 237:f3da66175598 140 __IO uint32_t Address; /* Internal variable to save address selected for program or erase */
mbed_official 237:f3da66175598 141
mbed_official 237:f3da66175598 142 __IO uint64_t Data; /* Internal variable to save data to be programmed */
mbed_official 237:f3da66175598 143
mbed_official 237:f3da66175598 144 HAL_LockTypeDef Lock; /* FLASH locking object */
mbed_official 237:f3da66175598 145
mbed_official 237:f3da66175598 146 __IO FLASH_ErrorTypeDef ErrorCode; /* FLASH error code */
mbed_official 237:f3da66175598 147
mbed_official 237:f3da66175598 148 } FLASH_ProcessTypeDef;
mbed_official 237:f3da66175598 149
mbed_official 237:f3da66175598 150 /**
mbed_official 237:f3da66175598 151 * @}
mbed_official 237:f3da66175598 152 */
mbed_official 237:f3da66175598 153
mbed_official 237:f3da66175598 154 /* Exported constants --------------------------------------------------------*/
mbed_official 375:3d36234a1087 155 /** @defgroup FLASH_Exported_Constants FLASH Exported Constants
mbed_official 237:f3da66175598 156 * @{
mbed_official 237:f3da66175598 157 */
mbed_official 237:f3da66175598 158
mbed_official 237:f3da66175598 159 /** @defgroup FLASH_Type_Erase FLASH Type Erase
mbed_official 237:f3da66175598 160 * @{
mbed_official 237:f3da66175598 161 */
mbed_official 237:f3da66175598 162 #define TYPEERASE_PAGES ((uint32_t)0x00) /*!<Pages erase only*/
mbed_official 237:f3da66175598 163 #define TYPEERASE_MASSERASE ((uint32_t)0x01) /*!<Flash mass erase activation*/
mbed_official 237:f3da66175598 164
mbed_official 237:f3da66175598 165 #define IS_TYPEERASE(VALUE) (((VALUE) == TYPEERASE_PAGES) || \
mbed_official 237:f3da66175598 166 ((VALUE) == TYPEERASE_MASSERASE))
mbed_official 237:f3da66175598 167 /**
mbed_official 237:f3da66175598 168 * @}
mbed_official 237:f3da66175598 169 */
mbed_official 237:f3da66175598 170
mbed_official 237:f3da66175598 171 /** @defgroup FLASH_Type_Program FLASH Type Program
mbed_official 237:f3da66175598 172 * @{
mbed_official 237:f3da66175598 173 */
mbed_official 237:f3da66175598 174 #define TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/
mbed_official 237:f3da66175598 175 #define TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/
mbed_official 237:f3da66175598 176 #define TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!<Program a double word (64-bit) at a specified address*/
mbed_official 237:f3da66175598 177
mbed_official 237:f3da66175598 178 #define IS_TYPEPROGRAM(VALUE) (((VALUE) == TYPEPROGRAM_HALFWORD) || \
mbed_official 237:f3da66175598 179 ((VALUE) == TYPEPROGRAM_WORD) || \
mbed_official 237:f3da66175598 180 ((VALUE) == TYPEPROGRAM_DOUBLEWORD))
mbed_official 237:f3da66175598 181 /**
mbed_official 237:f3da66175598 182 * @}
mbed_official 237:f3da66175598 183 */
mbed_official 237:f3da66175598 184
mbed_official 237:f3da66175598 185 /** @defgroup FLASH_OB_WRP_State FLASH WRP State
mbed_official 237:f3da66175598 186 * @{
mbed_official 237:f3da66175598 187 */
mbed_official 237:f3da66175598 188 #define WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/
mbed_official 237:f3da66175598 189 #define WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired pagess*/
mbed_official 237:f3da66175598 190
mbed_official 237:f3da66175598 191 #define IS_WRPSTATE(VALUE) (((VALUE) == WRPSTATE_DISABLE) || \
mbed_official 237:f3da66175598 192 ((VALUE) == WRPSTATE_ENABLE))
mbed_official 237:f3da66175598 193 /**
mbed_official 237:f3da66175598 194 * @}
mbed_official 237:f3da66175598 195 */
mbed_official 237:f3da66175598 196
mbed_official 237:f3da66175598 197 /** @defgroup FLASH_OB_Type FLASH Option Bytes Type
mbed_official 237:f3da66175598 198 * @{
mbed_official 237:f3da66175598 199 */
mbed_official 237:f3da66175598 200 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/
mbed_official 237:f3da66175598 201 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/
mbed_official 237:f3da66175598 202 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!<USER option byte configuration*/
mbed_official 237:f3da66175598 203 #define OPTIONBYTE_DATA ((uint32_t)0x08) /*!<DATA option byte configuration*/
mbed_official 237:f3da66175598 204
mbed_official 237:f3da66175598 205 #define IS_OPTIONBYTE(VALUE) (((VALUE) < (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA)))
mbed_official 237:f3da66175598 206 /**
mbed_official 237:f3da66175598 207 * @}
mbed_official 237:f3da66175598 208 */
mbed_official 237:f3da66175598 209
mbed_official 375:3d36234a1087 210 /** @defgroup FLASH_Latency FLASH Latency
mbed_official 237:f3da66175598 211 * @{
mbed_official 237:f3da66175598 212 */
mbed_official 237:f3da66175598 213 #define FLASH_LATENCY_0 ((uint8_t)0x0000) /*!< FLASH Zero Latency cycle */
mbed_official 237:f3da66175598 214 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_0 /*!< FLASH One Latency cycle */
mbed_official 237:f3da66175598 215 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_1 /*!< FLASH Two Latency cycles */
mbed_official 237:f3da66175598 216
mbed_official 237:f3da66175598 217 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
mbed_official 237:f3da66175598 218 ((LATENCY) == FLASH_LATENCY_1) || \
mbed_official 237:f3da66175598 219 ((LATENCY) == FLASH_LATENCY_2))
mbed_official 237:f3da66175598 220 /**
mbed_official 237:f3da66175598 221 * @}
mbed_official 237:f3da66175598 222 */
mbed_official 237:f3da66175598 223
mbed_official 375:3d36234a1087 224 /** @defgroup FLASH_OB_Data_Address FLASH Option Byte Data Address
mbed_official 237:f3da66175598 225 * @{
mbed_official 237:f3da66175598 226 */
mbed_official 237:f3da66175598 227 #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806))
mbed_official 237:f3da66175598 228 /**
mbed_official 237:f3da66175598 229 * @}
mbed_official 237:f3da66175598 230 */
mbed_official 237:f3da66175598 231
mbed_official 375:3d36234a1087 232 /** @defgroup FLASH_OB_Read_Protection FLASH Option Byte Read Protection
mbed_official 237:f3da66175598 233 * @{
mbed_official 237:f3da66175598 234 */
mbed_official 237:f3da66175598 235 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
mbed_official 237:f3da66175598 236 #define OB_RDP_LEVEL_1 ((uint8_t)0xBB)
mbed_official 237:f3da66175598 237 #define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2
mbed_official 237:f3da66175598 238 it's no more possible to go back to level 1 or 0 */
mbed_official 237:f3da66175598 239 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
mbed_official 237:f3da66175598 240 ((LEVEL) == OB_RDP_LEVEL_1))/*||\
mbed_official 237:f3da66175598 241 ((LEVEL) == OB_RDP_LEVEL_2))*/
mbed_official 237:f3da66175598 242 /**
mbed_official 237:f3da66175598 243 * @}
mbed_official 237:f3da66175598 244 */
mbed_official 237:f3da66175598 245
mbed_official 375:3d36234a1087 246 /** @defgroup FLASH_OB_IWatchdog FLASH Option Byte IWatchdog
mbed_official 237:f3da66175598 247 * @{
mbed_official 237:f3da66175598 248 */
mbed_official 237:f3da66175598 249 #define OB_IWDG_SW ((uint8_t)0x01) /*!< Software IWDG selected */
mbed_official 237:f3da66175598 250 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */
mbed_official 237:f3da66175598 251 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
mbed_official 237:f3da66175598 252 /**
mbed_official 237:f3da66175598 253 * @}
mbed_official 237:f3da66175598 254 */
mbed_official 237:f3da66175598 255
mbed_official 375:3d36234a1087 256 /** @defgroup FLASH_OB_nRST_STOP FLASH Option Byte nRST STOP
mbed_official 237:f3da66175598 257 * @{
mbed_official 237:f3da66175598 258 */
mbed_official 237:f3da66175598 259 #define OB_STOP_NO_RST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */
mbed_official 237:f3da66175598 260 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
mbed_official 237:f3da66175598 261 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
mbed_official 237:f3da66175598 262 /**
mbed_official 237:f3da66175598 263 * @}
mbed_official 237:f3da66175598 264 */
mbed_official 237:f3da66175598 265
mbed_official 375:3d36234a1087 266 /** @defgroup FLASH_OB_nRST_STDBY FLASH Option Byte nRST STDBY
mbed_official 237:f3da66175598 267 * @{
mbed_official 237:f3da66175598 268 */
mbed_official 237:f3da66175598 269 #define OB_STDBY_NO_RST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */
mbed_official 237:f3da66175598 270 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
mbed_official 237:f3da66175598 271 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
mbed_official 237:f3da66175598 272 /**
mbed_official 237:f3da66175598 273 * @}
mbed_official 237:f3da66175598 274 */
mbed_official 237:f3da66175598 275
mbed_official 375:3d36234a1087 276 /** @defgroup FLASH_OB_BOOT1 FLASH Option Byte BOOT1
mbed_official 237:f3da66175598 277 * @{
mbed_official 237:f3da66175598 278 */
mbed_official 237:f3da66175598 279 #define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */
mbed_official 237:f3da66175598 280 #define OB_BOOT1_SET ((uint8_t)0x10) /*!< BOOT1 Set */
mbed_official 237:f3da66175598 281 #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET))
mbed_official 237:f3da66175598 282 /**
mbed_official 237:f3da66175598 283 * @}
mbed_official 237:f3da66175598 284 */
mbed_official 237:f3da66175598 285
mbed_official 375:3d36234a1087 286 /** @defgroup FLASH_OB_VDDA_Analog_Monitoring FLASH Option Byte VDDA Analog Monitoring
mbed_official 237:f3da66175598 287 * @{
mbed_official 237:f3da66175598 288 */
mbed_official 237:f3da66175598 289 #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */
mbed_official 237:f3da66175598 290 #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00) /*!< Analog monitoring on VDDA Power source OFF */
mbed_official 237:f3da66175598 291 #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF))
mbed_official 237:f3da66175598 292 /**
mbed_official 237:f3da66175598 293 * @}
mbed_official 237:f3da66175598 294 */
mbed_official 237:f3da66175598 295
mbed_official 375:3d36234a1087 296 /** @defgroup FLASH_OB_SRAM_Parity_Enable FLASH Option Byte SRAM Parity Enable
mbed_official 237:f3da66175598 297 * @{
mbed_official 237:f3da66175598 298 */
mbed_official 237:f3da66175598 299 #define OB_SRAM_PARITY_SET ((uint8_t)0x00) /*!< SRAM parity enable set */
mbed_official 237:f3da66175598 300 #define OB_SRAM_PARITY_RESET ((uint8_t)0x40) /*!< SRAM parity enable reset */
mbed_official 237:f3da66175598 301 #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_SRAM_PARITY_SET) || ((PARITY) == OB_SRAM_PARITY_RESET))
mbed_official 237:f3da66175598 302 /**
mbed_official 237:f3da66175598 303 * @}
mbed_official 237:f3da66175598 304 */
mbed_official 237:f3da66175598 305
mbed_official 375:3d36234a1087 306 /** @defgroup FLASH_OB_SDADC12_VDD_MONITOR FLASH Option Byte SDADC12 VDD MONITOR
mbed_official 237:f3da66175598 307 * @{
mbed_official 237:f3da66175598 308 */
mbed_official 237:f3da66175598 309 #define OB_SDADC12_VDD_MONITOR_SET ((uint8_t)0x80) /*!< SDADC12_VDD power supply supervisor set */
mbed_official 237:f3da66175598 310 #define OB_SDADC12_VDD_MONITOR_RESET ((uint8_t)0x00) /*!< SDADC12_VDD power supply supervisor reset */
mbed_official 237:f3da66175598 311 #define IS_OB_SDADC12_VDD_MONITOR(MONITOR) (((MONITOR) == OB_SDADC12_VDD_MONITOR_SET) || ((MONITOR) == OB_SDADC12_VDD_MONITOR_RESET))
mbed_official 237:f3da66175598 312 /**
mbed_official 237:f3da66175598 313 * @}
mbed_official 237:f3da66175598 314 */
mbed_official 237:f3da66175598 315
mbed_official 375:3d36234a1087 316 /** @defgroup FLASH_Flag_definition FLASH Flag definition
mbed_official 237:f3da66175598 317 * @brief Flag definition
mbed_official 237:f3da66175598 318 * @{
mbed_official 237:f3da66175598 319 */
mbed_official 237:f3da66175598 320 #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */
mbed_official 237:f3da66175598 321 #define FLASH_FLAG_PGERR FLASH_SR_PGERR /*!< FLASH Programming error flag */
mbed_official 237:f3da66175598 322 #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */
mbed_official 237:f3da66175598 323 #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */
mbed_official 237:f3da66175598 324
mbed_official 237:f3da66175598 325 #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFC3) == 0x00000000) && ((FLAG) != 0x00000000))
mbed_official 237:f3da66175598 326 #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_PGERR) || \
mbed_official 237:f3da66175598 327 ((FLAG) == FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_EOP))
mbed_official 237:f3da66175598 328 /**
mbed_official 237:f3da66175598 329 * @}
mbed_official 237:f3da66175598 330 */
mbed_official 237:f3da66175598 331
mbed_official 375:3d36234a1087 332 /** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition
mbed_official 237:f3da66175598 333 * @brief FLASH Interrupt definition
mbed_official 237:f3da66175598 334 * @{
mbed_official 237:f3da66175598 335 */
mbed_official 237:f3da66175598 336 #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */
mbed_official 237:f3da66175598 337 #define FLASH_IT_ERR FLASH_CR_ERRIE /*!< Error Interrupt source */
mbed_official 237:f3da66175598 338 #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && ((IT) != 0x00000000))
mbed_official 237:f3da66175598 339 /**
mbed_official 237:f3da66175598 340 * @}
mbed_official 237:f3da66175598 341 */
mbed_official 237:f3da66175598 342
mbed_official 375:3d36234a1087 343 /** @defgroup FLASH_Timeout_definition FLASH Timeout definition
mbed_official 237:f3da66175598 344 * @brief FLASH Timeout definition
mbed_official 237:f3da66175598 345 * @{
mbed_official 237:f3da66175598 346 */
mbed_official 237:f3da66175598 347 #define HAL_FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
mbed_official 237:f3da66175598 348 /**
mbed_official 237:f3da66175598 349 * @}
mbed_official 237:f3da66175598 350 */
mbed_official 237:f3da66175598 351
mbed_official 237:f3da66175598 352 /**
mbed_official 237:f3da66175598 353 * @}
mbed_official 237:f3da66175598 354 */
mbed_official 237:f3da66175598 355
mbed_official 237:f3da66175598 356 /* Exported macro ------------------------------------------------------------*/
mbed_official 237:f3da66175598 357
mbed_official 375:3d36234a1087 358 /** @defgroup FLASH_Exported_Macros FLASH Exported Macros
mbed_official 237:f3da66175598 359 * @brief macros to control FLASH features
mbed_official 237:f3da66175598 360 * @{
mbed_official 237:f3da66175598 361 */
mbed_official 237:f3da66175598 362
mbed_official 237:f3da66175598 363 /**
mbed_official 237:f3da66175598 364 * @brief Set the FLASH Latency.
mbed_official 237:f3da66175598 365 * @param __LATENCY__: FLASH Latency
mbed_official 237:f3da66175598 366 * The value of this parameter depend on device used within the same series
mbed_official 237:f3da66175598 367 * @retval None
mbed_official 237:f3da66175598 368 */
mbed_official 237:f3da66175598 369 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__))
mbed_official 237:f3da66175598 370
mbed_official 237:f3da66175598 371 /**
mbed_official 237:f3da66175598 372 * @brief Enable the FLASH prefetch buffer.
mbed_official 237:f3da66175598 373 * @retval None
mbed_official 237:f3da66175598 374 */
mbed_official 237:f3da66175598 375 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE)
mbed_official 237:f3da66175598 376
mbed_official 237:f3da66175598 377 /**
mbed_official 237:f3da66175598 378 * @brief Disable the FLASH prefetch buffer.
mbed_official 237:f3da66175598 379 * @retval None
mbed_official 237:f3da66175598 380 */
mbed_official 237:f3da66175598 381 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE))
mbed_official 237:f3da66175598 382
mbed_official 237:f3da66175598 383 /**
mbed_official 237:f3da66175598 384 * @brief Enable the FLASH half cycle access.
mbed_official 237:f3da66175598 385 * @retval None
mbed_official 237:f3da66175598 386 */
mbed_official 237:f3da66175598 387 #define __HAL_FLASH_HALF_CYCLE_ACCESS_ENABLE() (FLASH->ACR |= FLASH_ACR_HLFCYA)
mbed_official 237:f3da66175598 388
mbed_official 237:f3da66175598 389 /**
mbed_official 237:f3da66175598 390 * @brief Disable the FLASH half cycle access.
mbed_official 237:f3da66175598 391 * @retval None
mbed_official 237:f3da66175598 392 */
mbed_official 237:f3da66175598 393 #define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA))
mbed_official 237:f3da66175598 394
mbed_official 375:3d36234a1087 395 /** @defgroup FLASH_Interrupt FLASH Interrupt
mbed_official 237:f3da66175598 396 * @brief macros to handle FLASH interrupts
mbed_official 237:f3da66175598 397 * @{
mbed_official 237:f3da66175598 398 */
mbed_official 237:f3da66175598 399
mbed_official 237:f3da66175598 400 /**
mbed_official 237:f3da66175598 401 * @brief Enable the specified FLASH interrupt.
mbed_official 237:f3da66175598 402 * @param __INTERRUPT__ : FLASH interrupt
mbed_official 237:f3da66175598 403 * This parameter can be any combination of the following values:
mbed_official 237:f3da66175598 404 * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
mbed_official 237:f3da66175598 405 * @arg FLASH_IT_ERR: Error Interrupt
mbed_official 237:f3da66175598 406 * @retval none
mbed_official 237:f3da66175598 407 */
mbed_official 237:f3da66175598 408 #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
mbed_official 237:f3da66175598 409
mbed_official 237:f3da66175598 410 /**
mbed_official 237:f3da66175598 411 * @brief Disable the specified FLASH interrupt.
mbed_official 237:f3da66175598 412 * @param __INTERRUPT__ : FLASH interrupt
mbed_official 237:f3da66175598 413 * This parameter can be any combination of the following values:
mbed_official 237:f3da66175598 414 * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
mbed_official 237:f3da66175598 415 * @arg FLASH_IT_ERR: Error Interrupt
mbed_official 237:f3da66175598 416 * @retval none
mbed_official 237:f3da66175598 417 */
mbed_official 237:f3da66175598 418 #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__))
mbed_official 237:f3da66175598 419
mbed_official 237:f3da66175598 420 /**
mbed_official 237:f3da66175598 421 * @brief Get the specified FLASH flag status.
mbed_official 237:f3da66175598 422 * @param __FLAG__: specifies the FLASH flag to check.
mbed_official 237:f3da66175598 423 * This parameter can be one of the following values:
mbed_official 237:f3da66175598 424 * @arg FLASH_FLAG_EOP : FLASH End of Operation flag
mbed_official 237:f3da66175598 425 * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
mbed_official 237:f3da66175598 426 * @arg FLASH_FLAG_PGERR : FLASH Programming error flag
mbed_official 237:f3da66175598 427 * @arg FLASH_FLAG_BSY : FLASH Busy flag
mbed_official 237:f3da66175598 428 * @retval The new state of __FLAG__ (SET or RESET).
mbed_official 237:f3da66175598 429 */
mbed_official 237:f3da66175598 430 #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)) == (__FLAG__))
mbed_official 237:f3da66175598 431
mbed_official 237:f3da66175598 432 /**
mbed_official 237:f3da66175598 433 * @brief Clear the specified FLASH flag.
mbed_official 237:f3da66175598 434 * @param __FLAG__: specifies the FLASH flags to clear.
mbed_official 237:f3da66175598 435 * This parameter can be any combination of the following values:
mbed_official 237:f3da66175598 436 * @arg FLASH_FLAG_EOP : FLASH End of Operation flag
mbed_official 237:f3da66175598 437 * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
mbed_official 237:f3da66175598 438 * @arg FLASH_FLAG_PGERR : FLASH Programming error flag
mbed_official 237:f3da66175598 439 * @retval none
mbed_official 237:f3da66175598 440 */
mbed_official 237:f3da66175598 441 #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__))
mbed_official 237:f3da66175598 442
mbed_official 237:f3da66175598 443 /**
mbed_official 237:f3da66175598 444 * @}
mbed_official 375:3d36234a1087 445 */
mbed_official 375:3d36234a1087 446
mbed_official 375:3d36234a1087 447 /**
mbed_official 375:3d36234a1087 448 * @}
mbed_official 237:f3da66175598 449 */
mbed_official 237:f3da66175598 450
mbed_official 375:3d36234a1087 451 /* Include FLASH HAL Extended module */
mbed_official 237:f3da66175598 452 #include "stm32f3xx_hal_flash_ex.h"
mbed_official 237:f3da66175598 453
mbed_official 237:f3da66175598 454 /* Exported functions --------------------------------------------------------*/
mbed_official 375:3d36234a1087 455 /** @addtogroup FLASH_Exported_Functions FLASH Exported Functions
mbed_official 237:f3da66175598 456 * @{
mbed_official 375:3d36234a1087 457 */
mbed_official 375:3d36234a1087 458
mbed_official 375:3d36234a1087 459 /** @addtogroup FLASH_Exported_Functions_Group1 Input and Output operation functions
mbed_official 375:3d36234a1087 460 * @{
mbed_official 375:3d36234a1087 461 */
mbed_official 237:f3da66175598 462 /* IO operation functions *****************************************************/
mbed_official 237:f3da66175598 463 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
mbed_official 237:f3da66175598 464 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
mbed_official 237:f3da66175598 465
mbed_official 237:f3da66175598 466 /* FLASH IRQ handler method */
mbed_official 237:f3da66175598 467 void HAL_FLASH_IRQHandler(void);
mbed_official 237:f3da66175598 468 /* Callbacks in non blocking modes */
mbed_official 237:f3da66175598 469 void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
mbed_official 237:f3da66175598 470 void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
mbed_official 237:f3da66175598 471
mbed_official 375:3d36234a1087 472 /**
mbed_official 375:3d36234a1087 473 * @}
mbed_official 375:3d36234a1087 474 */
mbed_official 375:3d36234a1087 475
mbed_official 375:3d36234a1087 476 /** @addtogroup FLASH_Exported_Functions_Group2 Peripheral Control functions
mbed_official 375:3d36234a1087 477 * @{
mbed_official 375:3d36234a1087 478 */
mbed_official 237:f3da66175598 479 /* Peripheral Control functions ***********************************************/
mbed_official 237:f3da66175598 480 HAL_StatusTypeDef HAL_FLASH_Unlock(void);
mbed_official 237:f3da66175598 481 HAL_StatusTypeDef HAL_FLASH_Lock(void);
mbed_official 237:f3da66175598 482 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
mbed_official 237:f3da66175598 483 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
mbed_official 237:f3da66175598 484 /* Option bytes control */
mbed_official 237:f3da66175598 485 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
mbed_official 237:f3da66175598 486
mbed_official 375:3d36234a1087 487 /**
mbed_official 375:3d36234a1087 488 * @}
mbed_official 375:3d36234a1087 489 */
mbed_official 375:3d36234a1087 490
mbed_official 375:3d36234a1087 491 /** @addtogroup FLASH_Exported_Functions_Group3 Peripheral State functions
mbed_official 375:3d36234a1087 492 * @{
mbed_official 375:3d36234a1087 493 */
mbed_official 237:f3da66175598 494 /* Peripheral State and Error functions ***************************************/
mbed_official 237:f3da66175598 495 FLASH_ErrorTypeDef HAL_FLASH_GetError(void);
mbed_official 237:f3da66175598 496
mbed_official 237:f3da66175598 497 /**
mbed_official 237:f3da66175598 498 * @}
mbed_official 237:f3da66175598 499 */
mbed_official 237:f3da66175598 500
mbed_official 237:f3da66175598 501 /**
mbed_official 237:f3da66175598 502 * @}
mbed_official 237:f3da66175598 503 */
mbed_official 237:f3da66175598 504
mbed_official 375:3d36234a1087 505 /* Exported Private function -------------------------------------------------*/
mbed_official 375:3d36234a1087 506 /** @addtogroup FLASH_Exported_Private_Functions FLASH Exported Private Functions
mbed_official 375:3d36234a1087 507 * @{
mbed_official 375:3d36234a1087 508 */
mbed_official 375:3d36234a1087 509 /* Erase operations */
mbed_official 375:3d36234a1087 510 void FLASH_PageErase(uint32_t PageAddress);
mbed_official 375:3d36234a1087 511 HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
mbed_official 375:3d36234a1087 512
mbed_official 375:3d36234a1087 513 /* Program operations */
mbed_official 375:3d36234a1087 514 /**
mbed_official 375:3d36234a1087 515 * @}
mbed_official 375:3d36234a1087 516 */
mbed_official 375:3d36234a1087 517
mbed_official 375:3d36234a1087 518 /**
mbed_official 375:3d36234a1087 519 * @}
mbed_official 375:3d36234a1087 520 */
mbed_official 375:3d36234a1087 521
mbed_official 237:f3da66175598 522 /**
mbed_official 237:f3da66175598 523 * @}
mbed_official 237:f3da66175598 524 */
mbed_official 237:f3da66175598 525
mbed_official 237:f3da66175598 526 #ifdef __cplusplus
mbed_official 237:f3da66175598 527 }
mbed_official 237:f3da66175598 528 #endif
mbed_official 237:f3da66175598 529
mbed_official 237:f3da66175598 530 #endif /* __STM32F3xx_HAL_FLASH_H */
mbed_official 237:f3da66175598 531
mbed_official 237:f3da66175598 532 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/