comparison Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src/stm32f4xx_hal_flash_ramfunc.c @ 38:5f11787b4f42

include in ostc4 repository
author heinrichsweikamp
date Sat, 28 Apr 2018 11:52:34 +0200
parents
children
comparison
equal deleted inserted replaced
37:ccc45c0e1ea2 38:5f11787b4f42
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_hal_flash_ramfunc.c
4 * @author MCD Application Team
5 * @version V1.2.0
6 * @date 26-December-2014
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) 2014 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 FLASH_RAMFUNC FLASH RAMFUNC
74 * @brief FLASH functions executed from RAM
75 * @{
76 */
77
78 #ifdef HAL_FLASH_MODULE_ENABLED
79
80 #if defined(STM32F411xE)
81
82 /* Private typedef -----------------------------------------------------------*/
83 /* Private define ------------------------------------------------------------*/
84 /* Private macro -------------------------------------------------------------*/
85 /* Private variables ---------------------------------------------------------*/
86 /* Private function prototypes -----------------------------------------------*/
87 /* Exported functions --------------------------------------------------------*/
88 /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions
89 * @{
90 */
91
92 /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM
93 * @brief Peripheral Extended features functions
94 *
95 @verbatim
96
97 ===============================================================================
98 ##### ramfunc functions #####
99 ===============================================================================
100 [..]
101 This subsection provides a set of functions that should be executed from RAM
102 transfers.
103
104 @endverbatim
105 * @{
106 */
107
108 /**
109 * @brief Stop the flash interface while System Run
110 * @note This mode is only available for STM32F411xx devices.
111 * @note This mode couldn't be set while executing with the flash itself.
112 * It should be done with specific routine executed from RAM.
113 * @retval None
114 */
115 __RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void)
116 {
117 /* Enable Power ctrl clock */
118 __HAL_RCC_PWR_CLK_ENABLE();
119 /* Stop the flash interface while System Run */
120 SET_BIT(PWR->CR, PWR_CR_FISSR);
121
122 return HAL_OK;
123 }
124
125 /**
126 * @brief Start the flash interface while System Run
127 * @note This mode is only available for STM32F411xx devices.
128 * @note This mode couldn't be set while executing with the flash itself.
129 * It should be done with specific routine executed from RAM.
130 * @retval None
131 */
132 __RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void)
133 {
134 /* Enable Power ctrl clock */
135 __HAL_RCC_PWR_CLK_ENABLE();
136 /* Start the flash interface while System Run */
137 CLEAR_BIT(PWR->CR, PWR_CR_FISSR);
138
139 return HAL_OK;
140 }
141
142 /**
143 * @brief Enable the flash sleep while System Run
144 * @note This mode is only available for STM32F411xx devices.
145 * @note This mode could n't be set while executing with the flash itself.
146 * It should be done with specific routine executed from RAM.
147 * @retval None
148 */
149 __RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void)
150 {
151 /* Enable Power ctrl clock */
152 __HAL_RCC_PWR_CLK_ENABLE();
153 /* Enable the flash sleep while System Run */
154 SET_BIT(PWR->CR, PWR_CR_FMSSR);
155
156 return HAL_OK;
157 }
158
159 /**
160 * @brief Disable the flash sleep while System Run
161 * @note This mode is only available for STM32F411xx devices.
162 * @note This mode could n't be set while executing with the flash itself.
163 * It should be done with specific routine executed from RAM.
164 * @retval None
165 */
166 __RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void)
167 {
168 /* Enable Power ctrl clock */
169 __HAL_RCC_PWR_CLK_ENABLE();
170 /* Disable the flash sleep while System Run */
171 CLEAR_BIT(PWR->CR, PWR_CR_FMSSR);
172
173 return HAL_OK;
174 }
175
176 /**
177 * @}
178 */
179
180 /**
181 * @}
182 */
183
184 #endif /* STM32F411xE */
185 #endif /* HAL_FLASH_MODULE_ENABLED */
186 /**
187 * @}
188 */
189
190 /**
191 * @}
192 */
193
194 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/