7#ifndef ZEPHYR_INCLUDE_FS_FCB_H_
8#define ZEPHYR_INCLUDE_FS_FCB_H_
40#define FCB_MAX_LEN (0x3fffu)
70#define FCB_ENTRY_FA_DATA_OFF(entry) (entry.fe_sector->fs_off +\
85#define FCB_FLAGS_CRC_DISABLED BIT(0)
140#ifdef CONFIG_FCB_ALLOW_FIXED_ENDMARKER
329 void *dst,
size_t len);
343 const void *src,
size_t len);
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa off
Definition: asm-macro-32-bit-gnu.h:17
Public API for flash map.
int fcb_append_to_scratch(struct fcb *fcbp)
Start using the scratch block.
int fcb_getnext(struct fcb *fcbp, struct fcb_entry *loc)
Get next fcb entry location.
int fcb_free_sector_cnt(struct fcb *fcbp)
Get free sector count.
int fcb_clear(struct fcb *fcbp)
Clear fcb instance storage.
int fcb_append_finish(struct fcb *fcbp, struct fcb_entry *append_loc)
Finishes entry append operation.
int fcb_init(int f_area_id, struct fcb *fcbp)
Initialize FCB instance.
int fcb_offset_last_n(struct fcb *fcbp, uint8_t entries, struct fcb_entry *last_n_entry)
Finds the fcb entry that gives back up to n entries at the end.
int fcb_rotate(struct fcb *fcbp)
Rotate fcb sectors.
int fcb_walk(struct fcb *fcbp, struct flash_sector *sector, fcb_walk_cb cb, void *cb_arg)
Walk over all entries in the FCB sector.
int fcb_append(struct fcb *fcbp, uint16_t len, struct fcb_entry *loc)
Appends an entry to circular buffer.
int fcb_is_empty(struct fcb *fcbp)
Check whether FCB has any data.
int(* fcb_walk_cb)(struct fcb_entry_ctx *loc_ctx, void *arg)
FCB Walk callback function type.
Definition: fcb.h:209
int fcb_flash_read(const struct fcb *fcbp, const struct flash_sector *sector, off_t off, void *dst, size_t len)
Read raw data from the fcb flash sector.
int fcb_flash_write(const struct fcb *fcbp, const struct flash_sector *sector, off_t off, const void *src, size_t len)
Write raw data to the fcb flash sector.
__INTPTR_TYPE__ off_t
Definition: types.h:36
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Structure for transferring complete information about FCB entry location within flash memory.
Definition: fcb.h:76
struct fcb_entry loc
FCB entry info.
Definition: fcb.h:77
const struct flash_area * fap
Flash area where the entry is placed.
Definition: fcb.h:78
FCB entry info structure.
Definition: fcb.h:51
uint32_t fe_elem_off
Offset from the start of the sector to beginning of element.
Definition: fcb.h:55
uint32_t fe_data_off
Offset from the start of the sector to the start of element.
Definition: fcb.h:58
uint16_t fe_data_len
Size of data area in fcb entry.
Definition: fcb.h:61
struct flash_sector * fe_sector
Pointer to info about sector where data are placed.
Definition: fcb.h:52
FCB instance structure.
Definition: fcb.h:94
uint8_t f_version
Current version number of the data.
Definition: fcb.h:105
const struct flash_area * fap
Flash area used by the fcb instance, internal state.
Definition: fcb.h:131
struct k_mutex f_mtx
Locking for accessing the FCB data, internal state.
Definition: fcb.h:116
struct fcb_entry f_active
internal state
Definition: fcb.h:124
uint32_t f_magic
Magic value, should not be 0xFFFFFFFF.
Definition: fcb.h:96
uint8_t f_erase_value
The value flash takes when it is erased.
Definition: fcb.h:136
uint16_t f_active_id
Flash location where the newest data is, internal state.
Definition: fcb.h:125
uint8_t f_sector_cnt
Number of elements in sector array.
Definition: fcb.h:106
uint8_t f_align
writes to flash have to aligned to this, internal state
Definition: fcb.h:128
uint8_t f_scratch_cnt
Number of sectors to keep empty.
Definition: fcb.h:107
struct flash_sector * f_oldest
Pointer to flash sector containing the oldest data, internal state.
Definition: fcb.h:119
struct flash_sector * f_sectors
Array of sectors, must be contiguous.
Definition: fcb.h:112
Flash partition.
Definition: flash_map.h:59
Structure for transfer flash sector boundaries.
Definition: flash_map.h:81
Mutex Structure.
Definition: kernel.h:2917