mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Tue Jan 06 16:15:36 2015 +0000
Revision:
441:d2c15dda23c1
Parent:
392:2b59412bb664
Child:
630:825f75ca301e
Synchronized with git revision 245a60b29caabb42eabdd19658eeac7c3f68313b

Full URL: https://github.com/mbedmicro/mbed/commit/245a60b29caabb42eabdd19658eeac7c3f68313b/

NUCLEO_F072RB/F091RC - adding target to rtos lib and exporter for coide and gcc_arm

Who changed what in which revision?

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