19#ifndef __STM32F4xx_HAL_FLASH_H
20#define __STM32F4xx_HAL_FLASH_H
88#define HAL_FLASH_ERROR_NONE 0x00000000U
89#define HAL_FLASH_ERROR_RD 0x00000001U
90#define HAL_FLASH_ERROR_PGS 0x00000002U
91#define HAL_FLASH_ERROR_PGP 0x00000004U
92#define HAL_FLASH_ERROR_PGA 0x00000008U
93#define HAL_FLASH_ERROR_WRP 0x00000010U
94#define HAL_FLASH_ERROR_OPERATION 0x00000020U
102#define FLASH_TYPEPROGRAM_BYTE 0x00000000U
103#define FLASH_TYPEPROGRAM_HALFWORD 0x00000001U
104#define FLASH_TYPEPROGRAM_WORD 0x00000002U
105#define FLASH_TYPEPROGRAM_DOUBLEWORD 0x00000003U
114#define FLASH_FLAG_EOP FLASH_SR_EOP
115#define FLASH_FLAG_OPERR FLASH_SR_SOP
116#define FLASH_FLAG_WRPERR FLASH_SR_WRPERR
117#define FLASH_FLAG_PGAERR FLASH_SR_PGAERR
118#define FLASH_FLAG_PGPERR FLASH_SR_PGPERR
119#define FLASH_FLAG_PGSERR FLASH_SR_PGSERR
120#if defined(FLASH_SR_RDERR)
121#define FLASH_FLAG_RDERR FLASH_SR_RDERR
123#define FLASH_FLAG_BSY FLASH_SR_BSY
132#define FLASH_IT_EOP FLASH_CR_EOPIE
133#define FLASH_IT_ERR 0x02000000U
141#define FLASH_PSIZE_BYTE 0x00000000U
142#define FLASH_PSIZE_HALF_WORD 0x00000100U
143#define FLASH_PSIZE_WORD 0x00000200U
144#define FLASH_PSIZE_DOUBLE_WORD 0x00000300U
145#define CR_PSIZE_MASK 0xFFFFFCFFU
153#define RDP_KEY ((uint16_t)0x00A5)
154#define FLASH_KEY1 0x45670123U
155#define FLASH_KEY2 0xCDEF89ABU
156#define FLASH_OPT_KEY1 0x08192A3BU
157#define FLASH_OPT_KEY2 0x4C5D6E7FU
176#define __HAL_FLASH_SET_LATENCY(__LATENCY__) (*(__IO uint8_t *)ACR_BYTE0_ADDRESS = (uint8_t)(__LATENCY__))
183#define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
189#define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN)
195#define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN))
201#define __HAL_FLASH_INSTRUCTION_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_ICEN)
207#define __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_ICEN))
213#define __HAL_FLASH_DATA_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_DCEN)
219#define __HAL_FLASH_DATA_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_DCEN))
226#define __HAL_FLASH_INSTRUCTION_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_ICRST; \
227 FLASH->ACR &= ~FLASH_ACR_ICRST; \
235#define __HAL_FLASH_DATA_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_DCRST; \
236 FLASH->ACR &= ~FLASH_ACR_DCRST; \
246#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
256#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__))
273#define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)))
289#define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__))
361#define ACR_BYTE0_ADDRESS 0x40023C00U
365#define OPTCR_BYTE0_ADDRESS 0x40023C14U
369#define OPTCR_BYTE1_ADDRESS 0x40023C15U
373#define OPTCR_BYTE2_ADDRESS 0x40023C16U
377#define OPTCR_BYTE3_ADDRESS 0x40023C17U
391#define IS_FLASH_TYPEPROGRAM(VALUE)(((VALUE) == FLASH_TYPEPROGRAM_BYTE) || \
392 ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
393 ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
394 ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
void HAL_FLASH_IRQHandler(void)
This function handles FLASH interrupt request.
void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
FLASH operation error interrupt callback.
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
FLASH end of operation interrupt callback.
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
Program byte, halfword, word or double word at a specified address with interrupt enabled.
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
Program byte, halfword, word or double word at a specified address.
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
Launch the option byte loading.
HAL_StatusTypeDef HAL_FLASH_Unlock(void)
Unlock the FLASH control register access.
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
Lock the FLASH Option Control Registers access.
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void)
Unlock the FLASH Option Control Registers access.
HAL_StatusTypeDef HAL_FLASH_Lock(void)
Locks the FLASH control register access.
uint32_t HAL_FLASH_GetError(void)
Get the specific FLASH error flag.
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
Wait for a FLASH operation to complete.
FLASH_ProcedureTypeDef
FLASH Procedure structure definition.
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition
HAL_LockTypeDef
HAL Lock structures definition
Header file of FLASH HAL Extension module.
Header file of FLASH RAMFUNC driver.
FLASH handle Structure definition.
__IO uint32_t NbSectorsToErase
__IO uint8_t VoltageForErase
__IO FLASH_ProcedureTypeDef ProcedureOnGoing