my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
93:e188a91d3eaa
First reale BlueNRG module for nucleo 401 board

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
Kojto 93:e188a91d3eaa 5 * @version V1.2.0
Kojto 93:e188a91d3eaa 6 * @date 11-December-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 Erase structure definition
bogdanm 85:024bf7f99721 65 */
bogdanm 85:024bf7f99721 66 typedef struct
bogdanm 85:024bf7f99721 67 {
bogdanm 85:024bf7f99721 68 uint32_t TypeErase; /*!< TypeErase: Mass erase or page erase.
bogdanm 85:024bf7f99721 69 This parameter can be a value of @ref FLASH_Type_Erase */
bogdanm 85:024bf7f99721 70
bogdanm 85:024bf7f99721 71 uint32_t PageAddress; /*!< PageAdress: Initial FLASH page address to erase when mass erase is disabled
bogdanm 85:024bf7f99721 72 This parameter must be a value of @ref FLASHEx_Address */
bogdanm 85:024bf7f99721 73
bogdanm 85:024bf7f99721 74 uint32_t NbPages; /*!< NbPages: Number of pagess to be erased.
bogdanm 85:024bf7f99721 75 This parameter must be a value between 1 and (max number of pages - value of initial page)*/
bogdanm 85:024bf7f99721 76
bogdanm 85:024bf7f99721 77 } FLASH_EraseInitTypeDef;
bogdanm 85:024bf7f99721 78
bogdanm 85:024bf7f99721 79 /**
bogdanm 85:024bf7f99721 80 * @brief FLASH Options bytes program structure definition
bogdanm 85:024bf7f99721 81 */
bogdanm 85:024bf7f99721 82 typedef struct
bogdanm 85:024bf7f99721 83 {
bogdanm 85:024bf7f99721 84 uint32_t OptionType; /*!< OptionType: Option byte to be configured.
bogdanm 85:024bf7f99721 85 This parameter can be a value of @ref FLASH_OB_Type */
bogdanm 85:024bf7f99721 86
bogdanm 85:024bf7f99721 87 uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
bogdanm 85:024bf7f99721 88 This parameter can be a value of @ref FLASH_OB_WRP_State */
bogdanm 85:024bf7f99721 89
bogdanm 85:024bf7f99721 90 uint32_t WRPPage; /*!< WRPSector: specifies the page(s) to be write protected
bogdanm 85:024bf7f99721 91 This parameter can be a value of @ref FLASHEx_OB_Write_Protection */
bogdanm 85:024bf7f99721 92
bogdanm 85:024bf7f99721 93 uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level..
bogdanm 85:024bf7f99721 94 This parameter can be a value of @ref FLASH_OB_Read_Protection */
bogdanm 85:024bf7f99721 95
bogdanm 85:024bf7f99721 96 uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
bogdanm 85:024bf7f99721 97 IWDG / STOP / STDBY / BOOT1 / VDDA_ANALOG / SRAM_PARITY
bogdanm 85:024bf7f99721 98 This parameter can be a combination of @ref FLASH_OB_Watchdog, @ref FLASH_OB_nRST_STOP,
bogdanm 85:024bf7f99721 99 @ref FLASH_OB_nRST_STDBY, @ref FLASH_OB_BOOT1, @ref FLASH_OB_VDDA_Analog_Monitoring and
bogdanm 85:024bf7f99721 100 @ref FLASH_OB_RAM_Parity_Check_Enable */
bogdanm 85:024bf7f99721 101
bogdanm 85:024bf7f99721 102 uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be prgrammed
bogdanm 85:024bf7f99721 103 This parameter can be a value of @ref FLASH_OB_Data_Address */
bogdanm 85:024bf7f99721 104
bogdanm 85:024bf7f99721 105 uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA
bogdanm 85:024bf7f99721 106 This parameter can have any value */
bogdanm 85:024bf7f99721 107
bogdanm 85:024bf7f99721 108 } FLASH_OBProgramInitTypeDef;
bogdanm 85:024bf7f99721 109
bogdanm 85:024bf7f99721 110 /**
bogdanm 85:024bf7f99721 111 * @brief FLASH Procedure structure definition
bogdanm 85:024bf7f99721 112 */
bogdanm 85:024bf7f99721 113 typedef enum
bogdanm 85:024bf7f99721 114 {
bogdanm 85:024bf7f99721 115 FLASH_PROC_NONE = 0,
bogdanm 85:024bf7f99721 116 FLASH_PROC_PAGEERASE = 1,
bogdanm 85:024bf7f99721 117 FLASH_PROC_MASSERASE = 2,
bogdanm 85:024bf7f99721 118 FLASH_PROC_PROGRAMHALFWORD = 3,
bogdanm 85:024bf7f99721 119 FLASH_PROC_PROGRAMWORD = 4,
bogdanm 85:024bf7f99721 120 FLASH_PROC_PROGRAMDOUBLEWORD = 5
bogdanm 85:024bf7f99721 121 } FLASH_ProcedureTypeDef;
bogdanm 85:024bf7f99721 122
bogdanm 85:024bf7f99721 123 /**
bogdanm 85:024bf7f99721 124 * @brief FLASH handle Structure definition
bogdanm 85:024bf7f99721 125 */
bogdanm 85:024bf7f99721 126 typedef struct
bogdanm 85:024bf7f99721 127 {
Kojto 93:e188a91d3eaa 128 __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */
bogdanm 85:024bf7f99721 129
Kojto 93:e188a91d3eaa 130 __IO uint32_t DataRemaining; /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */
bogdanm 85:024bf7f99721 131
Kojto 93:e188a91d3eaa 132 __IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */
bogdanm 85:024bf7f99721 133
Kojto 93:e188a91d3eaa 134 __IO uint64_t Data; /*!< Internal variable to save data to be programmed */
bogdanm 85:024bf7f99721 135
Kojto 93:e188a91d3eaa 136 HAL_LockTypeDef Lock; /*!< FLASH locking object */
bogdanm 85:024bf7f99721 137
Kojto 93:e188a91d3eaa 138 __IO uint32_t ErrorCode; /*!< FLASH error code
Kojto 93:e188a91d3eaa 139 This parameter can be a value of @ref FLASH_Error */
bogdanm 85:024bf7f99721 140
bogdanm 85:024bf7f99721 141 } FLASH_ProcessTypeDef;
bogdanm 85:024bf7f99721 142
bogdanm 85:024bf7f99721 143 /**
bogdanm 85:024bf7f99721 144 * @}
bogdanm 85:024bf7f99721 145 */
bogdanm 85:024bf7f99721 146
bogdanm 85:024bf7f99721 147 /* Exported constants --------------------------------------------------------*/
bogdanm 85:024bf7f99721 148
bogdanm 92:4fc01daae5a5 149 /** @defgroup FLASH_Exported_Constants FLASH Exported Constants
bogdanm 85:024bf7f99721 150 * @{
bogdanm 85:024bf7f99721 151 */
bogdanm 85:024bf7f99721 152
Kojto 93:e188a91d3eaa 153 /** @defgroup FLASH_Error FLASH Error
Kojto 93:e188a91d3eaa 154 * @{
Kojto 93:e188a91d3eaa 155 */
Kojto 93:e188a91d3eaa 156 #define FLASH_ERROR_NONE ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 157 #define FLASH_ERROR_PG ((uint32_t)0x00000001)
Kojto 93:e188a91d3eaa 158 #define FLASH_ERROR_WRP ((uint32_t)0x00000002)
Kojto 93:e188a91d3eaa 159 /**
Kojto 93:e188a91d3eaa 160 * @}
Kojto 93:e188a91d3eaa 161 */
Kojto 93:e188a91d3eaa 162
bogdanm 85:024bf7f99721 163 /** @defgroup FLASH_Type_Erase FLASH Type Erase
bogdanm 85:024bf7f99721 164 * @{
bogdanm 85:024bf7f99721 165 */
bogdanm 85:024bf7f99721 166 #define TYPEERASE_PAGES ((uint32_t)0x00) /*!<Pages erase only*/
bogdanm 85:024bf7f99721 167 #define TYPEERASE_MASSERASE ((uint32_t)0x01) /*!<Flash mass erase activation*/
bogdanm 85:024bf7f99721 168
bogdanm 85:024bf7f99721 169 #define IS_TYPEERASE(VALUE) (((VALUE) == TYPEERASE_PAGES) || \
bogdanm 85:024bf7f99721 170 ((VALUE) == TYPEERASE_MASSERASE))
bogdanm 85:024bf7f99721 171 /**
bogdanm 85:024bf7f99721 172 * @}
bogdanm 85:024bf7f99721 173 */
bogdanm 85:024bf7f99721 174
bogdanm 85:024bf7f99721 175 /** @defgroup FLASH_Type_Program FLASH Type Program
bogdanm 85:024bf7f99721 176 * @{
bogdanm 85:024bf7f99721 177 */
bogdanm 85:024bf7f99721 178 #define TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/
bogdanm 85:024bf7f99721 179 #define TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/
bogdanm 85:024bf7f99721 180 #define TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!<Program a double word (64-bit) at a specified address*/
bogdanm 85:024bf7f99721 181
bogdanm 85:024bf7f99721 182 #define IS_TYPEPROGRAM(VALUE) (((VALUE) == TYPEPROGRAM_HALFWORD) || \
bogdanm 85:024bf7f99721 183 ((VALUE) == TYPEPROGRAM_WORD) || \
bogdanm 85:024bf7f99721 184 ((VALUE) == TYPEPROGRAM_DOUBLEWORD))
bogdanm 85:024bf7f99721 185 /**
bogdanm 85:024bf7f99721 186 * @}
bogdanm 85:024bf7f99721 187 */
bogdanm 85:024bf7f99721 188
bogdanm 85:024bf7f99721 189 /** @defgroup FLASH_OB_WRP_State FLASH WRP State
bogdanm 85:024bf7f99721 190 * @{
bogdanm 85:024bf7f99721 191 */
bogdanm 85:024bf7f99721 192 #define WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/
bogdanm 85:024bf7f99721 193 #define WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired pagess*/
bogdanm 85:024bf7f99721 194
bogdanm 85:024bf7f99721 195 #define IS_WRPSTATE(VALUE) (((VALUE) == WRPSTATE_DISABLE) || \
bogdanm 85:024bf7f99721 196 ((VALUE) == WRPSTATE_ENABLE))
bogdanm 85:024bf7f99721 197 /**
bogdanm 85:024bf7f99721 198 * @}
bogdanm 85:024bf7f99721 199 */
bogdanm 85:024bf7f99721 200
bogdanm 85:024bf7f99721 201 /** @defgroup FLASH_OB_Type FLASH Option Bytes Type
bogdanm 85:024bf7f99721 202 * @{
bogdanm 85:024bf7f99721 203 */
bogdanm 85:024bf7f99721 204 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/
bogdanm 85:024bf7f99721 205 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/
bogdanm 85:024bf7f99721 206 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!<USER option byte configuration*/
bogdanm 85:024bf7f99721 207 #define OPTIONBYTE_DATA ((uint32_t)0x08) /*!<DATA option byte configuration*/
bogdanm 85:024bf7f99721 208
Kojto 93:e188a91d3eaa 209 #define IS_OPTIONBYTE(VALUE) ((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA))
bogdanm 85:024bf7f99721 210 /**
bogdanm 85:024bf7f99721 211 * @}
bogdanm 85:024bf7f99721 212 */
bogdanm 85:024bf7f99721 213
bogdanm 92:4fc01daae5a5 214 /** @defgroup FLASH_Latency FLASH Latency
bogdanm 85:024bf7f99721 215 * @{
bogdanm 85:024bf7f99721 216 */
bogdanm 85:024bf7f99721 217 #define FLASH_LATENCY_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */
bogdanm 85:024bf7f99721 218 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY /*!< FLASH One Latency cycle */
bogdanm 85:024bf7f99721 219
bogdanm 85:024bf7f99721 220 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
bogdanm 85:024bf7f99721 221 ((LATENCY) == FLASH_LATENCY_1))
bogdanm 85:024bf7f99721 222 /**
bogdanm 85:024bf7f99721 223 * @}
bogdanm 85:024bf7f99721 224 */
bogdanm 85:024bf7f99721 225
bogdanm 92:4fc01daae5a5 226 /** @defgroup FLASH_OB_Data_Address FLASH OB Data Address
bogdanm 85:024bf7f99721 227 * @{
bogdanm 85:024bf7f99721 228 */
bogdanm 85:024bf7f99721 229 #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806))
bogdanm 85:024bf7f99721 230 /**
bogdanm 85:024bf7f99721 231 * @}
bogdanm 85:024bf7f99721 232 */
bogdanm 85:024bf7f99721 233
bogdanm 92:4fc01daae5a5 234 /** @defgroup FLASH_OB_Read_Protection FLASH OB Read Protection
bogdanm 85:024bf7f99721 235 * @{
bogdanm 85:024bf7f99721 236 */
bogdanm 85:024bf7f99721 237 #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
bogdanm 85:024bf7f99721 238 #define OB_RDP_LEVEL_1 ((uint8_t)0xBB)
bogdanm 85:024bf7f99721 239 #define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2
bogdanm 85:024bf7f99721 240 it's no more possible to go back to level 1 or 0 */
bogdanm 85:024bf7f99721 241 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
bogdanm 85:024bf7f99721 242 ((LEVEL) == OB_RDP_LEVEL_1))/*||\
bogdanm 85:024bf7f99721 243 ((LEVEL) == OB_RDP_LEVEL_2))*/
bogdanm 85:024bf7f99721 244 /**
bogdanm 85:024bf7f99721 245 * @}
bogdanm 85:024bf7f99721 246 */
bogdanm 85:024bf7f99721 247
bogdanm 92:4fc01daae5a5 248 /** @defgroup FLASH_OB_Watchdog FLASH OB Watchdog
bogdanm 85:024bf7f99721 249 * @{
bogdanm 85:024bf7f99721 250 */
bogdanm 85:024bf7f99721 251 #define OB_WDG_SW ((uint8_t)0x01) /*!< Software WDG selected */
bogdanm 85:024bf7f99721 252 #define OB_WDG_HW ((uint8_t)0x00) /*!< Hardware WDG selected */
bogdanm 85:024bf7f99721 253 #define IS_OB_WDG_SOURCE(SOURCE) (((SOURCE) == OB_WDG_SW) || ((SOURCE) == OB_WDG_HW))
bogdanm 85:024bf7f99721 254 /**
bogdanm 85:024bf7f99721 255 * @}
bogdanm 85:024bf7f99721 256 */
bogdanm 85:024bf7f99721 257
bogdanm 92:4fc01daae5a5 258 /** @defgroup FLASH_OB_nRST_STOP FLASH OB nRST STOP
bogdanm 85:024bf7f99721 259 * @{
bogdanm 85:024bf7f99721 260 */
bogdanm 85:024bf7f99721 261 #define OB_STOP_NO_RST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */
bogdanm 85:024bf7f99721 262 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
bogdanm 85:024bf7f99721 263 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
bogdanm 85:024bf7f99721 264 /**
bogdanm 85:024bf7f99721 265 * @}
bogdanm 85:024bf7f99721 266 */
bogdanm 85:024bf7f99721 267
bogdanm 92:4fc01daae5a5 268 /** @defgroup FLASH_OB_nRST_STDBY FLASH OB nRST STDBY
bogdanm 85:024bf7f99721 269 * @{
bogdanm 85:024bf7f99721 270 */
bogdanm 85:024bf7f99721 271 #define OB_STDBY_NO_RST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */
bogdanm 85:024bf7f99721 272 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
bogdanm 85:024bf7f99721 273 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
bogdanm 85:024bf7f99721 274 /**
bogdanm 85:024bf7f99721 275 * @}
bogdanm 85:024bf7f99721 276 */
bogdanm 85:024bf7f99721 277
bogdanm 92:4fc01daae5a5 278 /** @defgroup FLASH_OB_BOOT1 FLASH OB BOOT1
bogdanm 85:024bf7f99721 279 * @{
bogdanm 85:024bf7f99721 280 */
bogdanm 85:024bf7f99721 281 #define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */
bogdanm 85:024bf7f99721 282 #define OB_BOOT1_SET ((uint8_t)0x10) /*!< BOOT1 Set */
bogdanm 85:024bf7f99721 283 #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET))
bogdanm 85:024bf7f99721 284 /**
bogdanm 85:024bf7f99721 285 * @}
bogdanm 85:024bf7f99721 286 */
bogdanm 85:024bf7f99721 287
bogdanm 92:4fc01daae5a5 288 /** @defgroup FLASH_OB_VDDA_Analog_Monitoring FLASH OB VDDA Analog Monitoring
bogdanm 85:024bf7f99721 289 * @{
bogdanm 85:024bf7f99721 290 */
bogdanm 85:024bf7f99721 291 #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */
bogdanm 85:024bf7f99721 292 #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00) /*!< Analog monitoring on VDDA Power source OFF */
bogdanm 85:024bf7f99721 293 #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF))
bogdanm 85:024bf7f99721 294 /**
bogdanm 85:024bf7f99721 295 * @}
bogdanm 85:024bf7f99721 296 */
bogdanm 85:024bf7f99721 297
bogdanm 92:4fc01daae5a5 298 /** @defgroup FLASH_OB_RAM_Parity_Check_Enable FLASH OB RAM Parity Check Enable
bogdanm 85:024bf7f99721 299 * @{
bogdanm 85:024bf7f99721 300 */
bogdanm 85:024bf7f99721 301 #define OB_RAM_PARITY_CHECK_SET ((uint8_t)0x00) /*!< RAM parity check enable set */
bogdanm 85:024bf7f99721 302 #define OB_RAM_PARITY_CHECK_RESET ((uint8_t)0x40) /*!< RAM parity check enable reset */
bogdanm 85:024bf7f99721 303 #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_RAM_PARITY_CHECK_SET) || ((PARITY) == OB_RAM_PARITY_CHECK_RESET))
bogdanm 85:024bf7f99721 304 /**
bogdanm 85:024bf7f99721 305 * @}
bogdanm 85:024bf7f99721 306 */
bogdanm 85:024bf7f99721 307
bogdanm 92:4fc01daae5a5 308 /** @defgroup FLASH_Flag_definition FLASH Flag definition
bogdanm 85:024bf7f99721 309 * @{
bogdanm 85:024bf7f99721 310 */
bogdanm 85:024bf7f99721 311 #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */
bogdanm 85:024bf7f99721 312 #define FLASH_FLAG_PGERR FLASH_SR_PGERR /*!< FLASH Programming error flag */
bogdanm 85:024bf7f99721 313 #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */
bogdanm 85:024bf7f99721 314 #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */
bogdanm 85:024bf7f99721 315 /**
bogdanm 85:024bf7f99721 316 * @}
bogdanm 85:024bf7f99721 317 */
bogdanm 85:024bf7f99721 318
bogdanm 92:4fc01daae5a5 319 /** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition
bogdanm 85:024bf7f99721 320 * @{
bogdanm 85:024bf7f99721 321 */
bogdanm 85:024bf7f99721 322 #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */
bogdanm 85:024bf7f99721 323 #define FLASH_IT_ERR FLASH_CR_ERRIE /*!< Error Interrupt source */
bogdanm 85:024bf7f99721 324 /**
bogdanm 85:024bf7f99721 325 * @}
bogdanm 85:024bf7f99721 326 */
bogdanm 85:024bf7f99721 327
bogdanm 92:4fc01daae5a5 328 /** @defgroup FLASH_Timeout_definition FLASH Timeout definition
bogdanm 85:024bf7f99721 329 * @brief FLASH Timeout definition
bogdanm 85:024bf7f99721 330 * @{
bogdanm 85:024bf7f99721 331 */
bogdanm 85:024bf7f99721 332 #define HAL_FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
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 */
bogdanm 85:024bf7f99721 340
bogdanm 85:024bf7f99721 341 /* Exported macro ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 342
bogdanm 92:4fc01daae5a5 343 /** @defgroup FLASH_Exported_Macros FLASH Exported Macros
bogdanm 85:024bf7f99721 344 * @brief macros to control FLASH features
bogdanm 85:024bf7f99721 345 * @{
bogdanm 85:024bf7f99721 346 */
bogdanm 92:4fc01daae5a5 347
bogdanm 92:4fc01daae5a5 348 /** @defgroup FLASH_Latency FLASH Latency
bogdanm 92:4fc01daae5a5 349 * @brief macros to handle FLASH Latency
bogdanm 92:4fc01daae5a5 350 * @{
bogdanm 92:4fc01daae5a5 351 */
bogdanm 92:4fc01daae5a5 352
bogdanm 85:024bf7f99721 353 /**
bogdanm 85:024bf7f99721 354 * @brief Set the FLASH Latency.
bogdanm 85:024bf7f99721 355 * @param __LATENCY__: FLASH Latency
bogdanm 85:024bf7f99721 356 * The value of this parameter depend on device used within the same series
bogdanm 85:024bf7f99721 357 * @retval None
bogdanm 85:024bf7f99721 358 */
bogdanm 85:024bf7f99721 359 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__))
bogdanm 92:4fc01daae5a5 360 /**
bogdanm 92:4fc01daae5a5 361 * @}
bogdanm 92:4fc01daae5a5 362 */
bogdanm 85:024bf7f99721 363
bogdanm 92:4fc01daae5a5 364 /** @defgroup FLASH_Prefetch FLASH Prefetch
bogdanm 92:4fc01daae5a5 365 * @brief macros to handle FLASH Prefetch buffer
bogdanm 92:4fc01daae5a5 366 * @{
bogdanm 92:4fc01daae5a5 367 */
bogdanm 85:024bf7f99721 368 /**
bogdanm 85:024bf7f99721 369 * @brief Enable the FLASH prefetch buffer.
bogdanm 85:024bf7f99721 370 * @retval None
bogdanm 85:024bf7f99721 371 */
bogdanm 85:024bf7f99721 372 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE)
bogdanm 85:024bf7f99721 373
bogdanm 85:024bf7f99721 374 /**
bogdanm 85:024bf7f99721 375 * @brief Disable the FLASH prefetch buffer.
bogdanm 85:024bf7f99721 376 * @retval None
bogdanm 85:024bf7f99721 377 */
bogdanm 85:024bf7f99721 378 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE))
bogdanm 85:024bf7f99721 379
bogdanm 85:024bf7f99721 380 /**
bogdanm 85:024bf7f99721 381 * @}
bogdanm 92:4fc01daae5a5 382 */
bogdanm 85:024bf7f99721 383
bogdanm 92:4fc01daae5a5 384 /** @defgroup FLASH_Interrupt FLASH Interrupt
bogdanm 85:024bf7f99721 385 * @brief macros to handle FLASH interrupts
bogdanm 85:024bf7f99721 386 * @{
bogdanm 85:024bf7f99721 387 */
bogdanm 85:024bf7f99721 388
bogdanm 85:024bf7f99721 389 /**
bogdanm 85:024bf7f99721 390 * @brief Enable the specified FLASH interrupt.
bogdanm 85:024bf7f99721 391 * @param __INTERRUPT__ : FLASH interrupt
bogdanm 85:024bf7f99721 392 * This parameter can be any combination of the following values:
bogdanm 85:024bf7f99721 393 * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
bogdanm 85:024bf7f99721 394 * @arg FLASH_IT_ERR: Error Interrupt
bogdanm 85:024bf7f99721 395 * @retval none
bogdanm 85:024bf7f99721 396 */
bogdanm 85:024bf7f99721 397 #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
bogdanm 85:024bf7f99721 398
bogdanm 85:024bf7f99721 399 /**
bogdanm 85:024bf7f99721 400 * @brief Disable the specified FLASH interrupt.
bogdanm 85:024bf7f99721 401 * @param __INTERRUPT__ : FLASH interrupt
bogdanm 85:024bf7f99721 402 * This parameter can be any combination of the following values:
bogdanm 85:024bf7f99721 403 * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
bogdanm 85:024bf7f99721 404 * @arg FLASH_IT_ERR: Error Interrupt
bogdanm 85:024bf7f99721 405 * @retval none
bogdanm 85:024bf7f99721 406 */
bogdanm 85:024bf7f99721 407 #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__))
bogdanm 85:024bf7f99721 408
bogdanm 85:024bf7f99721 409 /**
bogdanm 85:024bf7f99721 410 * @brief Get the specified FLASH flag status.
bogdanm 85:024bf7f99721 411 * @param __FLAG__: specifies the FLASH flag to check.
bogdanm 85:024bf7f99721 412 * This parameter can be one of the following values:
bogdanm 85:024bf7f99721 413 * @arg FLASH_FLAG_EOP : FLASH End of Operation flag
bogdanm 85:024bf7f99721 414 * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
bogdanm 85:024bf7f99721 415 * @arg FLASH_FLAG_PGERR : FLASH Programming error flag
bogdanm 85:024bf7f99721 416 * @arg FLASH_FLAG_BSY : FLASH Busy flag
bogdanm 85:024bf7f99721 417 * @retval The new state of __FLAG__ (SET or RESET).
bogdanm 85:024bf7f99721 418 */
bogdanm 85:024bf7f99721 419 #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)) == (__FLAG__))
bogdanm 85:024bf7f99721 420
bogdanm 85:024bf7f99721 421 /**
bogdanm 85:024bf7f99721 422 * @brief Clear the specified FLASH flag.
bogdanm 85:024bf7f99721 423 * @param __FLAG__: specifies the FLASH flags to clear.
bogdanm 85:024bf7f99721 424 * This parameter can be any combination of the following values:
bogdanm 85:024bf7f99721 425 * @arg FLASH_FLAG_EOP : FLASH End of Operation flag
bogdanm 85:024bf7f99721 426 * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
bogdanm 85:024bf7f99721 427 * @arg FLASH_FLAG_PGERR : FLASH Programming error flag
bogdanm 85:024bf7f99721 428 * @retval none
bogdanm 85:024bf7f99721 429 */
bogdanm 85:024bf7f99721 430 #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__))
bogdanm 85:024bf7f99721 431
bogdanm 85:024bf7f99721 432 /**
bogdanm 85:024bf7f99721 433 * @}
bogdanm 85:024bf7f99721 434 */
bogdanm 85:024bf7f99721 435
bogdanm 92:4fc01daae5a5 436 /**
bogdanm 92:4fc01daae5a5 437 * @}
bogdanm 92:4fc01daae5a5 438 */
bogdanm 92:4fc01daae5a5 439
bogdanm 85:024bf7f99721 440 /* Include FLASH HAL Extension module */
bogdanm 85:024bf7f99721 441 #include "stm32f0xx_hal_flash_ex.h"
bogdanm 85:024bf7f99721 442
bogdanm 85:024bf7f99721 443 /* Exported functions --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 444
bogdanm 92:4fc01daae5a5 445 /** @addtogroup FLASH_Exported_Functions
bogdanm 85:024bf7f99721 446 * @{
bogdanm 85:024bf7f99721 447 */
bogdanm 85:024bf7f99721 448
bogdanm 92:4fc01daae5a5 449 /** @addtogroup FLASH_Exported_Functions_Group1
bogdanm 92:4fc01daae5a5 450 * @brief Data transfers functions
bogdanm 92:4fc01daae5a5 451 * @{
bogdanm 92:4fc01daae5a5 452 */
bogdanm 92:4fc01daae5a5 453
bogdanm 85:024bf7f99721 454 /* IO operation functions *****************************************************/
bogdanm 85:024bf7f99721 455 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
bogdanm 85:024bf7f99721 456 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
bogdanm 85:024bf7f99721 457
bogdanm 85:024bf7f99721 458 /* FLASH IRQ handler method */
bogdanm 85:024bf7f99721 459 void HAL_FLASH_IRQHandler(void);
bogdanm 85:024bf7f99721 460 /* Callbacks in non blocking modes */
bogdanm 85:024bf7f99721 461 void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
bogdanm 85:024bf7f99721 462 void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
bogdanm 85:024bf7f99721 463
bogdanm 92:4fc01daae5a5 464 /**
bogdanm 92:4fc01daae5a5 465 * @}
bogdanm 92:4fc01daae5a5 466 */
bogdanm 92:4fc01daae5a5 467
bogdanm 92:4fc01daae5a5 468 /** @addtogroup FLASH_Exported_Functions_Group2
bogdanm 92:4fc01daae5a5 469 * @brief management functions
bogdanm 92:4fc01daae5a5 470 * @{
bogdanm 92:4fc01daae5a5 471 */
bogdanm 92:4fc01daae5a5 472
bogdanm 92:4fc01daae5a5 473 /* FLASH Memory Programming functions *****************************************/
bogdanm 85:024bf7f99721 474 HAL_StatusTypeDef HAL_FLASH_Unlock(void);
bogdanm 85:024bf7f99721 475 HAL_StatusTypeDef HAL_FLASH_Lock(void);
bogdanm 92:4fc01daae5a5 476
bogdanm 92:4fc01daae5a5 477 /* Option Bytes Programming functions *****************************************/
bogdanm 85:024bf7f99721 478 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
bogdanm 85:024bf7f99721 479 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
bogdanm 85:024bf7f99721 480 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
bogdanm 85:024bf7f99721 481
bogdanm 92:4fc01daae5a5 482 /**
bogdanm 92:4fc01daae5a5 483 * @}
bogdanm 92:4fc01daae5a5 484 */
bogdanm 92:4fc01daae5a5 485
bogdanm 92:4fc01daae5a5 486 /** @addtogroup FLASH_Exported_Functions_Group3
bogdanm 92:4fc01daae5a5 487 * @{
bogdanm 92:4fc01daae5a5 488 */
bogdanm 85:024bf7f99721 489 /* Peripheral State and Error functions ***************************************/
Kojto 93:e188a91d3eaa 490 uint32_t HAL_FLASH_GetError(void);
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 85:024bf7f99721 502 */
bogdanm 85:024bf7f99721 503
bogdanm 92:4fc01daae5a5 504 /**
bogdanm 92:4fc01daae5a5 505 * @}
bogdanm 92:4fc01daae5a5 506 */
bogdanm 92:4fc01daae5a5 507
bogdanm 85:024bf7f99721 508 #ifdef __cplusplus
bogdanm 85:024bf7f99721 509 }
bogdanm 85:024bf7f99721 510 #endif
bogdanm 85:024bf7f99721 511
bogdanm 85:024bf7f99721 512 #endif /* __STM32F0xx_HAL_FLASH_H */
bogdanm 85:024bf7f99721 513
bogdanm 85:024bf7f99721 514 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 515