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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_NUCLEO_L011K4/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_firewall.h@167:84c0a372a020
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 157:e7ca05fa8600 1 /**
AnnaBridge 157:e7ca05fa8600 2 ******************************************************************************
AnnaBridge 157:e7ca05fa8600 3 * @file stm32l0xx_hal_firewall.h
AnnaBridge 157:e7ca05fa8600 4 * @author MCD Application Team
AnnaBridge 157:e7ca05fa8600 5 * @brief Header file of FIREWALL HAL module.
AnnaBridge 157:e7ca05fa8600 6 ******************************************************************************
AnnaBridge 157:e7ca05fa8600 7 * @attention
AnnaBridge 157:e7ca05fa8600 8 *
AnnaBridge 157:e7ca05fa8600 9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
AnnaBridge 157:e7ca05fa8600 10 *
AnnaBridge 157:e7ca05fa8600 11 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 157:e7ca05fa8600 12 * are permitted provided that the following conditions are met:
AnnaBridge 157:e7ca05fa8600 13 * 1. Redistributions of source code must retain the above copyright notice,
AnnaBridge 157:e7ca05fa8600 14 * this list of conditions and the following disclaimer.
AnnaBridge 157:e7ca05fa8600 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
AnnaBridge 157:e7ca05fa8600 16 * this list of conditions and the following disclaimer in the documentation
AnnaBridge 157:e7ca05fa8600 17 * and/or other materials provided with the distribution.
AnnaBridge 157:e7ca05fa8600 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
AnnaBridge 157:e7ca05fa8600 19 * may be used to endorse or promote products derived from this software
AnnaBridge 157:e7ca05fa8600 20 * without specific prior written permission.
AnnaBridge 157:e7ca05fa8600 21 *
AnnaBridge 157:e7ca05fa8600 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AnnaBridge 157:e7ca05fa8600 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
AnnaBridge 157:e7ca05fa8600 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 157:e7ca05fa8600 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
AnnaBridge 157:e7ca05fa8600 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
AnnaBridge 157:e7ca05fa8600 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
AnnaBridge 157:e7ca05fa8600 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
AnnaBridge 157:e7ca05fa8600 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
AnnaBridge 157:e7ca05fa8600 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
AnnaBridge 157:e7ca05fa8600 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 157:e7ca05fa8600 32 *
AnnaBridge 157:e7ca05fa8600 33 ******************************************************************************
AnnaBridge 157:e7ca05fa8600 34 */
AnnaBridge 157:e7ca05fa8600 35
AnnaBridge 157:e7ca05fa8600 36 /* Define to prevent recursive inclusion -------------------------------------*/
AnnaBridge 157:e7ca05fa8600 37 #ifndef __STM32L0xx_HAL_FIREWALL_H
AnnaBridge 157:e7ca05fa8600 38 #define __STM32L0xx_HAL_FIREWALL_H
AnnaBridge 157:e7ca05fa8600 39
AnnaBridge 157:e7ca05fa8600 40 #ifdef __cplusplus
AnnaBridge 157:e7ca05fa8600 41 extern "C" {
AnnaBridge 157:e7ca05fa8600 42 #endif
AnnaBridge 157:e7ca05fa8600 43
AnnaBridge 157:e7ca05fa8600 44 #if !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx)
AnnaBridge 157:e7ca05fa8600 45
AnnaBridge 157:e7ca05fa8600 46 /* Includes ------------------------------------------------------------------*/
AnnaBridge 157:e7ca05fa8600 47 #include "stm32l0xx_hal_def.h"
AnnaBridge 157:e7ca05fa8600 48
AnnaBridge 157:e7ca05fa8600 49 /** @addtogroup STM32L0xx_HAL_Driver
AnnaBridge 157:e7ca05fa8600 50 * @{
AnnaBridge 157:e7ca05fa8600 51 */
AnnaBridge 157:e7ca05fa8600 52
AnnaBridge 157:e7ca05fa8600 53 /** @defgroup FIREWALL FIREWALL
AnnaBridge 157:e7ca05fa8600 54 * @{
AnnaBridge 157:e7ca05fa8600 55 */
AnnaBridge 157:e7ca05fa8600 56
AnnaBridge 157:e7ca05fa8600 57 /* Exported types ------------------------------------------------------------*/
AnnaBridge 157:e7ca05fa8600 58 /** @defgroup FIREWALL_Exported_Types FIREWALL Exported Types
AnnaBridge 157:e7ca05fa8600 59 * @{
AnnaBridge 157:e7ca05fa8600 60 */
AnnaBridge 157:e7ca05fa8600 61
AnnaBridge 157:e7ca05fa8600 62 /**
AnnaBridge 157:e7ca05fa8600 63 * @brief FIREWALL Initialization Structure definition
AnnaBridge 157:e7ca05fa8600 64 */
AnnaBridge 157:e7ca05fa8600 65 typedef struct
AnnaBridge 157:e7ca05fa8600 66 {
AnnaBridge 157:e7ca05fa8600 67 uint32_t CodeSegmentStartAddress; /*!< Protected code segment start address. This value is 24-bit long, the 8 LSB bits are
AnnaBridge 157:e7ca05fa8600 68 reserved and forced to 0 in order to allow a 256-byte granularity. */
AnnaBridge 157:e7ca05fa8600 69
AnnaBridge 157:e7ca05fa8600 70 uint32_t CodeSegmentLength; /*!< Protected code segment length in bytes. This value is 22-bit long, the 8 LSB bits are
AnnaBridge 157:e7ca05fa8600 71 reserved and forced to 0 for the length to be a multiple of 256 bytes. */
AnnaBridge 157:e7ca05fa8600 72
AnnaBridge 157:e7ca05fa8600 73 uint32_t NonVDataSegmentStartAddress; /*!< Protected non-volatile data segment start address. This value is 24-bit long, the 8 LSB
AnnaBridge 157:e7ca05fa8600 74 bits are reserved and forced to 0 in order to allow a 256-byte granularity. */
AnnaBridge 157:e7ca05fa8600 75
AnnaBridge 157:e7ca05fa8600 76 uint32_t NonVDataSegmentLength; /*!< Protected non-volatile data segment length in bytes. This value is 22-bit long, the 8 LSB
AnnaBridge 157:e7ca05fa8600 77 bits are reserved and forced to 0 for the length to be a multiple of 256 bytes. */
AnnaBridge 157:e7ca05fa8600 78
AnnaBridge 157:e7ca05fa8600 79 uint32_t VDataSegmentStartAddress; /*!< Protected volatile data segment start address. This value is 17-bit long, the 6 LSB bits
AnnaBridge 157:e7ca05fa8600 80 are reserved and forced to 0 in order to allow a 64-byte granularity. */
AnnaBridge 157:e7ca05fa8600 81
AnnaBridge 157:e7ca05fa8600 82 uint32_t VDataSegmentLength; /*!< Protected volatile data segment length in bytes. This value is 17-bit long, the 6 LSB
AnnaBridge 157:e7ca05fa8600 83 bits are reserved and forced to 0 for the length to be a multiple of 64 bytes. */
AnnaBridge 157:e7ca05fa8600 84
AnnaBridge 157:e7ca05fa8600 85 uint32_t VolatileDataExecution; /*!< Set VDE bit specifying whether or not the volatile data segment can be executed.
AnnaBridge 157:e7ca05fa8600 86 When VDS = 1 (set by parameter VolatileDataShared), VDE bit has no meaning.
AnnaBridge 157:e7ca05fa8600 87 This parameter can be a value of @ref FIREWALL_VolatileData_Executable */
AnnaBridge 157:e7ca05fa8600 88
AnnaBridge 157:e7ca05fa8600 89 uint32_t VolatileDataShared; /*!< Set VDS bit in specifying whether or not the volatile data segment can be shared with a
AnnaBridge 157:e7ca05fa8600 90 non-protected application code.
AnnaBridge 157:e7ca05fa8600 91 This parameter can be a value of @ref FIREWALL_VolatileData_Shared */
AnnaBridge 157:e7ca05fa8600 92
AnnaBridge 157:e7ca05fa8600 93 }FIREWALL_InitTypeDef;
AnnaBridge 157:e7ca05fa8600 94
AnnaBridge 157:e7ca05fa8600 95
AnnaBridge 157:e7ca05fa8600 96 /**
AnnaBridge 157:e7ca05fa8600 97 * @}
AnnaBridge 157:e7ca05fa8600 98 */
AnnaBridge 157:e7ca05fa8600 99
AnnaBridge 157:e7ca05fa8600 100
AnnaBridge 157:e7ca05fa8600 101 /* Exported constants --------------------------------------------------------*/
AnnaBridge 157:e7ca05fa8600 102 /** @defgroup FIREWALL_Exported_Constants FIREWALL Exported Constants
AnnaBridge 157:e7ca05fa8600 103 * @{
AnnaBridge 157:e7ca05fa8600 104 */
AnnaBridge 157:e7ca05fa8600 105
AnnaBridge 157:e7ca05fa8600 106 /** @defgroup FIREWALL_VolatileData_Executable FIREWALL volatile data segment execution status
AnnaBridge 157:e7ca05fa8600 107 * @{
AnnaBridge 157:e7ca05fa8600 108 */
AnnaBridge 157:e7ca05fa8600 109 #define FIREWALL_VOLATILEDATA_NOT_EXECUTABLE ((uint32_t)0x0000U)
AnnaBridge 157:e7ca05fa8600 110 #define FIREWALL_VOLATILEDATA_EXECUTABLE ((uint32_t)FW_CR_VDE)
AnnaBridge 157:e7ca05fa8600 111 /**
AnnaBridge 157:e7ca05fa8600 112 * @}
AnnaBridge 157:e7ca05fa8600 113 */
AnnaBridge 157:e7ca05fa8600 114
AnnaBridge 157:e7ca05fa8600 115 /** @defgroup FIREWALL_VolatileData_Shared FIREWALL volatile data segment share status
AnnaBridge 157:e7ca05fa8600 116 * @{
AnnaBridge 157:e7ca05fa8600 117 */
AnnaBridge 157:e7ca05fa8600 118 #define FIREWALL_VOLATILEDATA_NOT_SHARED ((uint32_t)0x0000U)
AnnaBridge 157:e7ca05fa8600 119 #define FIREWALL_VOLATILEDATA_SHARED ((uint32_t)FW_CR_VDS)
AnnaBridge 157:e7ca05fa8600 120 /**
AnnaBridge 157:e7ca05fa8600 121 * @}
AnnaBridge 157:e7ca05fa8600 122 */
AnnaBridge 157:e7ca05fa8600 123
AnnaBridge 157:e7ca05fa8600 124 /** @defgroup FIREWALL_Pre_Arm FIREWALL pre arm status
AnnaBridge 157:e7ca05fa8600 125 * @{
AnnaBridge 157:e7ca05fa8600 126 */
AnnaBridge 157:e7ca05fa8600 127 #define FIREWALL_PRE_ARM_RESET ((uint32_t)0x0000U)
AnnaBridge 157:e7ca05fa8600 128 #define FIREWALL_PRE_ARM_SET ((uint32_t)FW_CR_FPA)
AnnaBridge 157:e7ca05fa8600 129
AnnaBridge 157:e7ca05fa8600 130 /**
AnnaBridge 157:e7ca05fa8600 131 * @}
AnnaBridge 157:e7ca05fa8600 132 */
AnnaBridge 157:e7ca05fa8600 133
AnnaBridge 157:e7ca05fa8600 134 /**
AnnaBridge 157:e7ca05fa8600 135 * @}
AnnaBridge 157:e7ca05fa8600 136 */
AnnaBridge 157:e7ca05fa8600 137
AnnaBridge 157:e7ca05fa8600 138 /* Private macros --------------------------------------------------------*/
AnnaBridge 157:e7ca05fa8600 139 /** @addtogroup FIREWALL_Private
AnnaBridge 157:e7ca05fa8600 140 * @{
AnnaBridge 157:e7ca05fa8600 141 */
AnnaBridge 157:e7ca05fa8600 142 #define IS_FIREWALL_CODE_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) < (FLASH_BASE + FLASH_SIZE)))
AnnaBridge 157:e7ca05fa8600 143 #define IS_FIREWALL_CODE_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= (FLASH_BASE + FLASH_SIZE))
AnnaBridge 157:e7ca05fa8600 144
AnnaBridge 157:e7ca05fa8600 145 #define IS_FIREWALL_NONVOLATILEDATA_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) < (FLASH_BASE + FLASH_SIZE)))
AnnaBridge 157:e7ca05fa8600 146 #define IS_FIREWALL_NONVOLATILEDATA_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= (FLASH_BASE + FLASH_SIZE))
AnnaBridge 157:e7ca05fa8600 147
AnnaBridge 157:e7ca05fa8600 148 #define IS_FIREWALL_VOLATILEDATA_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= SRAM_BASE) && ((ADDRESS) < (SRAM_BASE + SRAM_SIZE_MAX)))
AnnaBridge 157:e7ca05fa8600 149 #define IS_FIREWALL_VOLATILEDATA_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= (SRAM_BASE + SRAM_SIZE_MAX))
AnnaBridge 157:e7ca05fa8600 150
AnnaBridge 157:e7ca05fa8600 151
AnnaBridge 157:e7ca05fa8600 152 #define IS_FIREWALL_VOLATILEDATA_SHARE(SHARE) (((SHARE) == FIREWALL_VOLATILEDATA_NOT_SHARED) || \
AnnaBridge 157:e7ca05fa8600 153 ((SHARE) == FIREWALL_VOLATILEDATA_SHARED))
AnnaBridge 157:e7ca05fa8600 154
AnnaBridge 157:e7ca05fa8600 155 #define IS_FIREWALL_VOLATILEDATA_EXECUTE(EXECUTE) (((EXECUTE) == FIREWALL_VOLATILEDATA_NOT_EXECUTABLE) || \
AnnaBridge 157:e7ca05fa8600 156 ((EXECUTE) == FIREWALL_VOLATILEDATA_EXECUTABLE))
AnnaBridge 157:e7ca05fa8600 157 /**
AnnaBridge 157:e7ca05fa8600 158 * @}
AnnaBridge 157:e7ca05fa8600 159 */
AnnaBridge 157:e7ca05fa8600 160
AnnaBridge 157:e7ca05fa8600 161
AnnaBridge 157:e7ca05fa8600 162 /* Exported macros -----------------------------------------------------------*/
AnnaBridge 157:e7ca05fa8600 163 /** @defgroup FIREWALL_Exported_Macros FIREWALL Exported Macros
AnnaBridge 157:e7ca05fa8600 164 * @{
AnnaBridge 157:e7ca05fa8600 165 */
AnnaBridge 157:e7ca05fa8600 166
AnnaBridge 157:e7ca05fa8600 167 /** @brief Check whether the FIREWALL is enabled or not.
AnnaBridge 157:e7ca05fa8600 168 * @retval FIREWALL enabling status (TRUE or FALSE).
AnnaBridge 157:e7ca05fa8600 169 */
AnnaBridge 157:e7ca05fa8600 170 #define __HAL_FIREWALL_IS_ENABLED() HAL_IS_BIT_CLR(SYSCFG->CFGR2, SYSCFG_CFGR2_FWDISEN)
AnnaBridge 157:e7ca05fa8600 171
AnnaBridge 157:e7ca05fa8600 172
AnnaBridge 157:e7ca05fa8600 173 /** @brief Enable FIREWALL pre arm.
AnnaBridge 157:e7ca05fa8600 174 * @note When FPA bit is set, any code executed outside the protected segment
AnnaBridge 157:e7ca05fa8600 175 * closes the Firewall, otherwise it generates a system reset.
AnnaBridge 157:e7ca05fa8600 176 * @note This macro provides the same service as HAL_FIREWALL_EnablePreArmFlag() API
AnnaBridge 157:e7ca05fa8600 177 * but can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 178 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 179 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 180 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 181 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 182 */
AnnaBridge 157:e7ca05fa8600 183 #define __HAL_FIREWALL_PREARM_ENABLE() \
AnnaBridge 157:e7ca05fa8600 184 do { \
AnnaBridge 157:e7ca05fa8600 185 __IO uint32_t tmpreg; \
AnnaBridge 157:e7ca05fa8600 186 SET_BIT(FIREWALL->CR, FW_CR_FPA) ; \
AnnaBridge 157:e7ca05fa8600 187 /* Read bit back to ensure it is taken into account by IP */ \
AnnaBridge 157:e7ca05fa8600 188 /* (introduce proper delay inside macro execution) */ \
AnnaBridge 157:e7ca05fa8600 189 tmpreg = READ_BIT(FIREWALL->CR, FW_CR_FPA) ; \
AnnaBridge 157:e7ca05fa8600 190 UNUSED(tmpreg); \
AnnaBridge 157:e7ca05fa8600 191 } while(0)
AnnaBridge 157:e7ca05fa8600 192
AnnaBridge 157:e7ca05fa8600 193
AnnaBridge 157:e7ca05fa8600 194
AnnaBridge 157:e7ca05fa8600 195 /** @brief Disable FIREWALL pre arm.
AnnaBridge 157:e7ca05fa8600 196 * @note When FPA bit is set, any code executed outside the protected segment
AnnaBridge 157:e7ca05fa8600 197 * closes the Firewall, otherwise, it generates a system reset.
AnnaBridge 157:e7ca05fa8600 198 * @note This macro provides the same service as HAL_FIREWALL_DisablePreArmFlag() API
AnnaBridge 157:e7ca05fa8600 199 * but can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 200 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 201 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 202 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 203 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 204 */
AnnaBridge 157:e7ca05fa8600 205 #define __HAL_FIREWALL_PREARM_DISABLE() \
AnnaBridge 157:e7ca05fa8600 206 do { \
AnnaBridge 157:e7ca05fa8600 207 __IO uint32_t tmpreg; \
AnnaBridge 157:e7ca05fa8600 208 CLEAR_BIT(FIREWALL->CR, FW_CR_FPA) ; \
AnnaBridge 157:e7ca05fa8600 209 /* Read bit back to ensure it is taken into account by IP */ \
AnnaBridge 157:e7ca05fa8600 210 /* (introduce proper delay inside macro execution) */ \
AnnaBridge 157:e7ca05fa8600 211 tmpreg = READ_BIT(FIREWALL->CR, FW_CR_FPA) ; \
AnnaBridge 157:e7ca05fa8600 212 UNUSED(tmpreg); \
AnnaBridge 157:e7ca05fa8600 213 } while(0)
AnnaBridge 157:e7ca05fa8600 214
AnnaBridge 157:e7ca05fa8600 215 /** @brief Enable volatile data sharing in setting VDS bit.
AnnaBridge 157:e7ca05fa8600 216 * @note When VDS bit is set, the volatile data segment is shared with non-protected
AnnaBridge 157:e7ca05fa8600 217 * application code. It can be accessed whatever the Firewall state (opened or closed).
AnnaBridge 157:e7ca05fa8600 218 * @note This macro can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 219 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 220 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 221 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 222 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 223 */
AnnaBridge 157:e7ca05fa8600 224 #define __HAL_FIREWALL_VOLATILEDATA_SHARED_ENABLE() \
AnnaBridge 157:e7ca05fa8600 225 do { \
AnnaBridge 157:e7ca05fa8600 226 __IO uint32_t tmpreg; \
AnnaBridge 157:e7ca05fa8600 227 SET_BIT(FIREWALL->CR, FW_CR_VDS) ; \
AnnaBridge 157:e7ca05fa8600 228 /* Read bit back to ensure it is taken into account by IP */ \
AnnaBridge 157:e7ca05fa8600 229 /* (introduce proper delay inside macro execution) */ \
AnnaBridge 157:e7ca05fa8600 230 tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDS) ; \
AnnaBridge 157:e7ca05fa8600 231 UNUSED(tmpreg); \
AnnaBridge 157:e7ca05fa8600 232 } while(0)
AnnaBridge 157:e7ca05fa8600 233
AnnaBridge 157:e7ca05fa8600 234 /** @brief Disable volatile data sharing in resetting VDS bit.
AnnaBridge 157:e7ca05fa8600 235 * @note When VDS bit is reset, the volatile data segment is not shared and cannot be
AnnaBridge 157:e7ca05fa8600 236 * hit by a non protected executable code when the Firewall is closed. If it is
AnnaBridge 157:e7ca05fa8600 237 * accessed in such a condition, a system reset is generated by the Firewall.
AnnaBridge 157:e7ca05fa8600 238 * @note This macro can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 239 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 240 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 241 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 242 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 243 */
AnnaBridge 157:e7ca05fa8600 244 #define __HAL_FIREWALL_VOLATILEDATA_SHARED_DISABLE() \
AnnaBridge 157:e7ca05fa8600 245 do { \
AnnaBridge 157:e7ca05fa8600 246 __IO uint32_t tmpreg; \
AnnaBridge 157:e7ca05fa8600 247 CLEAR_BIT(FIREWALL->CR, FW_CR_VDS) ; \
AnnaBridge 157:e7ca05fa8600 248 /* Read bit back to ensure it is taken into account by IP */ \
AnnaBridge 157:e7ca05fa8600 249 /* (introduce proper delay inside macro execution) */ \
AnnaBridge 157:e7ca05fa8600 250 tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDS) ; \
AnnaBridge 157:e7ca05fa8600 251 UNUSED(tmpreg); \
AnnaBridge 157:e7ca05fa8600 252 } while(0)
AnnaBridge 157:e7ca05fa8600 253
AnnaBridge 157:e7ca05fa8600 254 /** @brief Enable volatile data execution in setting VDE bit.
AnnaBridge 157:e7ca05fa8600 255 * @note VDE bit is ignored when VDS is set. IF VDS = 1, the Volatile data segment can be
AnnaBridge 157:e7ca05fa8600 256 * executed whatever the VDE bit value.
AnnaBridge 157:e7ca05fa8600 257 * @note When VDE bit is set (with VDS = 0), the volatile data segment is executable. When
AnnaBridge 157:e7ca05fa8600 258 * the Firewall call is closed, a "call gate" entry procedure is required to open
AnnaBridge 157:e7ca05fa8600 259 * first the Firewall.
AnnaBridge 157:e7ca05fa8600 260 * @note This macro can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 261 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 262 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 263 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 264 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 265 */
AnnaBridge 157:e7ca05fa8600 266 #define __HAL_FIREWALL_VOLATILEDATA_EXECUTION_ENABLE() \
AnnaBridge 157:e7ca05fa8600 267 do { \
AnnaBridge 157:e7ca05fa8600 268 __IO uint32_t tmpreg; \
AnnaBridge 157:e7ca05fa8600 269 SET_BIT(FIREWALL->CR, FW_CR_VDE) ; \
AnnaBridge 157:e7ca05fa8600 270 /* Read bit back to ensure it is taken into account by IP */ \
AnnaBridge 157:e7ca05fa8600 271 /* (introduce proper delay inside macro execution) */ \
AnnaBridge 157:e7ca05fa8600 272 tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDE) ; \
AnnaBridge 157:e7ca05fa8600 273 UNUSED(tmpreg); \
AnnaBridge 157:e7ca05fa8600 274 } while(0)
AnnaBridge 157:e7ca05fa8600 275
AnnaBridge 157:e7ca05fa8600 276 /** @brief Disable volatile data execution in resetting VDE bit.
AnnaBridge 157:e7ca05fa8600 277 * @note VDE bit is ignored when VDS is set. IF VDS = 1, the Volatile data segment can be
AnnaBridge 157:e7ca05fa8600 278 * executed whatever the VDE bit value.
AnnaBridge 157:e7ca05fa8600 279 * @note When VDE bit is reset (with VDS = 0), the volatile data segment cannot be executed.
AnnaBridge 157:e7ca05fa8600 280 * @note This macro can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 281 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 282 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 283 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 284 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 285 */
AnnaBridge 157:e7ca05fa8600 286 #define __HAL_FIREWALL_VOLATILEDATA_EXECUTION_DISABLE() \
AnnaBridge 157:e7ca05fa8600 287 do { \
AnnaBridge 157:e7ca05fa8600 288 __IO uint32_t tmpreg; \
AnnaBridge 157:e7ca05fa8600 289 CLEAR_BIT(FIREWALL->CR, FW_CR_VDE) ; \
AnnaBridge 157:e7ca05fa8600 290 /* Read bit back to ensure it is taken into account by IP */ \
AnnaBridge 157:e7ca05fa8600 291 /* (introduce proper delay inside macro execution) */ \
AnnaBridge 157:e7ca05fa8600 292 tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDE) ; \
AnnaBridge 157:e7ca05fa8600 293 UNUSED(tmpreg); \
AnnaBridge 157:e7ca05fa8600 294 } while(0)
AnnaBridge 157:e7ca05fa8600 295
AnnaBridge 157:e7ca05fa8600 296
AnnaBridge 157:e7ca05fa8600 297 /** @brief Check whether or not the volatile data segment is shared.
AnnaBridge 157:e7ca05fa8600 298 * @note This macro can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 299 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 300 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 301 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 302 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 303 * @retval VDS bit setting status (TRUE or FALSE).
AnnaBridge 157:e7ca05fa8600 304 */
AnnaBridge 157:e7ca05fa8600 305 #define __HAL_FIREWALL_GET_VOLATILEDATA_SHARED() ((FIREWALL->CR & FW_CR_VDS) == FW_CR_VDS)
AnnaBridge 157:e7ca05fa8600 306
AnnaBridge 157:e7ca05fa8600 307 /** @brief Check whether or not the volatile data segment is declared executable.
AnnaBridge 157:e7ca05fa8600 308 * @note This macro can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 309 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 310 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 311 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 312 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 313 * @retval VDE bit setting status (TRUE or FALSE).
AnnaBridge 157:e7ca05fa8600 314 */
AnnaBridge 157:e7ca05fa8600 315 #define __HAL_FIREWALL_GET_VOLATILEDATA_EXECUTION() ((FIREWALL->CR & FW_CR_VDE) == FW_CR_VDE)
AnnaBridge 157:e7ca05fa8600 316
AnnaBridge 157:e7ca05fa8600 317 /** @brief Check whether or not the Firewall pre arm bit is set.
AnnaBridge 157:e7ca05fa8600 318 * @note This macro can be executed inside a code area protected by the Firewall.
AnnaBridge 157:e7ca05fa8600 319 * @note This macro can be executed whatever the Firewall state (opened or closed) when
AnnaBridge 157:e7ca05fa8600 320 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
AnnaBridge 157:e7ca05fa8600 321 * 0, that is, when the non volatile data segment is defined), the macro can be
AnnaBridge 157:e7ca05fa8600 322 * executed only when the Firewall is opened.
AnnaBridge 157:e7ca05fa8600 323 * @retval FPA bit setting status (TRUE or FALSE).
AnnaBridge 157:e7ca05fa8600 324 */
AnnaBridge 157:e7ca05fa8600 325 #define __HAL_FIREWALL_GET_PREARM() ((FIREWALL->CR & FW_CR_FPA) == FW_CR_FPA)
AnnaBridge 157:e7ca05fa8600 326
AnnaBridge 157:e7ca05fa8600 327
AnnaBridge 157:e7ca05fa8600 328 /**
AnnaBridge 157:e7ca05fa8600 329 * @}
AnnaBridge 157:e7ca05fa8600 330 */
AnnaBridge 157:e7ca05fa8600 331
AnnaBridge 157:e7ca05fa8600 332 /* Exported functions --------------------------------------------------------*/
AnnaBridge 157:e7ca05fa8600 333
AnnaBridge 157:e7ca05fa8600 334 /** @defgroup FIREWALL_Exported_Functions FIREWALL Exported Functions
AnnaBridge 157:e7ca05fa8600 335 * @{
AnnaBridge 157:e7ca05fa8600 336 */
AnnaBridge 157:e7ca05fa8600 337
AnnaBridge 157:e7ca05fa8600 338 /** @defgroup FIREWALL_Exported_Functions_Group1 Initialization Functions
AnnaBridge 157:e7ca05fa8600 339 * @brief Initialization and Configuration Functions
AnnaBridge 157:e7ca05fa8600 340 * @{
AnnaBridge 157:e7ca05fa8600 341 */
AnnaBridge 157:e7ca05fa8600 342
AnnaBridge 157:e7ca05fa8600 343 /* Initialization functions ********************************/
AnnaBridge 157:e7ca05fa8600 344 HAL_StatusTypeDef HAL_FIREWALL_Config(FIREWALL_InitTypeDef * fw_init);
AnnaBridge 157:e7ca05fa8600 345 void HAL_FIREWALL_GetConfig(FIREWALL_InitTypeDef * fw_config);
AnnaBridge 157:e7ca05fa8600 346 void HAL_FIREWALL_EnableFirewall(void);
AnnaBridge 157:e7ca05fa8600 347 void HAL_FIREWALL_EnablePreArmFlag(void);
AnnaBridge 157:e7ca05fa8600 348 void HAL_FIREWALL_DisablePreArmFlag(void);
AnnaBridge 157:e7ca05fa8600 349
AnnaBridge 157:e7ca05fa8600 350 /**
AnnaBridge 157:e7ca05fa8600 351 * @}
AnnaBridge 157:e7ca05fa8600 352 */
AnnaBridge 157:e7ca05fa8600 353
AnnaBridge 157:e7ca05fa8600 354 /**
AnnaBridge 157:e7ca05fa8600 355 * @}
AnnaBridge 157:e7ca05fa8600 356 */
AnnaBridge 157:e7ca05fa8600 357 /* Define the private group ***********************************/
AnnaBridge 157:e7ca05fa8600 358 /**************************************************************/
AnnaBridge 157:e7ca05fa8600 359 /** @defgroup FIREWALL_Private FIREWALL Private
AnnaBridge 157:e7ca05fa8600 360 * @{
AnnaBridge 157:e7ca05fa8600 361 */
AnnaBridge 157:e7ca05fa8600 362 /**
AnnaBridge 157:e7ca05fa8600 363 * @}
AnnaBridge 157:e7ca05fa8600 364 */
AnnaBridge 157:e7ca05fa8600 365 /**************************************************************/
AnnaBridge 157:e7ca05fa8600 366
AnnaBridge 157:e7ca05fa8600 367 /**
AnnaBridge 157:e7ca05fa8600 368 * @}
AnnaBridge 157:e7ca05fa8600 369 */
AnnaBridge 157:e7ca05fa8600 370
AnnaBridge 157:e7ca05fa8600 371 /**
AnnaBridge 157:e7ca05fa8600 372 * @}
AnnaBridge 157:e7ca05fa8600 373 */
AnnaBridge 157:e7ca05fa8600 374
AnnaBridge 157:e7ca05fa8600 375
AnnaBridge 157:e7ca05fa8600 376 #endif /* #if !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx) */
AnnaBridge 157:e7ca05fa8600 377
AnnaBridge 157:e7ca05fa8600 378 #ifdef __cplusplus
AnnaBridge 157:e7ca05fa8600 379 }
AnnaBridge 157:e7ca05fa8600 380 #endif
AnnaBridge 157:e7ca05fa8600 381
AnnaBridge 157:e7ca05fa8600 382 #endif /* __STM32L0xx_HAL_FIREWALL_H */
AnnaBridge 157:e7ca05fa8600 383
AnnaBridge 157:e7ca05fa8600 384 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/