mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
394:83f921546702
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 354:e67efb2aab0e 1 /**
mbed_official 354:e67efb2aab0e 2 ******************************************************************************
mbed_official 354:e67efb2aab0e 3 * @file stm32l1xx_hal_flash.h
mbed_official 354:e67efb2aab0e 4 * @author MCD Application Team
mbed_official 354:e67efb2aab0e 5 * @version V1.0.0
mbed_official 354:e67efb2aab0e 6 * @date 5-September-2014
mbed_official 354:e67efb2aab0e 7 * @brief Header file of Flash HAL module.
mbed_official 354:e67efb2aab0e 8 ******************************************************************************
mbed_official 354:e67efb2aab0e 9 * @attention
mbed_official 354:e67efb2aab0e 10 *
mbed_official 354:e67efb2aab0e 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 354:e67efb2aab0e 12 *
mbed_official 354:e67efb2aab0e 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 354:e67efb2aab0e 14 * are permitted provided that the following conditions are met:
mbed_official 354:e67efb2aab0e 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 354:e67efb2aab0e 16 * this list of conditions and the following disclaimer.
mbed_official 354:e67efb2aab0e 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 354:e67efb2aab0e 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 354:e67efb2aab0e 19 * and/or other materials provided with the distribution.
mbed_official 354:e67efb2aab0e 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 354:e67efb2aab0e 21 * may be used to endorse or promote products derived from this software
mbed_official 354:e67efb2aab0e 22 * without specific prior written permission.
mbed_official 354:e67efb2aab0e 23 *
mbed_official 354:e67efb2aab0e 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 354:e67efb2aab0e 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 354:e67efb2aab0e 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 354:e67efb2aab0e 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 354:e67efb2aab0e 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 354:e67efb2aab0e 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 354:e67efb2aab0e 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 354:e67efb2aab0e 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 354:e67efb2aab0e 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 354:e67efb2aab0e 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 354:e67efb2aab0e 34 *
mbed_official 354:e67efb2aab0e 35 ******************************************************************************
mbed_official 354:e67efb2aab0e 36 */
mbed_official 354:e67efb2aab0e 37
mbed_official 354:e67efb2aab0e 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 354:e67efb2aab0e 39 #ifndef __STM32L1xx_HAL_FLASH_EX_H
mbed_official 354:e67efb2aab0e 40 #define __STM32L1xx_HAL_FLASH_EX_H
mbed_official 354:e67efb2aab0e 41
mbed_official 354:e67efb2aab0e 42 #ifdef __cplusplus
mbed_official 354:e67efb2aab0e 43 extern "C" {
mbed_official 354:e67efb2aab0e 44 #endif
mbed_official 354:e67efb2aab0e 45
mbed_official 354:e67efb2aab0e 46 /* Includes ------------------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 47 #include "stm32l1xx_hal_def.h"
mbed_official 354:e67efb2aab0e 48
mbed_official 354:e67efb2aab0e 49 /** @addtogroup STM32L1xx_HAL_Driver
mbed_official 354:e67efb2aab0e 50 * @{
mbed_official 354:e67efb2aab0e 51 */
mbed_official 354:e67efb2aab0e 52
mbed_official 354:e67efb2aab0e 53 /** @addtogroup FLASHEx
mbed_official 354:e67efb2aab0e 54 * @{
mbed_official 354:e67efb2aab0e 55 */
mbed_official 354:e67efb2aab0e 56
mbed_official 354:e67efb2aab0e 57 /* Exported types ------------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 58
mbed_official 354:e67efb2aab0e 59 /** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types
mbed_official 354:e67efb2aab0e 60 * @{
mbed_official 354:e67efb2aab0e 61 */
mbed_official 354:e67efb2aab0e 62
mbed_official 354:e67efb2aab0e 63 /**
mbed_official 354:e67efb2aab0e 64 * @brief FLASH Erase structure definition
mbed_official 354:e67efb2aab0e 65 */
mbed_official 354:e67efb2aab0e 66 typedef struct
mbed_official 354:e67efb2aab0e 67 {
mbed_official 354:e67efb2aab0e 68 uint32_t TypeErase; /*!< TypeErase: Page Erase only.
mbed_official 354:e67efb2aab0e 69 This parameter can be a value of @ref FLASHEx_Type_Erase */
mbed_official 354:e67efb2aab0e 70
mbed_official 354:e67efb2aab0e 71 uint32_t PageAddress; /*!< PageAddress: Initial FLASH address to be erased
mbed_official 354:e67efb2aab0e 72 This parameter must be a value belonging to FLASH Programm address (depending on the devices) */
mbed_official 354:e67efb2aab0e 73
mbed_official 354:e67efb2aab0e 74 uint32_t NbPages; /*!< NbPages: Number of pages to be erased.
mbed_official 354:e67efb2aab0e 75 This parameter must be a value between 1 and (max number of pages - value of Initial page)*/
mbed_official 354:e67efb2aab0e 76
mbed_official 354:e67efb2aab0e 77 } FLASH_EraseInitTypeDef;
mbed_official 354:e67efb2aab0e 78
mbed_official 354:e67efb2aab0e 79 /**
mbed_official 354:e67efb2aab0e 80 * @brief FLASH Option Bytes PROGRAM structure definition
mbed_official 354:e67efb2aab0e 81 */
mbed_official 354:e67efb2aab0e 82 typedef struct
mbed_official 354:e67efb2aab0e 83 {
mbed_official 354:e67efb2aab0e 84 uint32_t OptionType; /*!< OptionType: Option byte to be configured.
mbed_official 354:e67efb2aab0e 85 This parameter can be a value of @ref FLASHEx_Option_Type */
mbed_official 354:e67efb2aab0e 86
mbed_official 354:e67efb2aab0e 87 uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
mbed_official 354:e67efb2aab0e 88 This parameter can be a value of @ref FLASHEx_WRP_State */
mbed_official 354:e67efb2aab0e 89
mbed_official 354:e67efb2aab0e 90 uint32_t WRPSector0To31; /*!< WRPSector0To31: specifies the sector(s) which are write protected between Sector 0 to 31
mbed_official 354:e67efb2aab0e 91 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection1 */
mbed_official 354:e67efb2aab0e 92
mbed_official 354:e67efb2aab0e 93 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || \
mbed_official 354:e67efb2aab0e 94 defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 95 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 96 uint32_t WRPSector32To63; /*!< WRPSector32To63: specifies the sector(s) which are write protected between Sector 32 to 63
mbed_official 354:e67efb2aab0e 97 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection2 */
mbed_official 354:e67efb2aab0e 98 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 99
mbed_official 354:e67efb2aab0e 100 #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 101 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 102 uint32_t WRPSector64To95; /*!< WRPSector64to95: specifies the sector(s) which are write protected between Sector 64 to 95
mbed_official 354:e67efb2aab0e 103 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection3 */
mbed_official 354:e67efb2aab0e 104 #endif /* STM32L151xD || STM32L152xD || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 105
mbed_official 354:e67efb2aab0e 106 #if defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 107 uint32_t WRPSector96To127; /*!< WRPSector96To127: specifies the sector(s) which are write protected between Sector 96 to 127
mbed_official 354:e67efb2aab0e 108 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection4 */
mbed_official 354:e67efb2aab0e 109 #endif /* STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 110
mbed_official 354:e67efb2aab0e 111 uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level..
mbed_official 354:e67efb2aab0e 112 This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */
mbed_official 354:e67efb2aab0e 113
mbed_official 354:e67efb2aab0e 114 uint8_t BORLevel; /*!< BORLevel: Set the BOR Level.
mbed_official 354:e67efb2aab0e 115 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOR_Level */
mbed_official 354:e67efb2aab0e 116
mbed_official 354:e67efb2aab0e 117 uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
mbed_official 354:e67efb2aab0e 118 This parameter can be a combination of @ref FLASHEx_Option_Bytes_IWatchdog, @ref FLASHEx_Option_Bytes_nRST_STOP and @ref FLASHEx_Option_Bytes_nRST_STDBY*/
mbed_official 354:e67efb2aab0e 119 } FLASH_OBProgramInitTypeDef;
mbed_official 354:e67efb2aab0e 120
mbed_official 354:e67efb2aab0e 121 /**
mbed_official 354:e67efb2aab0e 122 * @brief FLASH Advanced Option Bytes Program structure definition
mbed_official 354:e67efb2aab0e 123 */
mbed_official 354:e67efb2aab0e 124 typedef struct
mbed_official 354:e67efb2aab0e 125 {
mbed_official 354:e67efb2aab0e 126 uint32_t OptionType; /*!< OptionType: Option byte to be configured for extension .
mbed_official 354:e67efb2aab0e 127 This parameter can be a value of @ref FLASHEx_OptionAdv_Type */
mbed_official 354:e67efb2aab0e 128
mbed_official 354:e67efb2aab0e 129 #if defined (STM32L151xBA) || defined (STM32L152xBA) || \
mbed_official 354:e67efb2aab0e 130 defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 131 uint32_t PCROPState; /*!< PCROPState: PCROP activation or deactivation.
mbed_official 354:e67efb2aab0e 132 This parameter can be a value of @ref FLASHEx_PCROP_State */
mbed_official 354:e67efb2aab0e 133
mbed_official 354:e67efb2aab0e 134 uint32_t PCROPSector0To31; /*!< PCROPSector0To31: specifies the sector(s) set for PCROP
mbed_official 354:e67efb2aab0e 135 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection1 */
mbed_official 354:e67efb2aab0e 136
mbed_official 354:e67efb2aab0e 137 #if defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 138 uint32_t PCROPSector32To63; /*!< PCROPSector32To63: specifies the sector(s) set for PCROP
mbed_official 354:e67efb2aab0e 139 This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 */
mbed_official 354:e67efb2aab0e 140 #endif /* STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 141 #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 142
mbed_official 354:e67efb2aab0e 143 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 144 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 145 uint16_t BootConfig; /*!< BootConfig: specifies Option bytes for boot config
mbed_official 354:e67efb2aab0e 146 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOT */
mbed_official 354:e67efb2aab0e 147 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE*/
mbed_official 354:e67efb2aab0e 148 } FLASH_AdvOBProgramInitTypeDef;
mbed_official 354:e67efb2aab0e 149
mbed_official 354:e67efb2aab0e 150 /**
mbed_official 354:e67efb2aab0e 151 * @}
mbed_official 354:e67efb2aab0e 152 */
mbed_official 354:e67efb2aab0e 153
mbed_official 354:e67efb2aab0e 154 /* Exported constants --------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 155
mbed_official 354:e67efb2aab0e 156
mbed_official 354:e67efb2aab0e 157 /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
mbed_official 354:e67efb2aab0e 158 * @{
mbed_official 354:e67efb2aab0e 159 */
mbed_official 354:e67efb2aab0e 160
mbed_official 354:e67efb2aab0e 161 /** @defgroup FLASHEx_Type_Erase FLASHEx_Type_Erase
mbed_official 354:e67efb2aab0e 162 * @{
mbed_official 354:e67efb2aab0e 163 */
mbed_official 354:e67efb2aab0e 164 #define TYPEERASE_PAGES ((uint32_t)0x00) /*!<Page erase only*/
mbed_official 354:e67efb2aab0e 165
mbed_official 354:e67efb2aab0e 166 #define IS_TYPEERASE(__VALUE__) (((__VALUE__) == TYPEERASE_PAGES))
mbed_official 354:e67efb2aab0e 167 /**
mbed_official 354:e67efb2aab0e 168 * @}
mbed_official 354:e67efb2aab0e 169 */
mbed_official 354:e67efb2aab0e 170
mbed_official 354:e67efb2aab0e 171 /** @defgroup FLASHEx_Option_Type FLASHEx Option Type
mbed_official 354:e67efb2aab0e 172 * @{
mbed_official 354:e67efb2aab0e 173 */
mbed_official 354:e67efb2aab0e 174 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/
mbed_official 354:e67efb2aab0e 175 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/
mbed_official 354:e67efb2aab0e 176 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!<USER option byte configuration*/
mbed_official 354:e67efb2aab0e 177 #define OPTIONBYTE_BOR ((uint32_t)0x08) /*!<BOR option byte configuration*/
mbed_official 354:e67efb2aab0e 178
mbed_official 354:e67efb2aab0e 179 #define IS_OPTIONBYTE(__VALUE__) (((__VALUE__) < (OPTIONBYTE_WRP|OPTIONBYTE_RDP|OPTIONBYTE_USER|OPTIONBYTE_BOR)))
mbed_official 354:e67efb2aab0e 180 /**
mbed_official 354:e67efb2aab0e 181 * @}
mbed_official 354:e67efb2aab0e 182 */
mbed_official 354:e67efb2aab0e 183
mbed_official 354:e67efb2aab0e 184 /** @defgroup FLASHEx_WRP_State FLASHEx WRP State
mbed_official 354:e67efb2aab0e 185 * @{
mbed_official 354:e67efb2aab0e 186 */
mbed_official 354:e67efb2aab0e 187 #define WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired bank 1 sectors*/
mbed_official 354:e67efb2aab0e 188 #define WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired bank 1 sectors*/
mbed_official 354:e67efb2aab0e 189
mbed_official 354:e67efb2aab0e 190 #define IS_WRPSTATE(__VALUE__) (((__VALUE__) == WRPSTATE_DISABLE) || \
mbed_official 354:e67efb2aab0e 191 ((__VALUE__) == WRPSTATE_ENABLE))
mbed_official 354:e67efb2aab0e 192 /**
mbed_official 354:e67efb2aab0e 193 * @}
mbed_official 354:e67efb2aab0e 194 */
mbed_official 354:e67efb2aab0e 195
mbed_official 354:e67efb2aab0e 196 /** @defgroup FLASHEx_Option_Bytes_Write_Mask FLASHEx Option Bytes Write Mask
mbed_official 354:e67efb2aab0e 197 * @{
mbed_official 354:e67efb2aab0e 198 */
mbed_official 354:e67efb2aab0e 199 #define WRP_MASK_LOW ((uint32_t)0x0000FFFF)
mbed_official 354:e67efb2aab0e 200 #define WRP_MASK_HIGH ((uint32_t)0xFFFF0000)
mbed_official 354:e67efb2aab0e 201
mbed_official 354:e67efb2aab0e 202 /**
mbed_official 354:e67efb2aab0e 203 * @}
mbed_official 354:e67efb2aab0e 204 */
mbed_official 354:e67efb2aab0e 205
mbed_official 354:e67efb2aab0e 206 /** @defgroup FLASHEx_Option_Bytes_Write_Protection1 FLASHEx Option Bytes Write Protection1
mbed_official 354:e67efb2aab0e 207 * @{
mbed_official 354:e67efb2aab0e 208 */
mbed_official 354:e67efb2aab0e 209
mbed_official 354:e67efb2aab0e 210 /* Common pages for Cat1, Cat2, Cat3, Cat4 & Cat5 devices */
mbed_official 354:e67efb2aab0e 211 #define OB_WRP1_PAGES0TO15 ((uint32_t)0x00000001) /* Write protection of Sector0 */
mbed_official 354:e67efb2aab0e 212 #define OB_WRP1_PAGES16TO31 ((uint32_t)0x00000002) /* Write protection of Sector1 */
mbed_official 354:e67efb2aab0e 213 #define OB_WRP1_PAGES32TO47 ((uint32_t)0x00000004) /* Write protection of Sector2 */
mbed_official 354:e67efb2aab0e 214 #define OB_WRP1_PAGES48TO63 ((uint32_t)0x00000008) /* Write protection of Sector3 */
mbed_official 354:e67efb2aab0e 215 #define OB_WRP1_PAGES64TO79 ((uint32_t)0x00000010) /* Write protection of Sector4 */
mbed_official 354:e67efb2aab0e 216 #define OB_WRP1_PAGES80TO95 ((uint32_t)0x00000020) /* Write protection of Sector5 */
mbed_official 354:e67efb2aab0e 217 #define OB_WRP1_PAGES96TO111 ((uint32_t)0x00000040) /* Write protection of Sector6 */
mbed_official 354:e67efb2aab0e 218 #define OB_WRP1_PAGES112TO127 ((uint32_t)0x00000080) /* Write protection of Sector7 */
mbed_official 354:e67efb2aab0e 219 #define OB_WRP1_PAGES128TO143 ((uint32_t)0x00000100) /* Write protection of Sector8 */
mbed_official 354:e67efb2aab0e 220 #define OB_WRP1_PAGES144TO159 ((uint32_t)0x00000200) /* Write protection of Sector9 */
mbed_official 354:e67efb2aab0e 221 #define OB_WRP1_PAGES160TO175 ((uint32_t)0x00000400) /* Write protection of Sector10 */
mbed_official 354:e67efb2aab0e 222 #define OB_WRP1_PAGES176TO191 ((uint32_t)0x00000800) /* Write protection of Sector11 */
mbed_official 354:e67efb2aab0e 223 #define OB_WRP1_PAGES192TO207 ((uint32_t)0x00001000) /* Write protection of Sector12 */
mbed_official 354:e67efb2aab0e 224 #define OB_WRP1_PAGES208TO223 ((uint32_t)0x00002000) /* Write protection of Sector13 */
mbed_official 354:e67efb2aab0e 225 #define OB_WRP1_PAGES224TO239 ((uint32_t)0x00004000) /* Write protection of Sector14 */
mbed_official 354:e67efb2aab0e 226 #define OB_WRP1_PAGES240TO255 ((uint32_t)0x00008000) /* Write protection of Sector15 */
mbed_official 354:e67efb2aab0e 227 #define OB_WRP1_PAGES256TO271 ((uint32_t)0x00010000) /* Write protection of Sector16 */
mbed_official 354:e67efb2aab0e 228 #define OB_WRP1_PAGES272TO287 ((uint32_t)0x00020000) /* Write protection of Sector17 */
mbed_official 354:e67efb2aab0e 229 #define OB_WRP1_PAGES288TO303 ((uint32_t)0x00040000) /* Write protection of Sector18 */
mbed_official 354:e67efb2aab0e 230 #define OB_WRP1_PAGES304TO319 ((uint32_t)0x00080000) /* Write protection of Sector19 */
mbed_official 354:e67efb2aab0e 231 #define OB_WRP1_PAGES320TO335 ((uint32_t)0x00100000) /* Write protection of Sector20 */
mbed_official 354:e67efb2aab0e 232 #define OB_WRP1_PAGES336TO351 ((uint32_t)0x00200000) /* Write protection of Sector21 */
mbed_official 354:e67efb2aab0e 233 #define OB_WRP1_PAGES352TO367 ((uint32_t)0x00400000) /* Write protection of Sector22 */
mbed_official 354:e67efb2aab0e 234 #define OB_WRP1_PAGES368TO383 ((uint32_t)0x00800000) /* Write protection of Sector23 */
mbed_official 354:e67efb2aab0e 235 #define OB_WRP1_PAGES384TO399 ((uint32_t)0x01000000) /* Write protection of Sector24 */
mbed_official 354:e67efb2aab0e 236 #define OB_WRP1_PAGES400TO415 ((uint32_t)0x02000000) /* Write protection of Sector25 */
mbed_official 354:e67efb2aab0e 237 #define OB_WRP1_PAGES416TO431 ((uint32_t)0x04000000) /* Write protection of Sector26 */
mbed_official 354:e67efb2aab0e 238 #define OB_WRP1_PAGES432TO447 ((uint32_t)0x08000000) /* Write protection of Sector27 */
mbed_official 354:e67efb2aab0e 239 #define OB_WRP1_PAGES448TO463 ((uint32_t)0x10000000) /* Write protection of Sector28 */
mbed_official 354:e67efb2aab0e 240 #define OB_WRP1_PAGES464TO479 ((uint32_t)0x20000000) /* Write protection of Sector29 */
mbed_official 354:e67efb2aab0e 241 #define OB_WRP1_PAGES480TO495 ((uint32_t)0x40000000) /* Write protection of Sector30 */
mbed_official 354:e67efb2aab0e 242 #define OB_WRP1_PAGES496TO511 ((uint32_t)0x80000000) /* Write protection of Sector31 */
mbed_official 354:e67efb2aab0e 243
mbed_official 354:e67efb2aab0e 244 #define OB_WRP1_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */
mbed_official 354:e67efb2aab0e 245
mbed_official 354:e67efb2aab0e 246 /**
mbed_official 354:e67efb2aab0e 247 * @}
mbed_official 354:e67efb2aab0e 248 */
mbed_official 354:e67efb2aab0e 249
mbed_official 354:e67efb2aab0e 250 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || \
mbed_official 354:e67efb2aab0e 251 defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 252 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 253
mbed_official 354:e67efb2aab0e 254 /** @defgroup FLASHEx_Option_Bytes_Write_Protection2 FLASHEx Option Bytes Write Protection2
mbed_official 354:e67efb2aab0e 255 * @{
mbed_official 354:e67efb2aab0e 256 */
mbed_official 354:e67efb2aab0e 257
mbed_official 354:e67efb2aab0e 258 /* Pages for Cat3, Cat4 & Cat5 devices*/
mbed_official 354:e67efb2aab0e 259 #define OB_WRP2_PAGES512TO527 ((uint32_t)0x00000001) /* Write protection of Sector32 */
mbed_official 354:e67efb2aab0e 260 #define OB_WRP2_PAGES528TO543 ((uint32_t)0x00000002) /* Write protection of Sector33 */
mbed_official 354:e67efb2aab0e 261 #define OB_WRP2_PAGES544TO559 ((uint32_t)0x00000004) /* Write protection of Sector34 */
mbed_official 354:e67efb2aab0e 262 #define OB_WRP2_PAGES560TO575 ((uint32_t)0x00000008) /* Write protection of Sector35 */
mbed_official 354:e67efb2aab0e 263 #define OB_WRP2_PAGES576TO591 ((uint32_t)0x00000010) /* Write protection of Sector36 */
mbed_official 354:e67efb2aab0e 264 #define OB_WRP2_PAGES592TO607 ((uint32_t)0x00000020) /* Write protection of Sector37 */
mbed_official 354:e67efb2aab0e 265 #define OB_WRP2_PAGES608TO623 ((uint32_t)0x00000040) /* Write protection of Sector38 */
mbed_official 354:e67efb2aab0e 266 #define OB_WRP2_PAGES624TO639 ((uint32_t)0x00000080) /* Write protection of Sector39 */
mbed_official 354:e67efb2aab0e 267 #define OB_WRP2_PAGES640TO655 ((uint32_t)0x00000100) /* Write protection of Sector40 */
mbed_official 354:e67efb2aab0e 268 #define OB_WRP2_PAGES656TO671 ((uint32_t)0x00000200) /* Write protection of Sector41 */
mbed_official 354:e67efb2aab0e 269 #define OB_WRP2_PAGES672TO687 ((uint32_t)0x00000400) /* Write protection of Sector42 */
mbed_official 354:e67efb2aab0e 270 #define OB_WRP2_PAGES688TO703 ((uint32_t)0x00000800) /* Write protection of Sector43 */
mbed_official 354:e67efb2aab0e 271 #define OB_WRP2_PAGES704TO719 ((uint32_t)0x00001000) /* Write protection of Sector44 */
mbed_official 354:e67efb2aab0e 272 #define OB_WRP2_PAGES720TO735 ((uint32_t)0x00002000) /* Write protection of Sector45 */
mbed_official 354:e67efb2aab0e 273 #define OB_WRP2_PAGES736TO751 ((uint32_t)0x00004000) /* Write protection of Sector46 */
mbed_official 354:e67efb2aab0e 274 #define OB_WRP2_PAGES752TO767 ((uint32_t)0x00008000) /* Write protection of Sector47 */
mbed_official 354:e67efb2aab0e 275 #define OB_WRP2_PAGES768TO783 ((uint32_t)0x00010000) /* Write protection of Sector48 */
mbed_official 354:e67efb2aab0e 276 #define OB_WRP2_PAGES784TO799 ((uint32_t)0x00020000) /* Write protection of Sector49 */
mbed_official 354:e67efb2aab0e 277 #define OB_WRP2_PAGES800TO815 ((uint32_t)0x00040000) /* Write protection of Sector50 */
mbed_official 354:e67efb2aab0e 278 #define OB_WRP2_PAGES816TO831 ((uint32_t)0x00080000) /* Write protection of Sector51 */
mbed_official 354:e67efb2aab0e 279 #define OB_WRP2_PAGES832TO847 ((uint32_t)0x00100000) /* Write protection of Sector52 */
mbed_official 354:e67efb2aab0e 280 #define OB_WRP2_PAGES848TO863 ((uint32_t)0x00200000) /* Write protection of Sector53 */
mbed_official 354:e67efb2aab0e 281 #define OB_WRP2_PAGES864TO879 ((uint32_t)0x00400000) /* Write protection of Sector54 */
mbed_official 354:e67efb2aab0e 282 #define OB_WRP2_PAGES880TO895 ((uint32_t)0x00800000) /* Write protection of Sector55 */
mbed_official 354:e67efb2aab0e 283 #define OB_WRP2_PAGES896TO911 ((uint32_t)0x01000000) /* Write protection of Sector56 */
mbed_official 354:e67efb2aab0e 284 #define OB_WRP2_PAGES912TO927 ((uint32_t)0x02000000) /* Write protection of Sector57 */
mbed_official 354:e67efb2aab0e 285 #define OB_WRP2_PAGES928TO943 ((uint32_t)0x04000000) /* Write protection of Sector58 */
mbed_official 354:e67efb2aab0e 286 #define OB_WRP2_PAGES944TO959 ((uint32_t)0x08000000) /* Write protection of Sector59 */
mbed_official 354:e67efb2aab0e 287 #define OB_WRP2_PAGES960TO975 ((uint32_t)0x10000000) /* Write protection of Sector60 */
mbed_official 354:e67efb2aab0e 288 #define OB_WRP2_PAGES976TO991 ((uint32_t)0x20000000) /* Write protection of Sector61 */
mbed_official 354:e67efb2aab0e 289 #define OB_WRP2_PAGES992TO1007 ((uint32_t)0x40000000) /* Write protection of Sector62 */
mbed_official 354:e67efb2aab0e 290 #define OB_WRP2_PAGES1008TO1023 ((uint32_t)0x80000000) /* Write protection of Sector63 */
mbed_official 354:e67efb2aab0e 291
mbed_official 354:e67efb2aab0e 292 #define OB_WRP2_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */
mbed_official 354:e67efb2aab0e 293
mbed_official 354:e67efb2aab0e 294 /**
mbed_official 354:e67efb2aab0e 295 * @}
mbed_official 354:e67efb2aab0e 296 */
mbed_official 354:e67efb2aab0e 297
mbed_official 354:e67efb2aab0e 298 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 299
mbed_official 354:e67efb2aab0e 300 #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 301 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 302
mbed_official 354:e67efb2aab0e 303 /** @defgroup FLASHEx_Option_Bytes_Write_Protection3 FLASHEx Option Bytes Write Protection3
mbed_official 354:e67efb2aab0e 304 * @{
mbed_official 354:e67efb2aab0e 305 */
mbed_official 354:e67efb2aab0e 306
mbed_official 354:e67efb2aab0e 307 /* Pages for devices with FLASH >= 256KB*/
mbed_official 354:e67efb2aab0e 308 #define OB_WRP3_PAGES1024TO1039 ((uint32_t)0x00000001) /* Write protection of Sector64 */
mbed_official 354:e67efb2aab0e 309 #define OB_WRP3_PAGES1040TO1055 ((uint32_t)0x00000002) /* Write protection of Sector65 */
mbed_official 354:e67efb2aab0e 310 #define OB_WRP3_PAGES1056TO1071 ((uint32_t)0x00000004) /* Write protection of Sector66 */
mbed_official 354:e67efb2aab0e 311 #define OB_WRP3_PAGES1072TO1087 ((uint32_t)0x00000008) /* Write protection of Sector67 */
mbed_official 354:e67efb2aab0e 312 #define OB_WRP3_PAGES1088TO1103 ((uint32_t)0x00000010) /* Write protection of Sector68 */
mbed_official 354:e67efb2aab0e 313 #define OB_WRP3_PAGES1104TO1119 ((uint32_t)0x00000020) /* Write protection of Sector69 */
mbed_official 354:e67efb2aab0e 314 #define OB_WRP3_PAGES1120TO1135 ((uint32_t)0x00000040) /* Write protection of Sector70 */
mbed_official 354:e67efb2aab0e 315 #define OB_WRP3_PAGES1136TO1151 ((uint32_t)0x00000080) /* Write protection of Sector71 */
mbed_official 354:e67efb2aab0e 316 #define OB_WRP3_PAGES1152TO1167 ((uint32_t)0x00000100) /* Write protection of Sector72 */
mbed_official 354:e67efb2aab0e 317 #define OB_WRP3_PAGES1168TO1183 ((uint32_t)0x00000200) /* Write protection of Sector73 */
mbed_official 354:e67efb2aab0e 318 #define OB_WRP3_PAGES1184TO1199 ((uint32_t)0x00000400) /* Write protection of Sector74 */
mbed_official 354:e67efb2aab0e 319 #define OB_WRP3_PAGES1200TO1215 ((uint32_t)0x00000800) /* Write protection of Sector75 */
mbed_official 354:e67efb2aab0e 320 #define OB_WRP3_PAGES1216TO1231 ((uint32_t)0x00001000) /* Write protection of Sector76 */
mbed_official 354:e67efb2aab0e 321 #define OB_WRP3_PAGES1232TO1247 ((uint32_t)0x00002000) /* Write protection of Sector77 */
mbed_official 354:e67efb2aab0e 322 #define OB_WRP3_PAGES1248TO1263 ((uint32_t)0x00004000) /* Write protection of Sector78 */
mbed_official 354:e67efb2aab0e 323 #define OB_WRP3_PAGES1264TO1279 ((uint32_t)0x00008000) /* Write protection of Sector79 */
mbed_official 354:e67efb2aab0e 324 #define OB_WRP3_PAGES1280TO1295 ((uint32_t)0x00010000) /* Write protection of Sector80 */
mbed_official 354:e67efb2aab0e 325 #define OB_WRP3_PAGES1296TO1311 ((uint32_t)0x00020000) /* Write protection of Sector81 */
mbed_official 354:e67efb2aab0e 326 #define OB_WRP3_PAGES1312TO1327 ((uint32_t)0x00040000) /* Write protection of Sector82 */
mbed_official 354:e67efb2aab0e 327 #define OB_WRP3_PAGES1328TO1343 ((uint32_t)0x00080000) /* Write protection of Sector83 */
mbed_official 354:e67efb2aab0e 328 #define OB_WRP3_PAGES1344TO1359 ((uint32_t)0x00100000) /* Write protection of Sector84 */
mbed_official 354:e67efb2aab0e 329 #define OB_WRP3_PAGES1360TO1375 ((uint32_t)0x00200000) /* Write protection of Sector85 */
mbed_official 354:e67efb2aab0e 330 #define OB_WRP3_PAGES1376TO1391 ((uint32_t)0x00400000) /* Write protection of Sector86 */
mbed_official 354:e67efb2aab0e 331 #define OB_WRP3_PAGES1392TO1407 ((uint32_t)0x00800000) /* Write protection of Sector87 */
mbed_official 354:e67efb2aab0e 332 #define OB_WRP3_PAGES1408TO1423 ((uint32_t)0x01000000) /* Write protection of Sector88 */
mbed_official 354:e67efb2aab0e 333 #define OB_WRP3_PAGES1424TO1439 ((uint32_t)0x02000000) /* Write protection of Sector89 */
mbed_official 354:e67efb2aab0e 334 #define OB_WRP3_PAGES1440TO1455 ((uint32_t)0x04000000) /* Write protection of Sector90 */
mbed_official 354:e67efb2aab0e 335 #define OB_WRP3_PAGES1456TO1471 ((uint32_t)0x08000000) /* Write protection of Sector91 */
mbed_official 354:e67efb2aab0e 336 #define OB_WRP3_PAGES1472TO1487 ((uint32_t)0x10000000) /* Write protection of Sector92 */
mbed_official 354:e67efb2aab0e 337 #define OB_WRP3_PAGES1488TO1503 ((uint32_t)0x20000000) /* Write protection of Sector93 */
mbed_official 354:e67efb2aab0e 338 #define OB_WRP3_PAGES1504TO1519 ((uint32_t)0x40000000) /* Write protection of Sector94 */
mbed_official 354:e67efb2aab0e 339 #define OB_WRP3_PAGES1520TO1535 ((uint32_t)0x80000000) /* Write protection of Sector95 */
mbed_official 354:e67efb2aab0e 340
mbed_official 354:e67efb2aab0e 341 #define OB_WRP3_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */
mbed_official 354:e67efb2aab0e 342
mbed_official 354:e67efb2aab0e 343 /**
mbed_official 354:e67efb2aab0e 344 * @}
mbed_official 354:e67efb2aab0e 345 */
mbed_official 354:e67efb2aab0e 346
mbed_official 354:e67efb2aab0e 347 #endif /* STM32L151xD || STM32L152xD || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE*/
mbed_official 354:e67efb2aab0e 348
mbed_official 354:e67efb2aab0e 349 #if defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 350
mbed_official 354:e67efb2aab0e 351 /** @defgroup FLASHEx_Option_Bytes_Write_Protection4 FLASHEx Option Bytes Write Protection4
mbed_official 354:e67efb2aab0e 352 * @{
mbed_official 354:e67efb2aab0e 353 */
mbed_official 354:e67efb2aab0e 354
mbed_official 354:e67efb2aab0e 355 /* Pages for Cat5 devices*/
mbed_official 354:e67efb2aab0e 356 #define OB_WRP4_PAGES1536TO1551 ((uint32_t)0x00000001)/* Write protection of Sector96*/
mbed_official 354:e67efb2aab0e 357 #define OB_WRP4_PAGES1552TO1567 ((uint32_t)0x00000002)/* Write protection of Sector97*/
mbed_official 354:e67efb2aab0e 358 #define OB_WRP4_PAGES1568TO1583 ((uint32_t)0x00000004)/* Write protection of Sector98*/
mbed_official 354:e67efb2aab0e 359 #define OB_WRP4_PAGES1584TO1599 ((uint32_t)0x00000008)/* Write protection of Sector99*/
mbed_official 354:e67efb2aab0e 360 #define OB_WRP4_PAGES1600TO1615 ((uint32_t)0x00000010) /* Write protection of Sector100*/
mbed_official 354:e67efb2aab0e 361 #define OB_WRP4_PAGES1616TO1631 ((uint32_t)0x00000020) /* Write protection of Sector101*/
mbed_official 354:e67efb2aab0e 362 #define OB_WRP4_PAGES1632TO1647 ((uint32_t)0x00000040) /* Write protection of Sector102*/
mbed_official 354:e67efb2aab0e 363 #define OB_WRP4_PAGES1648TO1663 ((uint32_t)0x00000080) /* Write protection of Sector103*/
mbed_official 354:e67efb2aab0e 364 #define OB_WRP4_PAGES1664TO1679 ((uint32_t)0x00000100) /* Write protection of Sector104*/
mbed_official 354:e67efb2aab0e 365 #define OB_WRP4_PAGES1680TO1695 ((uint32_t)0x00000200) /* Write protection of Sector105*/
mbed_official 354:e67efb2aab0e 366 #define OB_WRP4_PAGES1696TO1711 ((uint32_t)0x00000400) /* Write protection of Sector106*/
mbed_official 354:e67efb2aab0e 367 #define OB_WRP4_PAGES1712TO1727 ((uint32_t)0x00000800) /* Write protection of Sector107*/
mbed_official 354:e67efb2aab0e 368 #define OB_WRP4_PAGES1728TO1743 ((uint32_t)0x00001000) /* Write protection of Sector108*/
mbed_official 354:e67efb2aab0e 369 #define OB_WRP4_PAGES1744TO1759 ((uint32_t)0x00002000) /* Write protection of Sector109*/
mbed_official 354:e67efb2aab0e 370 #define OB_WRP4_PAGES1760TO1775 ((uint32_t)0x00004000) /* Write protection of Sector110*/
mbed_official 354:e67efb2aab0e 371 #define OB_WRP4_PAGES1776TO1791 ((uint32_t)0x00008000) /* Write protection of Sector111*/
mbed_official 354:e67efb2aab0e 372 #define OB_WRP4_PAGES1792TO1807 ((uint32_t)0x00010000) /* Write protection of Sector112*/
mbed_official 354:e67efb2aab0e 373 #define OB_WRP4_PAGES1808TO1823 ((uint32_t)0x00020000) /* Write protection of Sector113*/
mbed_official 354:e67efb2aab0e 374 #define OB_WRP4_PAGES1824TO1839 ((uint32_t)0x00040000) /* Write protection of Sector114*/
mbed_official 354:e67efb2aab0e 375 #define OB_WRP4_PAGES1840TO1855 ((uint32_t)0x00080000) /* Write protection of Sector115*/
mbed_official 354:e67efb2aab0e 376 #define OB_WRP4_PAGES1856TO1871 ((uint32_t)0x00100000) /* Write protection of Sector116*/
mbed_official 354:e67efb2aab0e 377 #define OB_WRP4_PAGES1872TO1887 ((uint32_t)0x00200000) /* Write protection of Sector117*/
mbed_official 354:e67efb2aab0e 378 #define OB_WRP4_PAGES1888TO1903 ((uint32_t)0x00400000) /* Write protection of Sector118*/
mbed_official 354:e67efb2aab0e 379 #define OB_WRP4_PAGES1904TO1919 ((uint32_t)0x00800000) /* Write protection of Sector119*/
mbed_official 354:e67efb2aab0e 380 #define OB_WRP4_PAGES1920TO1935 ((uint32_t)0x01000000) /* Write protection of Sector120*/
mbed_official 354:e67efb2aab0e 381 #define OB_WRP4_PAGES1936TO1951 ((uint32_t)0x02000000) /* Write protection of Sector121*/
mbed_official 354:e67efb2aab0e 382 #define OB_WRP4_PAGES1952TO1967 ((uint32_t)0x04000000) /* Write protection of Sector122*/
mbed_official 354:e67efb2aab0e 383 #define OB_WRP4_PAGES1968TO1983 ((uint32_t)0x08000000) /* Write protection of Sector123*/
mbed_official 354:e67efb2aab0e 384 #define OB_WRP4_PAGES1984TO1999 ((uint32_t)0x10000000) /* Write protection of Sector124*/
mbed_official 354:e67efb2aab0e 385 #define OB_WRP4_PAGES2000TO2015 ((uint32_t)0x20000000) /* Write protection of Sector125*/
mbed_official 354:e67efb2aab0e 386 #define OB_WRP4_PAGES2016TO2031 ((uint32_t)0x40000000) /* Write protection of Sector126*/
mbed_official 354:e67efb2aab0e 387 #define OB_WRP4_PAGES2032TO2047 ((uint32_t)0x80000000) /* Write protection of Sector127*/
mbed_official 354:e67efb2aab0e 388
mbed_official 354:e67efb2aab0e 389 #define OB_WRP4_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */
mbed_official 354:e67efb2aab0e 390
mbed_official 354:e67efb2aab0e 391 /**
mbed_official 354:e67efb2aab0e 392 * @}
mbed_official 354:e67efb2aab0e 393 */
mbed_official 354:e67efb2aab0e 394
mbed_official 354:e67efb2aab0e 395 #endif /* STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 396
mbed_official 354:e67efb2aab0e 397 /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASHEx Option Bytes Read Protection
mbed_official 354:e67efb2aab0e 398 * @{
mbed_official 354:e67efb2aab0e 399 */
mbed_official 354:e67efb2aab0e 400 #define OB_RDP_LEVEL0 ((uint8_t)0xAA)
mbed_official 354:e67efb2aab0e 401 #define OB_RDP_LEVEL1 ((uint8_t)0xBB)
mbed_official 354:e67efb2aab0e 402 /*#define OB_RDP_LEVEL2 ((uint8_t)0xCC)*/ /* Warning: When enabling read protection level 2
mbed_official 354:e67efb2aab0e 403 it's no more possible to go back to level 1 or 0 */
mbed_official 354:e67efb2aab0e 404
mbed_official 354:e67efb2aab0e 405 #define IS_OB_RDP(__LEVEL__) (((__LEVEL__) == OB_RDP_LEVEL0)||\
mbed_official 354:e67efb2aab0e 406 ((__LEVEL__) == OB_RDP_LEVEL1))/*||\
mbed_official 354:e67efb2aab0e 407 ((__LEVEL__) == OB_RDP_LEVEL2))*/
mbed_official 354:e67efb2aab0e 408 /**
mbed_official 354:e67efb2aab0e 409 * @}
mbed_official 354:e67efb2aab0e 410 */
mbed_official 354:e67efb2aab0e 411
mbed_official 354:e67efb2aab0e 412 /** @defgroup FLASHEx_Option_Bytes_BOR_Level FLASHEx Option Bytes BOR Level
mbed_official 354:e67efb2aab0e 413 * @{
mbed_official 354:e67efb2aab0e 414 */
mbed_official 354:e67efb2aab0e 415
mbed_official 354:e67efb2aab0e 416 #define OB_BOR_OFF ((uint8_t)0x00) /*!< BOR is disabled at power down, the reset is asserted when the VDD
mbed_official 354:e67efb2aab0e 417 power supply reaches the PDR(Power Down Reset) threshold (1.5V) */
mbed_official 354:e67efb2aab0e 418 #define OB_BOR_LEVEL1 ((uint8_t)0x08) /*!< BOR Reset threshold levels for 1.7V - 1.8V VDD power supply */
mbed_official 354:e67efb2aab0e 419 #define OB_BOR_LEVEL2 ((uint8_t)0x09) /*!< BOR Reset threshold levels for 1.9V - 2.0V VDD power supply */
mbed_official 354:e67efb2aab0e 420 #define OB_BOR_LEVEL3 ((uint8_t)0x0A) /*!< BOR Reset threshold levels for 2.3V - 2.4V VDD power supply */
mbed_official 354:e67efb2aab0e 421 #define OB_BOR_LEVEL4 ((uint8_t)0x0B) /*!< BOR Reset threshold levels for 2.55V - 2.65V VDD power supply */
mbed_official 354:e67efb2aab0e 422 #define OB_BOR_LEVEL5 ((uint8_t)0x0C) /*!< BOR Reset threshold levels for 2.8V - 2.9V VDD power supply */
mbed_official 354:e67efb2aab0e 423
mbed_official 354:e67efb2aab0e 424 #define IS_OB_BOR_LEVEL(__LEVEL__) ( ((__LEVEL__) == OB_BOR_OFF) || \
mbed_official 354:e67efb2aab0e 425 ((__LEVEL__) == OB_BOR_LEVEL1) || \
mbed_official 354:e67efb2aab0e 426 ((__LEVEL__) == OB_BOR_LEVEL2) || \
mbed_official 354:e67efb2aab0e 427 ((__LEVEL__) == OB_BOR_LEVEL3) || \
mbed_official 354:e67efb2aab0e 428 ((__LEVEL__) == OB_BOR_LEVEL4) || \
mbed_official 354:e67efb2aab0e 429 ((__LEVEL__) == OB_BOR_LEVEL5))
mbed_official 354:e67efb2aab0e 430
mbed_official 354:e67efb2aab0e 431 /**
mbed_official 354:e67efb2aab0e 432 * @}
mbed_official 354:e67efb2aab0e 433 */
mbed_official 354:e67efb2aab0e 434
mbed_official 354:e67efb2aab0e 435 /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASHEx Option Bytes IWatchdog
mbed_official 354:e67efb2aab0e 436 * @{
mbed_official 354:e67efb2aab0e 437 */
mbed_official 354:e67efb2aab0e 438
mbed_official 354:e67efb2aab0e 439 #define OB_IWDG_SW ((uint8_t)0x10) /*!< Software WDG selected */
mbed_official 354:e67efb2aab0e 440 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware WDG selected */
mbed_official 354:e67efb2aab0e 441
mbed_official 354:e67efb2aab0e 442 #define IS_OB_IWDG_SOURCE(__SOURCE__) (((__SOURCE__) == OB_IWDG_SW) || ((__SOURCE__) == OB_IWDG_HW))
mbed_official 354:e67efb2aab0e 443
mbed_official 354:e67efb2aab0e 444 /**
mbed_official 354:e67efb2aab0e 445 * @}
mbed_official 354:e67efb2aab0e 446 */
mbed_official 354:e67efb2aab0e 447
mbed_official 354:e67efb2aab0e 448 /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASHEx Option Bytes nRST_STOP
mbed_official 354:e67efb2aab0e 449 * @{
mbed_official 354:e67efb2aab0e 450 */
mbed_official 354:e67efb2aab0e 451
mbed_official 354:e67efb2aab0e 452 #define OB_STOP_NORST ((uint8_t)0x20) /*!< No reset generated when entering in STOP */
mbed_official 354:e67efb2aab0e 453 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
mbed_official 354:e67efb2aab0e 454 #define IS_OB_STOP_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STOP_NORST) || ((__SOURCE__) == OB_STOP_RST))
mbed_official 354:e67efb2aab0e 455
mbed_official 354:e67efb2aab0e 456 /**
mbed_official 354:e67efb2aab0e 457 * @}
mbed_official 354:e67efb2aab0e 458 */
mbed_official 354:e67efb2aab0e 459
mbed_official 354:e67efb2aab0e 460 /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASHEx Option Bytes nRST_STDBY
mbed_official 354:e67efb2aab0e 461 * @{
mbed_official 354:e67efb2aab0e 462 */
mbed_official 354:e67efb2aab0e 463
mbed_official 354:e67efb2aab0e 464 #define OB_STDBY_NORST ((uint8_t)0x40) /*!< No reset generated when entering in STANDBY */
mbed_official 354:e67efb2aab0e 465 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
mbed_official 354:e67efb2aab0e 466 #define IS_OB_STDBY_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STDBY_NORST) || ((__SOURCE__) == OB_STDBY_RST))
mbed_official 354:e67efb2aab0e 467
mbed_official 354:e67efb2aab0e 468 /**
mbed_official 354:e67efb2aab0e 469 * @}
mbed_official 354:e67efb2aab0e 470 */
mbed_official 354:e67efb2aab0e 471
mbed_official 354:e67efb2aab0e 472 #if defined (STM32L151xBA) || defined (STM32L152xBA) || \
mbed_official 354:e67efb2aab0e 473 defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 474
mbed_official 354:e67efb2aab0e 475 /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type
mbed_official 354:e67efb2aab0e 476 * @{
mbed_official 354:e67efb2aab0e 477 */
mbed_official 354:e67efb2aab0e 478
mbed_official 354:e67efb2aab0e 479 #define OBEX_PCROP ((uint32_t)0x01) /*!<PCROP option byte configuration*/
mbed_official 354:e67efb2aab0e 480
mbed_official 354:e67efb2aab0e 481 #define IS_OBEX(__VALUE__) ((__VALUE__) == OBEX_PCROP)
mbed_official 354:e67efb2aab0e 482
mbed_official 354:e67efb2aab0e 483 /**
mbed_official 354:e67efb2aab0e 484 * @}
mbed_official 354:e67efb2aab0e 485 */
mbed_official 354:e67efb2aab0e 486
mbed_official 354:e67efb2aab0e 487 #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 488
mbed_official 354:e67efb2aab0e 489 #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 490 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 491
mbed_official 354:e67efb2aab0e 492 /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type
mbed_official 354:e67efb2aab0e 493 * @{
mbed_official 354:e67efb2aab0e 494 */
mbed_official 354:e67efb2aab0e 495
mbed_official 354:e67efb2aab0e 496 #define OBEX_BOOTCONFIG ((uint32_t)0x02) /*!<BOOTConfig option byte configuration*/
mbed_official 354:e67efb2aab0e 497
mbed_official 354:e67efb2aab0e 498 #define IS_OBEX(__VALUE__) ((__VALUE__) == OBEX_BOOTCONFIG)
mbed_official 354:e67efb2aab0e 499
mbed_official 354:e67efb2aab0e 500 /**
mbed_official 354:e67efb2aab0e 501 * @}
mbed_official 354:e67efb2aab0e 502 */
mbed_official 354:e67efb2aab0e 503
mbed_official 354:e67efb2aab0e 504 #endif /* STM32L151xD || STM32L152xD || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 505
mbed_official 354:e67efb2aab0e 506 #if defined (STM32L151xBA) || defined (STM32L152xBA) || \
mbed_official 354:e67efb2aab0e 507 defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 508
mbed_official 354:e67efb2aab0e 509 /** @defgroup FLASHEx_PCROP_State FLASHEx PCROP State
mbed_official 354:e67efb2aab0e 510 * @{
mbed_official 354:e67efb2aab0e 511 */
mbed_official 354:e67efb2aab0e 512 #define PCROPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable PCROP for selected sectors */
mbed_official 354:e67efb2aab0e 513 #define PCROPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable PCROP for selected sectors */
mbed_official 354:e67efb2aab0e 514
mbed_official 354:e67efb2aab0e 515 #define IS_PCROPSTATE(__VALUE__) (((__VALUE__) == PCROPSTATE_DISABLE) || \
mbed_official 354:e67efb2aab0e 516 ((__VALUE__) == PCROPSTATE_ENABLE))
mbed_official 354:e67efb2aab0e 517 /**
mbed_official 354:e67efb2aab0e 518 * @}
mbed_official 354:e67efb2aab0e 519 */
mbed_official 354:e67efb2aab0e 520
mbed_official 354:e67efb2aab0e 521 /** @defgroup FLASHEx_Selection_Protection_Mode FLASHEx Selection Protection Mode
mbed_official 354:e67efb2aab0e 522 * @{
mbed_official 354:e67efb2aab0e 523 */
mbed_official 354:e67efb2aab0e 524 #define OB_PCROP_DESELECTED ((uint16_t)0x0000) /*!< Disabled PCROP, nWPRi bits used for Write Protection on sector i */
mbed_official 354:e67efb2aab0e 525 #define OB_PCROP_SELECTED ((uint16_t)FLASH_OBR_SPRMOD) /*!< Enable PCROP, nWPRi bits used for PCRoP Protection on sector i */
mbed_official 354:e67efb2aab0e 526
mbed_official 354:e67efb2aab0e 527 /**
mbed_official 354:e67efb2aab0e 528 * @}
mbed_official 354:e67efb2aab0e 529 */
mbed_official 354:e67efb2aab0e 530
mbed_official 354:e67efb2aab0e 531 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection1 FLASHEx Option Bytes PC ReadWrite Protection 1
mbed_official 354:e67efb2aab0e 532 * @{
mbed_official 354:e67efb2aab0e 533 */
mbed_official 354:e67efb2aab0e 534
mbed_official 354:e67efb2aab0e 535 /* Common pages for Cat1, Cat2, Cat3, Cat4 & Cat5 devices */
mbed_official 354:e67efb2aab0e 536 #define OB_PCROP1_PAGES0TO15 ((uint32_t)0x00000001) /* PC Read/Write protection of Sector0 */
mbed_official 354:e67efb2aab0e 537 #define OB_PCROP1_PAGES16TO31 ((uint32_t)0x00000002) /* PC Read/Write protection of Sector1 */
mbed_official 354:e67efb2aab0e 538 #define OB_PCROP1_PAGES32TO47 ((uint32_t)0x00000004) /* PC Read/Write protection of Sector2 */
mbed_official 354:e67efb2aab0e 539 #define OB_PCROP1_PAGES48TO63 ((uint32_t)0x00000008) /* PC Read/Write protection of Sector3 */
mbed_official 354:e67efb2aab0e 540 #define OB_PCROP1_PAGES64TO79 ((uint32_t)0x00000010) /* PC Read/Write protection of Sector4 */
mbed_official 354:e67efb2aab0e 541 #define OB_PCROP1_PAGES80TO95 ((uint32_t)0x00000020) /* PC Read/Write protection of Sector5 */
mbed_official 354:e67efb2aab0e 542 #define OB_PCROP1_PAGES96TO111 ((uint32_t)0x00000040) /* PC Read/Write protection of Sector6 */
mbed_official 354:e67efb2aab0e 543 #define OB_PCROP1_PAGES112TO127 ((uint32_t)0x00000080) /* PC Read/Write protection of Sector7 */
mbed_official 354:e67efb2aab0e 544 #define OB_PCROP1_PAGES128TO143 ((uint32_t)0x00000100) /* PC Read/Write protection of Sector8 */
mbed_official 354:e67efb2aab0e 545 #define OB_PCROP1_PAGES144TO159 ((uint32_t)0x00000200) /* PC Read/Write protection of Sector9 */
mbed_official 354:e67efb2aab0e 546 #define OB_PCROP1_PAGES160TO175 ((uint32_t)0x00000400) /* PC Read/Write protection of Sector10 */
mbed_official 354:e67efb2aab0e 547 #define OB_PCROP1_PAGES176TO191 ((uint32_t)0x00000800) /* PC Read/Write protection of Sector11 */
mbed_official 354:e67efb2aab0e 548 #define OB_PCROP1_PAGES192TO207 ((uint32_t)0x00001000) /* PC Read/Write protection of Sector12 */
mbed_official 354:e67efb2aab0e 549 #define OB_PCROP1_PAGES208TO223 ((uint32_t)0x00002000) /* PC Read/Write protection of Sector13 */
mbed_official 354:e67efb2aab0e 550 #define OB_PCROP1_PAGES224TO239 ((uint32_t)0x00004000) /* PC Read/Write protection of Sector14 */
mbed_official 354:e67efb2aab0e 551 #define OB_PCROP1_PAGES240TO255 ((uint32_t)0x00008000) /* PC Read/Write protection of Sector15 */
mbed_official 354:e67efb2aab0e 552 #define OB_PCROP1_PAGES256TO271 ((uint32_t)0x00010000) /* PC Read/Write protection of Sector16 */
mbed_official 354:e67efb2aab0e 553 #define OB_PCROP1_PAGES272TO287 ((uint32_t)0x00020000) /* PC Read/Write protection of Sector17 */
mbed_official 354:e67efb2aab0e 554 #define OB_PCROP1_PAGES288TO303 ((uint32_t)0x00040000) /* PC Read/Write protection of Sector18 */
mbed_official 354:e67efb2aab0e 555 #define OB_PCROP1_PAGES304TO319 ((uint32_t)0x00080000) /* PC Read/Write protection of Sector19 */
mbed_official 354:e67efb2aab0e 556 #define OB_PCROP1_PAGES320TO335 ((uint32_t)0x00100000) /* PC Read/Write protection of Sector20 */
mbed_official 354:e67efb2aab0e 557 #define OB_PCROP1_PAGES336TO351 ((uint32_t)0x00200000) /* PC Read/Write protection of Sector21 */
mbed_official 354:e67efb2aab0e 558 #define OB_PCROP1_PAGES352TO367 ((uint32_t)0x00400000) /* PC Read/Write protection of Sector22 */
mbed_official 354:e67efb2aab0e 559 #define OB_PCROP1_PAGES368TO383 ((uint32_t)0x00800000) /* PC Read/Write protection of Sector23 */
mbed_official 354:e67efb2aab0e 560 #define OB_PCROP1_PAGES384TO399 ((uint32_t)0x01000000) /* PC Read/Write protection of Sector24 */
mbed_official 354:e67efb2aab0e 561 #define OB_PCROP1_PAGES400TO415 ((uint32_t)0x02000000) /* PC Read/Write protection of Sector25 */
mbed_official 354:e67efb2aab0e 562 #define OB_PCROP1_PAGES416TO431 ((uint32_t)0x04000000) /* PC Read/Write protection of Sector26 */
mbed_official 354:e67efb2aab0e 563 #define OB_PCROP1_PAGES432TO447 ((uint32_t)0x08000000) /* PC Read/Write protection of Sector27 */
mbed_official 354:e67efb2aab0e 564 #define OB_PCROP1_PAGES448TO463 ((uint32_t)0x10000000) /* PC Read/Write protection of Sector28 */
mbed_official 354:e67efb2aab0e 565 #define OB_PCROP1_PAGES464TO479 ((uint32_t)0x20000000) /* PC Read/Write protection of Sector29 */
mbed_official 354:e67efb2aab0e 566 #define OB_PCROP1_PAGES480TO495 ((uint32_t)0x40000000) /* PC Read/Write protection of Sector30 */
mbed_official 354:e67efb2aab0e 567 #define OB_PCROP1_PAGES496TO511 ((uint32_t)0x80000000) /* PC Read/Write protection of Sector31 */
mbed_official 354:e67efb2aab0e 568
mbed_official 354:e67efb2aab0e 569 #define OB_PCROP1_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< PC Read/Write protection of all Sectors */
mbed_official 354:e67efb2aab0e 570
mbed_official 354:e67efb2aab0e 571 /**
mbed_official 354:e67efb2aab0e 572 * @}
mbed_official 354:e67efb2aab0e 573 */
mbed_official 354:e67efb2aab0e 574
mbed_official 354:e67efb2aab0e 575 #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 576
mbed_official 354:e67efb2aab0e 577 #if defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 578
mbed_official 354:e67efb2aab0e 579 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 FLASHEx Option Bytes PC ReadWrite Protection 2
mbed_official 354:e67efb2aab0e 580 * @{
mbed_official 354:e67efb2aab0e 581 */
mbed_official 354:e67efb2aab0e 582
mbed_official 354:e67efb2aab0e 583 /* Pages for Cat3, Cat4 & Cat5 devices*/
mbed_official 354:e67efb2aab0e 584 #define OB_PCROP2_PAGES512TO527 ((uint32_t)0x00000001) /* PC Read/Write protection of Sector32 */
mbed_official 354:e67efb2aab0e 585 #define OB_PCROP2_PAGES528TO543 ((uint32_t)0x00000002) /* PC Read/Write protection of Sector33 */
mbed_official 354:e67efb2aab0e 586 #define OB_PCROP2_PAGES544TO559 ((uint32_t)0x00000004) /* PC Read/Write protection of Sector34 */
mbed_official 354:e67efb2aab0e 587 #define OB_PCROP2_PAGES560TO575 ((uint32_t)0x00000008) /* PC Read/Write protection of Sector35 */
mbed_official 354:e67efb2aab0e 588 #define OB_PCROP2_PAGES576TO591 ((uint32_t)0x00000010) /* PC Read/Write protection of Sector36 */
mbed_official 354:e67efb2aab0e 589 #define OB_PCROP2_PAGES592TO607 ((uint32_t)0x00000020) /* PC Read/Write protection of Sector37 */
mbed_official 354:e67efb2aab0e 590 #define OB_PCROP2_PAGES608TO623 ((uint32_t)0x00000040) /* PC Read/Write protection of Sector38 */
mbed_official 354:e67efb2aab0e 591 #define OB_PCROP2_PAGES624TO639 ((uint32_t)0x00000080) /* PC Read/Write protection of Sector39 */
mbed_official 354:e67efb2aab0e 592 #define OB_PCROP2_PAGES640TO655 ((uint32_t)0x00000100) /* PC Read/Write protection of Sector40 */
mbed_official 354:e67efb2aab0e 593 #define OB_PCROP2_PAGES656TO671 ((uint32_t)0x00000200) /* PC Read/Write protection of Sector41 */
mbed_official 354:e67efb2aab0e 594 #define OB_PCROP2_PAGES672TO687 ((uint32_t)0x00000400) /* PC Read/Write protection of Sector42 */
mbed_official 354:e67efb2aab0e 595 #define OB_PCROP2_PAGES688TO703 ((uint32_t)0x00000800) /* PC Read/Write protection of Sector43 */
mbed_official 354:e67efb2aab0e 596 #define OB_PCROP2_PAGES704TO719 ((uint32_t)0x00001000) /* PC Read/Write protection of Sector44 */
mbed_official 354:e67efb2aab0e 597 #define OB_PCROP2_PAGES720TO735 ((uint32_t)0x00002000) /* PC Read/Write protection of Sector45 */
mbed_official 354:e67efb2aab0e 598 #define OB_PCROP2_PAGES736TO751 ((uint32_t)0x00004000) /* PC Read/Write protection of Sector46 */
mbed_official 354:e67efb2aab0e 599 #define OB_PCROP2_PAGES752TO767 ((uint32_t)0x00008000) /* PC Read/Write protection of Sector47 */
mbed_official 354:e67efb2aab0e 600 #define OB_PCROP2_PAGES768TO783 ((uint32_t)0x00010000) /* PC Read/Write protection of Sector48 */
mbed_official 354:e67efb2aab0e 601 #define OB_PCROP2_PAGES784TO799 ((uint32_t)0x00020000) /* PC Read/Write protection of Sector49 */
mbed_official 354:e67efb2aab0e 602 #define OB_PCROP2_PAGES800TO815 ((uint32_t)0x00040000) /* PC Read/Write protection of Sector50 */
mbed_official 354:e67efb2aab0e 603 #define OB_PCROP2_PAGES816TO831 ((uint32_t)0x00080000) /* PC Read/Write protection of Sector51 */
mbed_official 354:e67efb2aab0e 604 #define OB_PCROP2_PAGES832TO847 ((uint32_t)0x00100000) /* PC Read/Write protection of Sector52 */
mbed_official 354:e67efb2aab0e 605 #define OB_PCROP2_PAGES848TO863 ((uint32_t)0x00200000) /* PC Read/Write protection of Sector53 */
mbed_official 354:e67efb2aab0e 606 #define OB_PCROP2_PAGES864TO879 ((uint32_t)0x00400000) /* PC Read/Write protection of Sector54 */
mbed_official 354:e67efb2aab0e 607 #define OB_PCROP2_PAGES880TO895 ((uint32_t)0x00800000) /* PC Read/Write protection of Sector55 */
mbed_official 354:e67efb2aab0e 608 #define OB_PCROP2_PAGES896TO911 ((uint32_t)0x01000000) /* PC Read/Write protection of Sector56 */
mbed_official 354:e67efb2aab0e 609 #define OB_PCROP2_PAGES912TO927 ((uint32_t)0x02000000) /* PC Read/Write protection of Sector57 */
mbed_official 354:e67efb2aab0e 610 #define OB_PCROP2_PAGES928TO943 ((uint32_t)0x04000000) /* PC Read/Write protection of Sector58 */
mbed_official 354:e67efb2aab0e 611 #define OB_PCROP2_PAGES944TO959 ((uint32_t)0x08000000) /* PC Read/Write protection of Sector59 */
mbed_official 354:e67efb2aab0e 612 #define OB_PCROP2_PAGES960TO975 ((uint32_t)0x10000000) /* PC Read/Write protection of Sector60 */
mbed_official 354:e67efb2aab0e 613 #define OB_PCROP2_PAGES976TO991 ((uint32_t)0x20000000) /* PC Read/Write protection of Sector61 */
mbed_official 354:e67efb2aab0e 614 #define OB_PCROP2_PAGES992TO1007 ((uint32_t)0x40000000) /* PC Read/Write protection of Sector62 */
mbed_official 354:e67efb2aab0e 615 #define OB_PCROP2_PAGES1008TO1023 ((uint32_t)0x80000000) /* PC Read/Write protection of Sector63 */
mbed_official 354:e67efb2aab0e 616
mbed_official 354:e67efb2aab0e 617 #define OB_PCROP2_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< PC Read/Write protection of all Sectors */
mbed_official 354:e67efb2aab0e 618
mbed_official 354:e67efb2aab0e 619 /**
mbed_official 354:e67efb2aab0e 620 * @}
mbed_official 354:e67efb2aab0e 621 */
mbed_official 354:e67efb2aab0e 622
mbed_official 354:e67efb2aab0e 623 #endif /* STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 624
mbed_official 354:e67efb2aab0e 625 /** @defgroup FLASHEx_Type_Erase_Data FLASHEx Type Erase Data
mbed_official 354:e67efb2aab0e 626 * @{
mbed_official 354:e67efb2aab0e 627 */
mbed_official 354:e67efb2aab0e 628 #define TYPEERASEDATA_BYTE ((uint32_t)0x00) /*!<Erase byte (8-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 629 #define TYPEERASEDATA_HALFWORD ((uint32_t)0x01) /*!<Erase a half-word (16-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 630 #define TYPEERASEDATA_WORD ((uint32_t)0x02) /*!<Erase a word (32-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 631
mbed_official 354:e67efb2aab0e 632 #define IS_TYPEERASEDATA(__VALUE__) (((__VALUE__) == TYPEERASEDATA_BYTE) || \
mbed_official 354:e67efb2aab0e 633 ((__VALUE__) == TYPEERASEDATA_HALFWORD) || \
mbed_official 354:e67efb2aab0e 634 ((__VALUE__) == TYPEERASEDATA_WORD))
mbed_official 354:e67efb2aab0e 635 /**
mbed_official 354:e67efb2aab0e 636 * @}
mbed_official 354:e67efb2aab0e 637 */
mbed_official 354:e67efb2aab0e 638
mbed_official 354:e67efb2aab0e 639 /** @defgroup FLASHEx_Type_Program_Data FLASHEx Type Program Data
mbed_official 354:e67efb2aab0e 640 * @{
mbed_official 354:e67efb2aab0e 641 */
mbed_official 354:e67efb2aab0e 642 #define TYPEPROGRAMDATA_BYTE ((uint32_t)0x00) /*!<Program byte (8-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 643 #define TYPEPROGRAMDATA_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 644 #define TYPEPROGRAMDATA_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 645 #define TYPEPROGRAMDATA_FASTBYTE ((uint32_t)0x04) /*!<Fast Program byte (8-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 646 #define TYPEPROGRAMDATA_FASTHALFWORD ((uint32_t)0x08) /*!<Fast Program a half-word (16-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 647 #define TYPEPROGRAMDATA_FASTWORD ((uint32_t)0x10) /*!<Fast Program a word (32-bit) at a specified address.*/
mbed_official 354:e67efb2aab0e 648
mbed_official 354:e67efb2aab0e 649 #define IS_TYPEPROGRAMDATA(__VALUE__) (((__VALUE__) == TYPEPROGRAMDATA_BYTE) || \
mbed_official 354:e67efb2aab0e 650 ((__VALUE__) == TYPEPROGRAMDATA_HALFWORD) || \
mbed_official 354:e67efb2aab0e 651 ((__VALUE__) == TYPEPROGRAMDATA_WORD) || \
mbed_official 354:e67efb2aab0e 652 ((__VALUE__) == TYPEPROGRAMDATA_FASTBYTE) || \
mbed_official 354:e67efb2aab0e 653 ((__VALUE__) == TYPEPROGRAMDATA_FASTHALFWORD) || \
mbed_official 354:e67efb2aab0e 654 ((__VALUE__) == TYPEPROGRAMDATA_FASTWORD))
mbed_official 354:e67efb2aab0e 655 /**
mbed_official 354:e67efb2aab0e 656 * @}
mbed_official 354:e67efb2aab0e 657 */
mbed_official 354:e67efb2aab0e 658
mbed_official 354:e67efb2aab0e 659
mbed_official 354:e67efb2aab0e 660 /** @defgroup FLASHEx_Address FLASHEx Address
mbed_official 354:e67efb2aab0e 661 * @{
mbed_official 354:e67efb2aab0e 662 */
mbed_official 354:e67efb2aab0e 663 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || \
mbed_official 354:e67efb2aab0e 664 defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA)
mbed_official 354:e67efb2aab0e 665
mbed_official 354:e67efb2aab0e 666 /******* Devices with FLASH 128K *******/
mbed_official 354:e67efb2aab0e 667 #define FLASH_NBPAGES_MAX 512 /* 512 pages from page 0 to page 511 */
mbed_official 354:e67efb2aab0e 668
mbed_official 354:e67efb2aab0e 669 #elif defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || \
mbed_official 354:e67efb2aab0e 670 defined (STM32L151xCA) || defined (STM32L152xCA) || defined (STM32L162xCA)
mbed_official 354:e67efb2aab0e 671
mbed_official 354:e67efb2aab0e 672 /******* Devices with FLASH 256K *******/
mbed_official 354:e67efb2aab0e 673 #define FLASH_NBPAGES_MAX 1025 /* 1025 pages from page 0 to page 1024 */
mbed_official 354:e67efb2aab0e 674
mbed_official 354:e67efb2aab0e 675 #elif defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD)
mbed_official 354:e67efb2aab0e 676
mbed_official 354:e67efb2aab0e 677 /******* Devices with FLASH 384K *******/
mbed_official 354:e67efb2aab0e 678 #define FLASH_NBPAGES_MAX 1536 /* 1536 pages from page 0 to page 1535 */
mbed_official 354:e67efb2aab0e 679
mbed_official 354:e67efb2aab0e 680 #elif defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 681
mbed_official 354:e67efb2aab0e 682 /******* Devices with FLASH 512K *******/
mbed_official 354:e67efb2aab0e 683 #define FLASH_NBPAGES_MAX 2048 /* 2048 pages from page 0 to page 2047 */
mbed_official 354:e67efb2aab0e 684
mbed_official 354:e67efb2aab0e 685 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA */
mbed_official 354:e67efb2aab0e 686
mbed_official 354:e67efb2aab0e 687 #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_EEPROM_BASE) && ((__ADDRESS__) <= FLASH_EEPROM_END))
mbed_official 354:e67efb2aab0e 688
mbed_official 354:e67efb2aab0e 689 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || \
mbed_official 354:e67efb2aab0e 690 defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || \
mbed_official 354:e67efb2aab0e 691 defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || \
mbed_official 354:e67efb2aab0e 692 defined (STM32L151xCA) || defined (STM32L152xCA) || defined (STM32L162xCA)
mbed_official 354:e67efb2aab0e 693
mbed_official 354:e67efb2aab0e 694 #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) <= FLASH_END))
mbed_official 354:e67efb2aab0e 695
mbed_official 354:e67efb2aab0e 696 #else /*STM32L151xD || STM32L152xD || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 697
mbed_official 354:e67efb2aab0e 698 #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) <= FLASH_BANK2_END))
mbed_official 354:e67efb2aab0e 699 #define IS_FLASH_PROGRAM_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) <= FLASH_BANK1_END))
mbed_official 354:e67efb2aab0e 700 #define IS_FLASH_PROGRAM_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BANK2_BASE) && ((__ADDRESS__) <= FLASH_BANK2_END))
mbed_official 354:e67efb2aab0e 701
mbed_official 354:e67efb2aab0e 702 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L152xCA || STM32L162xCA */
mbed_official 354:e67efb2aab0e 703
mbed_official 354:e67efb2aab0e 704 #define IS_NBPAGES(_PAGES_) (((_PAGES_) >= 1) && ((_PAGES_) <= FLASH_NBPAGES_MAX))
mbed_official 354:e67efb2aab0e 705
mbed_official 354:e67efb2aab0e 706 /**
mbed_official 354:e67efb2aab0e 707 * @}
mbed_official 354:e67efb2aab0e 708 */
mbed_official 354:e67efb2aab0e 709
mbed_official 354:e67efb2aab0e 710 /** @defgroup FLASHEx_Flags FLASHEx Flags
mbed_official 354:e67efb2aab0e 711 * @{
mbed_official 354:e67efb2aab0e 712 */
mbed_official 354:e67efb2aab0e 713
mbed_official 354:e67efb2aab0e 714 /* Cat2 & Cat3*/
mbed_official 354:e67efb2aab0e 715 #if defined (STM32L151xBA) || defined (STM32L152xBA) || \
mbed_official 354:e67efb2aab0e 716 defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 717
mbed_official 354:e67efb2aab0e 718 #define FLASH_FLAG_RDERR FLASH_SR_RDERR /*!< Read protected error flag */
mbed_official 354:e67efb2aab0e 719
mbed_official 354:e67efb2aab0e 720 #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 721
mbed_official 354:e67efb2aab0e 722 /* Cat3, Cat4 & Cat5*/
mbed_official 354:e67efb2aab0e 723 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || \
mbed_official 354:e67efb2aab0e 724 defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 725 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 726
mbed_official 354:e67efb2aab0e 727 #define FLASH_FLAG_OPTVERRUSR FLASH_SR_OPTVERRUSR /*!< FLASH Option User Validity error flag */
mbed_official 354:e67efb2aab0e 728
mbed_official 354:e67efb2aab0e 729 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 730
mbed_official 354:e67efb2aab0e 731 /* Cat1*/
mbed_official 354:e67efb2aab0e 732 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || defined (STM32L100xBA)
mbed_official 354:e67efb2aab0e 733
mbed_official 354:e67efb2aab0e 734 #define FLASH_FLAG_MASK ( FLASH_FLAG_EOP | FLASH_FLAG_ENDHV | FLASH_FLAG_WRPERR | \
mbed_official 354:e67efb2aab0e 735 FLASH_FLAG_OPTVERR | FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR)
mbed_official 354:e67efb2aab0e 736
mbed_official 354:e67efb2aab0e 737 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA */
mbed_official 354:e67efb2aab0e 738
mbed_official 354:e67efb2aab0e 739 /* RDERR only for STM32L151xBA & STM32L152xBA (Cat2)*/
mbed_official 354:e67efb2aab0e 740 #if defined (STM32L151xBA) || defined (STM32L152xBA)
mbed_official 354:e67efb2aab0e 741
mbed_official 354:e67efb2aab0e 742 #define FLASH_FLAG_MASK ( FLASH_FLAG_EOP | FLASH_FLAG_ENDHV | FLASH_FLAG_WRPERR | \
mbed_official 354:e67efb2aab0e 743 FLASH_FLAG_OPTVERR | FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | \
mbed_official 354:e67efb2aab0e 744 FLASH_FLAG_RDERR)
mbed_official 354:e67efb2aab0e 745
mbed_official 354:e67efb2aab0e 746 #endif /* STM32L151xBA || STM32L152xBA */
mbed_official 354:e67efb2aab0e 747
mbed_official 354:e67efb2aab0e 748 /* FLASH_FLAG_OPTVERRUSR & RDERR only for STM32L151xC, STM32L152xC & STM32L152xBA (Cat3) */
mbed_official 354:e67efb2aab0e 749 #if defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 750
mbed_official 354:e67efb2aab0e 751 #define FLASH_FLAG_MASK ( FLASH_FLAG_EOP | FLASH_FLAG_ENDHV | FLASH_FLAG_WRPERR | \
mbed_official 354:e67efb2aab0e 752 FLASH_FLAG_OPTVERR | FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | \
mbed_official 354:e67efb2aab0e 753 FLASH_FLAG_OPTVERRUSR | FLASH_FLAG_RDERR)
mbed_official 354:e67efb2aab0e 754
mbed_official 354:e67efb2aab0e 755 #endif /* STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 756
mbed_official 354:e67efb2aab0e 757 /* FLASH_FLAG_OPTVERRUSR only for STM32L100xC (Cat3) */
mbed_official 354:e67efb2aab0e 758 #if defined (STM32L100xC)
mbed_official 354:e67efb2aab0e 759
mbed_official 354:e67efb2aab0e 760 #define FLASH_FLAG_MASK ( FLASH_FLAG_EOP | FLASH_FLAG_ENDHV | FLASH_FLAG_WRPERR | \
mbed_official 354:e67efb2aab0e 761 FLASH_FLAG_OPTVERR | FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | \
mbed_official 354:e67efb2aab0e 762 FLASH_FLAG_OPTVERRUSR)
mbed_official 354:e67efb2aab0e 763
mbed_official 354:e67efb2aab0e 764 #endif /* STM32L100xC */
mbed_official 354:e67efb2aab0e 765
mbed_official 354:e67efb2aab0e 766 /* Cat4 & Cat5 */
mbed_official 354:e67efb2aab0e 767 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 768 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 769
mbed_official 354:e67efb2aab0e 770 #define FLASH_FLAG_MASK ( FLASH_FLAG_EOP | FLASH_FLAG_ENDHV | FLASH_FLAG_WRPERR | \
mbed_official 354:e67efb2aab0e 771 FLASH_FLAG_OPTVERR | FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | \
mbed_official 354:e67efb2aab0e 772 FLASH_FLAG_OPTVERRUSR)
mbed_official 354:e67efb2aab0e 773
mbed_official 354:e67efb2aab0e 774 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 775
mbed_official 354:e67efb2aab0e 776 /**
mbed_official 354:e67efb2aab0e 777 * @}
mbed_official 354:e67efb2aab0e 778 */
mbed_official 354:e67efb2aab0e 779
mbed_official 354:e67efb2aab0e 780 #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 781 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 782
mbed_official 354:e67efb2aab0e 783 /** @defgroup FLASHEx_Option_Bytes_BOOT FLASHEx Option Bytes BOOT
mbed_official 354:e67efb2aab0e 784 * @{
mbed_official 354:e67efb2aab0e 785 */
mbed_official 354:e67efb2aab0e 786
mbed_official 354:e67efb2aab0e 787 #define OB_BOOT_BANK2 ((uint8_t)0x00) /*!< At startup, if boot pins are set in boot from user Flash position
mbed_official 354:e67efb2aab0e 788 and this parameter is selected the device will boot from Bank 2
mbed_official 354:e67efb2aab0e 789 or Bank 1, depending on the activation of the bank */
mbed_official 354:e67efb2aab0e 790 #define OB_BOOT_BANK1 ((uint8_t)(FLASH_OBR_nRST_BFB2 >> 16)) /*!< At startup, if boot pins are set in boot from user Flash position
mbed_official 354:e67efb2aab0e 791 and this parameter is selected the device will boot from Bank1(Default) */
mbed_official 354:e67efb2aab0e 792 #define IS_OB_BOOT_BANK(__BANK__) (((__BANK__) == OB_BOOT_BANK2) || ((__BANK__) == OB_BOOT_BANK1))
mbed_official 354:e67efb2aab0e 793
mbed_official 354:e67efb2aab0e 794 /**
mbed_official 354:e67efb2aab0e 795 * @}
mbed_official 354:e67efb2aab0e 796 */
mbed_official 354:e67efb2aab0e 797 #endif /* STM32L151xD || STM32L152xD || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 798
mbed_official 354:e67efb2aab0e 799 /**
mbed_official 354:e67efb2aab0e 800 * @}
mbed_official 354:e67efb2aab0e 801 */
mbed_official 354:e67efb2aab0e 802
mbed_official 354:e67efb2aab0e 803 /* Exported macro ------------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 804
mbed_official 354:e67efb2aab0e 805 /** @defgroup FLASHEx_Exported_Macros FLASHEx Exported Macros
mbed_official 354:e67efb2aab0e 806 * @{
mbed_official 354:e67efb2aab0e 807 */
mbed_official 354:e67efb2aab0e 808
mbed_official 354:e67efb2aab0e 809 /**
mbed_official 354:e67efb2aab0e 810 * @brief Set the FLASH Latency.
mbed_official 354:e67efb2aab0e 811 * @param __LATENCY__: FLASH Latency
mbed_official 354:e67efb2aab0e 812 * This parameter can be one of the following values:
mbed_official 354:e67efb2aab0e 813 * @arg FLASH_LATENCY_0: FLASH Zero Latency cycle
mbed_official 354:e67efb2aab0e 814 * @arg FLASH_LATENCY_1: FLASH One Latency cycle
mbed_official 354:e67efb2aab0e 815 * @retval none
mbed_official 354:e67efb2aab0e 816 */
mbed_official 354:e67efb2aab0e 817 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) do { \
mbed_official 354:e67efb2aab0e 818 if ((__LATENCY__) == FLASH_LATENCY_1) {__HAL_FLASH_ACC64_ENABLE();} \
mbed_official 354:e67efb2aab0e 819 MODIFY_REG((FLASH->ACR), FLASH_ACR_LATENCY, (__LATENCY__)); \
mbed_official 354:e67efb2aab0e 820 } while(0)
mbed_official 354:e67efb2aab0e 821
mbed_official 354:e67efb2aab0e 822 /**
mbed_official 354:e67efb2aab0e 823 * @brief Get the FLASH Latency.
mbed_official 354:e67efb2aab0e 824 * @retval FLASH Latency
mbed_official 354:e67efb2aab0e 825 * This parameter can be one of the following values:
mbed_official 354:e67efb2aab0e 826 * @arg FLASH_LATENCY_0: FLASH Zero Latency cycle
mbed_official 354:e67efb2aab0e 827 * @arg FLASH_LATENCY_1: FLASH One Latency cycle
mbed_official 354:e67efb2aab0e 828 */
mbed_official 354:e67efb2aab0e 829 #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
mbed_official 354:e67efb2aab0e 830
mbed_official 354:e67efb2aab0e 831 /**
mbed_official 354:e67efb2aab0e 832 * @brief Enable the FLASH 64-bit access.
mbed_official 354:e67efb2aab0e 833 * @note Read access 64 bit is used.
mbed_official 354:e67efb2aab0e 834 * @note This bit cannot be written at the same time as the LATENCY and
mbed_official 354:e67efb2aab0e 835 * PRFTEN bits.
mbed_official 354:e67efb2aab0e 836 * @retval none
mbed_official 354:e67efb2aab0e 837 */
mbed_official 354:e67efb2aab0e 838 #define __HAL_FLASH_ACC64_ENABLE() (SET_BIT((FLASH->ACR), FLASH_ACR_ACC64))
mbed_official 354:e67efb2aab0e 839
mbed_official 354:e67efb2aab0e 840 /**
mbed_official 354:e67efb2aab0e 841 * @brief Disable the FLASH 64-bit access.
mbed_official 354:e67efb2aab0e 842 * @note Read access 32 bit is used
mbed_official 354:e67efb2aab0e 843 * @note To reset this bit, the LATENCY should be zero wait state and the
mbed_official 354:e67efb2aab0e 844 * prefetch off.
mbed_official 354:e67efb2aab0e 845 * @retval none
mbed_official 354:e67efb2aab0e 846 */
mbed_official 354:e67efb2aab0e 847 #define __HAL_FLASH_ACC64_DISABLE() (CLEAR_BIT((FLASH->ACR), FLASH_ACR_ACC64))
mbed_official 354:e67efb2aab0e 848
mbed_official 354:e67efb2aab0e 849 /**
mbed_official 354:e67efb2aab0e 850 * @brief Enable the FLASH prefetch buffer.
mbed_official 354:e67efb2aab0e 851 * @retval none
mbed_official 354:e67efb2aab0e 852 */
mbed_official 354:e67efb2aab0e 853 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() do { __HAL_FLASH_ACC64_ENABLE(); \
mbed_official 354:e67efb2aab0e 854 SET_BIT((FLASH->ACR), FLASH_ACR_PRFTEN); \
mbed_official 354:e67efb2aab0e 855 } while(0)
mbed_official 354:e67efb2aab0e 856
mbed_official 354:e67efb2aab0e 857 /**
mbed_official 354:e67efb2aab0e 858 * @brief Disable the FLASH prefetch buffer.
mbed_official 354:e67efb2aab0e 859 * @retval none
mbed_official 354:e67efb2aab0e 860 */
mbed_official 354:e67efb2aab0e 861 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRFTEN)
mbed_official 354:e67efb2aab0e 862
mbed_official 354:e67efb2aab0e 863 /**
mbed_official 354:e67efb2aab0e 864 * @brief Enable the FLASH power down during Sleep mode
mbed_official 354:e67efb2aab0e 865 * @retval none
mbed_official 354:e67efb2aab0e 866 */
mbed_official 354:e67efb2aab0e 867 #define __HAL_FLASH_SLEEP_POWERDOWN_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
mbed_official 354:e67efb2aab0e 868
mbed_official 354:e67efb2aab0e 869 /**
mbed_official 354:e67efb2aab0e 870 * @brief Disable the FLASH power down during Sleep mode
mbed_official 354:e67efb2aab0e 871 * @retval none
mbed_official 354:e67efb2aab0e 872 */
mbed_official 354:e67efb2aab0e 873 #define __HAL_FLASH_SLEEP_POWERDOWN_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
mbed_official 354:e67efb2aab0e 874
mbed_official 354:e67efb2aab0e 875 /**
mbed_official 354:e67efb2aab0e 876 * @brief Macro to enable or disable the Flash Run power down mode.
mbed_official 354:e67efb2aab0e 877 * @note Writing this bit to 0 this bit, automatically the keys are
mbed_official 354:e67efb2aab0e 878 * loss and a new unlock sequence is necessary to re-write it to 1.
mbed_official 354:e67efb2aab0e 879 */
mbed_official 354:e67efb2aab0e 880
mbed_official 354:e67efb2aab0e 881 #define __HAL_FLASH_POWER_DOWN_ENABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \
mbed_official 354:e67efb2aab0e 882 FLASH->PDKEYR = FLASH_PDKEY2; \
mbed_official 354:e67efb2aab0e 883 SET_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \
mbed_official 354:e67efb2aab0e 884 } while (0)
mbed_official 354:e67efb2aab0e 885
mbed_official 354:e67efb2aab0e 886 #define __HAL_FLASH_POWER_DOWN_DISABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \
mbed_official 354:e67efb2aab0e 887 FLASH->PDKEYR = FLASH_PDKEY2; \
mbed_official 354:e67efb2aab0e 888 CLEAR_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \
mbed_official 354:e67efb2aab0e 889 } while (0)
mbed_official 354:e67efb2aab0e 890
mbed_official 354:e67efb2aab0e 891 /**
mbed_official 354:e67efb2aab0e 892 * @}
mbed_official 354:e67efb2aab0e 893 */
mbed_official 354:e67efb2aab0e 894
mbed_official 354:e67efb2aab0e 895 /* Exported functions --------------------------------------------------------*/
mbed_official 354:e67efb2aab0e 896
mbed_official 354:e67efb2aab0e 897 /** @addtogroup FLASHEx_Exported_Functions
mbed_official 354:e67efb2aab0e 898 * @{
mbed_official 354:e67efb2aab0e 899 */
mbed_official 354:e67efb2aab0e 900
mbed_official 354:e67efb2aab0e 901 /** @addtogroup FLASHEx_Exported_Functions_Group1
mbed_official 354:e67efb2aab0e 902 * @{
mbed_official 354:e67efb2aab0e 903 */
mbed_official 354:e67efb2aab0e 904
mbed_official 354:e67efb2aab0e 905 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
mbed_official 354:e67efb2aab0e 906 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
mbed_official 354:e67efb2aab0e 907
mbed_official 354:e67efb2aab0e 908 /**
mbed_official 354:e67efb2aab0e 909 * @}
mbed_official 354:e67efb2aab0e 910 */
mbed_official 354:e67efb2aab0e 911
mbed_official 354:e67efb2aab0e 912 /** @addtogroup FLASHEx_Exported_Functions_Group2
mbed_official 354:e67efb2aab0e 913 * @{
mbed_official 354:e67efb2aab0e 914 */
mbed_official 354:e67efb2aab0e 915
mbed_official 354:e67efb2aab0e 916 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
mbed_official 354:e67efb2aab0e 917 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
mbed_official 354:e67efb2aab0e 918
mbed_official 354:e67efb2aab0e 919 #if defined (STM32L151xBA) || defined (STM32L152xBA) || \
mbed_official 354:e67efb2aab0e 920 defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || \
mbed_official 354:e67efb2aab0e 921 defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) || \
mbed_official 354:e67efb2aab0e 922 defined(STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
mbed_official 354:e67efb2aab0e 923
mbed_official 354:e67efb2aab0e 924 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
mbed_official 354:e67efb2aab0e 925 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
mbed_official 354:e67efb2aab0e 926
mbed_official 354:e67efb2aab0e 927 #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xD || STM32L152xD || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */
mbed_official 354:e67efb2aab0e 928
mbed_official 354:e67efb2aab0e 929 #if defined (STM32L151xBA) || defined (STM32L152xBA) || \
mbed_official 354:e67efb2aab0e 930 defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
mbed_official 354:e67efb2aab0e 931
mbed_official 354:e67efb2aab0e 932 HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void);
mbed_official 354:e67efb2aab0e 933 HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void);
mbed_official 354:e67efb2aab0e 934
mbed_official 354:e67efb2aab0e 935 #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC */
mbed_official 354:e67efb2aab0e 936
mbed_official 354:e67efb2aab0e 937 /**
mbed_official 354:e67efb2aab0e 938 * @}
mbed_official 354:e67efb2aab0e 939 */
mbed_official 354:e67efb2aab0e 940
mbed_official 354:e67efb2aab0e 941 /** @addtogroup FLASHEx_Exported_Functions_Group3
mbed_official 354:e67efb2aab0e 942 * @{
mbed_official 354:e67efb2aab0e 943 */
mbed_official 354:e67efb2aab0e 944
mbed_official 354:e67efb2aab0e 945 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Unlock(void);
mbed_official 354:e67efb2aab0e 946 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Lock(void);
mbed_official 354:e67efb2aab0e 947
mbed_official 354:e67efb2aab0e 948 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Erase(uint32_t TypeErase, uint32_t Address);
mbed_official 354:e67efb2aab0e 949 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data);
mbed_official 354:e67efb2aab0e 950 void HAL_FLASHEx_DATAEEPROM_EnableFixedTimeProgram(void);
mbed_official 354:e67efb2aab0e 951 void HAL_FLASHEx_DATAEEPROM_DisableFixedTimeProgram(void);
mbed_official 354:e67efb2aab0e 952
mbed_official 354:e67efb2aab0e 953 /**
mbed_official 354:e67efb2aab0e 954 * @}
mbed_official 354:e67efb2aab0e 955 */
mbed_official 354:e67efb2aab0e 956
mbed_official 354:e67efb2aab0e 957 /**
mbed_official 354:e67efb2aab0e 958 * @}
mbed_official 354:e67efb2aab0e 959 */
mbed_official 354:e67efb2aab0e 960
mbed_official 354:e67efb2aab0e 961 /**
mbed_official 354:e67efb2aab0e 962 * @}
mbed_official 354:e67efb2aab0e 963 */
mbed_official 354:e67efb2aab0e 964
mbed_official 354:e67efb2aab0e 965 /**
mbed_official 354:e67efb2aab0e 966 * @}
mbed_official 354:e67efb2aab0e 967 */
mbed_official 354:e67efb2aab0e 968
mbed_official 354:e67efb2aab0e 969 #ifdef __cplusplus
mbed_official 354:e67efb2aab0e 970 }
mbed_official 354:e67efb2aab0e 971 #endif
mbed_official 354:e67efb2aab0e 972
mbed_official 354:e67efb2aab0e 973 #endif /* __STM32L1xx_HAL_FLASH_EX_H */
mbed_official 354:e67efb2aab0e 974
mbed_official 354:e67efb2aab0e 975 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/