mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu May 22 20:00:09 2014 +0100
Revision:
205:c41fc65bcfb4
Child:
218:44081b78fdc2
Synchronized with git revision ea4b6f76efab17a3f7d7777b0cc1ef05fec6d1cb

Full URL: https://github.com/mbedmicro/mbed/commit/ea4b6f76efab17a3f7d7777b0cc1ef05fec6d1cb/

[NUCLEO_F072RB] cmsis files

Who changed what in which revision?

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