Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
fcb.h File Reference
#include <inttypes.h>
#include <limits.h>
#include <zephyr/storage/flash_map.h>
#include <zephyr/sys/util_macro.h>
#include <zephyr/kernel.h>

Go to the source code of this file.

Data Structures

struct  fcb_entry
 FCB entry info structure. More...
 
struct  fcb_entry_ctx
 Structure for transferring complete information about FCB entry location within flash memory. More...
 
struct  fcb
 FCB instance structure. More...
 

Macros

#define FCB_MAX_LEN   (0x3fffu)
 Max length of element (16,383)
 
#define FCB_ENTRY_FA_DATA_OFF(entry)
 Helper macro for calculating the data offset related to the fcb flash_area start offset.
 
#define FCB_FLAGS_CRC_DISABLED   BIT(0)
 Flag to disable CRC for the fcb_entries in flash.
 

Typedefs

typedef int(* fcb_walk_cb) (struct fcb_entry_ctx *loc_ctx, void *arg)
 FCB Walk callback function type.
 

Functions

int fcb_init (int f_area_id, struct fcb *fcbp)
 Initialize FCB instance.
 
int fcb_append (struct fcb *fcbp, uint16_t len, struct fcb_entry *loc)
 Appends an entry to circular buffer.
 
int fcb_append_finish (struct fcb *fcbp, struct fcb_entry *append_loc)
 Finishes entry append operation.
 
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_getnext (struct fcb *fcbp, struct fcb_entry *loc)
 Get next fcb entry location.
 
int fcb_rotate (struct fcb *fcbp)
 Rotate fcb sectors.
 
int fcb_append_to_scratch (struct fcb *fcbp)
 Start using the scratch block.
 
int fcb_free_sector_cnt (struct fcb *fcbp)
 Get free sector count.
 
int fcb_is_empty (struct fcb *fcbp)
 Check whether FCB has any data.
 
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_clear (struct fcb *fcbp)
 Clear fcb instance storage.
 
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.