my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
85:024bf7f99721
Child:
93:e188a91d3eaa
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

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