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