mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
96:487b796308b0
remove SerialHalfDuplex.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 84:0b3ab51c8877 1 /**
bogdanm 84:0b3ab51c8877 2 ******************************************************************************
bogdanm 84:0b3ab51c8877 3 * @file stm32l0xx_hal_flash_ex.h
bogdanm 84:0b3ab51c8877 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V1.2.0
Kojto 96:487b796308b0 6 * @date 06-February-2015
Kojto 96:487b796308b0 7 * @brief Header file of FLash HAL Extension module.
bogdanm 84:0b3ab51c8877 8 ******************************************************************************
bogdanm 84:0b3ab51c8877 9 * @attention
bogdanm 84:0b3ab51c8877 10 *
Kojto 96:487b796308b0 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bogdanm 84:0b3ab51c8877 12 *
bogdanm 84:0b3ab51c8877 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 84:0b3ab51c8877 14 * are permitted provided that the following conditions are met:
bogdanm 84:0b3ab51c8877 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 84:0b3ab51c8877 16 * this list of conditions and the following disclaimer.
bogdanm 84:0b3ab51c8877 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 84:0b3ab51c8877 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 84:0b3ab51c8877 19 * and/or other materials provided with the distribution.
bogdanm 84:0b3ab51c8877 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 84:0b3ab51c8877 21 * may be used to endorse or promote products derived from this software
bogdanm 84:0b3ab51c8877 22 * without specific prior written permission.
bogdanm 84:0b3ab51c8877 23 *
bogdanm 84:0b3ab51c8877 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 84:0b3ab51c8877 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 84:0b3ab51c8877 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 84:0b3ab51c8877 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 84:0b3ab51c8877 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 84:0b3ab51c8877 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 84:0b3ab51c8877 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 84:0b3ab51c8877 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 84:0b3ab51c8877 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 84:0b3ab51c8877 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 84:0b3ab51c8877 34 *
bogdanm 84:0b3ab51c8877 35 ******************************************************************************
bogdanm 84:0b3ab51c8877 36 */
bogdanm 84:0b3ab51c8877 37
bogdanm 84:0b3ab51c8877 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 84:0b3ab51c8877 39 #ifndef __STM32L0xx_HAL_FLASH_EX_H
bogdanm 84:0b3ab51c8877 40 #define __STM32L0xx_HAL_FLASH_EX_H
bogdanm 84:0b3ab51c8877 41
bogdanm 84:0b3ab51c8877 42 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 43 extern "C" {
bogdanm 84:0b3ab51c8877 44 #endif
bogdanm 84:0b3ab51c8877 45
bogdanm 84:0b3ab51c8877 46 /* Includes ------------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 47 #include "stm32l0xx_hal_def.h"
bogdanm 84:0b3ab51c8877 48
bogdanm 84:0b3ab51c8877 49 /** @addtogroup STM32L0xx_HAL_Driver
bogdanm 84:0b3ab51c8877 50 * @{
bogdanm 84:0b3ab51c8877 51 */
bogdanm 84:0b3ab51c8877 52
Kojto 96:487b796308b0 53 /** @defgroup FLASHEx FLASHEx
bogdanm 84:0b3ab51c8877 54 * @{
bogdanm 84:0b3ab51c8877 55 */
bogdanm 84:0b3ab51c8877 56
Kojto 96:487b796308b0 57 /** @defgroup FLASHEx_Exported_Types FLASH Exported Types
Kojto 96:487b796308b0 58 * @{
Kojto 96:487b796308b0 59 */
Kojto 96:487b796308b0 60
Kojto 96:487b796308b0 61 /**
Kojto 96:487b796308b0 62 * @brief FLASH Option Bytes PROGRAM structure definition
Kojto 96:487b796308b0 63 */
Kojto 96:487b796308b0 64 typedef struct
Kojto 96:487b796308b0 65 {
Kojto 96:487b796308b0 66 uint32_t OptionType; /*!< OptionType: Option byte to be configured.
Kojto 96:487b796308b0 67 This parameter can be a value of @ref FLASHEx_Option_Type */
Kojto 96:487b796308b0 68
Kojto 96:487b796308b0 69 uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
Kojto 96:487b796308b0 70 This parameter can be a value of @ref FLASHEx_WRP_State */
Kojto 96:487b796308b0 71
Kojto 96:487b796308b0 72 uint32_t WRPSector; /*!< WRPSector: This bitfield specifies the sector (s) which are write protected.
Kojto 96:487b796308b0 73 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection */
Kojto 96:487b796308b0 74
Kojto 96:487b796308b0 75 #if defined(STM32L071xx) || defined(STM32L072xx) || defined(STM32L073xx) || defined(STM32L081xx) || defined(STM32L082xx) || defined(STM32L083xx)
Kojto 96:487b796308b0 76 uint32_t WRPSector2; /*!< WRPSector2 : This bitfield specifies the sector(s) upper Sector31 which are write protected.
Kojto 96:487b796308b0 77 This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection2 */
Kojto 96:487b796308b0 78 #endif
Kojto 96:487b796308b0 79
Kojto 96:487b796308b0 80 uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level.
Kojto 96:487b796308b0 81 This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */
Kojto 96:487b796308b0 82
Kojto 96:487b796308b0 83 uint8_t BORLevel; /*!< BORLevel: Set the BOR Level.
Kojto 96:487b796308b0 84 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOR_Level */
Kojto 96:487b796308b0 85
Kojto 96:487b796308b0 86 uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
Kojto 96:487b796308b0 87 This parameter can be a combination of @ref FLASHEx_Option_Bytes_IWatchdog,
Kojto 96:487b796308b0 88 @ref FLASHEx_Option_Bytes_nRST_STOP and @ref FLASHEx_Option_Bytes_nRST_STDBY */
Kojto 96:487b796308b0 89
Kojto 96:487b796308b0 90 uint8_t BOOTBit1Config; /*!< BOOT1Config: Together with input pad Boot0, this bit selects the boot source, flash, ram or system memory
Kojto 96:487b796308b0 91 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOTBit1 */
Kojto 96:487b796308b0 92
Kojto 96:487b796308b0 93 } FLASH_OBProgramInitTypeDef;
Kojto 96:487b796308b0 94
bogdanm 84:0b3ab51c8877 95 /**
bogdanm 84:0b3ab51c8877 96 * @brief FLASH Advanced Option Bytes Program structure definition
bogdanm 84:0b3ab51c8877 97 */
bogdanm 84:0b3ab51c8877 98 typedef struct
bogdanm 84:0b3ab51c8877 99 {
Kojto 96:487b796308b0 100 uint32_t OptionType; /*!< OptionType: Option byte to be configured for extension .
Kojto 96:487b796308b0 101 This parameter can be a value of @ref FLASHEx_OptionAdv_Type */
Kojto 96:487b796308b0 102
Kojto 96:487b796308b0 103 uint8_t PCROPState; /*!< PCROPState: PCROP activation or deactivation.
Kojto 96:487b796308b0 104 This parameter can be a value of @ref FLASHEx_PCROP_State */
bogdanm 84:0b3ab51c8877 105
Kojto 96:487b796308b0 106 uint32_t PCROPSector; /*!< PCROPSector : This bitfield specifies the sector(s) which are read/write protected.
Kojto 96:487b796308b0 107 This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */
bogdanm 84:0b3ab51c8877 108
Kojto 96:487b796308b0 109 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 96:487b796308b0 110 uint32_t PCROPSector2; /*!< PCROPSector : This bitfield specifies the sector(s) upper Sector31 which are read/write protected.
Kojto 96:487b796308b0 111 This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 */
bogdanm 84:0b3ab51c8877 112
Kojto 96:487b796308b0 113 uint8_t BootConfig; /*!< BootConfig: specifies Option bytes for boot config.
Kojto 96:487b796308b0 114 This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOT_BANK */
Kojto 96:487b796308b0 115 #endif /* if STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
Kojto 96:487b796308b0 116 } FLASH_AdvOBProgramInitTypeDef;
bogdanm 84:0b3ab51c8877 117
bogdanm 84:0b3ab51c8877 118 /**
bogdanm 84:0b3ab51c8877 119 * @}
bogdanm 84:0b3ab51c8877 120 */
Kojto 96:487b796308b0 121
Kojto 96:487b796308b0 122 /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
Kojto 96:487b796308b0 123 * @{
Kojto 96:487b796308b0 124 */
Kojto 96:487b796308b0 125
Kojto 96:487b796308b0 126 /** @defgroup FLASHEx_Type_Erase FLASHEx_Type_Erase
Kojto 96:487b796308b0 127 * @{
Kojto 96:487b796308b0 128 */
Kojto 96:487b796308b0 129 #define FLASH_TYPEERASE_PAGES ((uint32_t)0x00) /*!< Page erase only */
Kojto 96:487b796308b0 130 /**
Kojto 96:487b796308b0 131 * @}
Kojto 96:487b796308b0 132 */
Kojto 96:487b796308b0 133
Kojto 96:487b796308b0 134 /** @defgroup FLASHEx_Option_Type FLASHEx Option Type
Kojto 96:487b796308b0 135 * @{
Kojto 96:487b796308b0 136 */
Kojto 96:487b796308b0 137 #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!< WRP option byte configuration */
Kojto 96:487b796308b0 138 #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!< RDP option byte configuration */
Kojto 96:487b796308b0 139 #define OPTIONBYTE_USER ((uint32_t)0x04) /*!< USER option byte configuration */
Kojto 96:487b796308b0 140 #define OPTIONBYTE_BOR ((uint32_t)0x08) /*!< BOR option byte configuration */
Kojto 96:487b796308b0 141 #define OPTIONBYTE_BOOT_BIT1 ((uint32_t)0x10) /*!< BOOT PIN1 option byte configuration*/
Kojto 96:487b796308b0 142 /**
Kojto 96:487b796308b0 143 * @}
Kojto 96:487b796308b0 144 */
Kojto 96:487b796308b0 145
Kojto 96:487b796308b0 146 /** @defgroup FLASHEx_WRP_State FLASHEx WRP State
bogdanm 84:0b3ab51c8877 147 * @{
bogdanm 84:0b3ab51c8877 148 */
Kojto 96:487b796308b0 149 #define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!< Disable the write protection of the desired sectors */
Kojto 96:487b796308b0 150 #define OB_WRPSTATE_ENABLE ((uint32_t)0x01) /*!< Enable the write protection of the desired sectors */
Kojto 96:487b796308b0 151 /**
Kojto 96:487b796308b0 152 * @}
Kojto 96:487b796308b0 153 */
Kojto 96:487b796308b0 154
Kojto 96:487b796308b0 155 /** @defgroup FLASHEx_Option_Bytes_ReadWrite_Mask FLASHEx Option Bytes Write Mask
Kojto 96:487b796308b0 156 * @{
Kojto 96:487b796308b0 157 */
Kojto 96:487b796308b0 158 #define WRP_MASK_LOW ((uint32_t)0x0000FFFF)
Kojto 96:487b796308b0 159 #define WRP_MASK_HIGH ((uint32_t)0xFFFF0000)
Kojto 96:487b796308b0 160 /**
Kojto 96:487b796308b0 161 * @}
Kojto 96:487b796308b0 162 */
bogdanm 84:0b3ab51c8877 163
Kojto 96:487b796308b0 164 #if defined (STM32L031xx) || defined (STM32L041xx)
Kojto 96:487b796308b0 165 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASHEx Option Bytes Write Protection
Kojto 96:487b796308b0 166 * @{
Kojto 96:487b796308b0 167 */
Kojto 96:487b796308b0 168 #define OB_WRP_Pages0to31 ((uint32_t)0x00000001) /* Write protection of Sector0 */
Kojto 96:487b796308b0 169 #define OB_WRP_Pages32to63 ((uint32_t)0x00000002) /* Write protection of Sector1 */
Kojto 96:487b796308b0 170 #define OB_WRP_Pages64to95 ((uint32_t)0x00000004) /* Write protection of Sector2 */
Kojto 96:487b796308b0 171 #define OB_WRP_Pages96to127 ((uint32_t)0x00000008) /* Write protection of Sector3 */
Kojto 96:487b796308b0 172 #define OB_WRP_Pages128to159 ((uint32_t)0x00000010) /* Write protection of Sector4 */
Kojto 96:487b796308b0 173 #define OB_WRP_Pages160to191 ((uint32_t)0x00000020) /* Write protection of Sector5 */
Kojto 96:487b796308b0 174 #define OB_WRP_Pages192to223 ((uint32_t)0x00000040) /* Write protection of Sector6 */
Kojto 96:487b796308b0 175 #define OB_WRP_Pages224to255 ((uint32_t)0x00000080) /* Write protection of Sector7 */
Kojto 96:487b796308b0 176 #define OB_WRP_AllPages ((uint32_t)0x000000FF) /*!< Write protection of all Sectors */
Kojto 96:487b796308b0 177 /**
Kojto 96:487b796308b0 178 * @}
Kojto 96:487b796308b0 179 */
Kojto 96:487b796308b0 180 #elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx)
Kojto 96:487b796308b0 181 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASHEx Option Bytes Write Protection
Kojto 96:487b796308b0 182 * @{
Kojto 96:487b796308b0 183 */
Kojto 96:487b796308b0 184 #define OB_WRP_Pages0to31 ((uint32_t)0x00000001) /* Write protection of Sector0 */
Kojto 96:487b796308b0 185 #define OB_WRP_Pages32to63 ((uint32_t)0x00000002) /* Write protection of Sector1 */
Kojto 96:487b796308b0 186 #define OB_WRP_Pages64to95 ((uint32_t)0x00000004) /* Write protection of Sector2 */
Kojto 96:487b796308b0 187 #define OB_WRP_Pages96to127 ((uint32_t)0x00000008) /* Write protection of Sector3 */
Kojto 96:487b796308b0 188 #define OB_WRP_Pages128to159 ((uint32_t)0x00000010) /* Write protection of Sector4 */
Kojto 96:487b796308b0 189 #define OB_WRP_Pages160to191 ((uint32_t)0x00000020) /* Write protection of Sector5 */
Kojto 96:487b796308b0 190 #define OB_WRP_Pages192to223 ((uint32_t)0x00000040) /* Write protection of Sector6 */
Kojto 96:487b796308b0 191 #define OB_WRP_Pages224to255 ((uint32_t)0x00000080) /* Write protection of Sector7 */
Kojto 96:487b796308b0 192 #define OB_WRP_Pages256to287 ((uint32_t)0x00000100) /* Write protection of Sector8 */
Kojto 96:487b796308b0 193 #define OB_WRP_Pages288to319 ((uint32_t)0x00000200) /* Write protection of Sector9 */
Kojto 96:487b796308b0 194 #define OB_WRP_Pages320to351 ((uint32_t)0x00000400) /* Write protection of Sector10 */
Kojto 96:487b796308b0 195 #define OB_WRP_Pages352to383 ((uint32_t)0x00000800) /* Write protection of Sector11 */
Kojto 96:487b796308b0 196 #define OB_WRP_Pages384to415 ((uint32_t)0x00001000) /* Write protection of Sector12 */
Kojto 96:487b796308b0 197 #define OB_WRP_Pages416to447 ((uint32_t)0x00002000) /* Write protection of Sector13 */
Kojto 96:487b796308b0 198 #define OB_WRP_Pages448to479 ((uint32_t)0x00004000) /* Write protection of Sector14 */
Kojto 96:487b796308b0 199 #define OB_WRP_Pages480to511 ((uint32_t)0x00008000) /* Write protection of Sector15 */
Kojto 96:487b796308b0 200 #define OB_WRP_AllPages ((uint32_t)0x0000FFFF) /*!< Write protection of all Sectors */
bogdanm 84:0b3ab51c8877 201 /**
bogdanm 84:0b3ab51c8877 202 * @}
bogdanm 84:0b3ab51c8877 203 */
Kojto 96:487b796308b0 204
Kojto 96:487b796308b0 205 #elif defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 96:487b796308b0 206 /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASHEx Option Bytes Write ProtectionP
bogdanm 84:0b3ab51c8877 207 * @{
bogdanm 84:0b3ab51c8877 208 */
Kojto 96:487b796308b0 209 #define OB_WRP_Pages0to31 ((uint32_t)0x00000001) /* Write protection of Sector0 */
Kojto 96:487b796308b0 210 #define OB_WRP_Pages32to63 ((uint32_t)0x00000002) /* Write protection of Sector1 */
Kojto 96:487b796308b0 211 #define OB_WRP_Pages64to95 ((uint32_t)0x00000004) /* Write protection of Sector2 */
Kojto 96:487b796308b0 212 #define OB_WRP_Pages96to127 ((uint32_t)0x00000008) /* Write protection of Sector3 */
Kojto 96:487b796308b0 213 #define OB_WRP_Pages128to159 ((uint32_t)0x00000010) /* Write protection of Sector4 */
Kojto 96:487b796308b0 214 #define OB_WRP_Pages160to191 ((uint32_t)0x00000020) /* Write protection of Sector5 */
Kojto 96:487b796308b0 215 #define OB_WRP_Pages192to223 ((uint32_t)0x00000040) /* Write protection of Sector6 */
Kojto 96:487b796308b0 216 #define OB_WRP_Pages224to255 ((uint32_t)0x00000080) /* Write protection of Sector7 */
Kojto 96:487b796308b0 217 #define OB_WRP_Pages256to287 ((uint32_t)0x00000100) /* Write protection of Sector8 */
Kojto 96:487b796308b0 218 #define OB_WRP_Pages288to319 ((uint32_t)0x00000200) /* Write protection of Sector9 */
Kojto 96:487b796308b0 219 #define OB_WRP_Pages320to351 ((uint32_t)0x00000400) /* Write protection of Sector10 */
Kojto 96:487b796308b0 220 #define OB_WRP_Pages352to383 ((uint32_t)0x00000800) /* Write protection of Sector11 */
Kojto 96:487b796308b0 221 #define OB_WRP_Pages384to415 ((uint32_t)0x00001000) /* Write protection of Sector12 */
Kojto 96:487b796308b0 222 #define OB_WRP_Pages416to447 ((uint32_t)0x00002000) /* Write protection of Sector13 */
Kojto 96:487b796308b0 223 #define OB_WRP_Pages448to479 ((uint32_t)0x00004000) /* Write protection of Sector14 */
Kojto 96:487b796308b0 224 #define OB_WRP_Pages480to511 ((uint32_t)0x00008000) /* Write protection of Sector15 */
Kojto 96:487b796308b0 225 #define OB_WRP_Pages512to543 ((uint32_t)0x00010000) /* Write protection of Sector16 */
Kojto 96:487b796308b0 226 #define OB_WRP_Pages544to575 ((uint32_t)0x00020000) /* Write protection of Sector17 */
Kojto 96:487b796308b0 227 #define OB_WRP_Pages576to607 ((uint32_t)0x00040000) /* Write protection of Sector18 */
Kojto 96:487b796308b0 228 #define OB_WRP_Pages608to639 ((uint32_t)0x00080000) /* Write protection of Sector19 */
Kojto 96:487b796308b0 229 #define OB_WRP_Pages640to671 ((uint32_t)0x00100000) /* Write protection of Sector20 */
Kojto 96:487b796308b0 230 #define OB_WRP_Pages672to703 ((uint32_t)0x00200000) /* Write protection of Sector21 */
Kojto 96:487b796308b0 231 #define OB_WRP_Pages704to735 ((uint32_t)0x00400000) /* Write protection of Sector22 */
Kojto 96:487b796308b0 232 #define OB_WRP_Pages736to767 ((uint32_t)0x00800000) /* Write protection of Sector23 */
Kojto 96:487b796308b0 233 #define OB_WRP_Pages768to799 ((uint32_t)0x01000000) /* Write protection of Sector24 */
Kojto 96:487b796308b0 234 #define OB_WRP_Pages800to831 ((uint32_t)0x02000000) /* Write protection of Sector25 */
Kojto 96:487b796308b0 235 #define OB_WRP_Pages832to863 ((uint32_t)0x04000000) /* Write protection of Sector26 */
Kojto 96:487b796308b0 236 #define OB_WRP_Pages864to895 ((uint32_t)0x08000000) /* Write protection of Sector27 */
Kojto 96:487b796308b0 237 #define OB_WRP_Pages896to927 ((uint32_t)0x10000000) /* Write protection of Sector28 */
Kojto 96:487b796308b0 238 #define OB_WRP_Pages928to959 ((uint32_t)0x20000000) /* Write protection of Sector29 */
Kojto 96:487b796308b0 239 #define OB_WRP_Pages960to991 ((uint32_t)0x40000000) /* Write protection of Sector30 */
Kojto 96:487b796308b0 240 #define OB_WRP_Pages992to1023 ((uint32_t)0x80000000) /* Write protection of Sector31 */
Kojto 96:487b796308b0 241 #define OB_WRP_AllPages ((uint32_t)0xFFFFFFFF) /*!<Write protection of all Sectors */
Kojto 96:487b796308b0 242 /**
Kojto 96:487b796308b0 243 * @}
Kojto 96:487b796308b0 244 */
bogdanm 84:0b3ab51c8877 245
Kojto 96:487b796308b0 246 /** @defgroup FLASHEx_Option_Bytes_Write_Protection2 FLASHEx Option Bytes Write Protection
Kojto 96:487b796308b0 247 * @{
Kojto 96:487b796308b0 248 */
Kojto 96:487b796308b0 249 #define OB_WRP2_Pages1024to1055 ((uint32_t)0x00000001) /* Write protection of Sector32 */
Kojto 96:487b796308b0 250 #define OB_WRP2_Pages1056to1087 ((uint32_t)0x00000002) /* Write protection of Sector33 */
Kojto 96:487b796308b0 251 #define OB_WRP2_Pages1088to1119 ((uint32_t)0x00000004) /* Write protection of Sector34 */
Kojto 96:487b796308b0 252 #define OB_WRP2_Pages1120to1151 ((uint32_t)0x00000008) /* Write protection of Sector35 */
Kojto 96:487b796308b0 253 #define OB_WRP2_Pages1152to1183 ((uint32_t)0x00000010) /* Write protection of Sector36 */
Kojto 96:487b796308b0 254 #define OB_WRP2_Pages1184to1215 ((uint32_t)0x00000020) /* Write protection of Sector37 */
Kojto 96:487b796308b0 255 #define OB_WRP2_Pages1216to1247 ((uint32_t)0x00000040) /* Write protection of Sector38 */
Kojto 96:487b796308b0 256 #define OB_WRP2_Pages1248to1279 ((uint32_t)0x00000080) /* Write protection of Sector39 */
Kojto 96:487b796308b0 257 #define OB_WRP2_Pages1280to1311 ((uint32_t)0x00000100) /* Write protection of Sector40 */
Kojto 96:487b796308b0 258 #define OB_WRP2_Pages1312to1343 ((uint32_t)0x00000200) /* Write protection of Sector41 */
Kojto 96:487b796308b0 259 #define OB_WRP2_Pages1344to1375 ((uint32_t)0x00000400) /* Write protection of Sector42 */
Kojto 96:487b796308b0 260 #define OB_WRP2_Pages1376to1407 ((uint32_t)0x00000800) /* Write protection of Sector43 */
Kojto 96:487b796308b0 261 #define OB_WRP2_Pages1408to1439 ((uint32_t)0x00001000) /* Write protection of Sector44 */
Kojto 96:487b796308b0 262 #define OB_WRP2_Pages1440to1471 ((uint32_t)0x00002000) /* Write protection of Sector45 */
Kojto 96:487b796308b0 263 #define OB_WRP2_Pages1472to1503 ((uint32_t)0x00004000) /* Write protection of Sector46 */
Kojto 96:487b796308b0 264 #define OB_WRP2_Pages1504to1535 ((uint32_t)0x00008000) /* Write protection of Sector47 */
Kojto 96:487b796308b0 265 #define OB_WRP2_AllPages ((uint32_t)0x0000FFFF) /*!< Write protection of all Sectors WRP2 */
Kojto 96:487b796308b0 266 /**
Kojto 96:487b796308b0 267 * @}
Kojto 96:487b796308b0 268 */
Kojto 96:487b796308b0 269 #endif /* STM32L071xx || STM32L072xx || (STM32L073xx) || (STM32L081xx) || (STM32L082xx) || (STM32L083xx) */
bogdanm 84:0b3ab51c8877 270
Kojto 96:487b796308b0 271 /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASHEx Option Bytes Read Protection
Kojto 96:487b796308b0 272 * @{
Kojto 96:487b796308b0 273 */
Kojto 96:487b796308b0 274 #define OB_RDP_LEVEL0 ((uint8_t)0xAA)
Kojto 96:487b796308b0 275 #define OB_RDP_LEVEL1 ((uint8_t)0xBB)
Kojto 96:487b796308b0 276 #define OB_RDP_LEVEL2 ((uint8_t)0xCC) /* Warning: When enabling read protection level 2
Kojto 96:487b796308b0 277 it is no more possible to go back to level 1 or 0 */
Kojto 96:487b796308b0 278 /**
Kojto 96:487b796308b0 279 * @}
Kojto 96:487b796308b0 280 */
Kojto 96:487b796308b0 281
Kojto 96:487b796308b0 282 /** @defgroup FLASHEx_Option_Bytes_BOR_Level FLASHEx Option Bytes BOR Level
Kojto 96:487b796308b0 283 * @{
Kojto 96:487b796308b0 284 */
Kojto 96:487b796308b0 285 #define OB_BOR_OFF ((uint8_t)0x00) /*!< BOR is disabled at power down, the reset is asserted when the VDD
Kojto 96:487b796308b0 286 power supply reaches the PDR(Power Down Reset) threshold (1.5V) */
Kojto 96:487b796308b0 287 #define OB_BOR_LEVEL1 ((uint8_t)0x08) /*!< BOR Reset threshold levels for 1.7V - 1.8V VDD power supply */
Kojto 96:487b796308b0 288 #define OB_BOR_LEVEL2 ((uint8_t)0x09) /*!< BOR Reset threshold levels for 1.9V - 2.0V VDD power supply */
Kojto 96:487b796308b0 289 #define OB_BOR_LEVEL3 ((uint8_t)0x0A) /*!< BOR Reset threshold levels for 2.3V - 2.4V VDD power supply */
Kojto 96:487b796308b0 290 #define OB_BOR_LEVEL4 ((uint8_t)0x0B) /*!< BOR Reset threshold levels for 2.55V - 2.65V VDD power supply */
Kojto 96:487b796308b0 291 #define OB_BOR_LEVEL5 ((uint8_t)0x0C) /*!< BOR Reset threshold levels for 2.8V - 2.9V VDD power supply */
Kojto 96:487b796308b0 292 /**
Kojto 96:487b796308b0 293 * @}
Kojto 96:487b796308b0 294 */
Kojto 96:487b796308b0 295
Kojto 96:487b796308b0 296 /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASHEx Option Bytes IWatchdog
Kojto 96:487b796308b0 297 * @{
Kojto 96:487b796308b0 298 */
Kojto 96:487b796308b0 299 #define OB_IWDG_SW ((uint8_t)0x10) /*!< Software WDG selected */
Kojto 96:487b796308b0 300 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware WDG selected */
Kojto 96:487b796308b0 301 /**
Kojto 96:487b796308b0 302 * @}
Kojto 96:487b796308b0 303 */
Kojto 96:487b796308b0 304
Kojto 96:487b796308b0 305 /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASHEx Option Bytes nRST_STOP
Kojto 96:487b796308b0 306 * @{
Kojto 96:487b796308b0 307 */
Kojto 96:487b796308b0 308 #define OB_STOP_NORST ((uint8_t)0x20) /*!< No reset generated when entering in STOP */
Kojto 96:487b796308b0 309 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
bogdanm 84:0b3ab51c8877 310 /**
bogdanm 84:0b3ab51c8877 311 * @}
bogdanm 84:0b3ab51c8877 312 */
bogdanm 84:0b3ab51c8877 313
Kojto 96:487b796308b0 314 /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASHEx Option Bytes nRST_STDBY
bogdanm 84:0b3ab51c8877 315 * @{
bogdanm 84:0b3ab51c8877 316 */
Kojto 96:487b796308b0 317 #define OB_STDBY_NORST ((uint8_t)0x40) /*!< No reset generated when entering in STANDBY */
Kojto 96:487b796308b0 318 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
Kojto 96:487b796308b0 319 /**
Kojto 96:487b796308b0 320 * @}
Kojto 96:487b796308b0 321 */
Kojto 96:487b796308b0 322
Kojto 96:487b796308b0 323
Kojto 96:487b796308b0 324 /** @defgroup FLASHEx_PCROP_State
Kojto 96:487b796308b0 325 * @{
Kojto 96:487b796308b0 326 */
Kojto 96:487b796308b0 327 #define OB_PCROP_STATE_DISABLE ((uint8_t)0x00) /*!< Disable PCROP */
Kojto 96:487b796308b0 328 #define OB_PCROP_STATE_ENABLE ((uint8_t)0x01) /*!< Enable PCROP */
Kojto 96:487b796308b0 329 /**
Kojto 96:487b796308b0 330 * @}
Kojto 96:487b796308b0 331 */
Kojto 96:487b796308b0 332
Kojto 96:487b796308b0 333
Kojto 96:487b796308b0 334 /** @defgroup FLASHEx_OptionAdv_Type
Kojto 96:487b796308b0 335 * @{
Kojto 96:487b796308b0 336 */
Kojto 96:487b796308b0 337 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 96:487b796308b0 338 #define OPTIONBYTE_PCROP ((uint32_t)0x01) /*!< PCROP option byte configuration*/
Kojto 96:487b796308b0 339 #define OPTIONBYTE_BOOTCONFIG ((uint32_t)0x02) /*!< BOOTConfig option byte configuration, boot from bank 2*/
Kojto 96:487b796308b0 340 #else /* if STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
Kojto 96:487b796308b0 341 #define OPTIONBYTE_PCROP ((uint32_t)0x01) /*!< PCROP option byte configuration*/
Kojto 96:487b796308b0 342 #endif /* if STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
Kojto 96:487b796308b0 343 /**
Kojto 96:487b796308b0 344 * @}
Kojto 96:487b796308b0 345 */
Kojto 96:487b796308b0 346
Kojto 96:487b796308b0 347 #if defined (STM32L031xx) || defined (STM32L041xx)
Kojto 96:487b796308b0 348 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASHEx Option Bytes PC Read/Write Protection
Kojto 96:487b796308b0 349 * @{
Kojto 96:487b796308b0 350 */
Kojto 96:487b796308b0 351 #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001) /* PC Read/Write protection of Sector0 */
Kojto 96:487b796308b0 352 #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002) /* PC Read/Write protection of Sector1 */
Kojto 96:487b796308b0 353 #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004) /* PC Read/Write protection of Sector2 */
Kojto 96:487b796308b0 354 #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008) /* PC Read/Write protection of Sector3 */
Kojto 96:487b796308b0 355 #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010) /* PC Read/Write protection of Sector4 */
Kojto 96:487b796308b0 356 #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020) /* PC Read/Write protection of Sector5 */
Kojto 96:487b796308b0 357 #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040) /* PC Read/Write protection of Sector6 */
Kojto 96:487b796308b0 358 #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080) /* PC Read/Write protection of Sector7 */
Kojto 96:487b796308b0 359 #define OB_PCROP_AllPages ((uint32_t)0x000000FF) /*!< PC Read/Write protection of all Sectors */
Kojto 96:487b796308b0 360 /**
Kojto 96:487b796308b0 361 * @}
Kojto 96:487b796308b0 362 */
Kojto 96:487b796308b0 363 #elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx)
Kojto 96:487b796308b0 364 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASHEx Option Bytes PC Read/Write Protection
Kojto 96:487b796308b0 365 * @{
Kojto 96:487b796308b0 366 */
Kojto 96:487b796308b0 367 #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001) /* PC Read/Write protection of Sector0 */
Kojto 96:487b796308b0 368 #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002) /* PC Read/Write protection of Sector1 */
Kojto 96:487b796308b0 369 #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004) /* PC Read/Write protection of Sector2 */
Kojto 96:487b796308b0 370 #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008) /* PC Read/Write protection of Sector3 */
Kojto 96:487b796308b0 371 #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010) /* PC Read/Write protection of Sector4 */
Kojto 96:487b796308b0 372 #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020) /* PC Read/Write protection of Sector5 */
Kojto 96:487b796308b0 373 #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040) /* PC Read/Write protection of Sector6 */
Kojto 96:487b796308b0 374 #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080) /* PC Read/Write protection of Sector7 */
Kojto 96:487b796308b0 375 #define OB_PCROP_Pages256to287 ((uint32_t)0x00000100) /* PC Read/Write protection of Sector8 */
Kojto 96:487b796308b0 376 #define OB_PCROP_Pages288to319 ((uint32_t)0x00000200) /* PC Read/Write protection of Sector9 */
Kojto 96:487b796308b0 377 #define OB_PCROP_Pages320to351 ((uint32_t)0x00000400) /* PC Read/Write protection of Sector10 */
Kojto 96:487b796308b0 378 #define OB_PCROP_Pages352to383 ((uint32_t)0x00000800) /* PC Read/Write protection of Sector11 */
Kojto 96:487b796308b0 379 #define OB_PCROP_Pages384to415 ((uint32_t)0x00001000) /* PC Read/Write protection of Sector12 */
Kojto 96:487b796308b0 380 #define OB_PCROP_Pages416to447 ((uint32_t)0x00002000) /* PC Read/Write protection of Sector13 */
Kojto 96:487b796308b0 381 #define OB_PCROP_Pages448to479 ((uint32_t)0x00004000) /* PC Read/Write protection of Sector14 */
Kojto 96:487b796308b0 382 #define OB_PCROP_Pages480to511 ((uint32_t)0x00008000) /* PC Read/Write protection of Sector15 */
Kojto 96:487b796308b0 383 #define OB_PCROP_AllPages ((uint32_t)0x0000FFFF) /*!< PC Read/Write protection of all Sectors */
bogdanm 84:0b3ab51c8877 384 /**
bogdanm 84:0b3ab51c8877 385 * @}
bogdanm 84:0b3ab51c8877 386 */
Kojto 96:487b796308b0 387 #endif
Kojto 96:487b796308b0 388
Kojto 96:487b796308b0 389 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 96:487b796308b0 390 /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection FLASHEx Option Bytes PC Read/Write Protection
Kojto 96:487b796308b0 391 * @{
Kojto 96:487b796308b0 392 */
Kojto 96:487b796308b0 393 #define OB_PCROP_Pages0to31 ((uint32_t)0x00000001) /* PC Read/Write protection of Sector0 */
Kojto 96:487b796308b0 394 #define OB_PCROP_Pages32to63 ((uint32_t)0x00000002) /* PC Read/Write protection of Sector1 */
Kojto 96:487b796308b0 395 #define OB_PCROP_Pages64to95 ((uint32_t)0x00000004) /* PC Read/Write protection of Sector2 */
Kojto 96:487b796308b0 396 #define OB_PCROP_Pages96to127 ((uint32_t)0x00000008) /* PC Read/Write protection of Sector3 */
Kojto 96:487b796308b0 397 #define OB_PCROP_Pages128to159 ((uint32_t)0x00000010) /* PC Read/Write protection of Sector4 */
Kojto 96:487b796308b0 398 #define OB_PCROP_Pages160to191 ((uint32_t)0x00000020) /* PC Read/Write protection of Sector5 */
Kojto 96:487b796308b0 399 #define OB_PCROP_Pages192to223 ((uint32_t)0x00000040) /* PC Read/Write protection of Sector6 */
Kojto 96:487b796308b0 400 #define OB_PCROP_Pages224to255 ((uint32_t)0x00000080) /* PC Read/Write protection of Sector7 */
Kojto 96:487b796308b0 401 #define OB_PCROP_Pages256to287 ((uint32_t)0x00000100) /* PC Read/Write protection of Sector8 */
Kojto 96:487b796308b0 402 #define OB_PCROP_Pages288to319 ((uint32_t)0x00000200) /* PC Read/Write protection of Sector9 */
Kojto 96:487b796308b0 403 #define OB_PCROP_Pages320to351 ((uint32_t)0x00000400) /* PC Read/Write protection of Sector10 */
Kojto 96:487b796308b0 404 #define OB_PCROP_Pages352to383 ((uint32_t)0x00000800) /* PC Read/Write protection of Sector11 */
Kojto 96:487b796308b0 405 #define OB_PCROP_Pages384to415 ((uint32_t)0x00001000) /* PC Read/Write protection of Sector12 */
Kojto 96:487b796308b0 406 #define OB_PCROP_Pages416to447 ((uint32_t)0x00002000) /* PC Read/Write protection of Sector13 */
Kojto 96:487b796308b0 407 #define OB_PCROP_Pages448to479 ((uint32_t)0x00004000) /* PC Read/Write protection of Sector14 */
Kojto 96:487b796308b0 408 #define OB_PCROP_Pages480to511 ((uint32_t)0x00008000) /* PC Read/Write protection of Sector15 */
Kojto 96:487b796308b0 409 #define OB_PCROP_Pages512to543 ((uint32_t)0x00010000) /* PC Read/Write protection of Sector16 */
Kojto 96:487b796308b0 410 #define OB_PCROP_Pages544to575 ((uint32_t)0x00020000) /* PC Read/Write protection of Sector17 */
Kojto 96:487b796308b0 411 #define OB_PCROP_Pages576to607 ((uint32_t)0x00040000) /* PC Read/Write protection of Sector18 */
Kojto 96:487b796308b0 412 #define OB_PCROP_Pages608to639 ((uint32_t)0x00080000) /* PC Read/Write protection of Sector19 */
Kojto 96:487b796308b0 413 #define OB_PCROP_Pages640to671 ((uint32_t)0x00100000) /* PC Read/Write protection of Sector20 */
Kojto 96:487b796308b0 414 #define OB_PCROP_Pages672to703 ((uint32_t)0x00200000) /* PC Read/Write protection of Sector21 */
Kojto 96:487b796308b0 415 #define OB_PCROP_Pages704to735 ((uint32_t)0x00400000) /* PC Read/Write protection of Sector22 */
Kojto 96:487b796308b0 416 #define OB_PCROP_Pages736to767 ((uint32_t)0x00800000) /* PC Read/Write protection of Sector23 */
Kojto 96:487b796308b0 417 #define OB_PCROP_Pages768to799 ((uint32_t)0x01000000) /* PC Read/Write protection of Sector24 */
Kojto 96:487b796308b0 418 #define OB_PCROP_Pages800to831 ((uint32_t)0x02000000) /* PC Read/Write protection of Sector25 */
Kojto 96:487b796308b0 419 #define OB_PCROP_Pages832to863 ((uint32_t)0x04000000) /* PC Read/Write protection of Sector26 */
Kojto 96:487b796308b0 420 #define OB_PCROP_Pages864to895 ((uint32_t)0x08000000) /* PC Read/Write protection of Sector27 */
Kojto 96:487b796308b0 421 #define OB_PCROP_Pages896to927 ((uint32_t)0x10000000) /* PC Read/Write protection of Sector28 */
Kojto 96:487b796308b0 422 #define OB_PCROP_Pages928to959 ((uint32_t)0x20000000) /* PC Read/Write protection of Sector29 */
Kojto 96:487b796308b0 423 #define OB_PCROP_Pages960to991 ((uint32_t)0x40000000) /* PC Read/Write protection of Sector30 */
Kojto 96:487b796308b0 424 #define OB_PCROP_Pages992to1023 ((uint32_t)0x80000000) /* PC Read/Write protection of Sector31 */
Kojto 96:487b796308b0 425 #define OB_PCROP_AllPages ((uint32_t)0xFFFFFFFF) /*!<PC Read/Write protection of all Sectors */
Kojto 96:487b796308b0 426 /**
Kojto 96:487b796308b0 427 * @}
Kojto 96:487b796308b0 428 */
Kojto 96:487b796308b0 429
Kojto 96:487b796308b0 430 /** @defgroup FLASHEx_Option_Bytes_ReadWrite_Protection2 FLASHEx Option Bytes Read Write Protection
Kojto 96:487b796308b0 431 * @{
Kojto 96:487b796308b0 432 */
Kojto 96:487b796308b0 433 #define OB_PCROP2_Pages1024to1055 ((uint32_t)0x00000001) /* PC Read/Write protection of Sector32 */
Kojto 96:487b796308b0 434 #define OB_PCROP2_Pages1056to1087 ((uint32_t)0x00000002) /* PC Read/Write protection of Sector33 */
Kojto 96:487b796308b0 435 #define OB_PCROP2_Pages1088to1119 ((uint32_t)0x00000004) /* PC Read/Write protection of Sector34 */
Kojto 96:487b796308b0 436 #define OB_PCROP2_Pages1120to1151 ((uint32_t)0x00000008) /* PC Read/Write protection of Sector35 */
Kojto 96:487b796308b0 437 #define OB_PCROP2_Pages1152to1183 ((uint32_t)0x00000010) /* PC Read/Write protection of Sector36 */
Kojto 96:487b796308b0 438 #define OB_PCROP2_Pages1184to1215 ((uint32_t)0x00000020) /* PC Read/Write protection of Sector37 */
Kojto 96:487b796308b0 439 #define OB_PCROP2_Pages1216to1247 ((uint32_t)0x00000040) /* PC Read/Write protection of Sector38 */
Kojto 96:487b796308b0 440 #define OB_PCROP2_Pages1248to1279 ((uint32_t)0x00000080) /* PC Read/Write protection of Sector39 */
Kojto 96:487b796308b0 441 #define OB_PCROP2_Pages1280to1311 ((uint32_t)0x00000100) /* PC Read/Write protection of Sector40 */
Kojto 96:487b796308b0 442 #define OB_PCROP2_Pages1312to1343 ((uint32_t)0x00000200) /* PC Read/Write protection of Sector41 */
Kojto 96:487b796308b0 443 #define OB_PCROP2_Pages1344to1375 ((uint32_t)0x00000400) /* PC Read/Write protection of Sector42 */
Kojto 96:487b796308b0 444 #define OB_PCROP2_Pages1376to1407 ((uint32_t)0x00000800) /* PC Read/Write protection of Sector43 */
Kojto 96:487b796308b0 445 #define OB_PCROP2_Pages1408to1439 ((uint32_t)0x00001000) /* PC Read/Write protection of Sector44 */
Kojto 96:487b796308b0 446 #define OB_PCROP2_Pages1440to1471 ((uint32_t)0x00002000) /* PC Read/Write protection of Sector45 */
Kojto 96:487b796308b0 447 #define OB_PCROP2_Pages1472to1503 ((uint32_t)0x00004000) /* PC Read/Write protection of Sector46 */
Kojto 96:487b796308b0 448 #define OB_PCROP2_Pages1504to1535 ((uint32_t)0x00008000) /* PC Read/Write protection of Sector47 */
Kojto 96:487b796308b0 449 #define OB_PCROP2_AllPages ((uint32_t)0x0000FFFF) /*!< PC Read/Write protection of all Sectors PCROP2 */
Kojto 96:487b796308b0 450 /**
Kojto 96:487b796308b0 451 * @}
Kojto 96:487b796308b0 452 */
Kojto 96:487b796308b0 453 #endif /* if STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
Kojto 96:487b796308b0 454
Kojto 96:487b796308b0 455 /** @defgroup FLASHEx_Option_Bytes_BOOTBit1
Kojto 96:487b796308b0 456 * @{
Kojto 96:487b796308b0 457 */
Kojto 96:487b796308b0 458 #define OB_BOOT_BIT1_RESET (uint8_t)(0x00) /*!< BOOT Bit 1 Reset */
Kojto 96:487b796308b0 459 #define OB_BOOT_BIT1_SET (uint8_t)(0x01) /*!< BOOT Bit 1 Set */
Kojto 96:487b796308b0 460 /**
Kojto 96:487b796308b0 461 * @}
Kojto 96:487b796308b0 462 */
Kojto 96:487b796308b0 463
Kojto 96:487b796308b0 464 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 96:487b796308b0 465 /** @defgroup FLASHEx_Option_Bytes_BOOT_BANK FLASHEx Option Bytes BOOT BANK
Kojto 96:487b796308b0 466 * @{
Kojto 96:487b796308b0 467 */
Kojto 96:487b796308b0 468 #define OB_BOOT_BANK1 ((uint8_t)0x00) /*!< At startup, if boot pin 0 and BOOT1 bit are set in boot from user Flash position
Kojto 96:487b796308b0 469 and this parameter is selected the device will boot from Bank 2
Kojto 96:487b796308b0 470 or Bank 1, depending on the activation of the bank */
Kojto 96:487b796308b0 471 #define OB_BOOT_BANK2 (uint8_t)(0x01) /*!< At startup, if boot pin 0 and BOOT1 bit are set in boot from user Flash position
Kojto 96:487b796308b0 472 and this parameter is selected the device will boot from Bank1(Default) */
Kojto 96:487b796308b0 473 /**
Kojto 96:487b796308b0 474 * @}
Kojto 96:487b796308b0 475 */
Kojto 96:487b796308b0 476 #endif /* if STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */
Kojto 96:487b796308b0 477
Kojto 96:487b796308b0 478 /** @defgroup FLASHEx_Type_Program_Data FLASHEx Type Program Data
Kojto 96:487b796308b0 479 * @{
Kojto 96:487b796308b0 480 */
Kojto 96:487b796308b0 481 #define FLASH_TYPEPROGRAMDATA_BYTE ((uint32_t)0x00) /*!< Program byte (8-bit) at a specified address.*/
Kojto 96:487b796308b0 482 #define FLASH_TYPEPROGRAMDATA_HALFWORD ((uint32_t)0x01) /*!< Program a half-word (16-bit) at a specified address.*/
Kojto 96:487b796308b0 483 #define FLASH_TYPEPROGRAMDATA_WORD ((uint32_t)0x02) /*!< Program a word (32-bit) at a specified address.*/
Kojto 96:487b796308b0 484
Kojto 96:487b796308b0 485 /* Aliases for compatibility with the V1.0.0 package */
Kojto 96:487b796308b0 486 #define FLASH_TYPEPROGRAM_BYTE FLASH_TYPEPROGRAMDATA_BYTE
Kojto 96:487b796308b0 487 #define FLASH_TYPEPROGRAM_HALFWORD FLASH_TYPEPROGRAMDATA_HALFWORD
Kojto 96:487b796308b0 488 /**
Kojto 96:487b796308b0 489 * @}
Kojto 96:487b796308b0 490 */
Kojto 96:487b796308b0 491
Kojto 96:487b796308b0 492 /** @defgroup FLASHEx_Address FLASHEx Address
Kojto 96:487b796308b0 493 * @{
Kojto 96:487b796308b0 494 */
Kojto 96:487b796308b0 495 #define FLASH_NBPAGES_MAX (FLASH_SIZE / FLASH_PAGE_SIZE)
Kojto 96:487b796308b0 496 /**
Kojto 96:487b796308b0 497 * @}
Kojto 96:487b796308b0 498 */
bogdanm 84:0b3ab51c8877 499
bogdanm 84:0b3ab51c8877 500 /**
bogdanm 84:0b3ab51c8877 501 * @}
bogdanm 84:0b3ab51c8877 502 */
Kojto 96:487b796308b0 503
Kojto 96:487b796308b0 504 /** @defgroup FLASHEx_Exported_Macros macros to control FLASH features
Kojto 96:487b796308b0 505 * @brief
bogdanm 84:0b3ab51c8877 506 * @{
bogdanm 84:0b3ab51c8877 507 */
bogdanm 84:0b3ab51c8877 508
bogdanm 84:0b3ab51c8877 509 /**
bogdanm 84:0b3ab51c8877 510 * @brief Set the FLASH Latency.
bogdanm 84:0b3ab51c8877 511 * @param __LATENCY__: FLASH Latency
Kojto 96:487b796308b0 512 * This parameter can be one of the following values:
Kojto 96:487b796308b0 513 * @arg FLASH_LATENCY_0: FLASH Zero Latency cycle
Kojto 96:487b796308b0 514 * @arg FLASH_LATENCY_1: FLASH One Latency cycle
bogdanm 84:0b3ab51c8877 515 * @retval none
bogdanm 84:0b3ab51c8877 516 */
bogdanm 84:0b3ab51c8877 517 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) \
bogdanm 84:0b3ab51c8877 518 MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(__LATENCY__))
bogdanm 84:0b3ab51c8877 519
bogdanm 84:0b3ab51c8877 520 /**
Kojto 96:487b796308b0 521 * @brief Enable/Disable the FLASH prefetch buffer.
bogdanm 84:0b3ab51c8877 522 * @retval none
bogdanm 84:0b3ab51c8877 523 */
Kojto 96:487b796308b0 524 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRFTEN)
Kojto 96:487b796308b0 525 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRFTEN)
bogdanm 84:0b3ab51c8877 526
bogdanm 84:0b3ab51c8877 527 /**
Kojto 96:487b796308b0 528 * @brief Enable/Disable the FLASH Buffer cache.
bogdanm 84:0b3ab51c8877 529 * @retval none
bogdanm 84:0b3ab51c8877 530 */
Kojto 96:487b796308b0 531 #define __HAL_FLASH_BUFFER_CACHE_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF)
Kojto 96:487b796308b0 532 #define __HAL_FLASH_BUFFER_CACHE_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF)
bogdanm 84:0b3ab51c8877 533
bogdanm 84:0b3ab51c8877 534 /**
Kojto 96:487b796308b0 535 * @brief Enable/Disable the FLASH preread buffer.
bogdanm 84:0b3ab51c8877 536 * @retval none
bogdanm 84:0b3ab51c8877 537 */
Kojto 96:487b796308b0 538 #define __HAL_FLASH_PREREAD_BUFFER_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRE_READ)
Kojto 96:487b796308b0 539 #define __HAL_FLASH_PREREAD_BUFFER_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRE_READ)
bogdanm 84:0b3ab51c8877 540
bogdanm 84:0b3ab51c8877 541 /**
Kojto 96:487b796308b0 542 * @brief Enable/Disable the FLASH power down during Sleep mode.
bogdanm 84:0b3ab51c8877 543 * @retval none
bogdanm 84:0b3ab51c8877 544 */
Kojto 96:487b796308b0 545 #define __HAL_FLASH_SLEEP_POWERDOWN_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
Kojto 96:487b796308b0 546 #define __HAL_FLASH_SLEEP_POWERDOWN_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD)
bogdanm 84:0b3ab51c8877 547
bogdanm 84:0b3ab51c8877 548 /**
Kojto 96:487b796308b0 549 * @brief Enable the Flash Run power down mode.
bogdanm 84:0b3ab51c8877 550 * @note Writing this bit to 0 this bit, automatically the keys are
bogdanm 84:0b3ab51c8877 551 * loss and a new unlock sequence is necessary to re-write it to 1.
bogdanm 84:0b3ab51c8877 552 */
bogdanm 84:0b3ab51c8877 553 #define __HAL_FLASH_POWER_DOWN_ENABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \
bogdanm 84:0b3ab51c8877 554 FLASH->PDKEYR = FLASH_PDKEY2; \
Kojto 96:487b796308b0 555 SET_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \
bogdanm 84:0b3ab51c8877 556 } while (0)
bogdanm 84:0b3ab51c8877 557
Kojto 96:487b796308b0 558 /**
Kojto 96:487b796308b0 559 * @brief Disable the Flash Run power down mode.
Kojto 96:487b796308b0 560 * @note Writing this bit to 0 this bit, automatically the keys are
Kojto 96:487b796308b0 561 * loss and a new unlock sequence is necessary to re-write it to 1.
Kojto 96:487b796308b0 562 */
bogdanm 84:0b3ab51c8877 563 #define __HAL_FLASH_POWER_DOWN_DISABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \
bogdanm 84:0b3ab51c8877 564 FLASH->PDKEYR = FLASH_PDKEY2; \
Kojto 96:487b796308b0 565 CLEAR_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \
bogdanm 84:0b3ab51c8877 566 } while (0)
Kojto 96:487b796308b0 567
Kojto 96:487b796308b0 568 /**
Kojto 96:487b796308b0 569 * @}
Kojto 96:487b796308b0 570 */
Kojto 96:487b796308b0 571
Kojto 96:487b796308b0 572 /** @defgroup FLASHEx_Exported_Functions FLASHEx Exported functions
Kojto 96:487b796308b0 573 * @{
Kojto 96:487b796308b0 574 */
Kojto 96:487b796308b0 575
Kojto 96:487b796308b0 576 /** @defgroup FLASHEx_Exported_Functions_Group1 FLASH Memory Erasing functions
Kojto 96:487b796308b0 577 * @{
Kojto 96:487b796308b0 578 */
Kojto 96:487b796308b0 579 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
Kojto 96:487b796308b0 580 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
Kojto 96:487b796308b0 581 /**
Kojto 96:487b796308b0 582 * @}
Kojto 96:487b796308b0 583 */
Kojto 96:487b796308b0 584
Kojto 96:487b796308b0 585 /** @defgroup FLASHEx_Exported_Functions_Group2 Option Bytes Programming functions
Kojto 96:487b796308b0 586 * @{
Kojto 96:487b796308b0 587 */
Kojto 96:487b796308b0 588 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 96:487b796308b0 589 void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
Kojto 96:487b796308b0 590 HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
Kojto 96:487b796308b0 591 void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit);
Kojto 96:487b796308b0 592 HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void);
Kojto 96:487b796308b0 593 HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void);
bogdanm 84:0b3ab51c8877 594 /**
bogdanm 84:0b3ab51c8877 595 * @}
bogdanm 84:0b3ab51c8877 596 */
bogdanm 84:0b3ab51c8877 597
Kojto 96:487b796308b0 598 /** @defgroup FLASHEx_Exported_Functions_Group3 DATA EEPROM Programming functions
Kojto 96:487b796308b0 599 * @{
Kojto 96:487b796308b0 600 */
bogdanm 92:4fc01daae5a5 601 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Unlock(void);
bogdanm 92:4fc01daae5a5 602 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Lock(void);
bogdanm 92:4fc01daae5a5 603 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Erase(uint32_t Address);
bogdanm 92:4fc01daae5a5 604 HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data);
Kojto 96:487b796308b0 605 void HAL_FLASHEx_DATAEEPROM_EnableFixedTimeProgram(void);
Kojto 96:487b796308b0 606 void HAL_FLASHEx_DATAEEPROM_DisableFixedTimeProgram(void);
bogdanm 84:0b3ab51c8877 607
Kojto 96:487b796308b0 608 /**
Kojto 96:487b796308b0 609 * @}
Kojto 96:487b796308b0 610 */
Kojto 96:487b796308b0 611
Kojto 96:487b796308b0 612 /**
Kojto 96:487b796308b0 613 * @}
Kojto 96:487b796308b0 614 */
Kojto 96:487b796308b0 615
Kojto 96:487b796308b0 616 /** @addtogroup FLASH_Private_Macros FLASH Private Macros
Kojto 96:487b796308b0 617 * @{
Kojto 96:487b796308b0 618 */
Kojto 96:487b796308b0 619 #define IS_FLASH_TYPEERASE(__VALUE__) (((__VALUE__) == FLASH_TYPEERASE_PAGES))
Kojto 96:487b796308b0 620
Kojto 96:487b796308b0 621 #define IS_OPTIONBYTE(__VALUE__) (((__VALUE__) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | \
Kojto 96:487b796308b0 622 OPTIONBYTE_USER | OPTIONBYTE_BOR | OPTIONBYTE_BOOT_BIT1)))
bogdanm 84:0b3ab51c8877 623
Kojto 96:487b796308b0 624 #define IS_WRPSTATE(__VALUE__) (((__VALUE__) == OB_WRPSTATE_DISABLE) || \
Kojto 96:487b796308b0 625 ((__VALUE__) == OB_WRPSTATE_ENABLE))
Kojto 96:487b796308b0 626
Kojto 96:487b796308b0 627 #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000))
Kojto 96:487b796308b0 628
Kojto 96:487b796308b0 629 #define IS_OB_RDP(__LEVEL__) (((__LEVEL__) == OB_RDP_LEVEL0)||\
Kojto 96:487b796308b0 630 ((__LEVEL__) == OB_RDP_LEVEL1)||\
Kojto 96:487b796308b0 631 ((__LEVEL__) == OB_RDP_LEVEL2))
Kojto 96:487b796308b0 632
Kojto 96:487b796308b0 633 #define IS_OB_BOR_LEVEL(__LEVEL__) ( ((__LEVEL__) == OB_BOR_OFF) || \
Kojto 96:487b796308b0 634 ((__LEVEL__) == OB_BOR_LEVEL1) || \
Kojto 96:487b796308b0 635 ((__LEVEL__) == OB_BOR_LEVEL2) || \
Kojto 96:487b796308b0 636 ((__LEVEL__) == OB_BOR_LEVEL3) || \
Kojto 96:487b796308b0 637 ((__LEVEL__) == OB_BOR_LEVEL4) || \
Kojto 96:487b796308b0 638 ((__LEVEL__) == OB_BOR_LEVEL5))
bogdanm 84:0b3ab51c8877 639
Kojto 96:487b796308b0 640 #define IS_OB_IWDG_SOURCE(__SOURCE__) (((__SOURCE__) == OB_IWDG_SW) || ((__SOURCE__) == OB_IWDG_HW))
Kojto 96:487b796308b0 641
Kojto 96:487b796308b0 642 #define IS_OB_STOP_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STOP_NORST) || ((__SOURCE__) == OB_STOP_RST))
Kojto 96:487b796308b0 643
Kojto 96:487b796308b0 644 #define IS_OB_STDBY_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STDBY_NORST) || ((__SOURCE__) == OB_STDBY_RST))
Kojto 96:487b796308b0 645
Kojto 96:487b796308b0 646 #define IS_PCROPSTATE(VALUE)(((VALUE) == OB_PCROP_STATE_DISABLE) || \
Kojto 96:487b796308b0 647 ((VALUE) == OB_PCROP_STATE_ENABLE))
Kojto 96:487b796308b0 648
Kojto 96:487b796308b0 649 #define IS_OB_PCROP(__PAGE__) (((__PAGE__) != 0x0000000))
Kojto 96:487b796308b0 650
Kojto 96:487b796308b0 651 #define IS_OB_BOOT1(__BOOT_BIT1__) (((__BOOT_BIT1__) == OB_BOOT_BIT1_RESET) || ((__BOOT_BIT1__) == OB_BOOT_BIT1_SET))
Kojto 96:487b796308b0 652
Kojto 96:487b796308b0 653 #define IS_TYPEPROGRAMDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEPROGRAMDATA_BYTE) || \
Kojto 96:487b796308b0 654 ((__VALUE__) == FLASH_TYPEPROGRAMDATA_HALFWORD) || \
Kojto 96:487b796308b0 655 ((__VALUE__) == FLASH_TYPEPROGRAMDATA_WORD))
bogdanm 92:4fc01daae5a5 656
Kojto 96:487b796308b0 657 #define IS_NBPAGES(__PAGES__) (((__PAGES__) >= 1) && ((__PAGES__) <= FLASH_NBPAGES_MAX))
bogdanm 84:0b3ab51c8877 658
Kojto 96:487b796308b0 659 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
Kojto 96:487b796308b0 660 #define IS_OBEX(__VALUE__)(((__VALUE__) <= (OPTIONBYTE_PCROP | OPTIONBYTE_BOOTCONFIG)))
Kojto 96:487b796308b0 661 #define IS_OB_BOOT_BANK(__BANK__) (((__BANK__) == OB_BOOT_BANK2) || ((__BANK__) == OB_BOOT_BANK1))
Kojto 96:487b796308b0 662 #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END))
Kojto 96:487b796308b0 663 #define IS_FLASH_DATA_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK1_END))
Kojto 96:487b796308b0 664 #define IS_FLASH_DATA_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BANK2_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END))
Kojto 96:487b796308b0 665 #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE)))
Kojto 96:487b796308b0 666 #define IS_FLASH_PROGRAM_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + (FLASH_SIZE >> 1))))
Kojto 96:487b796308b0 667 #define IS_FLASH_PROGRAM_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BANK2_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE)))
Kojto 96:487b796308b0 668 #else
Kojto 96:487b796308b0 669 #define IS_OBEX(VALUE)((VALUE) == OPTIONBYTE_PCROP)
Kojto 96:487b796308b0 670 #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_END))
Kojto 96:487b796308b0 671 #define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE)))
Kojto 96:487b796308b0 672 #endif
Kojto 96:487b796308b0 673 /**
Kojto 96:487b796308b0 674 * @}
Kojto 96:487b796308b0 675 */
bogdanm 84:0b3ab51c8877 676
bogdanm 84:0b3ab51c8877 677 /**
bogdanm 84:0b3ab51c8877 678 * @}
bogdanm 84:0b3ab51c8877 679 */
bogdanm 84:0b3ab51c8877 680
bogdanm 84:0b3ab51c8877 681 /**
bogdanm 84:0b3ab51c8877 682 * @}
Kojto 96:487b796308b0 683 */
bogdanm 84:0b3ab51c8877 684
bogdanm 84:0b3ab51c8877 685 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 686 }
bogdanm 84:0b3ab51c8877 687 #endif
bogdanm 84:0b3ab51c8877 688
bogdanm 84:0b3ab51c8877 689 #endif /* __STM32L0xx_HAL_FLASH_EX_H */
bogdanm 84:0b3ab51c8877 690
bogdanm 84:0b3ab51c8877 691 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 96:487b796308b0 692