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

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

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