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