58 #include "sdk_errors.h"
59 #include "app_util_platform.h"
70 #define FDS_FILE_ID_INVALID (0xFFFF)
78 #define FDS_RECORD_KEY_DIRTY (0x0000)
83 #define FDS_BOUND_NOT_SET (0)
685 uint32_t * p_record_id);
ret_code_t fds_record_write(fds_record_desc_t *p_desc, fds_record_t const *p_record)
Function for writing a record to flash.
ret_code_t fds_record_find(uint16_t file_id, uint16_t record_key, fds_record_desc_t *p_desc, fds_find_token_t *p_token)
Function for searching for records with a given record key in a file.
ret_code_t fds_init(void)
Function for initializing the module.
ret_code_t fds_record_write_reserved(fds_record_desc_t *p_desc, fds_record_t const *p_record, fds_reserve_token_t const *p_token)
Function for writing a record to a space in flash that was reserved using fds_reserve.
ret_code_t fds_reserve(fds_reserve_token_t *p_token, uint16_t length_words)
Function for reserving space in flash.
ret_code_t fds_reserve_cancel(fds_reserve_token_t *p_token)
Function for canceling an fds_reserve operation.
ret_code_t fds_stat(fds_stat_t *p_stat)
Function for retrieving file system statistics.
ret_code_t fds_record_id_from_desc(fds_record_desc_t const *p_desc, uint32_t *p_record_id)
Function for obtaining a record ID from a record descriptor.
void(* fds_cb_t)(fds_evt_t const *p_evt)
FDS event handler function prototype.
ret_code_t flash_bounds_set(const uint32_t start_addr, const uint32_t end_addr)
Set physical boundaries for FDS.
ret_code_t fds_descriptor_from_rec_id(fds_record_desc_t *p_desc, uint32_t record_id)
Function for obtaining a descriptor from a record ID.
ret_code_t fds_record_iterate(fds_record_desc_t *p_desc, fds_find_token_t *p_token)
Function for iterating through all records in flash.
ret_code_t fds_file_delete(uint16_t file_id)
Function for deleting all records in a file.
ret_code_t fds_gc(void)
Function for running garbage collection.
fds_evt_id_t
FDS event IDs.
ret_code_t fds_record_find_in_file(uint16_t file_id, fds_record_desc_t *p_desc, fds_find_token_t *p_token)
Function for searching for any record in a file.
ret_code_t fds_record_update(fds_record_desc_t *p_desc, fds_record_t const *p_record)
Function for updating a record.
ret_code_t fds_record_open(fds_record_desc_t *p_desc, fds_flash_record_t *p_flash_record)
Function for opening a record for reading.
ret_code_t fds_record_find_by_key(uint16_t record_key, fds_record_desc_t *p_desc, fds_find_token_t *p_token)
Function for searching for records with a given record key.
ret_code_t fds_register(fds_cb_t cb)
Function for registering an FDS event handler.
ret_code_t fds_record_close(fds_record_desc_t *p_desc)
Function for closing a record.
ret_code_t fds_record_delete(fds_record_desc_t *p_desc)
Function for deleting a record.
@ FDS_ERR_NOT_FOUND
Error. The record was not found.
@ FDS_ERR_INTERNAL
Error. An internal error occurred.
@ FDS_ERR_INVALID_ARG
Error. The parameter contains invalid data.
@ FDS_ERR_NO_PAGES
Error. No flash pages are available.
@ FDS_ERR_USER_LIMIT_REACHED
Error. The maximum number of users has been reached.
@ FDS_ERR_NO_SPACE_IN_QUEUES
Error. There is no space in the internal queues.
@ FDS_ERR_RECORD_TOO_LARGE
Error. The record exceeds the maximum allowed size.
@ FDS_ERR_NULL_ARG
Error. The parameter is NULL.
@ FDS_ERR_NO_OPEN_RECORDS
Error. The record is not open, so it cannot be closed.
@ FDS_ERR_UNALIGNED_ADDR
Error. The input data is not aligned to a word boundary.
@ FDS_ERR_BUSY
Error. The underlying flash subsystem was busy.
@ FDS_ERR_NO_SPACE_IN_FLASH
Error. There is no space in flash memory.
@ FDS_ERR_OPERATION_TIMEOUT
Error. The operation timed out.
@ FDS_SUCCESS
The operation completed successfully.
@ FDS_ERR_CRC_CHECK_FAILED
Error. The CRC check failed.
@ FDS_ERR_NOT_INITIALIZED
Error. The module has not been initialized.
@ FDS_EVT_DEL_FILE
Event for fds_file_delete.
@ FDS_EVT_INIT
Event for fds_init.
@ FDS_EVT_GC
Event for fds_gc.
@ FDS_EVT_DEL_RECORD
Event for fds_record_delete.
@ FDS_EVT_UPDATE
Event for fds_record_update.
@ FDS_EVT_WRITE
Event for fds_record_write and fds_record_write_reserved.
fds_evt_id_t id
The event ID. See fds_evt_id_t.
ret_code_t result
The result of the operation related to this event.
A token to keep information about the progress of fds_record_find, fds_record_find_by_key,...
Structure that can be used to read the contents of a record stored in flash.
fds_header_t const * p_header
Location of the record header in flash.
void const * p_data
Location of the record data in flash.
The record descriptor structure that is used to manipulate records.
uint16_t gc_run_count
Number of times garbage collection has been run.
uint32_t record_id
The unique record ID.
bool record_is_open
Whether the record is currently open.
uint32_t const * p_record
The last known location of the record in flash.
A record to be written to flash.
uint16_t file_id
The ID of the file that the record belongs to.
uint16_t key
The record key.
A token to a reserved space in flash, created by fds_reserve.
uint16_t length_words
The amount of space reserved (in 4-byte words).
uint16_t page
The logical ID of the page where space was reserved.
uint16_t words_reserved
The number of words reserved by fds_reserve().
bool corruption
Filesystem corruption has been detected.
uint16_t open_records
The number of open records.
uint16_t freeable_words
The largest number of words that can be reclaimed by garbage collection.
uint16_t valid_records
The number of valid records.
uint16_t pages_available
The number of pages available.
uint16_t largest_contig
The largest number of free contiguous words in the file system.
uint16_t words_used
The number of words written to flash, including those reserved for future writes.
uint16_t dirty_records
The number of deleted ("dirty") records.