91 #define RDPRT_MASK ((uint32_t)0x00000002) 92 #define WRP01_MASK ((uint32_t)0x0000FFFF) 93 #define WRP23_MASK ((uint32_t)0xFFFF0000) 142 tmpreg |= FLASH_Latency;
274 FLASH->AR = Page_Address;
336 __IO uint32_t tmp = 0;
350 *(
__IO uint16_t*)Address = (uint16_t)Data;
361 *(
__IO uint16_t*) tmp = Data >> 16;
406 *(
__IO uint16_t*)Address = Data;
487 FLASH->OPTKEYR = FLASH_OPTKEY1;
488 FLASH->OPTKEYR = FLASH_OPTKEY2;
511 FLASH->CR |= FLASH_CR_OBL_LAUNCH;
554 OB->RDP = (uint16_t)rdptmp;
593 uint16_t WRP0_Data = 0xFFFF, WRP1_Data = 0xFFFF;
600 OB_WRP = (uint32_t)(~OB_WRP);
601 WRP0_Data = (uint16_t)(OB_WRP & OB_WRP0_WRP0);
602 WRP1_Data = (uint16_t)((OB_WRP & OB_WRP0_nWRP0) >> 8);
611 if(WRP0_Data != 0xFF)
613 OB->WRP0 = WRP0_Data;
620 OB->WRP1 = WRP1_Data;
735 OB->USER = (uint8_t)((uint8_t)(OB_IWDG | OB_STOP) | (uint8_t)(OB_STDBY |0xF8));
777 OB->USER = OB_BOOT1|0xEF;
819 OB->USER = OB_VDDA_ANALOG |0xDF;
857 OB->USER = OB_SRAM_Parity | 0xBF;
904 OB->USER = OB_USER | 0x88;
943 *(
__IO uint16_t*)Address = Data;
966 return (uint8_t)(
FLASH->OBR >> 8);
977 return (uint32_t)(
FLASH->WRPR);
989 if ((uint8_t)(
FLASH->OBR & (FLASH_OBR_RDPRT1 | FLASH_OBR_RDPRT2)) !=
RESET)
1034 FLASH->CR |= FLASH_IT;
1039 FLASH->CR &= ~(uint32_t)FLASH_IT;
1060 if((
FLASH->SR & FLASH_FLAG) != (uint32_t)
RESET)
1087 FLASH->SR = FLASH_FLAG;
1140 while((status ==
FLASH_BUSY) && (Timeout != 0x00))
1146 if(Timeout == 0x00 )
void FLASH_SetLatency(uint32_t FLASH_Latency)
Sets the code latency value.
FLASH_Status FLASH_OB_SRAMParityConfig(uint8_t OB_SRAM_Parity)
Sets or resets the SRAM partiy.
#define IS_OB_IWDG_SOURCE(SOURCE)
#define IS_OB_BOOT1(BOOT1)
#define IS_OB_STOP_SOURCE(SOURCE)
void FLASH_Unlock(void)
Unlocks the FLASH control register access.
FLASH_Status FLASH_ErasePage(uint32_t Page_Address)
Erases a specified page in program memory.
#define IS_FLASH_GET_FLAG(FLAG)
#define IS_FLASH_CLEAR_FLAG(FLAG)
#define IS_OB_VDDA_ANALOG(ANALOG)
This file contains all the functions prototypes for the FLASH firmware library.
void assert_param(int val)
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.
#define IS_FUNCTIONAL_STATE(STATE)
#define IS_OB_SRAM_PARITY(PARITY)
static volatile uint8_t * status
void FLASH_PrefetchBufferCmd(FunctionalState NewState)
Enables or disables the Prefetch Buffer.
void FLASH_OB_RDPConfig(uint8_t OB_RDP)
Enables or disables the read out protection.
void FLASH_HalfCycleAccessCmd(FunctionalState NewState)
Enables or disables the Half cycle flash access.
void FLASH_ClearFlag(uint32_t FLASH_FLAG)
Clears the FLASH's pending flags.
uint8_t FLASH_OB_GetUser(void)
Returns the FLASH User Option Bytes values.
FLASH_Status FLASH_EraseAllPages(void)
Erases all FLASH pages.
FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG)
Sets or resets the analogue monitoring on VDDA Power source.
#define IS_OB_DATA_ADDRESS(ADDRESS)
FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER)
Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY/ BOOT1 and OB_VDDA_ANALOG.
FLASH_Status FLASH_OB_Launch(void)
Launch the option byte loading.
void FLASH_OB_Unlock(void)
Unlocks the option bytes block access.
#define IS_OB_WRP(SECTOR)
FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1)
Sets or resets the BOOT1.
uint16_t FLASH_OB_GetWRP(void)
Returns the FLASH Write Protection Option Bytes value.
FLASH_Status FLASH_OB_Erase(void)
Erases the FLASH option bytes.
#define FLASH_ACR_LATENCY
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS)
#define IS_FLASH_LATENCY(LATENCY)
void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState)
Enables or disables the specified FLASH interrupts.
#define FLASH_ER_PRG_TIMEOUT
#define IS_OB_STDBY_SOURCE(SOURCE)
FLASH_Status FLASH_OB_EnableWRP(uint32_t OB_WRP)
Write protects the desired pages.
FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
Checks whether the specified FLASH flag is set or not.
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
Waits for a FLASH operation to complete or a TIMEOUT to occur.
FLASH_Status FLASH_GetStatus(void)
Returns the FLASH Status.
FlagStatus FLASH_OB_GetRDP(void)
Checks whether the FLASH Read out Protection Status is set or not.
FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
Programs a word at a specified address.
FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data)
Programs a half word at a specified Option Byte Data address.
FLASH_Status
FLASH Status.
#define FLASH_FLAG_WRPERR
void FLASH_Lock(void)
Locks the FLASH control register access.
void FLASH_OB_Lock(void)
Locks the option bytes block access.
FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
Programs a half word at a specified address.