source: asp3_wo_tecs/trunk/arch/arm_m_gcc/stm32f4xx_stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c@ 303

Last change on this file since 303 was 303, checked in by ertl-honda, 7 years ago

nucleo_f401re依存部の追加

File size: 7.0 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32f4xx_hal_flash_ramfunc.c
4 * @author MCD Application Team
5 * @version V1.4.1
6 * @date 09-October-2015
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
12 @verbatim
13 ==============================================================================
14 ##### APIs executed from Internal RAM #####
15 ==============================================================================
16 [..]
17 *** ARM Compiler ***
18 --------------------
19 [..] RAM functions are defined using the toolchain options.
20 Functions that are be executed in RAM should reside in a separate
21 source module. Using the 'Options for File' dialog you can simply change
22 the 'Code / Const' area of a module to a memory space in physical RAM.
23 Available memory areas are declared in the 'Target' tab of the
24 Options for Target' dialog.
25
26 *** ICCARM Compiler ***
27 -----------------------
28 [..] RAM functions are defined using a specific toolchain keyword "__ramfunc".
29
30 *** GNU Compiler ***
31 --------------------
32 [..] RAM functions are defined using a specific toolchain attribute
33 "__attribute__((section(".RamFunc")))".
34
35 @endverbatim
36 ******************************************************************************
37 * @attention
38 *
39 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
40 *
41 * Redistribution and use in source and binary forms, with or without modification,
42 * are permitted provided that the following conditions are met:
43 * 1. Redistributions of source code must retain the above copyright notice,
44 * this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright notice,
46 * this list of conditions and the following disclaimer in the documentation
47 * and/or other materials provided with the distribution.
48 * 3. Neither the name of STMicroelectronics nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
53 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
58 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
59 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
60 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 *
63 ******************************************************************************
64 */
65
66/* Includes ------------------------------------------------------------------*/
67#include "stm32f4xx_hal.h"
68
69/** @addtogroup STM32F4xx_HAL_Driver
70 * @{
71 */
72
73/** @defgroup FLASHRAMFUNC FLASH RAMFUNC
74 * @brief FLASH functions executed from RAM
75 * @{
76 */
77#ifdef HAL_FLASH_MODULE_ENABLED
78#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx)
79
80/* Private typedef -----------------------------------------------------------*/
81/* Private define ------------------------------------------------------------*/
82/* Private macro -------------------------------------------------------------*/
83/* Private variables ---------------------------------------------------------*/
84/* Private function prototypes -----------------------------------------------*/
85/* Exported functions --------------------------------------------------------*/
86/** @defgroup FLASHRAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions
87 * @{
88 */
89
90/** @defgroup FLASHRAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM
91 * @brief Peripheral Extended features functions
92 *
93@verbatim
94
95 ===============================================================================
96 ##### ramfunc functions #####
97 ===============================================================================
98 [..]
99 This subsection provides a set of functions that should be executed from RAM
100 transfers.
101
102@endverbatim
103 * @{
104 */
105
106/**
107 * @brief Stop the flash interface while System Run
108 * @note This mode is only available for STM32F411xx devices.
109 * @note This mode couldn't be set while executing with the flash itself.
110 * It should be done with specific routine executed from RAM.
111 * @retval None
112 */
113__RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void)
114{
115 /* Enable Power ctrl clock */
116 __HAL_RCC_PWR_CLK_ENABLE();
117 /* Stop the flash interface while System Run */
118 SET_BIT(PWR->CR, PWR_CR_FISSR);
119
120 return HAL_OK;
121}
122
123/**
124 * @brief Start the flash interface while System Run
125 * @note This mode is only available for STM32F411xx devices.
126 * @note This mode couldn't be set while executing with the flash itself.
127 * It should be done with specific routine executed from RAM.
128 * @retval None
129 */
130__RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void)
131{
132 /* Enable Power ctrl clock */
133 __HAL_RCC_PWR_CLK_ENABLE();
134 /* Start the flash interface while System Run */
135 CLEAR_BIT(PWR->CR, PWR_CR_FISSR);
136
137 return HAL_OK;
138}
139
140/**
141 * @brief Enable the flash sleep while System Run
142 * @note This mode is only available for STM32F411xx devices.
143 * @note This mode could n't be set while executing with the flash itself.
144 * It should be done with specific routine executed from RAM.
145 * @retval None
146 */
147__RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void)
148{
149 /* Enable Power ctrl clock */
150 __HAL_RCC_PWR_CLK_ENABLE();
151 /* Enable the flash sleep while System Run */
152 SET_BIT(PWR->CR, PWR_CR_FMSSR);
153
154 return HAL_OK;
155}
156
157/**
158 * @brief Disable the flash sleep while System Run
159 * @note This mode is only available for STM32F411xx devices.
160 * @note This mode couldn't be set while executing with the flash itself.
161 * It should be done with specific routine executed from RAM.
162 * @retval None
163 */
164__RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void)
165{
166 /* Enable Power ctrl clock */
167 __HAL_RCC_PWR_CLK_ENABLE();
168 /* Disable the flash sleep while System Run */
169 CLEAR_BIT(PWR->CR, PWR_CR_FMSSR);
170
171 return HAL_OK;
172}
173
174/**
175 * @}
176 */
177
178/**
179 * @}
180 */
181
182#endif /* STM32F410xx || STM32F411xE || STM32F446xx */
183#endif /* HAL_FLASH_MODULE_ENABLED */
184/**
185 * @}
186 */
187
188/**
189 * @}
190 */
191
192/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Note: See TracBrowser for help on using the repository browser.