fix LPC812 PWM

Dependents:   IR_LED_Send

Fork of mbed-dev by mbed official

Committer:
nameless129
Date:
Mon May 16 16:50:30 2016 +0000
Revision:
129:2e517c56bcfb
Parent:
0:9b334a45a8ff
PWM Fix:Duty 0%??H???????????????

Who changed what in which revision?

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