Greg Steiert / maxim-dev

Dependents:   MAX34417_demo MAXREFDES1265 MAXREFDES1265

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Sep 02 15:07:44 2016 +0100
Revision:
144:ef7eb2e8f9f7
Parent:
0:9b334a45a8ff
This updates the lib to the mbed lib v125

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /**
<> 144:ef7eb2e8f9f7 2 ******************************************************************************
<> 144:ef7eb2e8f9f7 3 * @file stm32l4xx_hal_firewall.c
<> 144:ef7eb2e8f9f7 4 * @author MCD Application Team
<> 144:ef7eb2e8f9f7 5 * @version V1.5.1
<> 144:ef7eb2e8f9f7 6 * @date 31-May-2016
<> 144:ef7eb2e8f9f7 7 * @brief FIREWALL HAL module driver.
<> 144:ef7eb2e8f9f7 8 * This file provides firmware functions to manage the Firewall
<> 144:ef7eb2e8f9f7 9 * Peripheral initialization and enabling.
<> 144:ef7eb2e8f9f7 10 *
<> 144:ef7eb2e8f9f7 11 *
<> 144:ef7eb2e8f9f7 12 @verbatim
<> 144:ef7eb2e8f9f7 13 ===============================================================================
<> 144:ef7eb2e8f9f7 14 ##### How to use this driver #####
<> 144:ef7eb2e8f9f7 15 ===============================================================================
<> 144:ef7eb2e8f9f7 16 [..]
<> 144:ef7eb2e8f9f7 17 The FIREWALL HAL driver can be used as follows:
<> 144:ef7eb2e8f9f7 18
<> 144:ef7eb2e8f9f7 19 (#) Declare a FIREWALL_InitTypeDef initialization structure.
<> 144:ef7eb2e8f9f7 20
<> 144:ef7eb2e8f9f7 21 (#) Resort to HAL_FIREWALL_Config() API to initialize the Firewall
<> 144:ef7eb2e8f9f7 22
<> 144:ef7eb2e8f9f7 23 (#) Enable the FIREWALL in calling HAL_FIREWALL_EnableFirewall() API
<> 144:ef7eb2e8f9f7 24
<> 144:ef7eb2e8f9f7 25 (#) To ensure that any code executed outside the protected segment closes the
<> 144:ef7eb2e8f9f7 26 FIREWALL, the user must set the flag FIREWALL_PRE_ARM_SET in calling
<> 144:ef7eb2e8f9f7 27 __HAL_FIREWALL_PREARM_ENABLE() macro if called within a protected code segment
<> 144:ef7eb2e8f9f7 28 or
<> 144:ef7eb2e8f9f7 29 HAL_FIREWALL_EnablePreArmFlag() API if called outside of protected code segment
<> 144:ef7eb2e8f9f7 30 after HAL_FIREWALL_Config() call.
<> 144:ef7eb2e8f9f7 31
<> 144:ef7eb2e8f9f7 32
<> 144:ef7eb2e8f9f7 33 @endverbatim
<> 144:ef7eb2e8f9f7 34 ******************************************************************************
<> 144:ef7eb2e8f9f7 35 * @attention
<> 144:ef7eb2e8f9f7 36 *
<> 144:ef7eb2e8f9f7 37 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 144:ef7eb2e8f9f7 38 *
<> 144:ef7eb2e8f9f7 39 * Redistribution and use in source and binary forms, with or without modification,
<> 144:ef7eb2e8f9f7 40 * are permitted provided that the following conditions are met:
<> 144:ef7eb2e8f9f7 41 * 1. Redistributions of source code must retain the above copyright notice,
<> 144:ef7eb2e8f9f7 42 * this list of conditions and the following disclaimer.
<> 144:ef7eb2e8f9f7 43 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 144:ef7eb2e8f9f7 44 * this list of conditions and the following disclaimer in the documentation
<> 144:ef7eb2e8f9f7 45 * and/or other materials provided with the distribution.
<> 144:ef7eb2e8f9f7 46 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 144:ef7eb2e8f9f7 47 * may be used to endorse or promote products derived from this software
<> 144:ef7eb2e8f9f7 48 * without specific prior written permission.
<> 144:ef7eb2e8f9f7 49 *
<> 144:ef7eb2e8f9f7 50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 144:ef7eb2e8f9f7 51 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 144:ef7eb2e8f9f7 52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 144:ef7eb2e8f9f7 53 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 144:ef7eb2e8f9f7 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 144:ef7eb2e8f9f7 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 144:ef7eb2e8f9f7 56 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 144:ef7eb2e8f9f7 57 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 144:ef7eb2e8f9f7 58 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 144:ef7eb2e8f9f7 59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 144:ef7eb2e8f9f7 60 *
<> 144:ef7eb2e8f9f7 61 ******************************************************************************
<> 144:ef7eb2e8f9f7 62 */
<> 144:ef7eb2e8f9f7 63
<> 144:ef7eb2e8f9f7 64 /* Includes ------------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 65 #include "stm32l4xx_hal.h"
<> 144:ef7eb2e8f9f7 66
<> 144:ef7eb2e8f9f7 67 /** @addtogroup STM32L4xx_HAL_Driver
<> 144:ef7eb2e8f9f7 68 * @{
<> 144:ef7eb2e8f9f7 69 */
<> 144:ef7eb2e8f9f7 70
<> 144:ef7eb2e8f9f7 71 /** @defgroup FIREWALL FIREWALL
<> 144:ef7eb2e8f9f7 72 * @brief HAL FIREWALL module driver
<> 144:ef7eb2e8f9f7 73 * @{
<> 144:ef7eb2e8f9f7 74 */
<> 144:ef7eb2e8f9f7 75 #ifdef HAL_FIREWALL_MODULE_ENABLED
<> 144:ef7eb2e8f9f7 76
<> 144:ef7eb2e8f9f7 77 /* Private typedef -----------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 78 /* Private define ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 79 /* Private macro -------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 80 /* Private variables ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 81 /* Private function prototypes -----------------------------------------------*/
<> 144:ef7eb2e8f9f7 82 /* Private functions ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 83
<> 144:ef7eb2e8f9f7 84
<> 144:ef7eb2e8f9f7 85 /** @defgroup FIREWALL_Exported_Functions FIREWALL Exported Functions
<> 144:ef7eb2e8f9f7 86 * @{
<> 144:ef7eb2e8f9f7 87 */
<> 144:ef7eb2e8f9f7 88
<> 144:ef7eb2e8f9f7 89 /** @defgroup FIREWALL_Exported_Functions_Group1 Initialization Functions
<> 144:ef7eb2e8f9f7 90 * @brief Initialization and Configuration Functions
<> 144:ef7eb2e8f9f7 91 *
<> 144:ef7eb2e8f9f7 92 @verbatim
<> 144:ef7eb2e8f9f7 93 ===============================================================================
<> 144:ef7eb2e8f9f7 94 ##### Initialization and Configuration functions #####
<> 144:ef7eb2e8f9f7 95 ===============================================================================
<> 144:ef7eb2e8f9f7 96 [..]
<> 144:ef7eb2e8f9f7 97 This subsection provides the functions allowing to initialize the Firewall.
<> 144:ef7eb2e8f9f7 98 Initialization is done by HAL_FIREWALL_Config():
<> 144:ef7eb2e8f9f7 99
<> 144:ef7eb2e8f9f7 100 (+) Enable the Firewall clock thru __HAL_RCC_FIREWALL_CLK_ENABLE() macro.
<> 144:ef7eb2e8f9f7 101
<> 144:ef7eb2e8f9f7 102 (+) Set the protected code segment address start and length.
<> 144:ef7eb2e8f9f7 103
<> 144:ef7eb2e8f9f7 104 (+) Set the protected non-volatile and/or volatile data segments
<> 144:ef7eb2e8f9f7 105 address starts and lengths if applicable.
<> 144:ef7eb2e8f9f7 106
<> 144:ef7eb2e8f9f7 107 (+) Set the volatile data segment execution and sharing status.
<> 144:ef7eb2e8f9f7 108
<> 144:ef7eb2e8f9f7 109 (+) Length must be set to 0 for an unprotected segment.
<> 144:ef7eb2e8f9f7 110
<> 144:ef7eb2e8f9f7 111 @endverbatim
<> 144:ef7eb2e8f9f7 112 * @{
<> 144:ef7eb2e8f9f7 113 */
<> 144:ef7eb2e8f9f7 114
<> 144:ef7eb2e8f9f7 115 /**
<> 144:ef7eb2e8f9f7 116 * @brief Initialize the Firewall according to the FIREWALL_InitTypeDef structure parameters.
<> 144:ef7eb2e8f9f7 117 * @param fw_init: Firewall initialization structure
<> 144:ef7eb2e8f9f7 118 * @note The API returns HAL_ERROR if the Firewall is already enabled.
<> 144:ef7eb2e8f9f7 119 * @retval HAL status
<> 144:ef7eb2e8f9f7 120 */
<> 144:ef7eb2e8f9f7 121 HAL_StatusTypeDef HAL_FIREWALL_Config(FIREWALL_InitTypeDef * fw_init)
<> 144:ef7eb2e8f9f7 122 {
<> 144:ef7eb2e8f9f7 123 /* Check the Firewall initialization structure allocation */
<> 144:ef7eb2e8f9f7 124 if(fw_init == NULL)
<> 144:ef7eb2e8f9f7 125 {
<> 144:ef7eb2e8f9f7 126 return HAL_ERROR;
<> 144:ef7eb2e8f9f7 127 }
<> 144:ef7eb2e8f9f7 128
<> 144:ef7eb2e8f9f7 129 /* Enable Firewall clock */
<> 144:ef7eb2e8f9f7 130 __HAL_RCC_FIREWALL_CLK_ENABLE();
<> 144:ef7eb2e8f9f7 131
<> 144:ef7eb2e8f9f7 132 /* Make sure that Firewall is not enabled already */
<> 144:ef7eb2e8f9f7 133 if (__HAL_FIREWALL_IS_ENABLED() != RESET)
<> 144:ef7eb2e8f9f7 134 {
<> 144:ef7eb2e8f9f7 135 return HAL_ERROR;
<> 144:ef7eb2e8f9f7 136 }
<> 144:ef7eb2e8f9f7 137
<> 144:ef7eb2e8f9f7 138 /* Check Firewall configuration addresses and lengths when segment is protected */
<> 144:ef7eb2e8f9f7 139 /* Code segment */
<> 144:ef7eb2e8f9f7 140 if (fw_init->CodeSegmentLength != 0)
<> 144:ef7eb2e8f9f7 141 {
<> 144:ef7eb2e8f9f7 142 assert_param(IS_FIREWALL_CODE_SEGMENT_ADDRESS(fw_init->CodeSegmentStartAddress));
<> 144:ef7eb2e8f9f7 143 assert_param(IS_FIREWALL_CODE_SEGMENT_LENGTH(fw_init->CodeSegmentStartAddress, fw_init->CodeSegmentLength));
<> 144:ef7eb2e8f9f7 144 }
<> 144:ef7eb2e8f9f7 145 /* Non volatile data segment */
<> 144:ef7eb2e8f9f7 146 if (fw_init->NonVDataSegmentLength != 0)
<> 144:ef7eb2e8f9f7 147 {
<> 144:ef7eb2e8f9f7 148 assert_param(IS_FIREWALL_NONVOLATILEDATA_SEGMENT_ADDRESS(fw_init->NonVDataSegmentStartAddress));
<> 144:ef7eb2e8f9f7 149 assert_param(IS_FIREWALL_NONVOLATILEDATA_SEGMENT_LENGTH(fw_init->NonVDataSegmentStartAddress, fw_init->NonVDataSegmentLength));
<> 144:ef7eb2e8f9f7 150 }
<> 144:ef7eb2e8f9f7 151 /* Volatile data segment */
<> 144:ef7eb2e8f9f7 152 if (fw_init->VDataSegmentLength != 0)
<> 144:ef7eb2e8f9f7 153 {
<> 144:ef7eb2e8f9f7 154 assert_param(IS_FIREWALL_VOLATILEDATA_SEGMENT_ADDRESS(fw_init->VDataSegmentStartAddress));
<> 144:ef7eb2e8f9f7 155 assert_param(IS_FIREWALL_VOLATILEDATA_SEGMENT_LENGTH(fw_init->VDataSegmentStartAddress, fw_init->VDataSegmentLength));
<> 144:ef7eb2e8f9f7 156 }
<> 144:ef7eb2e8f9f7 157
<> 144:ef7eb2e8f9f7 158 /* Check Firewall Configuration Register parameters */
<> 144:ef7eb2e8f9f7 159 assert_param(IS_FIREWALL_VOLATILEDATA_EXECUTE(fw_init->VolatileDataExecution));
<> 144:ef7eb2e8f9f7 160 assert_param(IS_FIREWALL_VOLATILEDATA_SHARE(fw_init->VolatileDataShared));
<> 144:ef7eb2e8f9f7 161
<> 144:ef7eb2e8f9f7 162
<> 144:ef7eb2e8f9f7 163 /* Configuration */
<> 144:ef7eb2e8f9f7 164
<> 144:ef7eb2e8f9f7 165 /* Protected code segment start address configuration */
<> 144:ef7eb2e8f9f7 166 WRITE_REG(FIREWALL->CSSA, (FW_CSSA_ADD & fw_init->CodeSegmentStartAddress));
<> 144:ef7eb2e8f9f7 167 /* Protected code segment length configuration */
<> 144:ef7eb2e8f9f7 168 WRITE_REG(FIREWALL->CSL, (FW_CSL_LENG & fw_init->CodeSegmentLength));
<> 144:ef7eb2e8f9f7 169
<> 144:ef7eb2e8f9f7 170 /* Protected non volatile data segment start address configuration */
<> 144:ef7eb2e8f9f7 171 WRITE_REG(FIREWALL->NVDSSA, (FW_NVDSSA_ADD & fw_init->NonVDataSegmentStartAddress));
<> 144:ef7eb2e8f9f7 172 /* Protected non volatile data segment length configuration */
<> 144:ef7eb2e8f9f7 173 WRITE_REG(FIREWALL->NVDSL, (FW_NVDSL_LENG & fw_init->NonVDataSegmentLength));
<> 144:ef7eb2e8f9f7 174
<> 144:ef7eb2e8f9f7 175 /* Protected volatile data segment start address configuration */
<> 144:ef7eb2e8f9f7 176 WRITE_REG(FIREWALL->VDSSA, (FW_VDSSA_ADD & fw_init->VDataSegmentStartAddress));
<> 144:ef7eb2e8f9f7 177 /* Protected volatile data segment length configuration */
<> 144:ef7eb2e8f9f7 178 WRITE_REG(FIREWALL->VDSL, (FW_VDSL_LENG & fw_init->VDataSegmentLength));
<> 144:ef7eb2e8f9f7 179
<> 144:ef7eb2e8f9f7 180 /* Set Firewall Configuration Register VDE and VDS bits
<> 144:ef7eb2e8f9f7 181 (volatile data execution and shared configuration) */
<> 144:ef7eb2e8f9f7 182 MODIFY_REG(FIREWALL->CR, FW_CR_VDS|FW_CR_VDE, fw_init->VolatileDataExecution|fw_init->VolatileDataShared);
<> 144:ef7eb2e8f9f7 183
<> 144:ef7eb2e8f9f7 184 return HAL_OK;
<> 144:ef7eb2e8f9f7 185 }
<> 144:ef7eb2e8f9f7 186
<> 144:ef7eb2e8f9f7 187 /**
<> 144:ef7eb2e8f9f7 188 * @brief Retrieve the Firewall configuration.
<> 144:ef7eb2e8f9f7 189 * @param fw_config: Firewall configuration, type is same as initialization structure
<> 144:ef7eb2e8f9f7 190 * @note This API can't be executed inside a code area protected by the Firewall
<> 144:ef7eb2e8f9f7 191 * when the Firewall is enabled
<> 144:ef7eb2e8f9f7 192 * @note If NVDSL register is different from 0, that is, if the non volatile data segment
<> 144:ef7eb2e8f9f7 193 * is defined, this API can't be executed when the Firewall is enabled.
<> 144:ef7eb2e8f9f7 194 * @note User should resort to __HAL_FIREWALL_GET_PREARM() macro to retrieve FPA bit status
<> 144:ef7eb2e8f9f7 195 * @retval None
<> 144:ef7eb2e8f9f7 196 */
<> 144:ef7eb2e8f9f7 197 void HAL_FIREWALL_GetConfig(FIREWALL_InitTypeDef * fw_config)
<> 144:ef7eb2e8f9f7 198 {
<> 144:ef7eb2e8f9f7 199
<> 144:ef7eb2e8f9f7 200 /* Enable Firewall clock, in case no Firewall configuration has been carried
<> 144:ef7eb2e8f9f7 201 out up to this point */
<> 144:ef7eb2e8f9f7 202 __HAL_RCC_FIREWALL_CLK_ENABLE();
<> 144:ef7eb2e8f9f7 203
<> 144:ef7eb2e8f9f7 204 /* Retrieve code segment protection setting */
<> 144:ef7eb2e8f9f7 205 fw_config->CodeSegmentStartAddress = (READ_REG(FIREWALL->CSSA) & FW_CSSA_ADD);
<> 144:ef7eb2e8f9f7 206 fw_config->CodeSegmentLength = (READ_REG(FIREWALL->CSL) & FW_CSL_LENG);
<> 144:ef7eb2e8f9f7 207
<> 144:ef7eb2e8f9f7 208 /* Retrieve non volatile data segment protection setting */
<> 144:ef7eb2e8f9f7 209 fw_config->NonVDataSegmentStartAddress = (READ_REG(FIREWALL->NVDSSA) & FW_NVDSSA_ADD);
<> 144:ef7eb2e8f9f7 210 fw_config->NonVDataSegmentLength = (READ_REG(FIREWALL->NVDSL) & FW_NVDSL_LENG);
<> 144:ef7eb2e8f9f7 211
<> 144:ef7eb2e8f9f7 212 /* Retrieve volatile data segment protection setting */
<> 144:ef7eb2e8f9f7 213 fw_config->VDataSegmentStartAddress = (READ_REG(FIREWALL->VDSSA) & FW_VDSSA_ADD);
<> 144:ef7eb2e8f9f7 214 fw_config->VDataSegmentLength = (READ_REG(FIREWALL->VDSL) & FW_VDSL_LENG);
<> 144:ef7eb2e8f9f7 215
<> 144:ef7eb2e8f9f7 216 /* Retrieve volatile data execution setting */
<> 144:ef7eb2e8f9f7 217 fw_config->VolatileDataExecution = (READ_REG(FIREWALL->CR) & FW_CR_VDE);
<> 144:ef7eb2e8f9f7 218
<> 144:ef7eb2e8f9f7 219 /* Retrieve volatile data shared setting */
<> 144:ef7eb2e8f9f7 220 fw_config->VolatileDataShared = (READ_REG(FIREWALL->CR) & FW_CR_VDS);
<> 144:ef7eb2e8f9f7 221
<> 144:ef7eb2e8f9f7 222 return;
<> 144:ef7eb2e8f9f7 223 }
<> 144:ef7eb2e8f9f7 224
<> 144:ef7eb2e8f9f7 225
<> 144:ef7eb2e8f9f7 226
<> 144:ef7eb2e8f9f7 227 /**
<> 144:ef7eb2e8f9f7 228 * @brief Enable FIREWALL.
<> 144:ef7eb2e8f9f7 229 * @note Firewall is enabled in clearing FWDIS bit of SYSCFG CFGR1 register.
<> 144:ef7eb2e8f9f7 230 * Once enabled, the Firewall cannot be disabled by software. Only a
<> 144:ef7eb2e8f9f7 231 * system reset can set again FWDIS bit.
<> 144:ef7eb2e8f9f7 232 * @retval None
<> 144:ef7eb2e8f9f7 233 */
<> 144:ef7eb2e8f9f7 234 void HAL_FIREWALL_EnableFirewall(void)
<> 144:ef7eb2e8f9f7 235 {
<> 144:ef7eb2e8f9f7 236 /* Clears FWDIS bit of SYSCFG CFGR1 register */
<> 144:ef7eb2e8f9f7 237 CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_FWDIS);
<> 144:ef7eb2e8f9f7 238
<> 144:ef7eb2e8f9f7 239 }
<> 144:ef7eb2e8f9f7 240
<> 144:ef7eb2e8f9f7 241 /**
<> 144:ef7eb2e8f9f7 242 * @brief Enable FIREWALL pre arm.
<> 144:ef7eb2e8f9f7 243 * @note When FPA bit is set, any code executed outside the protected segment
<> 144:ef7eb2e8f9f7 244 * will close the Firewall.
<> 144:ef7eb2e8f9f7 245 * @note This API provides the same service as __HAL_FIREWALL_PREARM_ENABLE() macro
<> 144:ef7eb2e8f9f7 246 * but can't be executed inside a code area protected by the Firewall.
<> 144:ef7eb2e8f9f7 247 * @note When the Firewall is disabled, user can resort to HAL_FIREWALL_EnablePreArmFlag() API any time.
<> 144:ef7eb2e8f9f7 248 * @note When the Firewall is enabled and NVDSL register is equal to 0 (that is,
<> 144:ef7eb2e8f9f7 249 * when the non volatile data segment is not defined),
<> 144:ef7eb2e8f9f7 250 * ** this API can be executed when the Firewall is closed
<> 144:ef7eb2e8f9f7 251 * ** when the Firewall is opened, user should resort to
<> 144:ef7eb2e8f9f7 252 * __HAL_FIREWALL_PREARM_ENABLE() macro instead
<> 144:ef7eb2e8f9f7 253 * @note When the Firewall is enabled and NVDSL register is different from 0
<> 144:ef7eb2e8f9f7 254 * (that is, when the non volatile data segment is defined)
<> 144:ef7eb2e8f9f7 255 * ** FW_CR register can be accessed only when the Firewall is opened:
<> 144:ef7eb2e8f9f7 256 * user should resort to __HAL_FIREWALL_PREARM_ENABLE() macro instead.
<> 144:ef7eb2e8f9f7 257 * @retval None
<> 144:ef7eb2e8f9f7 258 */
<> 144:ef7eb2e8f9f7 259 void HAL_FIREWALL_EnablePreArmFlag(void)
<> 144:ef7eb2e8f9f7 260 {
<> 144:ef7eb2e8f9f7 261 /* Set FPA bit */
<> 144:ef7eb2e8f9f7 262 SET_BIT(FIREWALL->CR, FW_CR_FPA);
<> 144:ef7eb2e8f9f7 263 }
<> 144:ef7eb2e8f9f7 264
<> 144:ef7eb2e8f9f7 265
<> 144:ef7eb2e8f9f7 266 /**
<> 144:ef7eb2e8f9f7 267 * @brief Disable FIREWALL pre arm.
<> 144:ef7eb2e8f9f7 268 * @note When FPA bit is reset, any code executed outside the protected segment
<> 144:ef7eb2e8f9f7 269 * when the Firewall is opened will generate a system reset.
<> 144:ef7eb2e8f9f7 270 * @note This API provides the same service as __HAL_FIREWALL_PREARM_DISABLE() macro
<> 144:ef7eb2e8f9f7 271 * but can't be executed inside a code area protected by the Firewall.
<> 144:ef7eb2e8f9f7 272 * @note When the Firewall is disabled, user can resort to HAL_FIREWALL_EnablePreArmFlag() API any time.
<> 144:ef7eb2e8f9f7 273 * @note When the Firewall is enabled and NVDSL register is equal to 0 (that is,
<> 144:ef7eb2e8f9f7 274 * when the non volatile data segment is not defined),
<> 144:ef7eb2e8f9f7 275 * ** this API can be executed when the Firewall is closed
<> 144:ef7eb2e8f9f7 276 * ** when the Firewall is opened, user should resort to
<> 144:ef7eb2e8f9f7 277 * __HAL_FIREWALL_PREARM_DISABLE() macro instead
<> 144:ef7eb2e8f9f7 278 * @note When the Firewall is enabled and NVDSL register is different from 0
<> 144:ef7eb2e8f9f7 279 * (that is, when the non volatile data segment is defined)
<> 144:ef7eb2e8f9f7 280 * ** FW_CR register can be accessed only when the Firewall is opened:
<> 144:ef7eb2e8f9f7 281 * user should resort to __HAL_FIREWALL_PREARM_DISABLE() macro instead.
<> 144:ef7eb2e8f9f7 282
<> 144:ef7eb2e8f9f7 283 * @retval None
<> 144:ef7eb2e8f9f7 284 */
<> 144:ef7eb2e8f9f7 285 void HAL_FIREWALL_DisablePreArmFlag(void)
<> 144:ef7eb2e8f9f7 286 {
<> 144:ef7eb2e8f9f7 287 /* Clear FPA bit */
<> 144:ef7eb2e8f9f7 288 CLEAR_BIT(FIREWALL->CR, FW_CR_FPA);
<> 144:ef7eb2e8f9f7 289 }
<> 144:ef7eb2e8f9f7 290
<> 144:ef7eb2e8f9f7 291 /**
<> 144:ef7eb2e8f9f7 292 * @}
<> 144:ef7eb2e8f9f7 293 */
<> 144:ef7eb2e8f9f7 294
<> 144:ef7eb2e8f9f7 295 /**
<> 144:ef7eb2e8f9f7 296 * @}
<> 144:ef7eb2e8f9f7 297 */
<> 144:ef7eb2e8f9f7 298
<> 144:ef7eb2e8f9f7 299 #endif /* HAL_FIREWALL_MODULE_ENABLED */
<> 144:ef7eb2e8f9f7 300 /**
<> 144:ef7eb2e8f9f7 301 * @}
<> 144:ef7eb2e8f9f7 302 */
<> 144:ef7eb2e8f9f7 303
<> 144:ef7eb2e8f9f7 304 /**
<> 144:ef7eb2e8f9f7 305 * @}
<> 144:ef7eb2e8f9f7 306 */
<> 144:ef7eb2e8f9f7 307
<> 144:ef7eb2e8f9f7 308 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/