STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_hal_flash_ramfunc.c 00004 * @author MCD Application Team 00005 * @brief FLASH RAMFUNC module driver. 00006 * This file provides a FLASH firmware functions which should be 00007 * executed from internal SRAM 00008 * + Stop/Start the flash interface while System Run 00009 * + Enable/Disable the flash sleep while System Run 00010 @verbatim 00011 ============================================================================== 00012 ##### APIs executed from Internal RAM ##### 00013 ============================================================================== 00014 [..] 00015 *** ARM Compiler *** 00016 -------------------- 00017 [..] RAM functions are defined using the toolchain options. 00018 Functions that are be executed in RAM should reside in a separate 00019 source module. Using the 'Options for File' dialog you can simply change 00020 the 'Code / Const' area of a module to a memory space in physical RAM. 00021 Available memory areas are declared in the 'Target' tab of the 00022 Options for Target' dialog. 00023 00024 *** ICCARM Compiler *** 00025 ----------------------- 00026 [..] RAM functions are defined using a specific toolchain keyword "__ramfunc". 00027 00028 *** GNU Compiler *** 00029 -------------------- 00030 [..] RAM functions are defined using a specific toolchain attribute 00031 "__attribute__((section(".RamFunc")))". 00032 00033 @endverbatim 00034 ****************************************************************************** 00035 * @attention 00036 * 00037 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00038 * All rights reserved.</center></h2> 00039 * 00040 * This software component is licensed by ST under BSD 3-Clause license, 00041 * the "License"; You may not use this file except in compliance with the 00042 * License. You may obtain a copy of the License at: 00043 * opensource.org/licenses/BSD-3-Clause 00044 * 00045 ****************************************************************************** 00046 */ 00047 00048 /* Includes ------------------------------------------------------------------*/ 00049 #include "stm32f4xx_hal.h" 00050 00051 /** @addtogroup STM32F4xx_HAL_Driver 00052 * @{ 00053 */ 00054 00055 /** @defgroup FLASH_RAMFUNC FLASH RAMFUNC 00056 * @brief FLASH functions executed from RAM 00057 * @{ 00058 */ 00059 #ifdef HAL_FLASH_MODULE_ENABLED 00060 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ 00061 defined(STM32F412Rx) || defined(STM32F412Cx) 00062 00063 /* Private typedef -----------------------------------------------------------*/ 00064 /* Private define ------------------------------------------------------------*/ 00065 /* Private macro -------------------------------------------------------------*/ 00066 /* Private variables ---------------------------------------------------------*/ 00067 /* Private function prototypes -----------------------------------------------*/ 00068 /* Exported functions --------------------------------------------------------*/ 00069 /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions 00070 * @{ 00071 */ 00072 00073 /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM 00074 * @brief Peripheral Extended features functions 00075 * 00076 @verbatim 00077 00078 =============================================================================== 00079 ##### ramfunc functions ##### 00080 =============================================================================== 00081 [..] 00082 This subsection provides a set of functions that should be executed from RAM 00083 transfers. 00084 00085 @endverbatim 00086 * @{ 00087 */ 00088 00089 /** 00090 * @brief Stop the flash interface while System Run 00091 * @note This mode is only available for STM32F41xxx/STM32F446xx devices. 00092 * @note This mode couldn't be set while executing with the flash itself. 00093 * It should be done with specific routine executed from RAM. 00094 * @retval HAL status 00095 */ 00096 __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void) 00097 { 00098 /* Enable Power ctrl clock */ 00099 __HAL_RCC_PWR_CLK_ENABLE(); 00100 /* Stop the flash interface while System Run */ 00101 SET_BIT(PWR->CR, PWR_CR_FISSR); 00102 00103 return HAL_OK; 00104 } 00105 00106 /** 00107 * @brief Start the flash interface while System Run 00108 * @note This mode is only available for STM32F411xx/STM32F446xx devices. 00109 * @note This mode couldn't be set while executing with the flash itself. 00110 * It should be done with specific routine executed from RAM. 00111 * @retval HAL status 00112 */ 00113 __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void) 00114 { 00115 /* Enable Power ctrl clock */ 00116 __HAL_RCC_PWR_CLK_ENABLE(); 00117 /* Start the flash interface while System Run */ 00118 CLEAR_BIT(PWR->CR, PWR_CR_FISSR); 00119 00120 return HAL_OK; 00121 } 00122 00123 /** 00124 * @brief Enable the flash sleep while System Run 00125 * @note This mode is only available for STM32F41xxx/STM32F446xx devices. 00126 * @note This mode could n't be set while executing with the flash itself. 00127 * It should be done with specific routine executed from RAM. 00128 * @retval HAL status 00129 */ 00130 __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void) 00131 { 00132 /* Enable Power ctrl clock */ 00133 __HAL_RCC_PWR_CLK_ENABLE(); 00134 /* Enable the flash sleep while System Run */ 00135 SET_BIT(PWR->CR, PWR_CR_FMSSR); 00136 00137 return HAL_OK; 00138 } 00139 00140 /** 00141 * @brief Disable the flash sleep while System Run 00142 * @note This mode is only available for STM32F41xxx/STM32F446xx devices. 00143 * @note This mode couldn't be set while executing with the flash itself. 00144 * It should be done with specific routine executed from RAM. 00145 * @retval HAL status 00146 */ 00147 __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void) 00148 { 00149 /* Enable Power ctrl clock */ 00150 __HAL_RCC_PWR_CLK_ENABLE(); 00151 /* Disable the flash sleep while System Run */ 00152 CLEAR_BIT(PWR->CR, PWR_CR_FMSSR); 00153 00154 return HAL_OK; 00155 } 00156 00157 /** 00158 * @} 00159 */ 00160 00161 /** 00162 * @} 00163 */ 00164 00165 #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 00166 #endif /* HAL_FLASH_MODULE_ENABLED */ 00167 /** 00168 * @} 00169 */ 00170 00171 /** 00172 * @} 00173 */ 00174 00175 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/