Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
|
Non-volatile Storage APIs . More...
Functions | |
int | nvs_mount (struct nvs_fs *fs) |
Mount an NVS file system onto the flash device specified in fs . | |
int | nvs_clear (struct nvs_fs *fs) |
Clear the NVS file system from flash. | |
ssize_t | nvs_write (struct nvs_fs *fs, uint16_t id, const void *data, size_t len) |
Write an entry to the file system. | |
int | nvs_delete (struct nvs_fs *fs, uint16_t id) |
Delete an entry from the file system. | |
ssize_t | nvs_read (struct nvs_fs *fs, uint16_t id, void *data, size_t len) |
Read an entry from the file system. | |
ssize_t | nvs_read_hist (struct nvs_fs *fs, uint16_t id, void *data, size_t len, uint16_t cnt) |
Read a history entry from the file system. | |
ssize_t | nvs_calc_free_space (struct nvs_fs *fs) |
Calculate the available free space in the file system. | |
size_t | nvs_sector_max_data_size (struct nvs_fs *fs) |
Tell how many contiguous free space remains in the currently active NVS sector. | |
int | nvs_sector_use_next (struct nvs_fs *fs) |
Close the currently active sector and switch to the next one. | |
Non-volatile Storage APIs .
#include <zephyr/fs/nvs.h>
Calculate the available free space in the file system.
fs | Pointer to file system |
int nvs_clear | ( | struct nvs_fs * | fs | ) |
#include <zephyr/fs/nvs.h>
Clear the NVS file system from flash.
fs | Pointer to file system |
0 | Success |
-ERRNO | errno code if error |
#include <zephyr/fs/nvs.h>
Delete an entry from the file system.
fs | Pointer to file system |
id | Id of the entry to be deleted |
0 | Success |
-ERRNO | errno code if error |
int nvs_mount | ( | struct nvs_fs * | fs | ) |
#include <zephyr/fs/nvs.h>
Mount an NVS file system onto the flash device specified in fs
.
fs | Pointer to file system |
0 | Success |
-ERRNO | errno code if error |
#include <zephyr/fs/nvs.h>
Read an entry from the file system.
fs | Pointer to file system |
id | Id of the entry to be read |
data | Pointer to data buffer |
len | Number of bytes to be read |
#include <zephyr/fs/nvs.h>
Read a history entry from the file system.
fs | Pointer to file system |
id | Id of the entry to be read |
data | Pointer to data buffer |
len | Number of bytes to be read |
cnt | History counter: 0: latest entry, 1: one before latest ... |
#include <zephyr/fs/nvs.h>
Tell how many contiguous free space remains in the currently active NVS sector.
fs | Pointer to the file system. |
int nvs_sector_use_next | ( | struct nvs_fs * | fs | ) |
#include <zephyr/fs/nvs.h>
Close the currently active sector and switch to the next one.
fs | Pointer to the file system. |
#include <zephyr/fs/nvs.h>
Write an entry to the file system.
len
parameter is equal to 0
then entry is effectively removed (it is equivalent to calling of nvs_delete). Any calls to nvs_read for entries with data of length 0
will return error.fs | Pointer to file system |
id | Id of the entry to be written |
data | Pointer to the data to be written |
len | Number of bytes to be written |