87#ifdef HAL_FLASH_MODULE_ENABLED
94#define FLASH_TIMEOUT_VALUE 50000U
194 FLASH->CR &= (~FLASH_CR_PG);
258 uint32_t addresstmp = 0U;
261#if defined(FLASH_SR_RDERR)
357 CLEAR_BIT(FLASH->CR, (FLASH_CR_PG | FLASH_CR_SER | FLASH_CR_SNB |
FLASH_MER_BIT));
429 if (READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET)
436 if (READ_BIT(FLASH->CR, FLASH_CR_LOCK) != RESET)
452 FLASH->CR |= FLASH_CR_LOCK;
463 if ((FLASH->OPTCR & FLASH_OPTCR_OPTLOCK) != RESET)
484 FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK;
546 uint32_t tickstart = 0U;
561 if ((Timeout == 0U) || ((
HAL_GetTick() - tickstart) > Timeout))
574#if defined(FLASH_SR_RDERR)
610 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
612 FLASH->CR |= FLASH_CR_PG;
615 *(__IO uint32_t *)Address = (uint32_t)Data;
622 *(__IO uint32_t *)(Address + 4) = (uint32_t)(Data >> 32);
644 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
646 FLASH->CR |= FLASH_CR_PG;
648 *(__IO uint32_t *)Address = Data;
669 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
671 FLASH->CR |= FLASH_CR_PG;
673 *(__IO uint16_t *)Address = Data;
694 CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
696 FLASH->CR |= FLASH_CR_PG;
698 *(__IO uint8_t *)Address = Data;
738#if defined(FLASH_SR_RDERR)
#define IS_FLASH_ADDRESS(ADDRESS)
void FLASH_FlushCaches(void)
Flush the instruction and data caches.
void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange)
Erase the specified FLASH memory sector.
#define HAL_FLASH_ERROR_WRP
#define HAL_FLASH_ERROR_RD
#define HAL_FLASH_ERROR_PGP
#define HAL_FLASH_ERROR_PGS
#define HAL_FLASH_ERROR_PGA
#define HAL_FLASH_ERROR_NONE
#define HAL_FLASH_ERROR_OPERATION
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.
#define __HAL_FLASH_GET_FLAG(__FLAG__)
Get the specified FLASH flag status.
#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__)
Enable the specified FLASH interrupt.
#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__)
Disable the specified FLASH interrupt.
#define __HAL_FLASH_CLEAR_FLAG(__FLAG__)
Clear the specified FLASH flags.
#define FLASH_FLAG_PGSERR
#define FLASH_FLAG_PGAERR
#define FLASH_FLAG_WRPERR
#define FLASH_FLAG_PGPERR
#define IS_FLASH_TYPEPROGRAM(VALUE)
#define FLASH_TIMEOUT_VALUE
#define OPTCR_BYTE0_ADDRESS
OPTCR register byte 0 (Bits[7:0]) base address.
static void FLASH_Program_Word(uint32_t Address, uint32_t Data)
Program word (32-bit) at a specified address.
static void FLASH_Program_Byte(uint32_t Address, uint8_t Data)
Program byte (8-bit) at a specified address.
static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data)
Program a half-word (16-bit) at a specified address.
static void FLASH_SetErrorCode(void)
Set the specific FLASH error flag.
static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data)
Program a double word (64-bit) at a specified address.
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
Wait for a FLASH operation to complete.
FLASH_ProcessTypeDef pFlash
#define FLASH_PSIZE_DOUBLE_WORD
#define FLASH_PSIZE_HALF_WORD
#define FLASH_TYPEPROGRAM_HALFWORD
#define FLASH_TYPEPROGRAM_BYTE
#define FLASH_TYPEPROGRAM_WORD
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define assert_param(expr)
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef
HAL Status structures definition
#define __HAL_UNLOCK(__HANDLE__)
#define __HAL_LOCK(__HANDLE__)
FLASH handle Structure definition.
__IO uint32_t NbSectorsToErase
__IO uint8_t VoltageForErase
__IO FLASH_ProcedureTypeDef ProcedureOnGoing