198#include "px_log_fs_cfg.h"
208#if (PX_LOG_FS_CFG_VER < 2)
209#error "New log_fs not backwards compatible with existing file system"
213#if ( !defined(PX_LOG_FS_CFG_VER ) \
214 || !defined(PX_LOG_FS_CFG_PAGE_SIZE ) \
215 || !defined(PX_LOG_FS_CFG_ERASE_BLOCK_SIZE ) \
216 || !defined(PX_LOG_FS_CFG_REC_DATA_SIZE ) \
217 || !defined(PX_LOG_FS_CFG_STOP_WR_WHEN_FULL) )
218#error "One or more options not defined in 'px_log_fs_cfg.h'"
221#if (PX_LOG_FS_CFG_ERASE_BLOCK_SIZE == 0)
222#error "PX_LOG_FS_CFG_ERASE_BLOCK_SIZE cannot be zero"
224#if(!PX_VAL_IS_PWR_OF_TWO(PX_LOG_FS_CFG_ERASE_BLOCK_SIZE))
225#error "PX_LOG_FS_CFG_ERASE_BLOCK_SIZE must be a multiple of two, e.g. 1, 2, 4, 8, 16, ..."
277 uint16_t fs_page_start,
278 uint16_t fs_page_end);
290 uint16_t fs_page_start,
291 uint16_t fs_page_end);
uint16_t fs_page_start
First page in file system (must be on the start of an erase block)
uint16_t offset
Offset inside page.
uint16_t page_nr_next
Next page number to use (starts at 0)
bool archive_flag
Flag is set if current read record is archived.
px_log_fs_adr_t adr_rd
Current read address.
uint16_t page_last
Last page with records (PX_LOG_FS_PAGE_INVALID if empty)
uint16_t page_first
First page with records (PX_LOG_FS_PAGE_INVALID if empty)
px_log_fs_adr_t adr_wr
Next write address (open position)
uint16_t fs_page_end
Last page in file system (must be on the end of an erase block)
px_log_fs_err_t px_log_fs_reset(px_log_fs_handle_t *handle, uint16_t fs_page_start, uint16_t fs_page_end)
Reset log file system.
px_log_fs_err_t px_log_fs_init(px_log_fs_handle_t *handle, uint16_t fs_page_start, uint16_t fs_page_end)
Initialise log file system.
px_log_fs_err_t px_log_fs_rd_next(px_log_fs_handle_t *handle, void *data, size_t nr_of_bytes)
Read next (newer) record.
px_log_fs_err_t px_log_fs_rd_first(px_log_fs_handle_t *handle, void *data, size_t nr_of_bytes)
Read first (oldest) record.
px_log_fs_err_t px_log_fs_rd_previous(px_log_fs_handle_t *handle, void *data, size_t nr_of_bytes)
Read previous (older) record.
px_log_fs_err_t px_log_fs_wr(px_log_fs_handle_t *handle, const void *data, size_t nr_of_bytes)
Write a record to the file.
px_log_fs_err_t
Error codes.
px_log_fs_err_t px_log_fs_rd_first_unarchived(px_log_fs_handle_t *handle, void *data, size_t nr_of_bytes)
Read first (oldest) unarchived record.
void px_log_fs_dbg_report_info(px_log_fs_handle_t *handle)
Report log file system info.
bool px_log_fs_rd_rec_is_archived(px_log_fs_handle_t *handle)
See if currently read record is archived or not.
px_log_fs_err_t px_log_fs_rd_rec_set_archive(px_log_fs_handle_t *handle)
Set currently read record as archived.
px_log_fs_err_t px_log_fs_rd_last(px_log_fs_handle_t *handle, void *data, size_t nr_of_bytes)
Read last (newest) record.
@ PX_LOG_FS_ERR_NONE
No error.
@ PX_LOG_FS_ERR_WRITE_FAIL
Failed to write.
@ PX_LOG_FS_ERR_NO_RECORD
No record found.
@ PX_LOG_FS_ERR_EMPTY
File is empty.
@ PX_LOG_FS_ERR_FATAL
Fatal file system error.
@ PX_LOG_FS_ERR_FULL
File is full.
Specification of data address in Serial Flash.