2 ******************************************************************************
3 * @file stm32f4xx_flash_ramfunc.c
4 * @author MCD Application Team
7 * @brief FLASH RAMFUNC module driver.
8 * This file provides a FLASH firmware functions which should be
9 * executed from internal SRAM
10 * + Stop/Start the flash interface while System Run
11 * + Enable/Disable the flash sleep while System Run
14 ==============================================================================
15 ##### APIs executed from Internal RAM #####
16 ==============================================================================
20 [..] RAM functions are defined using the toolchain options.
21 Functions that are be executed in RAM should reside in a separate
22 source module. Using the 'Options for File' dialog you can simply change
23 the 'Code / Const' area of a module to a memory space in physical RAM.
24 Available memory areas are declared in the 'Target' tab of the
25 Options for Target' dialog.
27 *** ICCARM Compiler ***
28 -----------------------
29 [..] RAM functions are defined using a specific toolchain keyword "__ramfunc".
33 [..] RAM functions are defined using a specific toolchain attribute
34 "__attribute__((section(".RamFunc")))".
37 ******************************************************************************
40 * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2>
42 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
43 * You may not use this file except in compliance with the License.
44 * You may obtain a copy of the License at:
46 * http://www.st.com/software_license_agreement_liberty_v2
48 * Unless required by applicable law or agreed to in writing, software
49 * distributed under the License is distributed on an "AS IS" BASIS,
50 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
51 * See the License for the specific language governing permissions and
52 * limitations under the License.
54 ******************************************************************************
57 /* Includes ------------------------------------------------------------------*/
58 #include "stm32f4xx_flash_ramfunc.h"
60 /** @addtogroup STM32F4xx_StdPeriph_Driver
64 /** @defgroup FLASH RAMFUNC
65 * @brief FLASH RAMFUNC driver modules
69 /* Private typedef -----------------------------------------------------------*/
70 /* Private define ------------------------------------------------------------*/
71 /* Private macro -------------------------------------------------------------*/
72 /* Private variables ---------------------------------------------------------*/
73 /* Private function prototypes -----------------------------------------------*/
74 /* Private functions ---------------------------------------------------------*/
76 /** @defgroup FLASH_RAMFUNC_Private_Functions
80 /** @defgroup FLASH_RAMFUNC_Group1 Peripheral features functions executed from internal RAM
81 * @brief Peripheral Extended features functions
85 ===============================================================================
86 ##### ramfunc functions #####
87 ===============================================================================
89 This subsection provides a set of functions that should be executed from RAM
97 * @brief Start/Stop the flash interface while System Run
98 * @note This mode is only available for STM32F411xx devices.
99 * @note This mode could n't be set while executing with the flash itself.
100 * It should be done with specific routine executed from RAM.
101 * @param NewState: new state of the Smart Card mode.
102 * This parameter can be: ENABLE or DISABLE.
105 __RAM_FUNC
FLASH_FlashInterfaceCmd(FunctionalState NewState
)
107 if (NewState
!= DISABLE
)
109 /* Start the flash interface while System Run */
110 CLEAR_BIT(PWR
->CR
, PWR_CR_FISSR
);
114 /* Stop the flash interface while System Run */
115 SET_BIT(PWR
->CR
, PWR_CR_FISSR
);
120 * @brief Enable/Disable the flash sleep while System Run
121 * @note This mode is only available for STM32F411xx devices.
122 * @note This mode could n't be set while executing with the flash itself.
123 * It should be done with specific routine executed from RAM.
124 * @param NewState: new state of the Smart Card mode.
125 * This parameter can be: ENABLE or DISABLE.
128 __RAM_FUNC
FLASH_FlashSleepModeCmd(FunctionalState NewState
)
130 if (NewState
!= DISABLE
)
132 /* Enable the flash sleep while System Run */
133 SET_BIT(PWR
->CR
, PWR_CR_FMSSR
);
137 /* Disable the flash sleep while System Run */
138 CLEAR_BIT(PWR
->CR
, PWR_CR_FMSSR
);
158 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/