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