L4 HAL Drivers

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32l4xx_hal_flash_ramfunc.c Source File

stm32l4xx_hal_flash_ramfunc.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_hal_flash_ramfunc.c
00004   * @author  MCD Application Team
00005   * @version V1.1.0
00006   * @date    16-September-2015
00007   * @brief   FLASH RAMFUNC driver.
00008   *          This file provides a Flash firmware functions which should be 
00009   *          executed from internal SRAM
00010   *            + FLASH HalfPage Programming
00011   *            + FLASH Power Down in Run mode
00012   *
00013   *  @verbatim
00014   ==============================================================================
00015                    ##### Flash RAM functions #####
00016   ==============================================================================    
00017 
00018     *** ARM Compiler ***
00019     --------------------
00020     [..] RAM functions are defined using the toolchain options. 
00021          Functions that are executed in RAM should reside in a separate
00022          source module. Using the 'Options for File' dialog you can simply change
00023          the 'Code / Const' area of a module to a memory space in physical RAM.
00024          Available memory areas are declared in the 'Target' tab of the 
00025          Options for Target' dialog.
00026 
00027     *** ICCARM Compiler ***
00028     -----------------------
00029     [..] RAM functions are defined using a specific toolchain keyword "__ramfunc".
00030 
00031     *** GNU Compiler ***
00032     --------------------
00033     [..] RAM functions are defined using a specific toolchain attribute
00034          "__attribute__((section(".RamFunc")))".
00035   
00036   @endverbatim
00037   ******************************************************************************
00038   * @attention
00039   *
00040   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
00041   *
00042   * Redistribution and use in source and binary forms, with or without modification,
00043   * are permitted provided that the following conditions are met:
00044   *   1. Redistributions of source code must retain the above copyright notice,
00045   *      this list of conditions and the following disclaimer.
00046   *   2. Redistributions in binary form must reproduce the above copyright notice,
00047   *      this list of conditions and the following disclaimer in the documentation
00048   *      and/or other materials provided with the distribution.
00049   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00050   *      may be used to endorse or promote products derived from this software
00051   *      without specific prior written permission.
00052   *
00053   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00054   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00055   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00056   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00057   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00058   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00059   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00060   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00061   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00062   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00063   *
00064   ******************************************************************************
00065   */ 
00066 
00067 /* Includes ------------------------------------------------------------------*/
00068 #include "stm32l4xx_hal.h"
00069 
00070 /** @addtogroup STM32L4xx_HAL_Driver
00071   * @{
00072   */
00073 
00074 /** @defgroup FLASH_RAMFUNC FLASH_RAMFUNC
00075   * @brief FLASH functions executed from RAM
00076   * @{
00077   */
00078 
00079 #ifdef HAL_FLASH_MODULE_ENABLED
00080 
00081 /* Private typedef -----------------------------------------------------------*/
00082 /* Private define ------------------------------------------------------------*/
00083 /* Private macro -------------------------------------------------------------*/
00084 /* Private variables ---------------------------------------------------------*/
00085 /* Private function prototypes -----------------------------------------------*/
00086 /* Exported functions -------------------------------------------------------*/
00087 
00088 /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH in RAM function Exported Functions
00089   * @{
00090   */
00091 
00092 /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions 
00093  *  @brief   Data transfers functions 
00094  *
00095 @verbatim   
00096  ===============================================================================
00097                       ##### ramfunc functions #####
00098  ===============================================================================  
00099     [..]
00100     This subsection provides a set of functions that should be executed from RAM.
00101 
00102 @endverbatim
00103   * @{
00104   */
00105 
00106 /**
00107   * @brief   Enable the Power down in Run Mode
00108   * @note    This function should be called and executed from SRAM memory
00109   * @retval None
00110   */
00111 __RAM_FUNC HAL_FLASHEx_EnableRunPowerDown(void)
00112 {
00113   /* Enable the Power Down in Run mode*/
00114   __HAL_FLASH_POWER_DOWN_ENABLE();
00115   
00116   return HAL_OK;
00117   
00118 }
00119 
00120 /**
00121   * @brief   Disable the Power down in Run Mode
00122   * @note    This function should be called and executed from SRAM memory
00123   * @retval None
00124   */
00125 __RAM_FUNC HAL_FLASHEx_DisableRunPowerDown(void)
00126 {
00127   /* Disable the Power Down in Run mode*/
00128   __HAL_FLASH_POWER_DOWN_DISABLE();
00129 
00130   return HAL_OK;  
00131 }
00132 
00133 /**
00134   * @}
00135   */
00136 
00137 /**
00138   * @}
00139   */   
00140 #endif /* HAL_FLASH_MODULE_ENABLED */
00141 
00142 
00143   
00144 /**
00145   * @}
00146   */
00147 
00148 /**
00149   * @}
00150   */
00151 
00152      
00153 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
00154 
00155 
00156