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:
Kojto
Date:
Tue Mar 17 14:27:45 2015 +0000
Revision:
96:487b796308b0
Release 96 of the mbed library

Changes:
- IAR support for ble boards, lpc, ethernet stack
- RTC - attach function to redirect time functions
- Nucleo F103RB - cube driver
- k20xx - fixes for teensy and k20 platforms in sleep/deepsleep and usb
- STM32L0, Nucleo/Disco L053 - refactoring

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 96:487b796308b0 5 * @version V1.2.0
Kojto 96:487b796308b0 6 * @date 06-February-2015
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 96:487b796308b0 11 * <h2><center>&copy; COPYRIGHT(c) 2015 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 96:487b796308b0 46 /* Includes ------------------------------------------------------------------*/
Kojto 96:487b796308b0 47 #include "stm32l0xx_hal_def.h"
Kojto 96:487b796308b0 48
Kojto 96:487b796308b0 49 /** @addtogroup STM32L0xx_HAL_Driver
Kojto 96:487b796308b0 50 * @{
Kojto 96:487b796308b0 51 */
Kojto 96:487b796308b0 52
Kojto 96:487b796308b0 53 /** @addtogroup FIREWALL FIREWALL
Kojto 96:487b796308b0 54 * @{
Kojto 96:487b796308b0 55 */
Kojto 96:487b796308b0 56
Kojto 96:487b796308b0 57 /* Exported types ------------------------------------------------------------*/
Kojto 96:487b796308b0 58 /** @defgroup FIREWALL_Exported_Types FIREWALL Exported Types
Kojto 96:487b796308b0 59 * @{
Kojto 96:487b796308b0 60 */
Kojto 96:487b796308b0 61
Kojto 96:487b796308b0 62 /**
Kojto 96:487b796308b0 63 * @brief FIREWALL Initialization Structure definition
Kojto 96:487b796308b0 64 */
Kojto 96:487b796308b0 65 typedef struct
Kojto 96:487b796308b0 66 {
Kojto 96:487b796308b0 67 uint32_t CodeSegmentStartAddress; /*!< Protected code segment start address. This value is 24-bit long, the 8 LSB bits are
Kojto 96:487b796308b0 68 reserved and forced to 0 in order to allow a 256-byte granularity. */
Kojto 96:487b796308b0 69
Kojto 96:487b796308b0 70 uint32_t CodeSegmentLength; /*!< Protected code segment length in bytes. This value is 22-bit long, the 8 LSB bits are
Kojto 96:487b796308b0 71 reserved and forced to 0 for the length to be a multiple of 256 bytes. */
Kojto 96:487b796308b0 72
Kojto 96:487b796308b0 73 uint32_t NonVDataSegmentStartAddress; /*!< Protected non-volatile data segment start address. This value is 24-bit long, the 8 LSB
Kojto 96:487b796308b0 74 bits are reserved and forced to 0 in order to allow a 256-byte granularity. */
Kojto 96:487b796308b0 75
Kojto 96:487b796308b0 76 uint32_t NonVDataSegmentLength; /*!< Protected non-volatile data segment length in bytes. This value is 22-bit long, the 8 LSB
Kojto 96:487b796308b0 77 bits are reserved and forced to 0 for the length to be a multiple of 256 bytes. */
Kojto 96:487b796308b0 78
Kojto 96:487b796308b0 79 uint32_t VDataSegmentStartAddress; /*!< Protected volatile data segment start address. This value is 17-bit long, the 6 LSB bits
Kojto 96:487b796308b0 80 are reserved and forced to 0 in order to allow a 64-byte granularity. */
Kojto 96:487b796308b0 81
Kojto 96:487b796308b0 82 uint32_t VDataSegmentLength; /*!< Protected volatile data segment length in bytes. This value is 17-bit long, the 6 LSB
Kojto 96:487b796308b0 83 bits are reserved and forced to 0 for the length to be a multiple of 64 bytes. */
Kojto 96:487b796308b0 84
Kojto 96:487b796308b0 85 uint32_t VolatileDataExecution; /*!< Set VDE bit specifying whether or not the volatile data segment can be executed.
Kojto 96:487b796308b0 86 When VDS = 1 (set by parameter VolatileDataShared), VDE bit has no meaning.
Kojto 96:487b796308b0 87 This parameter can be a value of @ref FIREWALL_VolatileData_Executable */
Kojto 96:487b796308b0 88
Kojto 96:487b796308b0 89 uint32_t VolatileDataShared; /*!< Set VDS bit in specifying whether or not the volatile data segment can be shared with a
Kojto 96:487b796308b0 90 non-protected application code.
Kojto 96:487b796308b0 91 This parameter can be a value of @ref FIREWALL_VolatileData_Shared */
Kojto 96:487b796308b0 92
Kojto 96:487b796308b0 93 }FIREWALL_InitTypeDef;
Kojto 96:487b796308b0 94
Kojto 96:487b796308b0 95
Kojto 96:487b796308b0 96 /**
Kojto 96:487b796308b0 97 * @}
Kojto 96:487b796308b0 98 */
Kojto 96:487b796308b0 99
Kojto 96:487b796308b0 100
Kojto 96:487b796308b0 101 /* Exported constants --------------------------------------------------------*/
Kojto 96:487b796308b0 102 /** @defgroup FIREWALL_Exported_Constants FIREWALL Exported Constants
Kojto 96:487b796308b0 103 * @{
Kojto 96:487b796308b0 104 */
Kojto 96:487b796308b0 105
Kojto 96:487b796308b0 106 /** @defgroup FIREWALL_VolatileData_Executable FIREWALL volatile data segment execution status
Kojto 96:487b796308b0 107 * @{
Kojto 96:487b796308b0 108 */
Kojto 96:487b796308b0 109 #define FIREWALL_VOLATILEDATA_NOT_EXECUTABLE ((uint32_t)0x0000)
Kojto 96:487b796308b0 110 #define FIREWALL_VOLATILEDATA_EXECUTABLE ((uint32_t)FW_CR_VDE)
Kojto 96:487b796308b0 111 /**
Kojto 96:487b796308b0 112 * @}
Kojto 96:487b796308b0 113 */
Kojto 96:487b796308b0 114
Kojto 96:487b796308b0 115 /** @defgroup FIREWALL_VolatileData_Shared FIREWALL volatile data segment share status
Kojto 96:487b796308b0 116 * @{
Kojto 96:487b796308b0 117 */
Kojto 96:487b796308b0 118 #define FIREWALL_VOLATILEDATA_NOT_SHARED ((uint32_t)0x0000)
Kojto 96:487b796308b0 119 #define FIREWALL_VOLATILEDATA_SHARED ((uint32_t)FW_CR_VDS)
Kojto 96:487b796308b0 120 /**
Kojto 96:487b796308b0 121 * @}
Kojto 96:487b796308b0 122 */
Kojto 96:487b796308b0 123
Kojto 96:487b796308b0 124 /** @defgroup FIREWALL_Pre_Arm FIREWALL pre arm status
Kojto 96:487b796308b0 125 * @{
Kojto 96:487b796308b0 126 */
Kojto 96:487b796308b0 127 #define FIREWALL_PRE_ARM_RESET ((uint32_t)0x0000)
Kojto 96:487b796308b0 128 #define FIREWALL_PRE_ARM_SET ((uint32_t)FW_CR_FPA)
Kojto 96:487b796308b0 129
Kojto 96:487b796308b0 130 /**
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 /* Private macros --------------------------------------------------------*/
Kojto 96:487b796308b0 139 /** @defgroup FIREWALL_Private_Macros FIREWALL Private Macros
Kojto 96:487b796308b0 140 * @{
Kojto 96:487b796308b0 141 */
Kojto 96:487b796308b0 142 #define IS_FIREWALL_CODE_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x080FFFFF))
Kojto 96:487b796308b0 143 #define IS_FIREWALL_CODE_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= 0x080FFFFF)
Kojto 96:487b796308b0 144
Kojto 96:487b796308b0 145 #define IS_FIREWALL_NONVOLATILEDATA_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x080FFFFF))
Kojto 96:487b796308b0 146 #define IS_FIREWALL_NONVOLATILEDATA_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= 0x080FFFFF)
Kojto 96:487b796308b0 147
Kojto 96:487b796308b0 148 #define IS_FIREWALL_VOLATILEDATA_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= 0x20000000) && ((ADDRESS) <= 0x20017FFF))
Kojto 96:487b796308b0 149 #define IS_FIREWALL_VOLATILEDATA_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= 0x20017FFF)
Kojto 96:487b796308b0 150
Kojto 96:487b796308b0 151
Kojto 96:487b796308b0 152 #define IS_FIREWALL_VOLATILEDATA_SHARE(SHARE) (((SHARE) == FIREWALL_VOLATILEDATA_NOT_SHARED) || \
Kojto 96:487b796308b0 153 ((SHARE) == FIREWALL_VOLATILEDATA_SHARED))
Kojto 96:487b796308b0 154
Kojto 96:487b796308b0 155 #define IS_FIREWALL_VOLATILEDATA_EXECUTE(EXECUTE) (((EXECUTE) == FIREWALL_VOLATILEDATA_NOT_EXECUTABLE) || \
Kojto 96:487b796308b0 156 ((EXECUTE) == FIREWALL_VOLATILEDATA_EXECUTABLE))
Kojto 96:487b796308b0 157 /**
Kojto 96:487b796308b0 158 * @}
Kojto 96:487b796308b0 159 */
Kojto 96:487b796308b0 160
Kojto 96:487b796308b0 161
Kojto 96:487b796308b0 162 /* Exported macros -----------------------------------------------------------*/
Kojto 96:487b796308b0 163 /** @defgroup FIREWALL_Exported_Macros FIREWALL Exported Macros
Kojto 96:487b796308b0 164 * @{
Kojto 96:487b796308b0 165 */
Kojto 96:487b796308b0 166
Kojto 96:487b796308b0 167 /** @brief Check whether or not the FIREWALL is enabled
Kojto 96:487b796308b0 168 * @retval FIREWALL enabling status (TRUE or FALSE).
Kojto 96:487b796308b0 169 */
Kojto 96:487b796308b0 170 #define __HAL_FIREWALL_IS_ENABLED() HAL_IS_BIT_CLR(SYSCFG->CFGR2, SYSCFG_CFGR2_FWDISEN)
Kojto 96:487b796308b0 171
Kojto 96:487b796308b0 172
Kojto 96:487b796308b0 173 /** @brief Enable FIREWALL pre arm.
Kojto 96:487b796308b0 174 * @note When FPA bit is set, any code executed outside the protected segment
Kojto 96:487b796308b0 175 * closes the Firewall, otherwise it generates a system reset.
Kojto 96:487b796308b0 176 * @note This macro provides the same service as HAL_FIREWALL_EnablePreArmFlag() API
Kojto 96:487b796308b0 177 * but can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 178 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 179 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 180 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 181 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 182 */
Kojto 96:487b796308b0 183 #define __HAL_FIREWALL_PREARM_ENABLE() \
Kojto 96:487b796308b0 184 do { \
Kojto 96:487b796308b0 185 __IO uint32_t tmpreg; \
Kojto 96:487b796308b0 186 SET_BIT(FW->CR, FW_CR_FPA) ; \
Kojto 96:487b796308b0 187 /* Read bit back to ensure it is taken into account by IP */ \
Kojto 96:487b796308b0 188 /* (introduce proper delay inside macro execution) */ \
Kojto 96:487b796308b0 189 tmpreg = READ_BIT(FW->CR, FW_CR_FPA) ; \
Kojto 96:487b796308b0 190 UNUSED(tmpreg); \
Kojto 96:487b796308b0 191 } while(0)
Kojto 96:487b796308b0 192
Kojto 96:487b796308b0 193
Kojto 96:487b796308b0 194
Kojto 96:487b796308b0 195 /** @brief Disable FIREWALL pre arm.
Kojto 96:487b796308b0 196 * @note When FPA bit is set, any code executed outside the protected segment
Kojto 96:487b796308b0 197 * closes the Firewall, otherwise, it generates a system reset.
Kojto 96:487b796308b0 198 * @note This macro provides the same service as HAL_FIREWALL_DisablePreArmFlag() API
Kojto 96:487b796308b0 199 * but can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 200 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 201 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 202 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 203 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 204 */
Kojto 96:487b796308b0 205 #define __HAL_FIREWALL_PREARM_DISABLE() \
Kojto 96:487b796308b0 206 do { \
Kojto 96:487b796308b0 207 __IO uint32_t tmpreg; \
Kojto 96:487b796308b0 208 CLEAR_BIT(FW->CR, FW_CR_FPA) ; \
Kojto 96:487b796308b0 209 /* Read bit back to ensure it is taken into account by IP */ \
Kojto 96:487b796308b0 210 /* (introduce proper delay inside macro execution) */ \
Kojto 96:487b796308b0 211 tmpreg = READ_BIT(FW->CR, FW_CR_FPA) ; \
Kojto 96:487b796308b0 212 UNUSED(tmpreg); \
Kojto 96:487b796308b0 213 } while(0)
Kojto 96:487b796308b0 214
Kojto 96:487b796308b0 215 /** @brief Enable volatile data sharing in setting VDS bit.
Kojto 96:487b796308b0 216 * @note When VDS bit is set, the volatile data segment is shared with non-protected
Kojto 96:487b796308b0 217 * application code. It can be accessed whatever the Firewall state (opened or closed).
Kojto 96:487b796308b0 218 * @note This macro can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 219 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 220 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 221 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 222 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 223 */
Kojto 96:487b796308b0 224 #define __HAL_FIREWALL_VOLATILEDATA_SHARED_ENABLE() \
Kojto 96:487b796308b0 225 do { \
Kojto 96:487b796308b0 226 __IO uint32_t tmpreg; \
Kojto 96:487b796308b0 227 SET_BIT(FW->CR, FW_CR_VDS) ; \
Kojto 96:487b796308b0 228 /* Read bit back to ensure it is taken into account by IP */ \
Kojto 96:487b796308b0 229 /* (introduce proper delay inside macro execution) */ \
Kojto 96:487b796308b0 230 tmpreg = READ_BIT(FW->CR, FW_CR_VDS) ; \
Kojto 96:487b796308b0 231 UNUSED(tmpreg); \
Kojto 96:487b796308b0 232 } while(0)
Kojto 96:487b796308b0 233
Kojto 96:487b796308b0 234 /** @brief Disable volatile data sharing in resetting VDS bit.
Kojto 96:487b796308b0 235 * @note When VDS bit is reset, the volatile data segment is not shared and cannot be
Kojto 96:487b796308b0 236 * hit by a non protected executable code when the Firewall is closed. If it is
Kojto 96:487b796308b0 237 * accessed in such a condition, a system reset is generated by the Firewall.
Kojto 96:487b796308b0 238 * @note This macro can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 239 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 240 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 241 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 242 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 243 */
Kojto 96:487b796308b0 244 #define __HAL_FIREWALL_VOLATILEDATA_SHARED_DISABLE() \
Kojto 96:487b796308b0 245 do { \
Kojto 96:487b796308b0 246 __IO uint32_t tmpreg; \
Kojto 96:487b796308b0 247 CLEAR_BIT(FW->CR, FW_CR_VDS) ; \
Kojto 96:487b796308b0 248 /* Read bit back to ensure it is taken into account by IP */ \
Kojto 96:487b796308b0 249 /* (introduce proper delay inside macro execution) */ \
Kojto 96:487b796308b0 250 tmpreg = READ_BIT(FW->CR, FW_CR_VDS) ; \
Kojto 96:487b796308b0 251 UNUSED(tmpreg); \
Kojto 96:487b796308b0 252 } while(0)
Kojto 96:487b796308b0 253
Kojto 96:487b796308b0 254 /** @brief Enable volatile data execution in setting VDE bit.
Kojto 96:487b796308b0 255 * @note VDE bit is ignored when VDS is set. IF VDS = 1, the Volatile data segment can be
Kojto 96:487b796308b0 256 * executed whatever the VDE bit value.
Kojto 96:487b796308b0 257 * @note When VDE bit is set (with VDS = 0), the volatile data segment is executable. When
Kojto 96:487b796308b0 258 * the Firewall call is closed, a "call gate" entry procedure is required to open
Kojto 96:487b796308b0 259 * first the Firewall.
Kojto 96:487b796308b0 260 * @note This macro can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 261 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 262 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 263 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 264 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 265 */
Kojto 96:487b796308b0 266 #define __HAL_FIREWALL_VOLATILEDATA_EXECUTION_ENABLE() \
Kojto 96:487b796308b0 267 do { \
Kojto 96:487b796308b0 268 __IO uint32_t tmpreg; \
Kojto 96:487b796308b0 269 SET_BIT(FW->CR, FW_CR_VDE) ; \
Kojto 96:487b796308b0 270 /* Read bit back to ensure it is taken into account by IP */ \
Kojto 96:487b796308b0 271 /* (introduce proper delay inside macro execution) */ \
Kojto 96:487b796308b0 272 tmpreg = READ_BIT(FW->CR, FW_CR_VDE) ; \
Kojto 96:487b796308b0 273 UNUSED(tmpreg); \
Kojto 96:487b796308b0 274 } while(0)
Kojto 96:487b796308b0 275
Kojto 96:487b796308b0 276 /** @brief Disable volatile data execution in resetting VDE bit.
Kojto 96:487b796308b0 277 * @note VDE bit is ignored when VDS is set. IF VDS = 1, the Volatile data segment can be
Kojto 96:487b796308b0 278 * executed whatever the VDE bit value.
Kojto 96:487b796308b0 279 * @note When VDE bit is reset (with VDS = 0), the volatile data segment cannot be executed.
Kojto 96:487b796308b0 280 * @note This macro can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 281 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 282 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 283 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 284 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 285 */
Kojto 96:487b796308b0 286 #define __HAL_FIREWALL_VOLATILEDATA_EXECUTION_DISABLE() \
Kojto 96:487b796308b0 287 do { \
Kojto 96:487b796308b0 288 __IO uint32_t tmpreg; \
Kojto 96:487b796308b0 289 CLEAR_BIT(FW->CR, FW_CR_VDE) ; \
Kojto 96:487b796308b0 290 /* Read bit back to ensure it is taken into account by IP */ \
Kojto 96:487b796308b0 291 /* (introduce proper delay inside macro execution) */ \
Kojto 96:487b796308b0 292 tmpreg = READ_BIT(FW->CR, FW_CR_VDE) ; \
Kojto 96:487b796308b0 293 UNUSED(tmpreg); \
Kojto 96:487b796308b0 294 } while(0)
Kojto 96:487b796308b0 295
Kojto 96:487b796308b0 296
Kojto 96:487b796308b0 297 /** @brief Check whether or not the volatile data segment is shared.
Kojto 96:487b796308b0 298 * @note This macro can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 299 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 300 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 301 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 302 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 303 * @retval VDS bit setting status (TRUE or FALSE).
Kojto 96:487b796308b0 304 */
Kojto 96:487b796308b0 305 #define __HAL_FIREWALL_GET_VOLATILEDATA_SHARED() ((FW->CR & FW_CR_VDS) == FW_CR_VDS)
Kojto 96:487b796308b0 306
Kojto 96:487b796308b0 307 /** @brief Check whether or not the volatile data segment is declared executable.
Kojto 96:487b796308b0 308 * @note This macro can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 309 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 310 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 311 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 312 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 313 * @retval VDE bit setting status (TRUE or FALSE).
Kojto 96:487b796308b0 314 */
Kojto 96:487b796308b0 315 #define __HAL_FIREWALL_GET_VOLATILEDATA_EXECUTION() ((FW->CR & FW_CR_VDE) == FW_CR_VDE)
Kojto 96:487b796308b0 316
Kojto 96:487b796308b0 317 /** @brief Check whether or not the Firewall pre arm bit is set.
Kojto 96:487b796308b0 318 * @note This macro can be executed inside a code area protected by the Firewall.
Kojto 96:487b796308b0 319 * @note This macro can be executed whatever the Firewall state (opened or closed) when
Kojto 96:487b796308b0 320 * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
Kojto 96:487b796308b0 321 * 0, that is, when the non volatile data segment is defined), the macro can be
Kojto 96:487b796308b0 322 * executed only when the Firewall is opened.
Kojto 96:487b796308b0 323 * @retval FPA bit setting status (TRUE or FALSE).
Kojto 96:487b796308b0 324 */
Kojto 96:487b796308b0 325 #define __HAL_FIREWALL_GET_PREARM() ((FW->CR & FW_CR_FPA) == FW_CR_FPA)
Kojto 96:487b796308b0 326
Kojto 96:487b796308b0 327
Kojto 96:487b796308b0 328 /**
Kojto 96:487b796308b0 329 * @}
Kojto 96:487b796308b0 330 */
Kojto 96:487b796308b0 331
Kojto 96:487b796308b0 332 /* Exported functions --------------------------------------------------------*/
Kojto 96:487b796308b0 333
Kojto 96:487b796308b0 334 /** @addtogroup FIREWALL_Exported_Functions FIREWALL Exported Functions
Kojto 96:487b796308b0 335 * @{
Kojto 96:487b796308b0 336 */
Kojto 96:487b796308b0 337
Kojto 96:487b796308b0 338 /** @addtogroup FIREWALL_Exported_Functions_Group1 Initialization Functions
Kojto 96:487b796308b0 339 * @brief Initialization and Configuration Functions
Kojto 96:487b796308b0 340 * @{
Kojto 96:487b796308b0 341 */
Kojto 96:487b796308b0 342
Kojto 96:487b796308b0 343 /* Initialization functions ********************************/
Kojto 96:487b796308b0 344 HAL_StatusTypeDef HAL_FIREWALL_Config(FIREWALL_InitTypeDef * fw_init);
Kojto 96:487b796308b0 345 void HAL_FIREWALL_GetConfig(FIREWALL_InitTypeDef * fw_config);
Kojto 96:487b796308b0 346 void HAL_FIREWALL_EnableFirewall(void);
Kojto 96:487b796308b0 347 void HAL_FIREWALL_EnablePreArmFlag(void);
Kojto 96:487b796308b0 348 void HAL_FIREWALL_DisablePreArmFlag(void);
Kojto 96:487b796308b0 349
Kojto 96:487b796308b0 350 /**
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 96:487b796308b0 359 * @}
Kojto 96:487b796308b0 360 */
Kojto 96:487b796308b0 361
Kojto 96:487b796308b0 362 /**
Kojto 96:487b796308b0 363 * @}
Kojto 96:487b796308b0 364 */
Kojto 96:487b796308b0 365
Kojto 96:487b796308b0 366 #ifdef __cplusplus
Kojto 96:487b796308b0 367 }
Kojto 96:487b796308b0 368 #endif
Kojto 96:487b796308b0 369
Kojto 96:487b796308b0 370 #endif /* __STM32L0xx_HAL_FIREWALL_H */
Kojto 96:487b796308b0 371
Kojto 96:487b796308b0 372 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/