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