FMC Exported Flash Functions

group x3e_FMC_Exported_Flash_Functions

Functions

bool fmc_flash_nor_read(uint32_t addr, void *data, uint32_t len)

Task-safe NOR flash read.

Parameters:
  • addr -- The RAM address mapping of NOR flash going to be read.

  • data -- The buffer to be read into.

  • len -- The length of read data.

Returns:

True if read successful, otherwise false.

bool fmc_flash_nor_write(uint32_t addr, void *data, uint32_t len)

Task-safe NOR flash write.

Parameters:
  • addr -- The RAM address mapping of NOR flash going to be written.

  • data -- The buffer to be written into.

  • len -- The length of write data.

Returns:

True if write successful, otherwise false.

bool fmc_flash_nor_erase(uint32_t addr, FMC_FLASH_NOR_ERASE_MODE mode)

Task-safe NOR flash erase.

Parameters:
  • addr -- The RAM address mapping of NOR flash going to be erased.

  • mode -- Erase mode defined as FMC_FLASH_NOR_ERASE_MODE.

Returns:

True if erase successful, otherwise false.

bool fmc_flash_nor_auto_dma_read(uint32_t src, uint32_t dst, uint32_t len, FMC_FLASH_NOR_ASYNC_CB cb)

Task-safe NOR flash auto DMA read.

Parameters:
  • src -- The RAM address mapping of NOR flash going to be read from.

  • dst -- The RAM address going to be written to.

  • len -- DMA data length.

  • cb -- Callback function to be executed when DMA finishes.

Returns:

True if trigger auto DMA read successful, otherwise false.

bool fmc_flash_nor_clock_switch(FMC_SPIC_ID idx, uint32_t required_mhz, uint32_t *actual_mhz)

Switch NOR flash clock.

Experimental Added Since 2.13.0.0:
Parameters:
  • idx -- The index of SPIC.

  • required_mhz -- Clock need to be set.

  • actual_mhz -- Used to pass back actual flash clock.

Returns:

True if switch clock successful, otherwise false.

uint32_t flash_partition_addr_get(T_FLASH_PARTITION_NAME name)

Get the address of a flash partition.

Parameters:

name -- The partition name in T_FLASH_PARTITION_NAME.

Returns:

The address of the flash partition.

uint32_t flash_partition_size_get(T_FLASH_PARTITION_NAME name)

Get the size of a flash partition.

Parameters:

name -- The partition in T_FLASH_PARTITION_NAME.

Returns:

The size of the flash partition.

uint32_t flash_cur_bank_img_payload_addr_get(FLASH_IMG_ID id)

Get the payload address of an image.

Parameters:

id -- The image id in FLASH_IMG_ID.

Returns:

The payload address of the image.

uint32_t flash_cur_bank_img_header_addr_get(FLASH_IMG_ID id)

Get the header address of an image.

Parameters:

id -- The image id in FLASH_IMG_ID.

Returns:

The header address of the image.

bool fmc_flash_nor_set_bp_lv(uint32_t addr, uint8_t bp_lv)

NOR flash set block protect level.

Parameters:
  • addr -- The RAM address mapping of NOR flash.

  • bp_lv -- The block protect level to be set.

Returns:

True if set block protect level is successful, otherwise false.

bool fmc_flash_nor_get_bp_lv(uint32_t addr, uint8_t *bp_lv)

Get NOR flash block protect level.

Parameters:
  • addr -- The RAM address mapping of NOR flash.

  • bp_lv -- Used to pass back the block protect level.

Returns:

True if get bp level is successful, otherwise false.

bool fmc_flash_nor_get_otp(bool *is_lock)

Get NOR flash OTP lock status.

Parameters:

is_lock -- Used to pass back the lock status.

Returns:

True if get lock status is successful, otherwise false.

bool fmc_flash_nor_set_otp(bool is_lock)

Set NOR flash OTP lock status.

Parameters:

is_lock -- The lock status to be set.

Returns:

True if set lock status is successful, otherwise false.

bool fmc_flash_nor_write_otp(uint32_t addr, uint8_t *otp_data, uint32_t size)

NOR flash write OTP.

Parameters:
  • addr -- The address mapping of OTP to be written.

  • otp_data -- Data buffer to be written into.

  • size -- Write data length.

Returns:

True if write is successful, otherwise false.

bool fmc_flash_nor_erase_otp(uint32_t addr)

Erase flash OTP.

Parameters:

addr -- The address mapping of OTP going to be erased.

Returns:

True if erase is successful, otherwise false.

bool fmc_flash_nor_read_otp(uint32_t addr, uint8_t *otp_data, uint32_t size)

Read flash OTP.

Parameters:
  • addr -- The address mapping of OTP going to be read.

  • otp_data -- Data buffer to be read into.

  • size -- Read data length.

Returns:

True if read is successful, otherwise false.

bool fmc_flash_nor_get_uuid(uint8_t *uuid, uint8_t size)

Get the UUID of NOR flash.

Parameters:
  • uuid -- Used to pass back the UUID of NOR flash.

  • size -- The size of UUID.

Returns:

True if getting the UUID is successful, otherwise false.

bool fmc_flash_nor_otp_init(void)

Init flash OTP (One Time Programmable).

Returns:

True if init is successful, otherwise false.

uint32_t fmc_flash_get_flash_size(uint8_t idx)

Get flash size.

Experimental Added Since 2.13.0.0:
Parameters:

idx -- SPIC channel number.

Returns:

The Byte size of current flash.