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_DISCO_L475VG_IOT01A/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_firewall.h@161:aa5281ff4a02
mbed library. Release version 164

Who changed what in which revision?

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