mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Oct 09 08:15:07 2014 +0100
Revision:
340:28d1f895c6fe
Synchronized with git revision b5a4c8e80393336b2656fb29ab46d405d3068602

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

HAL: nrf51822 - Few fixes for PWM and Serial

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