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