mbed library sources

Fork of mbed-src by mbed official

Committer:
lzbpli
Date:
Thu Jul 07 06:48:59 2016 +0000
Revision:
636:b0d178e9fa10
Parent:
610:813dcc80987e
l053

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 610:813dcc80987e 1 /**
mbed_official 610:813dcc80987e 2 ******************************************************************************
mbed_official 610:813dcc80987e 3 * @file stm32l4xx_hal_flash.h
mbed_official 610:813dcc80987e 4 * @author MCD Application Team
mbed_official 610:813dcc80987e 5 * @version V1.0.0
mbed_official 610:813dcc80987e 6 * @date 26-June-2015
mbed_official 610:813dcc80987e 7 * @brief Header file of FLASH HAL module.
mbed_official 610:813dcc80987e 8 ******************************************************************************
mbed_official 610:813dcc80987e 9 * @attention
mbed_official 610:813dcc80987e 10 *
mbed_official 610:813dcc80987e 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 610:813dcc80987e 12 *
mbed_official 610:813dcc80987e 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 610:813dcc80987e 14 * are permitted provided that the following conditions are met:
mbed_official 610:813dcc80987e 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 610:813dcc80987e 16 * this list of conditions and the following disclaimer.
mbed_official 610:813dcc80987e 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 610:813dcc80987e 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 610:813dcc80987e 19 * and/or other materials provided with the distribution.
mbed_official 610:813dcc80987e 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 610:813dcc80987e 21 * may be used to endorse or promote products derived from this software
mbed_official 610:813dcc80987e 22 * without specific prior written permission.
mbed_official 610:813dcc80987e 23 *
mbed_official 610:813dcc80987e 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 610:813dcc80987e 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 610:813dcc80987e 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 610:813dcc80987e 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 610:813dcc80987e 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 610:813dcc80987e 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 610:813dcc80987e 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 610:813dcc80987e 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 610:813dcc80987e 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 610:813dcc80987e 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 610:813dcc80987e 34 *
mbed_official 610:813dcc80987e 35 ******************************************************************************
mbed_official 610:813dcc80987e 36 */
mbed_official 610:813dcc80987e 37
mbed_official 610:813dcc80987e 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 610:813dcc80987e 39 #ifndef __STM32L4xx_HAL_FLASH_H
mbed_official 610:813dcc80987e 40 #define __STM32L4xx_HAL_FLASH_H
mbed_official 610:813dcc80987e 41
mbed_official 610:813dcc80987e 42 #ifdef __cplusplus
mbed_official 610:813dcc80987e 43 extern "C" {
mbed_official 610:813dcc80987e 44 #endif
mbed_official 610:813dcc80987e 45
mbed_official 610:813dcc80987e 46 /* Includes ------------------------------------------------------------------*/
mbed_official 610:813dcc80987e 47 #include "stm32l4xx_hal_def.h"
mbed_official 610:813dcc80987e 48
mbed_official 610:813dcc80987e 49 /** @addtogroup STM32L4xx_HAL_Driver
mbed_official 610:813dcc80987e 50 * @{
mbed_official 610:813dcc80987e 51 */
mbed_official 610:813dcc80987e 52
mbed_official 610:813dcc80987e 53 /** @addtogroup FLASH
mbed_official 610:813dcc80987e 54 * @{
mbed_official 610:813dcc80987e 55 */
mbed_official 610:813dcc80987e 56
mbed_official 610:813dcc80987e 57 /* Exported types ------------------------------------------------------------*/
mbed_official 610:813dcc80987e 58 /** @defgroup FLASH_Exported_Types FLASH Exported Types
mbed_official 610:813dcc80987e 59 * @{
mbed_official 610:813dcc80987e 60 */
mbed_official 610:813dcc80987e 61
mbed_official 610:813dcc80987e 62 /**
mbed_official 610:813dcc80987e 63 * @brief FLASH Erase structure definition
mbed_official 610:813dcc80987e 64 */
mbed_official 610:813dcc80987e 65 typedef struct
mbed_official 610:813dcc80987e 66 {
mbed_official 610:813dcc80987e 67 uint32_t TypeErase; /*!< Mass erase or page erase.
mbed_official 610:813dcc80987e 68 This parameter can be a value of @ref FLASH_Type_Erase */
mbed_official 610:813dcc80987e 69 uint32_t Banks; /*!< Select bank to erase.
mbed_official 610:813dcc80987e 70 This parameter must be a value of @ref FLASH_Banks
mbed_official 610:813dcc80987e 71 (FLASH_BANK_BOTH should be used only for mass erase) */
mbed_official 610:813dcc80987e 72 uint32_t Page; /*!< Initial Flash page to erase when page erase is disabled
mbed_official 610:813dcc80987e 73 This parameter must be a value between 0 and (max number of pages in the bank - 1)
mbed_official 610:813dcc80987e 74 (eg : 255 for 1MB dual bank) */
mbed_official 610:813dcc80987e 75 uint32_t NbPages; /*!< Number of pages to be erased.
mbed_official 610:813dcc80987e 76 This parameter must be a value between 1 and (max number of pages in the bank - value of initial page)*/
mbed_official 610:813dcc80987e 77 } FLASH_EraseInitTypeDef;
mbed_official 610:813dcc80987e 78
mbed_official 610:813dcc80987e 79 /**
mbed_official 610:813dcc80987e 80 * @brief FLASH Option Bytes Program structure definition
mbed_official 610:813dcc80987e 81 */
mbed_official 610:813dcc80987e 82 typedef struct
mbed_official 610:813dcc80987e 83 {
mbed_official 610:813dcc80987e 84 uint32_t OptionType; /*!< Option byte to be configured.
mbed_official 610:813dcc80987e 85 This parameter can be a combination of the values of @ref FLASH_OB_Type */
mbed_official 610:813dcc80987e 86 uint32_t WRPArea; /*!< Write protection area to be programmed (used for OPTIONBYTE_WRP).
mbed_official 610:813dcc80987e 87 Only one WRP area could be programmed at the same time.
mbed_official 610:813dcc80987e 88 This parameter can be value of @ref FLASH_OB_WRP_Area */
mbed_official 610:813dcc80987e 89 uint32_t WRPStartOffset; /*!< Write protection start offset (used for OPTIONBYTE_WRP).
mbed_official 610:813dcc80987e 90 This parameter must be a value between 0 and (max number of pages in the bank - 1)
mbed_official 610:813dcc80987e 91 (eg : 25 for 1MB dual bank) */
mbed_official 610:813dcc80987e 92 uint32_t WRPEndOffset; /*!< Write protection end offset (used for OPTIONBYTE_WRP).
mbed_official 610:813dcc80987e 93 This parameter must be a value between WRPStartOffset and (max number of pages in the bank - 1) */
mbed_official 610:813dcc80987e 94 uint32_t RDPLevel; /*!< Set the read protection level.. (used for OPTIONBYTE_RDP).
mbed_official 610:813dcc80987e 95 This parameter can be a value of @ref FLASH_OB_Read_Protection */
mbed_official 610:813dcc80987e 96 uint32_t USERType; /*!< User option byte(s) to be configured (used for OPTIONBYTE_USER).
mbed_official 610:813dcc80987e 97 This parameter can be a combination of @ref FLASH_OB_USER_Type */
mbed_official 610:813dcc80987e 98 uint32_t USERConfig; /*!< Value of the user option byte (used for OPTIONBYTE_USER).
mbed_official 610:813dcc80987e 99 This parameter can be a combination of @ref FLASH_OB_USER_BOR_LEVEL,
mbed_official 610:813dcc80987e 100 @ref FLASH_OB_USER_nRST_STOP, @ref FLASH_OB_USER_nRST_STANDBY,
mbed_official 610:813dcc80987e 101 @ref FLASH_OB_USER_IWDG_SW, @ref FLASH_OB_USER_IWDG_STOP,
mbed_official 610:813dcc80987e 102 @ref FLASH_OB_USER_IWDG_STANDBY, @ref FLASH_OB_USER_WWDG_SW,
mbed_official 610:813dcc80987e 103 @ref FLASH_OB_USER_BFB2, @ref IS_OB_USER_DUALBANK,
mbed_official 610:813dcc80987e 104 @ref IS_OB_USER_BOOT1, @ref FLASH_OB_USER_SRAM2_PE and
mbed_official 610:813dcc80987e 105 @ref FLASH_OB_USER_SRAM2_RST */
mbed_official 610:813dcc80987e 106 uint32_t PCROPConfig; /*!< Configuration of the PCROP (used for OPTIONBYTE_PCROP).
mbed_official 610:813dcc80987e 107 This parameter must be a combination of @ref FLASH_Banks (except FLASH_BANK_BOTH)
mbed_official 610:813dcc80987e 108 and @ref FLASH_OB_PCROP_RDP */
mbed_official 610:813dcc80987e 109 uint32_t PCROPStartAddr; /*!< PCROP Start address (used for OPTIONBYTE_PCROP).
mbed_official 610:813dcc80987e 110 This parameter must be a value between begin and end of bank
mbed_official 610:813dcc80987e 111 => Be careful of the bank swapping for the address */
mbed_official 610:813dcc80987e 112 uint32_t PCROPEndAddr; /*!< PCROP End address (used for OPTIONBYTE_PCROP).
mbed_official 610:813dcc80987e 113 This parameter must be a value between PCROP Start address and end of bank */
mbed_official 610:813dcc80987e 114 } FLASH_OBProgramInitTypeDef;
mbed_official 610:813dcc80987e 115
mbed_official 610:813dcc80987e 116 /**
mbed_official 610:813dcc80987e 117 * @brief FLASH Procedure structure definition
mbed_official 610:813dcc80987e 118 */
mbed_official 610:813dcc80987e 119 typedef enum
mbed_official 610:813dcc80987e 120 {
mbed_official 610:813dcc80987e 121 FLASH_PROC_NONE = 0,
mbed_official 610:813dcc80987e 122 FLASH_PROC_PAGE_ERASE,
mbed_official 610:813dcc80987e 123 FLASH_PROC_MASS_ERASE,
mbed_official 610:813dcc80987e 124 FLASH_PROC_PROGRAM,
mbed_official 610:813dcc80987e 125 FLASH_PROC_PROGRAM_LAST
mbed_official 610:813dcc80987e 126 } FLASH_ProcedureTypeDef;
mbed_official 610:813dcc80987e 127
mbed_official 610:813dcc80987e 128 /**
mbed_official 610:813dcc80987e 129 * @brief FLASH handle Structure definition
mbed_official 610:813dcc80987e 130 */
mbed_official 610:813dcc80987e 131 typedef struct
mbed_official 610:813dcc80987e 132 {
mbed_official 610:813dcc80987e 133 HAL_LockTypeDef Lock; /* FLASH locking object */
mbed_official 610:813dcc80987e 134 __IO uint32_t ErrorCode; /* FLASH error code */
mbed_official 610:813dcc80987e 135 __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */
mbed_official 610:813dcc80987e 136 __IO uint32_t Address; /* Internal variable to save address selected for program in IT context */
mbed_official 610:813dcc80987e 137 __IO uint32_t Bank; /* Internal variable to save current bank selected during erase in IT context */
mbed_official 610:813dcc80987e 138 __IO uint32_t Page; /* Internal variable to define the current page which is erasing in IT context */
mbed_official 610:813dcc80987e 139 __IO uint32_t NbPagesToErase; /* Internal variable to save the remaining pages to erase in IT context */
mbed_official 610:813dcc80987e 140 }FLASH_ProcessTypeDef;
mbed_official 610:813dcc80987e 141
mbed_official 610:813dcc80987e 142 /**
mbed_official 610:813dcc80987e 143 * @}
mbed_official 610:813dcc80987e 144 */
mbed_official 610:813dcc80987e 145
mbed_official 610:813dcc80987e 146 /* Exported constants --------------------------------------------------------*/
mbed_official 610:813dcc80987e 147 /** @defgroup FLASH_Exported_Constants FLASH Exported Constants
mbed_official 610:813dcc80987e 148 * @{
mbed_official 610:813dcc80987e 149 */
mbed_official 610:813dcc80987e 150
mbed_official 610:813dcc80987e 151 /** @defgroup FLASH_Error FLASH Error
mbed_official 610:813dcc80987e 152 * @{
mbed_official 610:813dcc80987e 153 */
mbed_official 610:813dcc80987e 154 #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00000000)
mbed_official 610:813dcc80987e 155 #define HAL_FLASH_ERROR_OP ((uint32_t)0x00000001)
mbed_official 610:813dcc80987e 156 #define HAL_FLASH_ERROR_PROG ((uint32_t)0x00000002)
mbed_official 610:813dcc80987e 157 #define HAL_FLASH_ERROR_WRP ((uint32_t)0x00000004)
mbed_official 610:813dcc80987e 158 #define HAL_FLASH_ERROR_PGA ((uint32_t)0x00000008)
mbed_official 610:813dcc80987e 159 #define HAL_FLASH_ERROR_SIZ ((uint32_t)0x00000010)
mbed_official 610:813dcc80987e 160 #define HAL_FLASH_ERROR_PGS ((uint32_t)0x00000020)
mbed_official 610:813dcc80987e 161 #define HAL_FLASH_ERROR_MIS ((uint32_t)0x00000040)
mbed_official 610:813dcc80987e 162 #define HAL_FLASH_ERROR_FAST ((uint32_t)0x00000080)
mbed_official 610:813dcc80987e 163 #define HAL_FLASH_ERROR_RD ((uint32_t)0x00000100)
mbed_official 610:813dcc80987e 164 #define HAL_FLASH_ERROR_OPTV ((uint32_t)0x00000200)
mbed_official 610:813dcc80987e 165 #define HAL_FLASH_ERROR_ECCD ((uint32_t)0x00000400)
mbed_official 610:813dcc80987e 166 /**
mbed_official 610:813dcc80987e 167 * @}
mbed_official 610:813dcc80987e 168 */
mbed_official 610:813dcc80987e 169
mbed_official 610:813dcc80987e 170 /** @defgroup FLASH_Type_Erase FLASH Erase Type
mbed_official 610:813dcc80987e 171 * @{
mbed_official 610:813dcc80987e 172 */
mbed_official 610:813dcc80987e 173 #define FLASH_TYPEERASE_PAGES ((uint32_t)0x00) /*!<Pages erase only*/
mbed_official 610:813dcc80987e 174 #define FLASH_TYPEERASE_MASSERASE ((uint32_t)0x01) /*!<Flash mass erase activation*/
mbed_official 610:813dcc80987e 175 /**
mbed_official 610:813dcc80987e 176 * @}
mbed_official 610:813dcc80987e 177 */
mbed_official 610:813dcc80987e 178
mbed_official 610:813dcc80987e 179 /** @defgroup FLASH_Banks FLASH Banks
mbed_official 610:813dcc80987e 180 * @{
mbed_official 610:813dcc80987e 181 */
mbed_official 610:813dcc80987e 182 #define FLASH_BANK_1 ((uint32_t)0x01) /*!< Bank 1 */
mbed_official 610:813dcc80987e 183 #define FLASH_BANK_2 ((uint32_t)0x02) /*!< Bank 2 */
mbed_official 610:813dcc80987e 184 #define FLASH_BANK_BOTH ((uint32_t)(FLASH_BANK_1 | FLASH_BANK_2)) /*!< Bank1 and Bank2 */
mbed_official 610:813dcc80987e 185 /**
mbed_official 610:813dcc80987e 186 * @}
mbed_official 610:813dcc80987e 187 */
mbed_official 610:813dcc80987e 188
mbed_official 610:813dcc80987e 189
mbed_official 610:813dcc80987e 190 /** @defgroup FLASH_Type_Program FLASH Program Type
mbed_official 610:813dcc80987e 191 * @{
mbed_official 610:813dcc80987e 192 */
mbed_official 610:813dcc80987e 193 #define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x00) /*!<Program a double-word (64-bit) at a specified address.*/
mbed_official 610:813dcc80987e 194 #define FLASH_TYPEPROGRAM_FAST ((uint32_t)0x01) /*!<Fast program a 32 row double-word (64-bit) at a specified address.
mbed_official 610:813dcc80987e 195 And another 32 row double-word (64-bit) will be programmed */
mbed_official 610:813dcc80987e 196 #define FLASH_TYPEPROGRAM_FAST_AND_LAST ((uint32_t)0x02) /*!<Fast program a 32 row double-word (64-bit) at a specified address.
mbed_official 610:813dcc80987e 197 And this is the last 32 row double-word (64-bit) programmed */
mbed_official 610:813dcc80987e 198 /**
mbed_official 610:813dcc80987e 199 * @}
mbed_official 610:813dcc80987e 200 */
mbed_official 610:813dcc80987e 201
mbed_official 610:813dcc80987e 202 /** @defgroup FLASH_OB_Type FLASH Option Bytes Type
mbed_official 610:813dcc80987e 203 * @{
mbed_official 610:813dcc80987e 204 */
mbed_official 610:813dcc80987e 205 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!< WRP option byte configuration */
mbed_official 610:813dcc80987e 206 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!< RDP option byte configuration */
mbed_official 610:813dcc80987e 207 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!< USER option byte configuration */
mbed_official 610:813dcc80987e 208 #define OPTIONBYTE_PCROP ((uint32_t)0x08) /*!< PCROP option byte configuration */
mbed_official 610:813dcc80987e 209 /**
mbed_official 610:813dcc80987e 210 * @}
mbed_official 610:813dcc80987e 211 */
mbed_official 610:813dcc80987e 212
mbed_official 610:813dcc80987e 213 /** @defgroup FLASH_OB_WRP_Area FLASH WRP Area
mbed_official 610:813dcc80987e 214 * @{
mbed_official 610:813dcc80987e 215 */
mbed_official 610:813dcc80987e 216 #define OB_WRPAREA_BANK1_AREAA ((uint32_t)0x00) /*!< Flash Bank 1 Area A */
mbed_official 610:813dcc80987e 217 #define OB_WRPAREA_BANK1_AREAB ((uint32_t)0x01) /*!< Flash Bank 1 Area B */
mbed_official 610:813dcc80987e 218 #define OB_WRPAREA_BANK2_AREAA ((uint32_t)0x02) /*!< Flash Bank 2 Area A */
mbed_official 610:813dcc80987e 219 #define OB_WRPAREA_BANK2_AREAB ((uint32_t)0x04) /*!< Flash Bank 2 Area B */
mbed_official 610:813dcc80987e 220 /**
mbed_official 610:813dcc80987e 221 * @}
mbed_official 610:813dcc80987e 222 */
mbed_official 610:813dcc80987e 223
mbed_official 610:813dcc80987e 224 /** @defgroup FLASH_OB_Read_Protection FLASH Option Bytes Read Protection
mbed_official 610:813dcc80987e 225 * @{
mbed_official 610:813dcc80987e 226 */
mbed_official 610:813dcc80987e 227 #define OB_RDP_LEVEL_0 ((uint32_t)0xAA)
mbed_official 610:813dcc80987e 228 #define OB_RDP_LEVEL_1 ((uint32_t)0xBB)
mbed_official 610:813dcc80987e 229 #define OB_RDP_LEVEL_2 ((uint32_t)0xCC) /*!< Warning: When enabling read protection level 2
mbed_official 610:813dcc80987e 230 it's no more possible to go back to level 1 or 0 */
mbed_official 610:813dcc80987e 231 /**
mbed_official 610:813dcc80987e 232 * @}
mbed_official 610:813dcc80987e 233 */
mbed_official 610:813dcc80987e 234
mbed_official 610:813dcc80987e 235 /** @defgroup FLASH_OB_USER_Type FLASH Option Bytes User Type
mbed_official 610:813dcc80987e 236 * @{
mbed_official 610:813dcc80987e 237 */
mbed_official 610:813dcc80987e 238 #define OB_USER_BOR_LEV ((uint32_t)0x001) /*!< BOR reset Level */
mbed_official 610:813dcc80987e 239 #define OB_USER_nRST_STOP ((uint32_t)0x002) /*!< Reset generated when entering the stop mode */
mbed_official 610:813dcc80987e 240 #define OB_USER_nRST_STDBY ((uint32_t)0x004) /*!< Reset generated when entering the standby mode */
mbed_official 610:813dcc80987e 241 #define OB_USER_IWDG_SW ((uint32_t)0x008) /*!< Independent watchdog selection */
mbed_official 610:813dcc80987e 242 #define OB_USER_IWDG_STOP ((uint32_t)0x010) /*!< Independent watchdog counter freeze in stop mode */
mbed_official 610:813dcc80987e 243 #define OB_USER_IWDG_STDBY ((uint32_t)0x020) /*!< Independent watchdog counter freeze in standby mode */
mbed_official 610:813dcc80987e 244 #define OB_USER_WWDG_SW ((uint32_t)0x040) /*!< Window watchdog selection */
mbed_official 610:813dcc80987e 245 #define OB_USER_BFB2 ((uint32_t)0x080) /*!< Dual-bank boot */
mbed_official 610:813dcc80987e 246 #define OB_USER_DUALBANK ((uint32_t)0x100) /*!< Dual-Bank on 512KB or 256KB Flash memory devices */
mbed_official 610:813dcc80987e 247 #define OB_USER_nBOOT1 ((uint32_t)0x200) /*!< Boot configuration */
mbed_official 610:813dcc80987e 248 #define OB_USER_SRAM2_PE ((uint32_t)0x400) /*!< SRAM2 parity check enable */
mbed_official 610:813dcc80987e 249 #define OB_USER_SRAM2_RST ((uint32_t)0x800) /*!< SRAM2 Erase when system reset */
mbed_official 610:813dcc80987e 250 /**
mbed_official 610:813dcc80987e 251 * @}
mbed_official 610:813dcc80987e 252 */
mbed_official 610:813dcc80987e 253
mbed_official 610:813dcc80987e 254 /** @defgroup FLASH_OB_USER_BOR_LEVEL FLASH Option Bytes User BOR Level
mbed_official 610:813dcc80987e 255 * @{
mbed_official 610:813dcc80987e 256 */
mbed_official 610:813dcc80987e 257 #define OB_BOR_LEVEL_0 ((uint32_t)0x0000) /*!< Reset level threshold is around 1.7V */
mbed_official 610:813dcc80987e 258 #define OB_BOR_LEVEL_1 ((uint32_t)0x0100) /*!< Reset level threshold is around 2.0V */
mbed_official 610:813dcc80987e 259 #define OB_BOR_LEVEL_2 ((uint32_t)0x0200) /*!< Reset level threshold is around 2.2V */
mbed_official 610:813dcc80987e 260 #define OB_BOR_LEVEL_3 ((uint32_t)0x0300) /*!< Reset level threshold is around 2.5V */
mbed_official 610:813dcc80987e 261 #define OB_BOR_LEVEL_4 ((uint32_t)0x0400) /*!< Reset level threshold is around 2.8V */
mbed_official 610:813dcc80987e 262 /**
mbed_official 610:813dcc80987e 263 * @}
mbed_official 610:813dcc80987e 264 */
mbed_official 610:813dcc80987e 265
mbed_official 610:813dcc80987e 266 /** @defgroup FLASH_OB_USER_nRST_STOP FLASH Option Bytes User Reset On Stop
mbed_official 610:813dcc80987e 267 * @{
mbed_official 610:813dcc80987e 268 */
mbed_official 610:813dcc80987e 269 #define OB_STOP_RST ((uint32_t)0x0000) /*!< Reset generated when entering the stop mode */
mbed_official 610:813dcc80987e 270 #define OB_STOP_NORST ((uint32_t)0x1000) /*!< No reset generated when entering the stop mode */
mbed_official 610:813dcc80987e 271 /**
mbed_official 610:813dcc80987e 272 * @}
mbed_official 610:813dcc80987e 273 */
mbed_official 610:813dcc80987e 274
mbed_official 610:813dcc80987e 275 /** @defgroup FLASH_OB_USER_nRST_STANDBY FLASH Option Bytes User Reset On Standby
mbed_official 610:813dcc80987e 276 * @{
mbed_official 610:813dcc80987e 277 */
mbed_official 610:813dcc80987e 278 #define OB_STANDBY_RST ((uint32_t)0x0000) /*!< Reset generated when entering the standby mode */
mbed_official 610:813dcc80987e 279 #define OB_STANDBY_NORST ((uint32_t)0x2000) /*!< No reset generated when entering the standby mode */
mbed_official 610:813dcc80987e 280 /**
mbed_official 610:813dcc80987e 281 * @}
mbed_official 610:813dcc80987e 282 */
mbed_official 610:813dcc80987e 283
mbed_official 610:813dcc80987e 284 /** @defgroup FLASH_OB_USER_IWDG_SW FLASH Option Bytes User IWDG Type
mbed_official 610:813dcc80987e 285 * @{
mbed_official 610:813dcc80987e 286 */
mbed_official 610:813dcc80987e 287 #define OB_IWDG_HW ((uint32_t)0x00000) /*!< Hardware independent watchdog */
mbed_official 610:813dcc80987e 288 #define OB_IWDG_SW ((uint32_t)0x10000) /*!< Software independent watchdog */
mbed_official 610:813dcc80987e 289 /**
mbed_official 610:813dcc80987e 290 * @}
mbed_official 610:813dcc80987e 291 */
mbed_official 610:813dcc80987e 292
mbed_official 610:813dcc80987e 293 /** @defgroup FLASH_OB_USER_IWDG_STOP FLASH Option Bytes User IWDG Mode On Stop
mbed_official 610:813dcc80987e 294 * @{
mbed_official 610:813dcc80987e 295 */
mbed_official 610:813dcc80987e 296 #define OB_IWDG_STOP_FREEZE ((uint32_t)0x00000) /*!< Independent watchdog counter is frozen in Stop mode */
mbed_official 610:813dcc80987e 297 #define OB_IWDG_STOP_RUN ((uint32_t)0x20000) /*!< Independent watchdog counter is running in Stop mode */
mbed_official 610:813dcc80987e 298 /**
mbed_official 610:813dcc80987e 299 * @}
mbed_official 610:813dcc80987e 300 */
mbed_official 610:813dcc80987e 301
mbed_official 610:813dcc80987e 302 /** @defgroup FLASH_OB_USER_IWDG_STANDBY FLASH Option Bytes User IWDG Mode On Standby
mbed_official 610:813dcc80987e 303 * @{
mbed_official 610:813dcc80987e 304 */
mbed_official 610:813dcc80987e 305 #define OB_IWDG_STDBY_FREEZE ((uint32_t)0x00000) /*!< Independent watchdog counter is frozen in Standby mode */
mbed_official 610:813dcc80987e 306 #define OB_IWDG_STDBY_RUN ((uint32_t)0x40000) /*!< Independent watchdog counter is running in Standby mode */
mbed_official 610:813dcc80987e 307 /**
mbed_official 610:813dcc80987e 308 * @}
mbed_official 610:813dcc80987e 309 */
mbed_official 610:813dcc80987e 310
mbed_official 610:813dcc80987e 311 /** @defgroup FLASH_OB_USER_WWDG_SW FLASH Option Bytes User WWDG Type
mbed_official 610:813dcc80987e 312 * @{
mbed_official 610:813dcc80987e 313 */
mbed_official 610:813dcc80987e 314 #define OB_WWDG_HW ((uint32_t)0x00000) /*!< Hardware window watchdog */
mbed_official 610:813dcc80987e 315 #define OB_WWDG_SW ((uint32_t)0x80000) /*!< Software window watchdog */
mbed_official 610:813dcc80987e 316 /**
mbed_official 610:813dcc80987e 317 * @}
mbed_official 610:813dcc80987e 318 */
mbed_official 610:813dcc80987e 319
mbed_official 610:813dcc80987e 320 /** @defgroup FLASH_OB_USER_BFB2 FLASH Option Bytes User BFB2 Mode
mbed_official 610:813dcc80987e 321 * @{
mbed_official 610:813dcc80987e 322 */
mbed_official 610:813dcc80987e 323 #define OB_BFB2_DISABLE ((uint32_t)0x000000) /*!< Dual-bank boot disable */
mbed_official 610:813dcc80987e 324 #define OB_BFB2_ENABLE ((uint32_t)0x100000) /*!< Dual-bank boot enable */
mbed_official 610:813dcc80987e 325 /**
mbed_official 610:813dcc80987e 326 * @}
mbed_official 610:813dcc80987e 327 */
mbed_official 610:813dcc80987e 328
mbed_official 610:813dcc80987e 329 /** @defgroup FLASH_OB_USER_DUALBANK FLASH Option Bytes User Dual-bank Type
mbed_official 610:813dcc80987e 330 * @{
mbed_official 610:813dcc80987e 331 */
mbed_official 610:813dcc80987e 332 #define OB_DUALBANK_SINGLE ((uint32_t)0x000000) /*!< 256 KB/512 KB Single-bank Flash */
mbed_official 610:813dcc80987e 333 #define OB_DUALBANK_DUAL ((uint32_t)0x200000) /*!< 256 KB/512 KB Dual-bank Flash */
mbed_official 610:813dcc80987e 334 /**
mbed_official 610:813dcc80987e 335 * @}
mbed_official 610:813dcc80987e 336 */
mbed_official 610:813dcc80987e 337
mbed_official 610:813dcc80987e 338 /** @defgroup FLASH_OB_USER_nBOOT1 FLASH Option Bytes User BOOT1 Type
mbed_official 610:813dcc80987e 339 * @{
mbed_official 610:813dcc80987e 340 */
mbed_official 610:813dcc80987e 341 #define OB_BOOT1_SRAM ((uint32_t)0x000000) /*!< Embedded SRAM1 is selected as boot space (if BOOT0=1) */
mbed_official 610:813dcc80987e 342 #define OB_BOOT1_SYSTEM ((uint32_t)0x800000) /*!< System memory is selected as boot space (if BOOT0=1) */
mbed_official 610:813dcc80987e 343 /**
mbed_official 610:813dcc80987e 344 * @}
mbed_official 610:813dcc80987e 345 */
mbed_official 610:813dcc80987e 346
mbed_official 610:813dcc80987e 347 /** @defgroup FLASH_OB_USER_SRAM2_PE FLASH Option Bytes User SRAM2 Parity Check Type
mbed_official 610:813dcc80987e 348 * @{
mbed_official 610:813dcc80987e 349 */
mbed_official 610:813dcc80987e 350 #define OB_SRAM2_PARITY_ENABLE ((uint32_t)0x0000000) /*!< SRAM2 parity check enable */
mbed_official 610:813dcc80987e 351 #define OB_SRAM2_PARITY_DISABLE ((uint32_t)0x1000000) /*!< SRAM2 parity check disable */
mbed_official 610:813dcc80987e 352 /**
mbed_official 610:813dcc80987e 353 * @}
mbed_official 610:813dcc80987e 354 */
mbed_official 610:813dcc80987e 355
mbed_official 610:813dcc80987e 356 /** @defgroup FLASH_OB_USER_SRAM2_RST FLASH Option Bytes User SRAM2 Erase On Reset Type
mbed_official 610:813dcc80987e 357 * @{
mbed_official 610:813dcc80987e 358 */
mbed_official 610:813dcc80987e 359 #define OB_SRAM2_RST_ERASE ((uint32_t)0x0000000) /*!< SRAM2 erased when a system reset occurs */
mbed_official 610:813dcc80987e 360 #define OB_SRAM2_RST_NOT_ERASE ((uint32_t)0x2000000) /*!< SRAM2 is not erased when a system reset occurs */
mbed_official 610:813dcc80987e 361 /**
mbed_official 610:813dcc80987e 362 * @}
mbed_official 610:813dcc80987e 363 */
mbed_official 610:813dcc80987e 364
mbed_official 610:813dcc80987e 365 /** @defgroup FLASH_OB_PCROP_RDP FLASH Option Bytes PCROP On RDP Level Type
mbed_official 610:813dcc80987e 366 * @{
mbed_official 610:813dcc80987e 367 */
mbed_official 610:813dcc80987e 368 #define OB_PCROP_RDP_NOT_ERASE ((uint32_t)0x00000000) /*!< PCROP area is not erased when the RDP level
mbed_official 610:813dcc80987e 369 is decreased from Level 1 to Level 0 */
mbed_official 610:813dcc80987e 370 #define OB_PCROP_RDP_ERASE ((uint32_t)0x80000000) /*!< PCROP area is erased when the RDP level is
mbed_official 610:813dcc80987e 371 decreased from Level 1 to Level 0 (full mass erase) */
mbed_official 610:813dcc80987e 372 /**
mbed_official 610:813dcc80987e 373 * @}
mbed_official 610:813dcc80987e 374 */
mbed_official 610:813dcc80987e 375
mbed_official 610:813dcc80987e 376 /** @defgroup FLASH_Latency FLASH Latency
mbed_official 610:813dcc80987e 377 * @{
mbed_official 610:813dcc80987e 378 */
mbed_official 610:813dcc80987e 379 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero wait state */
mbed_official 610:813dcc80987e 380 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One wait state */
mbed_official 610:813dcc80987e 381 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two wait states */
mbed_official 610:813dcc80987e 382 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three wait states */
mbed_official 610:813dcc80987e 383 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four wait states */
mbed_official 610:813dcc80987e 384 /**
mbed_official 610:813dcc80987e 385 * @}
mbed_official 610:813dcc80987e 386 */
mbed_official 610:813dcc80987e 387
mbed_official 610:813dcc80987e 388 /** @defgroup FLASH_Keys FLASH Keys
mbed_official 610:813dcc80987e 389 * @{
mbed_official 610:813dcc80987e 390 */
mbed_official 610:813dcc80987e 391 #define FLASH_KEY1 ((uint32_t)0x45670123) /*!< Flash key1 */
mbed_official 610:813dcc80987e 392 #define FLASH_KEY2 ((uint32_t)0xCDEF89AB) /*!< Flash key2: used with FLASH_KEY1
mbed_official 610:813dcc80987e 393 to unlock the FLASH registers access */
mbed_official 610:813dcc80987e 394
mbed_official 610:813dcc80987e 395 #define FLASH_PDKEY1 ((uint32_t)0x04152637) /*!< Flash power down key1 */
mbed_official 610:813dcc80987e 396 #define FLASH_PDKEY2 ((uint32_t)0xFAFBFCFD) /*!< Flash power down key2: used with FLASH_PDKEY1
mbed_official 610:813dcc80987e 397 to unlock the RUN_PD bit in FLASH_ACR */
mbed_official 610:813dcc80987e 398
mbed_official 610:813dcc80987e 399 #define FLASH_OPTKEY1 ((uint32_t)0x08192A3B) /*!< Flash option byte key1 */
mbed_official 610:813dcc80987e 400 #define FLASH_OPTKEY2 ((uint32_t)0x4C5D6E7F) /*!< Flash option byte key2: used with FLASH_OPTKEY1
mbed_official 610:813dcc80987e 401 to allow option bytes operations */
mbed_official 610:813dcc80987e 402 /**
mbed_official 610:813dcc80987e 403 * @}
mbed_official 610:813dcc80987e 404 */
mbed_official 610:813dcc80987e 405
mbed_official 610:813dcc80987e 406 /** @defgroup FLASH_Flags FLASH Flags Definition
mbed_official 610:813dcc80987e 407 * @{
mbed_official 610:813dcc80987e 408 */
mbed_official 610:813dcc80987e 409 #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of operation flag */
mbed_official 610:813dcc80987e 410 #define FLASH_FLAG_OPERR FLASH_SR_OPERR /*!< FLASH Operation error flag */
mbed_official 610:813dcc80987e 411 #define FLASH_FLAG_PROGERR FLASH_SR_PROGERR /*!< FLASH Programming error flag */
mbed_official 610:813dcc80987e 412 #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protection error flag */
mbed_official 610:813dcc80987e 413 #define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming alignment error flag */
mbed_official 610:813dcc80987e 414 #define FLASH_FLAG_SIZERR FLASH_SR_SIZERR /*!< FLASH Size error flag */
mbed_official 610:813dcc80987e 415 #define FLASH_FLAG_PGSERR FLASH_SR_PGSERR /*!< FLASH Programming sequence error flag */
mbed_official 610:813dcc80987e 416 #define FLASH_FLAG_MISERR FLASH_SR_MISERR /*!< FLASH Fast programming data miss error flag */
mbed_official 610:813dcc80987e 417 #define FLASH_FLAG_FASTERR FLASH_SR_FASTERR /*!< FLASH Fast programming error flag */
mbed_official 610:813dcc80987e 418 #define FLASH_FLAG_RDERR FLASH_SR_RDERR /*!< FLASH PCROP read error flag */
mbed_official 610:813dcc80987e 419 #define FLASH_FLAG_OPTVERR FLASH_SR_OPTVERR /*!< FLASH Option validity error flag */
mbed_official 610:813dcc80987e 420 #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */
mbed_official 610:813dcc80987e 421 #define FLASH_FLAG_ECCC FLASH_ECCR_ECCC /*!< FLASH ECC correction */
mbed_official 610:813dcc80987e 422 #define FLASH_FLAG_ECCD FLASH_ECCR_ECCD /*!< FLASH ECC detection */
mbed_official 610:813dcc80987e 423
mbed_official 610:813dcc80987e 424 #define FLASH_FLAG_ALL_ERRORS (FLASH_FLAG_OPERR | FLASH_FLAG_PROGERR | FLASH_FLAG_WRPERR | \
mbed_official 610:813dcc80987e 425 FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | FLASH_FLAG_PGSERR | \
mbed_official 610:813dcc80987e 426 FLASH_FLAG_MISERR | FLASH_FLAG_FASTERR | FLASH_FLAG_RDERR | \
mbed_official 610:813dcc80987e 427 FLASH_FLAG_OPTVERR | FLASH_FLAG_ECCD)
mbed_official 610:813dcc80987e 428 /**
mbed_official 610:813dcc80987e 429 * @}
mbed_official 610:813dcc80987e 430 */
mbed_official 610:813dcc80987e 431
mbed_official 610:813dcc80987e 432 /** @defgroup FLASH_Interrupt_definition FLASH Interrupts Definition
mbed_official 610:813dcc80987e 433 * @brief FLASH Interrupt definition
mbed_official 610:813dcc80987e 434 * @{
mbed_official 610:813dcc80987e 435 */
mbed_official 610:813dcc80987e 436 #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */
mbed_official 610:813dcc80987e 437 #define FLASH_IT_OPERR FLASH_CR_ERRIE /*!< Error Interrupt source */
mbed_official 610:813dcc80987e 438 #define FLASH_IT_RDERR FLASH_CR_RDERRIE /*!< PCROP Read Error Interrupt source*/
mbed_official 610:813dcc80987e 439 #define FLASH_IT_ECCC (FLASH_ECCR_ECCIE >> 24)/*!< ECC Correction Interrupt source */
mbed_official 610:813dcc80987e 440 /**
mbed_official 610:813dcc80987e 441 * @}
mbed_official 610:813dcc80987e 442 */
mbed_official 610:813dcc80987e 443
mbed_official 610:813dcc80987e 444 /**
mbed_official 610:813dcc80987e 445 * @}
mbed_official 610:813dcc80987e 446 */
mbed_official 610:813dcc80987e 447
mbed_official 610:813dcc80987e 448 /* Exported macros -----------------------------------------------------------*/
mbed_official 610:813dcc80987e 449 /** @defgroup FLASH_Exported_Macros FLASH Exported Macros
mbed_official 610:813dcc80987e 450 * @brief macros to control FLASH features
mbed_official 610:813dcc80987e 451 * @{
mbed_official 610:813dcc80987e 452 */
mbed_official 610:813dcc80987e 453
mbed_official 610:813dcc80987e 454 /**
mbed_official 610:813dcc80987e 455 * @brief Set the FLASH Latency.
mbed_official 610:813dcc80987e 456 * @param __LATENCY__: FLASH Latency
mbed_official 610:813dcc80987e 457 * This parameter can be one of the following values :
mbed_official 610:813dcc80987e 458 * @arg FLASH_LATENCY_0: FLASH Zero wait state
mbed_official 610:813dcc80987e 459 * @arg FLASH_LATENCY_1: FLASH One wait state
mbed_official 610:813dcc80987e 460 * @arg FLASH_LATENCY_2: FLASH Two wait states
mbed_official 610:813dcc80987e 461 * @arg FLASH_LATENCY_3: FLASH Three wait states
mbed_official 610:813dcc80987e 462 * @arg FLASH_LATENCY_4: FLASH Four wait states
mbed_official 610:813dcc80987e 463 * @retval None
mbed_official 610:813dcc80987e 464 */
mbed_official 610:813dcc80987e 465 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = IS_FLASH_LATENCY(__LATENCY__) ? \
mbed_official 610:813dcc80987e 466 (FLASH->ACR & (~FLASH_ACR_LATENCY)) | (__LATENCY__) : FLASH->ACR)
mbed_official 610:813dcc80987e 467
mbed_official 610:813dcc80987e 468 /**
mbed_official 610:813dcc80987e 469 * @brief Get the FLASH Latency.
mbed_official 610:813dcc80987e 470 * @retval FLASH Latency
mbed_official 610:813dcc80987e 471 * This parameter can be one of the following values :
mbed_official 610:813dcc80987e 472 * @arg FLASH_LATENCY_0: FLASH Zero wait state
mbed_official 610:813dcc80987e 473 * @arg FLASH_LATENCY_1: FLASH One wait state
mbed_official 610:813dcc80987e 474 * @arg FLASH_LATENCY_2: FLASH Two wait states
mbed_official 610:813dcc80987e 475 * @arg FLASH_LATENCY_3: FLASH Three wait states
mbed_official 610:813dcc80987e 476 * @arg FLASH_LATENCY_4: FLASH Four wait states
mbed_official 610:813dcc80987e 477 */
mbed_official 610:813dcc80987e 478 #define __HAL_FLASH_GET_LATENCY() READ_BIT(FLASH->ACR, FLASH_ACR_LATENCY)
mbed_official 610:813dcc80987e 479
mbed_official 610:813dcc80987e 480 /**
mbed_official 610:813dcc80987e 481 * @brief Enable the FLASH prefetch buffer.
mbed_official 610:813dcc80987e 482 * @retval None
mbed_official 610:813dcc80987e 483 */
mbed_official 610:813dcc80987e 484 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_PRFTEN)
mbed_official 610:813dcc80987e 485
mbed_official 610:813dcc80987e 486 /**
mbed_official 610:813dcc80987e 487 * @brief Disable the FLASH prefetch buffer.
mbed_official 610:813dcc80987e 488 * @retval None
mbed_official 610:813dcc80987e 489 */
mbed_official 610:813dcc80987e 490 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_PRFTEN)
mbed_official 610:813dcc80987e 491
mbed_official 610:813dcc80987e 492 /**
mbed_official 610:813dcc80987e 493 * @brief Enable the FLASH instruction cache.
mbed_official 610:813dcc80987e 494 * @retval none
mbed_official 610:813dcc80987e 495 */
mbed_official 610:813dcc80987e 496 #define __HAL_FLASH_INSTRUCTION_CACHE_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_ICEN)
mbed_official 610:813dcc80987e 497
mbed_official 610:813dcc80987e 498 /**
mbed_official 610:813dcc80987e 499 * @brief Disable the FLASH instruction cache.
mbed_official 610:813dcc80987e 500 * @retval none
mbed_official 610:813dcc80987e 501 */
mbed_official 610:813dcc80987e 502 #define __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_ICEN)
mbed_official 610:813dcc80987e 503
mbed_official 610:813dcc80987e 504 /**
mbed_official 610:813dcc80987e 505 * @brief Enable the FLASH data cache.
mbed_official 610:813dcc80987e 506 * @retval none
mbed_official 610:813dcc80987e 507 */
mbed_official 610:813dcc80987e 508 #define __HAL_FLASH_DATA_CACHE_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_DCEN)
mbed_official 610:813dcc80987e 509
mbed_official 610:813dcc80987e 510 /**
mbed_official 610:813dcc80987e 511 * @brief Disable the FLASH data cache.
mbed_official 610:813dcc80987e 512 * @retval none
mbed_official 610:813dcc80987e 513 */
mbed_official 610:813dcc80987e 514 #define __HAL_FLASH_DATA_CACHE_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_DCEN)
mbed_official 610:813dcc80987e 515
mbed_official 610:813dcc80987e 516 /**
mbed_official 610:813dcc80987e 517 * @brief Reset the FLASH instruction Cache.
mbed_official 610:813dcc80987e 518 * @note This function must be used only when the Instruction Cache is disabled.
mbed_official 610:813dcc80987e 519 * @retval None
mbed_official 610:813dcc80987e 520 */
mbed_official 610:813dcc80987e 521 #define __HAL_FLASH_INSTRUCTION_CACHE_RESET() SET_BIT(FLASH->ACR, FLASH_ACR_ICRST)
mbed_official 610:813dcc80987e 522
mbed_official 610:813dcc80987e 523 /**
mbed_official 610:813dcc80987e 524 * @brief Reset the FLASH data Cache.
mbed_official 610:813dcc80987e 525 * @note This function must be used only when the data Cache is disabled.
mbed_official 610:813dcc80987e 526 * @retval None
mbed_official 610:813dcc80987e 527 */
mbed_official 610:813dcc80987e 528 #define __HAL_FLASH_DATA_CACHE_RESET() SET_BIT(FLASH->ACR, FLASH_ACR_DCRST)
mbed_official 610:813dcc80987e 529
mbed_official 610:813dcc80987e 530 /**
mbed_official 610:813dcc80987e 531 * @brief Enable the FLASH power down during Low-power run mode.
mbed_official 610:813dcc80987e 532 * @note Writing this bit to 0 this bit, automatically the keys are
mbed_official 610:813dcc80987e 533 * loss and a new unlock sequence is necessary to re-write it to 1.
mbed_official 610:813dcc80987e 534 */
mbed_official 610:813dcc80987e 535 #define __HAL_FLASH_POWER_DOWN_ENABLE() do { WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY1); \
mbed_official 610:813dcc80987e 536 WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY2); \
mbed_official 610:813dcc80987e 537 SET_BIT(FLASH->ACR, FLASH_ACR_RUN_PD); \
mbed_official 610:813dcc80987e 538 } while (0)
mbed_official 610:813dcc80987e 539
mbed_official 610:813dcc80987e 540 /**
mbed_official 610:813dcc80987e 541 * @brief Disable the FLASH power down during Low-power run mode.
mbed_official 610:813dcc80987e 542 * @note Writing this bit to 0 this bit, automatically the keys are
mbed_official 610:813dcc80987e 543 * loss and a new unlock sequence is necessary to re-write it to 1.
mbed_official 610:813dcc80987e 544 */
mbed_official 610:813dcc80987e 545 #define __HAL_FLASH_POWER_DOWN_DISABLE() do { WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY1); \
mbed_official 610:813dcc80987e 546 WRITE_REG(FLASH->PDKEYR, FLASH_PDKEY2); \
mbed_official 610:813dcc80987e 547 CLEAR_BIT(FLASH->ACR, FLASH_ACR_RUN_PD); \
mbed_official 610:813dcc80987e 548 } while (0)
mbed_official 610:813dcc80987e 549
mbed_official 610:813dcc80987e 550 /**
mbed_official 610:813dcc80987e 551 * @brief Enable the FLASH power down during Low-Power sleep mode
mbed_official 610:813dcc80987e 552 * @retval none
mbed_official 610:813dcc80987e 553 */
mbed_official 610:813dcc80987e 554 #define __HAL_FLASH_SLEEP_POWERDOWN_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
mbed_official 610:813dcc80987e 555
mbed_official 610:813dcc80987e 556 /**
mbed_official 610:813dcc80987e 557 * @brief Disable the FLASH power down during Low-Power sleep mode
mbed_official 610:813dcc80987e 558 * @retval none
mbed_official 610:813dcc80987e 559 */
mbed_official 610:813dcc80987e 560 #define __HAL_FLASH_SLEEP_POWERDOWN_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
mbed_official 610:813dcc80987e 561
mbed_official 610:813dcc80987e 562 /**
mbed_official 610:813dcc80987e 563 * @}
mbed_official 610:813dcc80987e 564 */
mbed_official 610:813dcc80987e 565
mbed_official 610:813dcc80987e 566 /** @defgroup FLASH_Interrupt FLASH Interrupts Macros
mbed_official 610:813dcc80987e 567 * @brief macros to handle FLASH interrupts
mbed_official 610:813dcc80987e 568 * @{
mbed_official 610:813dcc80987e 569 */
mbed_official 610:813dcc80987e 570
mbed_official 610:813dcc80987e 571 /**
mbed_official 610:813dcc80987e 572 * @brief Enable the specified FLASH interrupt.
mbed_official 610:813dcc80987e 573 * @param __INTERRUPT__: FLASH interrupt
mbed_official 610:813dcc80987e 574 * This parameter can be any combination of the following values:
mbed_official 610:813dcc80987e 575 * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
mbed_official 610:813dcc80987e 576 * @arg FLASH_IT_OPERR: Error Interrupt
mbed_official 610:813dcc80987e 577 * @arg FLASH_IT_RDERR: PCROP Read Error Interrupt
mbed_official 610:813dcc80987e 578 * @arg FLASH_IT_ECCC: ECC Correction Interrupt
mbed_official 610:813dcc80987e 579 * @retval none
mbed_official 610:813dcc80987e 580 */
mbed_official 610:813dcc80987e 581 #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) do { if((__INTERRUPT__) & FLASH_IT_ECCC) { SET_BIT(FLASH->ECCR, FLASH_ECCR_ECCIE); }\
mbed_official 610:813dcc80987e 582 if((__INTERRUPT__) & (~FLASH_IT_ECCC)) { SET_BIT(FLASH->CR, ((__INTERRUPT__) & (~FLASH_IT_ECCC))); }\
mbed_official 610:813dcc80987e 583 } while(0)
mbed_official 610:813dcc80987e 584
mbed_official 610:813dcc80987e 585 /**
mbed_official 610:813dcc80987e 586 * @brief Disable the specified FLASH interrupt.
mbed_official 610:813dcc80987e 587 * @param __INTERRUPT__: FLASH interrupt
mbed_official 610:813dcc80987e 588 * This parameter can be any combination of the following values:
mbed_official 610:813dcc80987e 589 * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
mbed_official 610:813dcc80987e 590 * @arg FLASH_IT_OPERR: Error Interrupt
mbed_official 610:813dcc80987e 591 * @arg FLASH_IT_RDERR: PCROP Read Error Interrupt
mbed_official 610:813dcc80987e 592 * @arg FLASH_IT_ECCC: ECC Correction Interrupt
mbed_official 610:813dcc80987e 593 * @retval none
mbed_official 610:813dcc80987e 594 */
mbed_official 610:813dcc80987e 595 #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) do { if((__INTERRUPT__) & FLASH_IT_ECCC) { CLEAR_BIT(FLASH->ECCR, FLASH_ECCR_ECCIE); }\
mbed_official 610:813dcc80987e 596 if((__INTERRUPT__) & (~FLASH_IT_ECCC)) { CLEAR_BIT(FLASH->CR, ((__INTERRUPT__) & (~FLASH_IT_ECCC))); }\
mbed_official 610:813dcc80987e 597 } while(0)
mbed_official 610:813dcc80987e 598
mbed_official 610:813dcc80987e 599 /**
mbed_official 610:813dcc80987e 600 * @brief Check whether the specified FLASH flag is set or not.
mbed_official 610:813dcc80987e 601 * @param __FLAG__: specifies the FLASH flag to check.
mbed_official 610:813dcc80987e 602 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 603 * @arg FLASH_FLAG_EOP: FLASH End of Operation flag
mbed_official 610:813dcc80987e 604 * @arg FLASH_FLAG_OPERR: FLASH Operation error flag
mbed_official 610:813dcc80987e 605 * @arg FLASH_FLAG_PROGERR: FLASH Programming error flag
mbed_official 610:813dcc80987e 606 * @arg FLASH_FLAG_WRPERR: FLASH Write protection error flag
mbed_official 610:813dcc80987e 607 * @arg FLASH_FLAG_PGAERR: FLASH Programming alignment error flag
mbed_official 610:813dcc80987e 608 * @arg FLASH_FLAG_SIZERR: FLASH Size error flag
mbed_official 610:813dcc80987e 609 * @arg FLASH_FLAG_PGSERR: FLASH Programming sequence error flag
mbed_official 610:813dcc80987e 610 * @arg FLASH_FLAG_MISERR: FLASH Fast programming data miss error flag
mbed_official 610:813dcc80987e 611 * @arg FLASH_FLAG_FASTERR: FLASH Fast programming error flag
mbed_official 610:813dcc80987e 612 * @arg FLASH_FLAG_RDERR: FLASH PCROP read error flag
mbed_official 610:813dcc80987e 613 * @arg FLASH_FLAG_OPTVERR: FLASH Option validity error flag
mbed_official 610:813dcc80987e 614 * @arg FLASH_FLAG_BSY: FLASH write/erase operations in progress flag
mbed_official 610:813dcc80987e 615 * @arg FLASH_FLAG_ECCC: FLASH one ECC error has been detected and corrected
mbed_official 610:813dcc80987e 616 * @arg FLASH_FLAG_ECCD: FLASH two ECC errors have been detected
mbed_official 610:813dcc80987e 617 * @retval The new state of FLASH_FLAG (SET or RESET).
mbed_official 610:813dcc80987e 618 */
mbed_official 610:813dcc80987e 619 #define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) & (FLASH_FLAG_ECCC | FLASH_FLAG_ECCD)) ? \
mbed_official 610:813dcc80987e 620 (READ_BIT(FLASH->ECCR, (__FLAG__)) == (__FLAG__)) : \
mbed_official 610:813dcc80987e 621 (READ_BIT(FLASH->SR, (__FLAG__)) == (__FLAG__)))
mbed_official 610:813dcc80987e 622
mbed_official 610:813dcc80987e 623 /**
mbed_official 610:813dcc80987e 624 * @brief Clear the FLASH's pending flags.
mbed_official 610:813dcc80987e 625 * @param __FLAG__: specifies the FLASH flags to clear.
mbed_official 610:813dcc80987e 626 * This parameter can be any combination of the following values:
mbed_official 610:813dcc80987e 627 * @arg FLASH_FLAG_EOP: FLASH End of Operation flag
mbed_official 610:813dcc80987e 628 * @arg FLASH_FLAG_OPERR: FLASH Operation error flag
mbed_official 610:813dcc80987e 629 * @arg FLASH_FLAG_PROGERR: FLASH Programming error flag
mbed_official 610:813dcc80987e 630 * @arg FLASH_FLAG_WRPERR: FLASH Write protection error flag
mbed_official 610:813dcc80987e 631 * @arg FLASH_FLAG_PGAERR: FLASH Programming alignment error flag
mbed_official 610:813dcc80987e 632 * @arg FLASH_FLAG_SIZERR: FLASH Size error flag
mbed_official 610:813dcc80987e 633 * @arg FLASH_FLAG_PGSERR: FLASH Programming sequence error flag
mbed_official 610:813dcc80987e 634 * @arg FLASH_FLAG_MISERR: FLASH Fast programming data miss error flag
mbed_official 610:813dcc80987e 635 * @arg FLASH_FLAG_FASTERR: FLASH Fast programming error flag
mbed_official 610:813dcc80987e 636 * @arg FLASH_FLAG_RDERR: FLASH PCROP read error flag
mbed_official 610:813dcc80987e 637 * @arg FLASH_FLAG_OPTVERR: FLASH Option validity error flag
mbed_official 610:813dcc80987e 638 * @arg FLASH_FLAG_ECCC: FLASH one ECC error has been detected and corrected
mbed_official 610:813dcc80987e 639 * @arg FLASH_FLAG_ECCD: FLASH two ECC errors have been detected
mbed_official 610:813dcc80987e 640 * @arg FLASH_FLAG_ALL_ERRORS: FLASH All errors flags
mbed_official 610:813dcc80987e 641 * @retval None
mbed_official 610:813dcc80987e 642 */
mbed_official 610:813dcc80987e 643 #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { if((__FLAG__) & (FLASH_FLAG_ECCC | FLASH_FLAG_ECCD)) { SET_BIT(FLASH->ECCR, ((__FLAG__) & (FLASH_FLAG_ECCC | FLASH_FLAG_ECCD))); }\
mbed_official 610:813dcc80987e 644 if((__FLAG__) & ~(FLASH_FLAG_ECCC | FLASH_FLAG_ECCD)) { WRITE_REG(FLASH->SR, ((__FLAG__) & ~(FLASH_FLAG_ECCC | FLASH_FLAG_ECCD))); }\
mbed_official 610:813dcc80987e 645 } while(0)
mbed_official 610:813dcc80987e 646 /**
mbed_official 610:813dcc80987e 647 * @}
mbed_official 610:813dcc80987e 648 */
mbed_official 610:813dcc80987e 649
mbed_official 610:813dcc80987e 650 /* Include FLASH HAL Extended module */
mbed_official 610:813dcc80987e 651 #include "stm32l4xx_hal_flash_ex.h"
mbed_official 610:813dcc80987e 652 #include "stm32l4xx_hal_flash_ramfunc.h"
mbed_official 610:813dcc80987e 653
mbed_official 610:813dcc80987e 654 /* Exported functions --------------------------------------------------------*/
mbed_official 610:813dcc80987e 655 /** @addtogroup FLASH_Exported_Functions
mbed_official 610:813dcc80987e 656 * @{
mbed_official 610:813dcc80987e 657 */
mbed_official 610:813dcc80987e 658
mbed_official 610:813dcc80987e 659 /* Program operation functions ***********************************************/
mbed_official 610:813dcc80987e 660 /** @addtogroup FLASH_Exported_Functions_Group1
mbed_official 610:813dcc80987e 661 * @{
mbed_official 610:813dcc80987e 662 */
mbed_official 610:813dcc80987e 663 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
mbed_official 610:813dcc80987e 664 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
mbed_official 610:813dcc80987e 665 /* FLASH IRQ handler method */
mbed_official 610:813dcc80987e 666 void HAL_FLASH_IRQHandler(void);
mbed_official 610:813dcc80987e 667 /* Callbacks in non blocking modes */
mbed_official 610:813dcc80987e 668 void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
mbed_official 610:813dcc80987e 669 void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
mbed_official 610:813dcc80987e 670 /**
mbed_official 610:813dcc80987e 671 * @}
mbed_official 610:813dcc80987e 672 */
mbed_official 610:813dcc80987e 673
mbed_official 610:813dcc80987e 674 /* Peripheral Control functions **********************************************/
mbed_official 610:813dcc80987e 675 /** @addtogroup FLASH_Exported_Functions_Group2
mbed_official 610:813dcc80987e 676 * @{
mbed_official 610:813dcc80987e 677 */
mbed_official 610:813dcc80987e 678 HAL_StatusTypeDef HAL_FLASH_Unlock(void);
mbed_official 610:813dcc80987e 679 HAL_StatusTypeDef HAL_FLASH_Lock(void);
mbed_official 610:813dcc80987e 680 /* Option bytes control */
mbed_official 610:813dcc80987e 681 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
mbed_official 610:813dcc80987e 682 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
mbed_official 610:813dcc80987e 683 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
mbed_official 610:813dcc80987e 684 /**
mbed_official 610:813dcc80987e 685 * @}
mbed_official 610:813dcc80987e 686 */
mbed_official 610:813dcc80987e 687
mbed_official 610:813dcc80987e 688 /* Peripheral State functions ************************************************/
mbed_official 610:813dcc80987e 689 /** @addtogroup FLASH_Exported_Functions_Group3
mbed_official 610:813dcc80987e 690 * @{
mbed_official 610:813dcc80987e 691 */
mbed_official 610:813dcc80987e 692 uint32_t HAL_FLASH_GetError(void);
mbed_official 610:813dcc80987e 693 /**
mbed_official 610:813dcc80987e 694 * @}
mbed_official 610:813dcc80987e 695 */
mbed_official 610:813dcc80987e 696
mbed_official 610:813dcc80987e 697 /**
mbed_official 610:813dcc80987e 698 * @}
mbed_official 610:813dcc80987e 699 */
mbed_official 610:813dcc80987e 700
mbed_official 610:813dcc80987e 701 /* Private constants --------------------------------------------------------*/
mbed_official 610:813dcc80987e 702 /** @defgroup FLASH_Private_Constants FLASH Private Constants
mbed_official 610:813dcc80987e 703 * @{
mbed_official 610:813dcc80987e 704 */
mbed_official 610:813dcc80987e 705 #define FLASH_SIZE_DATA_REGISTER ((uint32_t)0x1FFF75E0)
mbed_official 610:813dcc80987e 706
mbed_official 610:813dcc80987e 707 #define FLASH_SIZE ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0xFFFF)) ? (0x400 << 10) : \
mbed_official 610:813dcc80987e 708 (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFF)) << 10))
mbed_official 610:813dcc80987e 709
mbed_official 610:813dcc80987e 710 #define FLASH_BANK_SIZE (FLASH_SIZE >> 1)
mbed_official 610:813dcc80987e 711
mbed_official 610:813dcc80987e 712 #define FLASH_PAGE_SIZE ((uint32_t)0x800)
mbed_official 610:813dcc80987e 713
mbed_official 610:813dcc80987e 714 #define FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
mbed_official 610:813dcc80987e 715 /**
mbed_official 610:813dcc80987e 716 * @}
mbed_official 610:813dcc80987e 717 */
mbed_official 610:813dcc80987e 718
mbed_official 610:813dcc80987e 719 /* Private macros ------------------------------------------------------------*/
mbed_official 610:813dcc80987e 720 /** @defgroup FLASH_Private_Macros FLASH Private Macros
mbed_official 610:813dcc80987e 721 * @{
mbed_official 610:813dcc80987e 722 */
mbed_official 610:813dcc80987e 723
mbed_official 610:813dcc80987e 724 #define IS_FLASH_TYPEERASE(VALUE) (((VALUE) == FLASH_TYPEERASE_PAGES) || \
mbed_official 610:813dcc80987e 725 ((VALUE) == FLASH_TYPEERASE_MASSERASE))
mbed_official 610:813dcc80987e 726
mbed_official 610:813dcc80987e 727 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \
mbed_official 610:813dcc80987e 728 ((BANK) == FLASH_BANK_2) || \
mbed_official 610:813dcc80987e 729 ((BANK) == FLASH_BANK_BOTH))
mbed_official 610:813dcc80987e 730
mbed_official 610:813dcc80987e 731 #define IS_FLASH_BANK_EXCLUSIVE(BANK) (((BANK) == FLASH_BANK_1) || \
mbed_official 610:813dcc80987e 732 ((BANK) == FLASH_BANK_2))
mbed_official 610:813dcc80987e 733
mbed_official 610:813dcc80987e 734 #define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD) || \
mbed_official 610:813dcc80987e 735 ((VALUE) == FLASH_TYPEPROGRAM_FAST) || \
mbed_official 610:813dcc80987e 736 ((VALUE) == FLASH_TYPEPROGRAM_FAST_AND_LAST))
mbed_official 610:813dcc80987e 737
mbed_official 610:813dcc80987e 738 #define IS_FLASH_MAIN_MEM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFF)) == 0x400) ? \
mbed_official 610:813dcc80987e 739 ((ADDRESS) <= FLASH_BASE+0xFFFFF) : ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFF)) == 0x200) ? \
mbed_official 610:813dcc80987e 740 ((ADDRESS) <= FLASH_BASE+0x7FFFF) : ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFF)) == 0x100) ? \
mbed_official 610:813dcc80987e 741 ((ADDRESS) <= FLASH_BASE+0x3FFFF) : ((ADDRESS) <= FLASH_BASE+0xFFFFF)))))
mbed_official 610:813dcc80987e 742
mbed_official 610:813dcc80987e 743 #define IS_FLASH_OTP_ADDRESS(ADDRESS) (((ADDRESS) >= 0x1FFF7000) && ((ADDRESS) <= 0x1FFF73FF))
mbed_official 610:813dcc80987e 744
mbed_official 610:813dcc80987e 745 #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (IS_FLASH_MAIN_MEM_ADDRESS(ADDRESS) || IS_FLASH_OTP_ADDRESS(ADDRESS))
mbed_official 610:813dcc80987e 746
mbed_official 610:813dcc80987e 747 #define IS_FLASH_PAGE(PAGE) (((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFF)) == 0x400) ? ((PAGE) < 256) : \
mbed_official 610:813dcc80987e 748 ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFF)) == 0x200) ? ((PAGE) < 128) : \
mbed_official 610:813dcc80987e 749 ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFF)) == 0x100) ? ((PAGE) < 64) : \
mbed_official 610:813dcc80987e 750 ((PAGE) < 256)))))
mbed_official 610:813dcc80987e 751
mbed_official 610:813dcc80987e 752 #define IS_OPTIONBYTE(VALUE) (((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_PCROP)))
mbed_official 610:813dcc80987e 753
mbed_official 610:813dcc80987e 754 #define IS_OB_WRPAREA(VALUE) (((VALUE) == OB_WRPAREA_BANK1_AREAA) || ((VALUE) == OB_WRPAREA_BANK1_AREAB) || \
mbed_official 610:813dcc80987e 755 ((VALUE) == OB_WRPAREA_BANK2_AREAA) || ((VALUE) == OB_WRPAREA_BANK2_AREAB))
mbed_official 610:813dcc80987e 756
mbed_official 610:813dcc80987e 757 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
mbed_official 610:813dcc80987e 758 ((LEVEL) == OB_RDP_LEVEL_1)/* ||\
mbed_official 610:813dcc80987e 759 ((LEVEL) == OB_RDP_LEVEL_2)*/)
mbed_official 610:813dcc80987e 760
mbed_official 610:813dcc80987e 761 #define IS_OB_USER_TYPE(TYPE) (((TYPE) <= (uint32_t)0xFFF) && ((TYPE) != 0))
mbed_official 610:813dcc80987e 762
mbed_official 610:813dcc80987e 763 #define IS_OB_USER_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL_0) || ((LEVEL) == OB_BOR_LEVEL_1) || \
mbed_official 610:813dcc80987e 764 ((LEVEL) == OB_BOR_LEVEL_2) || ((LEVEL) == OB_BOR_LEVEL_3) || \
mbed_official 610:813dcc80987e 765 ((LEVEL) == OB_BOR_LEVEL_4))
mbed_official 610:813dcc80987e 766
mbed_official 610:813dcc80987e 767 #define IS_OB_USER_STOP(VALUE) (((VALUE) == OB_STOP_RST) || ((VALUE) == OB_STOP_NORST))
mbed_official 610:813dcc80987e 768
mbed_official 610:813dcc80987e 769 #define IS_OB_USER_STANDBY(VALUE) (((VALUE) == OB_STANDBY_RST) || ((VALUE) == OB_STANDBY_NORST))
mbed_official 610:813dcc80987e 770
mbed_official 610:813dcc80987e 771 #define IS_OB_USER_IWDG(VALUE) (((VALUE) == OB_IWDG_HW) || ((VALUE) == OB_IWDG_SW))
mbed_official 610:813dcc80987e 772
mbed_official 610:813dcc80987e 773 #define IS_OB_USER_IWDG_STOP(VALUE) (((VALUE) == OB_IWDG_STOP_FREEZE) || ((VALUE) == OB_IWDG_STOP_RUN))
mbed_official 610:813dcc80987e 774
mbed_official 610:813dcc80987e 775 #define IS_OB_USER_IWDG_STDBY(VALUE) (((VALUE) == OB_IWDG_STDBY_FREEZE) || ((VALUE) == OB_IWDG_STDBY_RUN))
mbed_official 610:813dcc80987e 776
mbed_official 610:813dcc80987e 777 #define IS_OB_USER_WWDG(VALUE) (((VALUE) == OB_WWDG_HW) || ((VALUE) == OB_WWDG_SW))
mbed_official 610:813dcc80987e 778
mbed_official 610:813dcc80987e 779 #define IS_OB_USER_BFB2(VALUE) (((VALUE) == OB_BFB2_DISABLE) || ((VALUE) == OB_BFB2_ENABLE))
mbed_official 610:813dcc80987e 780
mbed_official 610:813dcc80987e 781 #define IS_OB_USER_DUALBANK(VALUE) (((VALUE) == OB_DUALBANK_SINGLE) || ((VALUE) == OB_DUALBANK_DUAL))
mbed_official 610:813dcc80987e 782
mbed_official 610:813dcc80987e 783 #define IS_OB_USER_BOOT1(VALUE) (((VALUE) == OB_BOOT1_SRAM) || ((VALUE) == OB_BOOT1_SYSTEM))
mbed_official 610:813dcc80987e 784
mbed_official 610:813dcc80987e 785 #define IS_OB_USER_SRAM2_PARITY(VALUE) (((VALUE) == OB_SRAM2_PARITY_ENABLE) || ((VALUE) == OB_SRAM2_PARITY_DISABLE))
mbed_official 610:813dcc80987e 786
mbed_official 610:813dcc80987e 787 #define IS_OB_USER_SRAM2_RST(VALUE) (((VALUE) == OB_SRAM2_RST_ERASE) || ((VALUE) == OB_SRAM2_RST_NOT_ERASE))
mbed_official 610:813dcc80987e 788
mbed_official 610:813dcc80987e 789 #define IS_OB_PCROP_RDP(VALUE) (((VALUE) == OB_PCROP_RDP_NOT_ERASE) || ((VALUE) == OB_PCROP_RDP_ERASE))
mbed_official 610:813dcc80987e 790
mbed_official 610:813dcc80987e 791 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
mbed_official 610:813dcc80987e 792 ((LATENCY) == FLASH_LATENCY_1) || \
mbed_official 610:813dcc80987e 793 ((LATENCY) == FLASH_LATENCY_2) || \
mbed_official 610:813dcc80987e 794 ((LATENCY) == FLASH_LATENCY_3) || \
mbed_official 610:813dcc80987e 795 ((LATENCY) == FLASH_LATENCY_4))
mbed_official 610:813dcc80987e 796 /**
mbed_official 610:813dcc80987e 797 * @}
mbed_official 610:813dcc80987e 798 */
mbed_official 610:813dcc80987e 799
mbed_official 610:813dcc80987e 800 /**
mbed_official 610:813dcc80987e 801 * @}
mbed_official 610:813dcc80987e 802 */
mbed_official 610:813dcc80987e 803
mbed_official 610:813dcc80987e 804 /**
mbed_official 610:813dcc80987e 805 * @}
mbed_official 610:813dcc80987e 806 */
mbed_official 610:813dcc80987e 807
mbed_official 610:813dcc80987e 808 #ifdef __cplusplus
mbed_official 610:813dcc80987e 809 }
mbed_official 610:813dcc80987e 810 #endif
mbed_official 610:813dcc80987e 811
mbed_official 610:813dcc80987e 812 #endif /* __STM32L4xx_HAL_FLASH_H */
mbed_official 610:813dcc80987e 813
mbed_official 610:813dcc80987e 814 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/