Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed May 27 08:07:35 2015 +0100
Revision:
100:cbbeb26dbd92
Release 100 of the mbed library

Changes:
- new target: DISCOF334C8
- API: Ticker/Timer bugfix with constness
- Silabs: RTC, PWM, Serial clocks bufixes
- Renesas: i2c bugfix
- Maxim: 326000 - pin definitions for v2, spi freq fix

Who changed what in which revision?

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