CARME-M4 BSP  V1.5
stm32f4xx_flash.c File Reference

This file provides firmware functions to manage the following functionalities of the FLASH peripheral: More...

#include "stm32f4xx_flash.h"
+ Include dependency graph for stm32f4xx_flash.c:

Go to the source code of this file.

Macros

#define SECTOR_MASK   ((uint32_t)0xFFFFFF07)
 

Functions

void FLASH_SetLatency (uint32_t FLASH_Latency)
 Sets the code latency value. More...
 
void FLASH_PrefetchBufferCmd (FunctionalState NewState)
 Enables or disables the Prefetch Buffer. More...
 
void FLASH_InstructionCacheCmd (FunctionalState NewState)
 Enables or disables the Instruction Cache feature. More...
 
void FLASH_DataCacheCmd (FunctionalState NewState)
 Enables or disables the Data Cache feature. More...
 
void FLASH_InstructionCacheReset (void)
 Resets the Instruction Cache. More...
 
void FLASH_DataCacheReset (void)
 Resets the Data Cache. More...
 
void FLASH_Unlock (void)
 Unlocks the FLASH control register access. More...
 
void FLASH_Lock (void)
 Locks the FLASH control register access. More...
 
FLASH_Status FLASH_EraseSector (uint32_t FLASH_Sector, uint8_t VoltageRange)
 Erases a specified FLASH Sector. More...
 
FLASH_Status FLASH_EraseAllSectors (uint8_t VoltageRange)
 Erases all FLASH Sectors. More...
 
FLASH_Status FLASH_EraseAllBank1Sectors (uint8_t VoltageRange)
 Erases all FLASH Sectors in Bank 1. More...
 
FLASH_Status FLASH_EraseAllBank2Sectors (uint8_t VoltageRange)
 Erases all FLASH Sectors in Bank 2. More...
 
FLASH_Status FLASH_ProgramDoubleWord (uint32_t Address, uint64_t Data)
 Programs a double word (64-bit) at a specified address. More...
 
FLASH_Status FLASH_ProgramWord (uint32_t Address, uint32_t Data)
 Programs a word (32-bit) at a specified address. More...
 
FLASH_Status FLASH_ProgramHalfWord (uint32_t Address, uint16_t Data)
 Programs a half word (16-bit) at a specified address. More...
 
FLASH_Status FLASH_ProgramByte (uint32_t Address, uint8_t Data)
 Programs a byte (8-bit) at a specified address. More...
 
void FLASH_OB_Unlock (void)
 Unlocks the FLASH Option Control Registers access. More...
 
void FLASH_OB_Lock (void)
 Locks the FLASH Option Control Registers access. More...
 
void FLASH_OB_WRPConfig (uint32_t OB_WRP, FunctionalState NewState)
 Enables or disables the write protection of the desired sectors, for the first 1 Mb of the Flash. More...
 
void FLASH_OB_WRP1Config (uint32_t OB_WRP, FunctionalState NewState)
 Enables or disables the write protection of the desired sectors, for the second 1 Mb of the Flash. More...
 
void FLASH_OB_PCROPSelectionConfig (uint8_t OB_PcROP)
 Select the Protection Mode (SPRMOD). More...
 
void FLASH_OB_PCROPConfig (uint32_t OB_PCROP, FunctionalState NewState)
 Enables or disables the read/write protection (PCROP) of the desired sectors, for the first 1 MB of the Flash. More...
 
void FLASH_OB_PCROP1Config (uint32_t OB_PCROP, FunctionalState NewState)
 Enables or disables the read/write protection (PCROP) of the desired sectors. More...
 
void FLASH_OB_RDPConfig (uint8_t OB_RDP)
 Sets the read protection level. More...
 
void FLASH_OB_UserConfig (uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY)
 Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. More...
 
void FLASH_OB_BootConfig (uint8_t OB_BOOT)
 Configure the Dual Bank Boot. More...
 
void FLASH_OB_BORConfig (uint8_t OB_BOR)
 Sets the BOR Level. More...
 
FLASH_Status FLASH_OB_Launch (void)
 Launch the option byte loading. More...
 
uint8_t FLASH_OB_GetUser (void)
 Returns the FLASH User Option Bytes values. More...
 
uint16_t FLASH_OB_GetWRP (void)
 Returns the FLASH Write Protection Option Bytes value. More...
 
uint16_t FLASH_OB_GetWRP1 (void)
 Returns the FLASH Write Protection Option Bytes value. More...
 
uint16_t FLASH_OB_GetPCROP (void)
 Returns the FLASH PC Read/Write Protection Option Bytes value. More...
 
uint16_t FLASH_OB_GetPCROP1 (void)
 Returns the FLASH PC Read/Write Protection Option Bytes value. More...
 
FlagStatus FLASH_OB_GetRDP (void)
 Returns the FLASH Read Protection level. More...
 
uint8_t FLASH_OB_GetBOR (void)
 Returns the FLASH BOR level. More...
 
void FLASH_ITConfig (uint32_t FLASH_IT, FunctionalState NewState)
 Enables or disables the specified FLASH interrupts. More...
 
FlagStatus FLASH_GetFlagStatus (uint32_t FLASH_FLAG)
 Checks whether the specified FLASH flag is set or not. More...
 
void FLASH_ClearFlag (uint32_t FLASH_FLAG)
 Clears the FLASH's pending flags. More...
 
FLASH_Status FLASH_GetStatus (void)
 Returns the FLASH Status. More...
 
FLASH_Status FLASH_WaitForLastOperation (void)
 Waits for a FLASH operation to complete. More...
 

Detailed Description

This file provides firmware functions to manage the following functionalities of the FLASH peripheral:

Author
MCD Application Team
Version
V1.3.0
Date
08-November-2013
  • FLASH Interface configuration
  • FLASH Memory Programming
  • Option Bytes Programming
  • Interrupts and flags management
===============================================================================
                       ##### How to use this driver #####
===============================================================================
   [..]                             
     This driver provides functions to configure and program the FLASH memory 
     of all STM32F4xx devices. These functions are split in 4 groups:
  
     (#) FLASH Interface configuration functions: this group includes the
         management of the following features:
       (++) Set the latency
       (++) Enable/Disable the prefetch buffer
       (++) Enable/Disable the Instruction cache and the Data cache
       (++) Reset the Instruction cache and the Data cache
   
     (#) FLASH Memory Programming functions: this group includes all needed
         functions to erase and program the main memory:
       (++) Lock and Unlock the FLASH interface
       (++) Erase function: Erase sector, erase all sectors
       (++) Program functions: byte, half word, word and double word
   
     (#) Option Bytes Programming functions: this group includes all needed
         functions to manage the Option Bytes:
       (++) Set/Reset the write protection
       (++) Set the Read protection Level
       (++) Set the BOR level
       (++) Program the user Option Bytes
       (++) Launch the Option Bytes loader
   
     (#) Interrupts and flags management functions: this group 
         includes all needed functions to:
       (++) Enable/Disable the FLASH interrupt sources
       (++) Get flags status
       (++) Clear flags
       (++) Get FLASH operation status
       (++) Wait for last FLASH operation   
Attention

© COPYRIGHT 2013 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file stm32f4xx_flash.c.