mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
489:119543c9f674
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

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