mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jul 02 13:22:23 2014 +0100
Revision:
86:04dd9b1680ae
Child:
92:4fc01daae5a5
Release 86 of the mbed library

Main changes:


- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets

Who changed what in which revision?

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