Flash Transport Layer Exported Functions

group FTL_Exported_Functions

Functions

int ftl_init(const T_STORAGE_PARTITION_INFO *info)

Init FTL.

Parameters:

info -- FTL partition info.

Returns:

Refer to errno.h.

int32_t ftl_init_module(char *module_name, uint16_t malloc_size, uint8_t block_len)

Init an ext FTL module.

Note

Up to 6 modules can be applied.

Parameters:
  • module_name -- Specify FTL module name, and the first 4 bytes must be unique.

  • malloc_size -- FTL module logical size.

  • block_len -- The minimum access unit for the FTL module must be an integral multiple of 4 and cannot exceed 128.

Returns:

Refer to errno.h.

void ftl_v1_module_info(char *module_name, uint32_t u32PageStartAddr, uint8_t pagenum, uint32_t value_size, uint16_t offset_min)

Set V1 FTL information for the FTL upgrade.

Parameters:
  • module_name -- V1 ext FTL name.

  • u32PageStartAddr -- V1 FTL ext start address.

  • pagenum -- V1 ext FTL pagenum.

  • value_size -- V1 ext FTL value size.

  • offset_min -- V1 ext FTL min offset.

int32_t ftl_save_to_module(char *module_name, void *pdata, uint16_t offset, uint16_t size)

Save specified value to FTL module.

Parameters:
  • module_name -- Specify FTL module name.

  • pdata -- Specify data buffer.

  • offset -- FTL offset to store.

  • size -- Size to store, needs to be an integer multiple of block_len in ftl_init_module.

Returns:

Refer to errno.h.

int32_t ftl_load_from_module(char *module_name, void *pdata, uint16_t offset, uint16_t size)

Load specified FTL module offset parameter to specified buffer.

Parameters:
  • module_name -- Specify FTL module name.

  • pdata -- Specify data buffer.

  • offset -- Specify FTL offset to load, needs to be an integer multiple of block_len in ftl_init_module.

  • size -- Size to load.

Returns:

Refer to errno.h.

bool ftl_cache_init(uint16_t cache_size)

Init FTL cache and set FTL cache enable.

Parameters:

cache_size -- FTL cache size.

Returns:

True if init is successful, otherwise false.

int32_t ftl_set_rom_module_size(uint16_t rom_size)

Set ROM FTL module size.

Parameters:

rom_size -- FTL module logic size.

Returns:

Refer to errno.h.

Variables

uint32_t (*ftl_save_to_storage)(void *pdata, uint16_t offset, uint16_t size)

Save specified value to specified FTL offset.

Note

FTL offset is pre-defined and no conflict with ROM.

Param pdata:

Specify data buffer.

Param offset:

Specify FTL offset to store.

Param size:

Size to store.

Return:

Refer to errno.h.

uint32_t (*ftl_load_from_storage)(void *pdata, uint16_t offset, uint16_t size)

Load specified FTL offset parameter to specified buffer.

Note

FTL offset is pre-defined and no conflict with ROM.

Param pdata:

Specify data buffer.

Param offset:

Specify FTL offset to load.

Param size:

Size to load.

Return:

Refer to errno.h.