meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
90:cb3d968589d8
Child:
93:e188a91d3eaa
dgdgr

Who changed what in which revision?

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