Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
99:dbbf35b96557
.

Who changed what in which revision?

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