mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Oct 29 08:40:18 2015 +0000
Revision:
109:9296ab0bfc11
Child:
122:f9eeca106725
Release 109  of the mbed library

Changes:
- new platforms - NUCLEO_F042K6, WIZNWIKI_W7500ECO
- MTS targets - bootloaders update to 0.1.1
- STM F7 - RTC enable fixes
- STM F4 - i2c pending stop before start fix
- STM all targets - analogout normalization fix

Who changed what in which revision?

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