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:
116:c0f6e94411f5
.

Who changed what in which revision?

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