Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Flash Circular Buffer APIs. More...
Typedefs | |
typedef int(* | fcb_walk_cb) (struct fcb_entry_ctx *loc_ctx, void *arg) |
Functions | |
int | fcb_init (int f_area_id, struct fcb *fcb) |
int | fcb_append (struct fcb *fcb, uint16_t len, struct fcb_entry *loc) |
int | fcb_append_finish (struct fcb *fcb, struct fcb_entry *append_loc) |
int | fcb_walk (struct fcb *fcb, struct flash_sector *sector, fcb_walk_cb cb, void *cb_arg) |
int | fcb_getnext (struct fcb *fcb, struct fcb_entry *loc) |
int | fcb_rotate (struct fcb *fcb) |
int | fcb_append_to_scratch (struct fcb *fcb) |
int | fcb_free_sector_cnt (struct fcb *fcb) |
int | fcb_is_empty (struct fcb *fcb) |
int | fcb_offset_last_n (struct fcb *fcb, uint8_t entries, struct fcb_entry *last_n_entry) |
int | fcb_clear (struct fcb *fcb) |
Flash Circular Buffer APIs.
typedef int(* fcb_walk_cb) (struct fcb_entry_ctx *loc_ctx, void *arg) |
#include <include/fs/fcb.h>
FCB Walk callback function type.
Type of function which is expected to be called while walking over fcb entries thanks to a fcb_walk call.
Entry data can be read using flash_area_read(), using loc_ctx fields as arguments. If cb wants to stop the walk, it should return non-zero value.
[in] | loc_ctx | entry location information (full context) |
[in,out] | arg | callback context, transferred from fcb_walk. |
#include <include/fs/fcb.h>
Appends an entry to circular buffer.
When writing the contents for the entry, use loc->fe_sector and loc->fe_data_off with flash_area_write() to fcb flash_area. When you're finished, call fcb_append_finish() with loc as argument.
[in] | fcb | FCB instance structure. |
[in] | len | Length of data which are expected to be written as the entry payload. |
[out] | loc | entry location information |
#include <include/fs/fcb.h>
Finishes entry append operation.
[in] | fcb | FCB instance structure. |
[in] | append_loc | entry location information |
int fcb_append_to_scratch | ( | struct fcb * | fcb | ) |
#include <include/fs/fcb.h>
int fcb_clear | ( | struct fcb * | fcb | ) |
#include <include/fs/fcb.h>
Clear fcb instance storage.
[in] | fcb | FCB instance structure. |
int fcb_free_sector_cnt | ( | struct fcb * | fcb | ) |
#include <include/fs/fcb.h>
Get free sector count.
[in] | fcb | FCB instance structure. |
#include <include/fs/fcb.h>
Get next fcb entry location.
Function to obtain fcb entry location in relation to entry pointed by
loc. If loc->fe_sector is set and loc->fe_elem_off is not 0 function fetches next fcb entry location. If loc->fe_sector is NULL function fetches the oldest entry location within FCB storage. loc->fe_sector is set and loc->fe_elem_off is 0 function fetches the first entry location in the fcb sector.
[in] | fcb | FCB instance structure. |
[in,out] | loc | entry location information |
int fcb_init | ( | int | f_area_id, |
struct fcb * | fcb | ||
) |
#include <include/fs/fcb.h>
Initialize FCB instance.
[in] | f_area_id | ID of flash area where fcb storage resides. |
[in,out] | fcb | FCB instance structure. |
int fcb_is_empty | ( | struct fcb * | fcb | ) |
#include <include/fs/fcb.h>
Check whether FCB has any data.
[in] | fcb | FCB instance structure. |
#include <include/fs/fcb.h>
Finds the fcb entry that gives back up to n entries at the end.
[in] | fcb | FCB instance structure. |
[in] | entries | number of fcb entries the user wants to get |
[out] | last_n_entry | last_n_entry the fcb_entry to be returned |
int fcb_rotate | ( | struct fcb * | fcb | ) |
#include <include/fs/fcb.h>
int fcb_walk | ( | struct fcb * | fcb, |
struct flash_sector * | sector, | ||
fcb_walk_cb | cb, | ||
void * | cb_arg | ||
) |
#include <include/fs/fcb.h>
Walk over all entries in the FCB sector
[in] | sector | fcb sector to be walked. If null, traverse entire storage. |
[in] | fcb | FCB instance structure. |
[in] | cb | pointer to the function which gets called for every entry. If cb wants to stop the walk, it should return non-zero value. |
[in,out] | cb_arg | callback context, transferred to the callback implementation. |