X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tmk_core%2Ftool%2Fmbed%2Fmbed-sdk%2Flibraries%2Fmbed%2Ftargets%2Fcmsis%2FTARGET_STM%2FTARGET_STM32L0%2Fstm32l0xx_hal_flash_ex.h;fp=tmk_core%2Ftool%2Fmbed%2Fmbed-sdk%2Flibraries%2Fmbed%2Ftargets%2Fcmsis%2FTARGET_STM%2FTARGET_STM32L0%2Fstm32l0xx_hal_flash_ex.h;h=794f4ddd4cab41208b8a7de2c454af95bf640175;hb=a3d96d3aa96318d339a67de1085e0ae495d57c84;hp=0000000000000000000000000000000000000000;hpb=1d5bac21dc6f1425b8ef4bbe7935330c37c3a93e;p=qmk_firmware.git diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/stm32l0xx_hal_flash_ex.h b/tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/stm32l0xx_hal_flash_ex.h new file mode 100644 index 000000000..794f4ddd4 --- /dev/null +++ b/tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/stm32l0xx_hal_flash_ex.h @@ -0,0 +1,692 @@ +/** + ****************************************************************************** + * @file stm32l0xx_hal_flash_ex.h + * @author MCD Application Team + * @version V1.2.0 + * @date 06-February-2015 + * @brief Header file of FLash HAL Extension module. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2015 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32L0xx_HAL_FLASH_EX_H +#define __STM32L0xx_HAL_FLASH_EX_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32l0xx_hal_def.h" + +/** @addtogroup STM32L0xx_HAL_Driver + * @{ + */ + +/** @defgroup FLASHEx FLASHEx + * @{ + */ + +/** @defgroup FLASHEx_Exported_Types FLASH Exported Types + * @{ + */ + +/** + * @brief FLASH Option Bytes PROGRAM structure definition + */ +typedef struct +{ + uint32_t OptionType; /*!< OptionType: Option byte to be configured. + This parameter can be a value of @ref FLASHEx_Option_Type */ + + uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation. + This parameter can be a value of @ref FLASHEx_WRP_State */ + + uint32_t WRPSector; /*!< WRPSector: This bitfield specifies the sector (s) which are write protected. + This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection */ + +#if defined(STM32L071xx) || defined(STM32L072xx) || defined(STM32L073xx) || defined(STM32L081xx) || defined(STM32L082xx) || defined(STM32L083xx) + uint32_t WRPSector2; /*!< WRPSector2 : This bitfield specifies the sector(s) upper Sector31 which are write protected. + This parameter can be a combination of @ref FLASHEx_Option_Bytes_Write_Protection2 */ +#endif + + uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level. + This parameter can be a value of @ref FLASHEx_Option_Bytes_Read_Protection */ + + uint8_t BORLevel; /*!< BORLevel: Set the BOR Level. + This parameter can be a value of @ref FLASHEx_Option_Bytes_BOR_Level */ + + uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. + 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 */ + + uint8_t BOOTBit1Config; /*!< BOOT1Config: Together with input pad Boot0, this bit selects the boot source, flash, ram or system memory + This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOTBit1 */ + +} FLASH_OBProgramInitTypeDef; + +/** + * @brief FLASH Advanced Option Bytes Program structure definition + */ +typedef struct +{ + uint32_t OptionType; /*!< OptionType: Option byte to be configured for extension . + This parameter can be a value of @ref FLASHEx_OptionAdv_Type */ + + uint8_t PCROPState; /*!< PCROPState: PCROP activation or deactivation. + This parameter can be a value of @ref FLASHEx_PCROP_State */ + + uint32_t PCROPSector; /*!< PCROPSector : This bitfield specifies the sector(s) which are read/write protected. + This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ + +#if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) + uint32_t PCROPSector2; /*!< PCROPSector : This bitfield specifies the sector(s) upper Sector31 which are read/write protected. + This parameter can be a combination of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 */ + + uint8_t BootConfig; /*!< BootConfig: specifies Option bytes for boot config. + This parameter can be a value of @ref FLASHEx_Option_Bytes_BOOT_BANK */ +#endif /* if STM32L071xx || STM32L072xx || STM32L073xx || STM32L081xx || STM32L082xx || STM32L083xx */ +} FLASH_AdvOBProgramInitTypeDef; + +/** + * @} + */ + +/** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants + * @{ + */ + +/** @defgroup FLASHEx_Type_Erase FLASHEx_Type_Erase + * @{ + */ +#define FLASH_TYPEERASE_PAGES ((uint32_t)0x00) /*!< Page erase only */ +/** + * @} + */ + +/** @defgroup FLASHEx_Option_Type FLASHEx Option Type + * @{ + */ +#define OPTIONBYTE_WRP ((uint32_t)0x01) /*!< WRP option byte configuration */ +#define OPTIONBYTE_RDP ((uint32_t)0x02) /*!< RDP option byte configuration */ +#define OPTIONBYTE_USER ((uint32_t)0x04) /*!< USER option byte configuration */ +#define OPTIONBYTE_BOR ((uint32_t)0x08) /*!< BOR option byte configuration */ +#define OPTIONBYTE_BOOT_BIT1 ((uint32_t)0x10) /*!< BOOT PIN1 option byte configuration*/ +/** + * @} + */ + +/** @defgroup FLASHEx_WRP_State FLASHEx WRP State + * @{ + */ +#define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!< Disable the write protection of the desired sectors */ +#define OB_WRPSTATE_ENABLE ((uint32_t)0x01) /*!< Enable the write protection of the desired sectors */ +/** + * @} + */ + +/** @defgroup FLASHEx_Option_Bytes_ReadWrite_Mask FLASHEx Option Bytes Write Mask + * @{ + */ +#define WRP_MASK_LOW ((uint32_t)0x0000FFFF) +#define WRP_MASK_HIGH ((uint32_t)0xFFFF0000) +/** + * @} + */ + +#if defined (STM32L031xx) || defined (STM32L041xx) +/** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASHEx Option Bytes Write Protection + * @{ + */ +#define OB_WRP_Pages0to31 ((uint32_t)0x00000001) /* Write protection of Sector0 */ +#define OB_WRP_Pages32to63 ((uint32_t)0x00000002) /* Write protection of Sector1 */ +#define OB_WRP_Pages64to95 ((uint32_t)0x00000004) /* Write protection of Sector2 */ +#define OB_WRP_Pages96to127 ((uint32_t)0x00000008) /* Write protection of Sector3 */ +#define OB_WRP_Pages128to159 ((uint32_t)0x00000010) /* Write protection of Sector4 */ +#define OB_WRP_Pages160to191 ((uint32_t)0x00000020) /* Write protection of Sector5 */ +#define OB_WRP_Pages192to223 ((uint32_t)0x00000040) /* Write protection of Sector6 */ +#define OB_WRP_Pages224to255 ((uint32_t)0x00000080) /* Write protection of Sector7 */ +#define OB_WRP_AllPages ((uint32_t)0x000000FF) /*!< Write protection of all Sectors */ +/** + * @} + */ +#elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx) +/** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASHEx Option Bytes Write Protection + * @{ + */ +#define OB_WRP_Pages0to31 ((uint32_t)0x00000001) /* Write protection of Sector0 */ +#define OB_WRP_Pages32to63 ((uint32_t)0x00000002) /* Write protection of Sector1 */ +#define OB_WRP_Pages64to95 ((uint32_t)0x00000004) /* Write protection of Sector2 */ +#define OB_WRP_Pages96to127 ((uint32_t)0x00000008) /* Write protection of Sector3 */ +#define OB_WRP_Pages128to159 ((uint32_t)0x00000010) /* Write protection of Sector4 */ +#define OB_WRP_Pages160to191 ((uint32_t)0x00000020) /* Write protection of Sector5 */ +#define OB_WRP_Pages192to223 ((uint32_t)0x00000040) /* Write protection of Sector6 */ +#define OB_WRP_Pages224to255 ((uint32_t)0x00000080) /* Write protection of Sector7 */ +#define OB_WRP_Pages256to287 ((uint32_t)0x00000100) /* Write protection of Sector8 */ +#define OB_WRP_Pages288to319 ((uint32_t)0x00000200) /* Write protection of Sector9 */ +#define OB_WRP_Pages320to351 ((uint32_t)0x00000400) /* Write protection of Sector10 */ +#define OB_WRP_Pages352to383 ((uint32_t)0x00000800) /* Write protection of Sector11 */ +#define OB_WRP_Pages384to415 ((uint32_t)0x00001000) /* Write protection of Sector12 */ +#define OB_WRP_Pages416to447 ((uint32_t)0x00002000) /* Write protection of Sector13 */ +#define OB_WRP_Pages448to479 ((uint32_t)0x00004000) /* Write protection of Sector14 */ +#define OB_WRP_Pages480to511 ((uint32_t)0x00008000) /* Write protection of Sector15 */ +#define OB_WRP_AllPages ((uint32_t)0x0000FFFF) /*!< Write protection of all Sectors */ +/** + * @} + */ + +#elif defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) +/** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASHEx Option Bytes Write ProtectionP + * @{ + */ +#define OB_WRP_Pages0to31 ((uint32_t)0x00000001) /* Write protection of Sector0 */ +#define OB_WRP_Pages32to63 ((uint32_t)0x00000002) /* Write protection of Sector1 */ +#define OB_WRP_Pages64to95 ((uint32_t)0x00000004) /* Write protection of Sector2 */ +#define OB_WRP_Pages96to127 ((uint32_t)0x00000008) /* Write protection of Sector3 */ +#define OB_WRP_Pages128to159 ((uint32_t)0x00000010) /* Write protection of Sector4 */ +#define OB_WRP_Pages160to191 ((uint32_t)0x00000020) /* Write protection of Sector5 */ +#define OB_WRP_Pages192to223 ((uint32_t)0x00000040) /* Write protection of Sector6 */ +#define OB_WRP_Pages224to255 ((uint32_t)0x00000080) /* Write protection of Sector7 */ +#define OB_WRP_Pages256to287 ((uint32_t)0x00000100) /* Write protection of Sector8 */ +#define OB_WRP_Pages288to319 ((uint32_t)0x00000200) /* Write protection of Sector9 */ +#define OB_WRP_Pages320to351 ((uint32_t)0x00000400) /* Write protection of Sector10 */ +#define OB_WRP_Pages352to383 ((uint32_t)0x00000800) /* Write protection of Sector11 */ +#define OB_WRP_Pages384to415 ((uint32_t)0x00001000) /* Write protection of Sector12 */ +#define OB_WRP_Pages416to447 ((uint32_t)0x00002000) /* Write protection of Sector13 */ +#define OB_WRP_Pages448to479 ((uint32_t)0x00004000) /* Write protection of Sector14 */ +#define OB_WRP_Pages480to511 ((uint32_t)0x00008000) /* Write protection of Sector15 */ +#define OB_WRP_Pages512to543 ((uint32_t)0x00010000) /* Write protection of Sector16 */ +#define OB_WRP_Pages544to575 ((uint32_t)0x00020000) /* Write protection of Sector17 */ +#define OB_WRP_Pages576to607 ((uint32_t)0x00040000) /* Write protection of Sector18 */ +#define OB_WRP_Pages608to639 ((uint32_t)0x00080000) /* Write protection of Sector19 */ +#define OB_WRP_Pages640to671 ((uint32_t)0x00100000) /* Write protection of Sector20 */ +#define OB_WRP_Pages672to703 ((uint32_t)0x00200000) /* Write protection of Sector21 */ +#define OB_WRP_Pages704to735 ((uint32_t)0x00400000) /* Write protection of Sector22 */ +#define OB_WRP_Pages736to767 ((uint32_t)0x00800000) /* Write protection of Sector23 */ +#define OB_WRP_Pages768to799 ((uint32_t)0x01000000) /* Write protection of Sector24 */ +#define OB_WRP_Pages800to831 ((uint32_t)0x02000000) /* Write protection of Sector25 */ +#define OB_WRP_Pages832to863 ((uint32_t)0x04000000) /* Write protection of Sector26 */ +#define OB_WRP_Pages864to895 ((uint32_t)0x08000000) /* Write protection of Sector27 */ +#define OB_WRP_Pages896to927 ((uint32_t)0x10000000) /* Write protection of Sector28 */ +#define OB_WRP_Pages928to959 ((uint32_t)0x20000000) /* Write protection of Sector29 */ +#define OB_WRP_Pages960to991 ((uint32_t)0x40000000) /* Write protection of Sector30 */ +#define OB_WRP_Pages992to1023 ((uint32_t)0x80000000) /* Write protection of Sector31 */ +#define OB_WRP_AllPages ((uint32_t)0xFFFFFFFF) /*!ACR, FLASH_ACR_LATENCY, (uint32_t)(__LATENCY__)) + +/** + * @brief Enable/Disable the FLASH prefetch buffer. + * @retval none + */ +#define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRFTEN) +#define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRFTEN) + +/** + * @brief Enable/Disable the FLASH Buffer cache. + * @retval none + */ +#define __HAL_FLASH_BUFFER_CACHE_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF) +#define __HAL_FLASH_BUFFER_CACHE_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_DISAB_BUF) + +/** + * @brief Enable/Disable the FLASH preread buffer. + * @retval none + */ +#define __HAL_FLASH_PREREAD_BUFFER_ENABLE() SET_BIT((FLASH->ACR), FLASH_ACR_PRE_READ) +#define __HAL_FLASH_PREREAD_BUFFER_DISABLE() CLEAR_BIT((FLASH->ACR), FLASH_ACR_PRE_READ) + +/** + * @brief Enable/Disable the FLASH power down during Sleep mode. + * @retval none + */ +#define __HAL_FLASH_SLEEP_POWERDOWN_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD) +#define __HAL_FLASH_SLEEP_POWERDOWN_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_SLEEP_PD) + +/** + * @brief Enable the Flash Run power down mode. + * @note Writing this bit to 0 this bit, automatically the keys are + * loss and a new unlock sequence is necessary to re-write it to 1. + */ +#define __HAL_FLASH_POWER_DOWN_ENABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ + FLASH->PDKEYR = FLASH_PDKEY2; \ + SET_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ + } while (0) + +/** + * @brief Disable the Flash Run power down mode. + * @note Writing this bit to 0 this bit, automatically the keys are + * loss and a new unlock sequence is necessary to re-write it to 1. + */ +#define __HAL_FLASH_POWER_DOWN_DISABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ + FLASH->PDKEYR = FLASH_PDKEY2; \ + CLEAR_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ + } while (0) + +/** + * @} + */ + +/** @defgroup FLASHEx_Exported_Functions FLASHEx Exported functions + * @{ + */ + +/** @defgroup FLASHEx_Exported_Functions_Group1 FLASH Memory Erasing functions + * @{ + */ +HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError); +HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); +/** + * @} + */ + +/** @defgroup FLASHEx_Exported_Functions_Group2 Option Bytes Programming functions + * @{ + */ +HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); +void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); +HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); +void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); +HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void); +HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void); +/** + * @} + */ + +/** @defgroup FLASHEx_Exported_Functions_Group3 DATA EEPROM Programming functions + * @{ + */ +HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Unlock(void); +HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Lock(void); +HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Erase(uint32_t Address); +HAL_StatusTypeDef HAL_FLASHEx_DATAEEPROM_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data); +void HAL_FLASHEx_DATAEEPROM_EnableFixedTimeProgram(void); +void HAL_FLASHEx_DATAEEPROM_DisableFixedTimeProgram(void); + +/** + * @} + */ + +/** + * @} + */ + +/** @addtogroup FLASH_Private_Macros FLASH Private Macros + * @{ + */ +#define IS_FLASH_TYPEERASE(__VALUE__) (((__VALUE__) == FLASH_TYPEERASE_PAGES)) + +#define IS_OPTIONBYTE(__VALUE__) (((__VALUE__) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | \ + OPTIONBYTE_USER | OPTIONBYTE_BOR | OPTIONBYTE_BOOT_BIT1))) + +#define IS_WRPSTATE(__VALUE__) (((__VALUE__) == OB_WRPSTATE_DISABLE) || \ + ((__VALUE__) == OB_WRPSTATE_ENABLE)) + +#define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000)) + +#define IS_OB_RDP(__LEVEL__) (((__LEVEL__) == OB_RDP_LEVEL0)||\ + ((__LEVEL__) == OB_RDP_LEVEL1)||\ + ((__LEVEL__) == OB_RDP_LEVEL2)) + +#define IS_OB_BOR_LEVEL(__LEVEL__) ( ((__LEVEL__) == OB_BOR_OFF) || \ + ((__LEVEL__) == OB_BOR_LEVEL1) || \ + ((__LEVEL__) == OB_BOR_LEVEL2) || \ + ((__LEVEL__) == OB_BOR_LEVEL3) || \ + ((__LEVEL__) == OB_BOR_LEVEL4) || \ + ((__LEVEL__) == OB_BOR_LEVEL5)) + +#define IS_OB_IWDG_SOURCE(__SOURCE__) (((__SOURCE__) == OB_IWDG_SW) || ((__SOURCE__) == OB_IWDG_HW)) + +#define IS_OB_STOP_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STOP_NORST) || ((__SOURCE__) == OB_STOP_RST)) + +#define IS_OB_STDBY_SOURCE(__SOURCE__) (((__SOURCE__) == OB_STDBY_NORST) || ((__SOURCE__) == OB_STDBY_RST)) + +#define IS_PCROPSTATE(VALUE)(((VALUE) == OB_PCROP_STATE_DISABLE) || \ + ((VALUE) == OB_PCROP_STATE_ENABLE)) + +#define IS_OB_PCROP(__PAGE__) (((__PAGE__) != 0x0000000)) + +#define IS_OB_BOOT1(__BOOT_BIT1__) (((__BOOT_BIT1__) == OB_BOOT_BIT1_RESET) || ((__BOOT_BIT1__) == OB_BOOT_BIT1_SET)) + +#define IS_TYPEPROGRAMDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEPROGRAMDATA_BYTE) || \ + ((__VALUE__) == FLASH_TYPEPROGRAMDATA_HALFWORD) || \ + ((__VALUE__) == FLASH_TYPEPROGRAMDATA_WORD)) + +#define IS_NBPAGES(__PAGES__) (((__PAGES__) >= 1) && ((__PAGES__) <= FLASH_NBPAGES_MAX)) + +#if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) +#define IS_OBEX(__VALUE__)(((__VALUE__) <= (OPTIONBYTE_PCROP | OPTIONBYTE_BOOTCONFIG))) +#define IS_OB_BOOT_BANK(__BANK__) (((__BANK__) == OB_BOOT_BANK2) || ((__BANK__) == OB_BOOT_BANK1)) +#define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END)) +#define IS_FLASH_DATA_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK1_END)) +#define IS_FLASH_DATA_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BANK2_BASE) && ((__ADDRESS__) <= DATA_EEPROM_BANK2_END)) +#define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE))) +#define IS_FLASH_PROGRAM_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + (FLASH_SIZE >> 1)))) +#define IS_FLASH_PROGRAM_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BANK2_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE))) +#else +#define IS_OBEX(VALUE)((VALUE) == OPTIONBYTE_PCROP) +#define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= DATA_EEPROM_BASE) && ((__ADDRESS__) <= DATA_EEPROM_END)) +#define IS_FLASH_PROGRAM_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) < (FLASH_BASE + FLASH_SIZE))) +#endif +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32L0xx_HAL_FLASH_EX_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ +