mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Wed Apr 27 12:10:56 2016 -0500
Revision:
119:aae6fcc7d9bb
Parent:
96:487b796308b0
Release 119 of the mbed library

Changes:
- new targets - EFM32PG_STK3401, NUCLEO_L031K6
- ST - hwflwctl support for NUCLEO_L476RG
- Update STM32CUBE_L0 from v1.2 to v1.5
- STM32F7 - bugfix - The weak function HAL_Delay is overwritten to use us ticker API.
- Maxim - Fixing the send break for the MAXWSNENV and MAX32600MBED

Who changed what in which revision?

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