mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Nov 03 10:30:07 2014 +0000
Revision:
381:5460fc57b6e4
Synchronized with git revision 02478cd1f27fc7b9643486472635eb515b2bca81

Full URL: https://github.com/mbedmicro/mbed/commit/02478cd1f27fc7b9643486472635eb515b2bca81/

Target: LPC1549 - Fix serial interrupt issues (issue report #616)

Who changed what in which revision?

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