30 #ifndef __STM32F30x_FLASH_H 31 #define __STM32F30x_FLASH_H 38 #include "stm32f30x.h" 70 #define FLASH_Latency_0 ((uint8_t)0x0000) 71 #define FLASH_Latency_1 FLASH_ACR_LATENCY_0 72 #define FLASH_Latency_2 FLASH_ACR_LATENCY_1 74 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_Latency_0) || \ 75 ((LATENCY) == FLASH_Latency_1) || \ 76 ((LATENCY) == FLASH_Latency_2)) 85 #define FLASH_IT_EOP FLASH_CR_EOPIE 86 #define FLASH_IT_ERR FLASH_CR_ERRIE 87 #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && (((IT) != 0x00000000))) 95 #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0803FFFF)) 104 #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806)) 114 #define OB_WRP_Pages0to1 ((uint32_t)0x00000001) 115 #define OB_WRP_Pages2to3 ((uint32_t)0x00000002) 116 #define OB_WRP_Pages4to5 ((uint32_t)0x00000004) 117 #define OB_WRP_Pages6to7 ((uint32_t)0x00000008) 118 #define OB_WRP_Pages8to9 ((uint32_t)0x00000010) 119 #define OB_WRP_Pages10to11 ((uint32_t)0x00000020) 120 #define OB_WRP_Pages12to13 ((uint32_t)0x00000040) 121 #define OB_WRP_Pages14to15 ((uint32_t)0x00000080) 122 #define OB_WRP_Pages16to17 ((uint32_t)0x00000100) 123 #define OB_WRP_Pages18to19 ((uint32_t)0x00000200) 124 #define OB_WRP_Pages20to21 ((uint32_t)0x00000400) 125 #define OB_WRP_Pages22to23 ((uint32_t)0x00000800) 126 #define OB_WRP_Pages24to25 ((uint32_t)0x00001000) 127 #define OB_WRP_Pages26to27 ((uint32_t)0x00002000) 128 #define OB_WRP_Pages28to29 ((uint32_t)0x00004000) 129 #define OB_WRP_Pages30to31 ((uint32_t)0x00008000) 130 #define OB_WRP_Pages32to33 ((uint32_t)0x00010000) 131 #define OB_WRP_Pages34to35 ((uint32_t)0x00020000) 132 #define OB_WRP_Pages36to37 ((uint32_t)0x00040000) 133 #define OB_WRP_Pages38to39 ((uint32_t)0x00080000) 134 #define OB_WRP_Pages40to41 ((uint32_t)0x00100000) 135 #define OB_WRP_Pages42to43 ((uint32_t)0x00200000) 136 #define OB_WRP_Pages44to45 ((uint32_t)0x00400000) 137 #define OB_WRP_Pages46to47 ((uint32_t)0x00800000) 138 #define OB_WRP_Pages48to49 ((uint32_t)0x01000000) 139 #define OB_WRP_Pages50to51 ((uint32_t)0x02000000) 140 #define OB_WRP_Pages52to53 ((uint32_t)0x04000000) 141 #define OB_WRP_Pages54to55 ((uint32_t)0x08000000) 142 #define OB_WRP_Pages56to57 ((uint32_t)0x10000000) 143 #define OB_WRP_Pages58to59 ((uint32_t)0x20000000) 144 #define OB_WRP_Pages60to61 ((uint32_t)0x40000000) 145 #define OB_WRP_Pages62to127 ((uint32_t)0x80000000) 147 #define OB_WRP_AllPages ((uint32_t)0xFFFFFFFF) 149 #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000)) 162 #define OB_RDP_Level_0 ((uint8_t)0xAA) 163 #define OB_RDP_Level_1 ((uint8_t)0xBB) 167 #define IS_OB_RDP(LEVEL) (((LEVEL) == OB_RDP_Level_0)||\ 168 ((LEVEL) == OB_RDP_Level_1)) 178 #define OB_IWDG_SW ((uint8_t)0x01) 179 #define OB_IWDG_HW ((uint8_t)0x00) 180 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW)) 190 #define OB_STOP_NoRST ((uint8_t)0x02) 191 #define OB_STOP_RST ((uint8_t)0x00) 192 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST)) 202 #define OB_STDBY_NoRST ((uint8_t)0x04) 203 #define OB_STDBY_RST ((uint8_t)0x00) 204 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST)) 213 #define OB_BOOT1_RESET ((uint8_t)0x00) 214 #define OB_BOOT1_SET ((uint8_t)0x10) 215 #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET)) 224 #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) 225 #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00) 227 #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF)) 237 #define OB_SRAM_PARITY_SET ((uint8_t)0x00) 238 #define OB_SRAM_PARITY_RESET ((uint8_t)0x40) 240 #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_SRAM_PARITY_SET) || ((PARITY) == OB_SRAM_PARITY_RESET)) 250 #define FLASH_FLAG_BSY FLASH_SR_BSY 251 #define FLASH_FLAG_PGERR FLASH_SR_PGERR 252 #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR 253 #define FLASH_FLAG_EOP FLASH_SR_EOP 255 #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFCB) == 0x00000000) && ((FLAG) != 0x00000000)) 257 #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_PGERR) || \ 258 ((FLAG) == FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_EOP)) 265 #define FLASH_ER_PRG_TIMEOUT ((uint32_t)0x000B0000) void FLASH_SetLatency(uint32_t FLASH_Latency)
Sets the code latency value.
FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1)
Sets or resets the BOOT1.
void FLASH_Unlock(void)
Unlocks the FLASH control register access.
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
Waits for a Flash operation to complete or a TIMEOUT to occur.
FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG)
Sets or resets the analogue monitoring on VDDA Power source.
FLASH_Status FLASH_ErasePage(uint32_t Page_Address)
Erases a specified FLASH page.
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.
void FLASH_HalfCycleAccessCmd(FunctionalState NewState)
Enables or disables the Half cycle flash access.
FLASH_Status FLASH_EraseAllPages(void)
Erases all FLASH pages.
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.
FLASH_Status FLASH_OB_SRAMParityConfig(uint8_t OB_SRAM_Parity)
Sets or resets the SRAM partiy.
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_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.
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.
FLASH_Status FLASH_OB_EnableWRP(uint32_t OB_WRP)
Write protects the desired pages.
void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState)
Enables or disables the specified FLASH interrupts.
FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
Checks whether the specified FLASH flag is set or not.
FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data)
Programs a half word at a specified Option Byte Data address.
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 Status.
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.