8 #ifndef __ITS_FLASH_FS_MBLOCK_H__
9 #define __ITS_FLASH_FS_MBLOCK_H__
28 #define ITS_SUPPORTED_VERSION 0x01
35 #define ITS_METADATA_INVALID_INDEX 0xFFFF
42 #define ITS_LOGICAL_DBLOCK0 0
56 uint32_t scratch_dblock; \
60 uint8_t active_swap_count;
62 struct its_metadata_block_header_t {
64 #if ((ITS_FLASH_MAX_ALIGNMENT) > 4)
66 sizeof(
struct {
_T1 })];
88 struct its_block_meta_t {
90 #if ((ITS_FLASH_MAX_ALIGNMENT) > 4)
92 sizeof(
struct {
_T2 })];
115 uint8_t id[ITS_FILE_ID_SIZE];
117 struct its_file_meta_t {
119 #if ((ITS_FLASH_MAX_ALIGNMENT) > 4)
121 sizeof(
struct {
_T3 })];
279 uint32_t *file_meta_idx,
301 uint32_t phy_id, uint32_t lblock);
const struct its_flash_info_t * flash_info
psa_status_t its_flash_fs_mblock_reset_metablock(struct its_flash_fs_ctx_t *fs_ctx)
Resets metablock by cleaning and initializing the metadatablock.
psa_status_t its_flash_fs_mblock_reserve_file(struct its_flash_fs_ctx_t *fs_ctx, const uint8_t *fid, bool use_spare, size_t size, uint32_t flags, uint32_t *file_meta_idx, struct its_file_meta_t *file_meta, struct its_block_meta_t *block_meta)
Reserves space for a file.
uint32_t its_flash_fs_mblock_cur_data_scratch_id(struct its_flash_fs_ctx_t *fs_ctx, uint32_t lblock)
Gets current scratch datablock physical ID.
uint32_t scratch_metablock
uint32_t active_metablock
psa_status_t its_flash_fs_mblock_get_file_idx(struct its_flash_fs_ctx_t *fs_ctx, const uint8_t *fid, uint32_t *idx)
Gets file metadata entry index.
Standard error codes for the SPM and RoT Services.
psa_status_t its_flash_fs_mblock_migrate_lb0_data_to_scratch(struct its_flash_fs_ctx_t *fs_ctx)
Writes the files data area of logical block 0 into the scratch block.
struct its_metadata_block_header_t meta_block_header
psa_status_t its_flash_fs_mblock_read_file_meta(struct its_flash_fs_ctx_t *fs_ctx, uint32_t idx, struct its_file_meta_t *file_meta)
Reads specified file metadata.
psa_status_t its_flash_fs_mblock_get_file_idx_flag(struct its_flash_fs_ctx_t *fs_ctx, uint32_t flags, uint32_t *idx)
Gets file metadata entry index of the first file with one of the provided flags set.
psa_status_t its_flash_fs_mblock_update_scratch_file_meta(struct its_flash_fs_ctx_t *fs_ctx, uint32_t idx, const struct its_file_meta_t *file_meta)
Writes a file metadata entry into scratch metadata block.
psa_status_t its_flash_fs_mblock_init(struct its_flash_fs_ctx_t *fs_ctx)
Initializes metadata block with the valid/active metablock.
#define ITS_FLASH_MAX_ALIGNMENT
Provides a compile-time constant for the maximum program unit required by any flash device that can b...
psa_status_t its_flash_fs_mblock_cp_file_meta(struct its_flash_fs_ctx_t *fs_ctx, uint32_t idx_start, uint32_t idx_end)
Copies the file metadata entries between two indexes from the active metadata block to the scratch me...
psa_status_t its_flash_fs_mblock_update_scratch_block_meta(struct its_flash_fs_ctx_t *fs_ctx, uint32_t lblock, struct its_block_meta_t *block_meta)
Puts logical block's metadata in scratch metadata block.
void its_flash_fs_mblock_set_data_scratch(struct its_flash_fs_ctx_t *fs_ctx, uint32_t phy_id, uint32_t lblock)
Sets current data scratch block.
Structure containing the required information about a flash device to be used by the ITS Flash FS...
Structure to store the ITS flash file system context.
int32_t psa_status_t
Function return status.
psa_status_t its_flash_fs_mblock_read_block_metadata(struct its_flash_fs_ctx_t *fs_ctx, uint32_t lblock, struct its_block_meta_t *block_meta)
Reads specified logical block metadata.
psa_status_t its_flash_fs_mblock_meta_update_finalize(struct its_flash_fs_ctx_t *fs_ctx)
Finalizes an update operation. Last step when a create/write/delete is performed. ...