Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Retention API. More...
Modules | |
Boot mode interface | |
Boot mode interface. | |
Bootloader info interface | |
Bootloader info interface. | |
Data Structures | |
struct | retention_api |
Typedefs | |
typedef ssize_t(* | retention_size_api) (const struct device *dev) |
typedef int(* | retention_is_valid_api) (const struct device *dev) |
typedef int(* | retention_read_api) (const struct device *dev, off_t offset, uint8_t *buffer, size_t size) |
typedef int(* | retention_write_api) (const struct device *dev, off_t offset, const uint8_t *buffer, size_t size) |
typedef int(* | retention_clear_api) (const struct device *dev) |
Functions | |
ssize_t | retention_size (const struct device *dev) |
Returns the size of the retention area. | |
int | retention_is_valid (const struct device *dev) |
Checks if the underlying data in the retention area is valid or not. | |
int | retention_read (const struct device *dev, off_t offset, uint8_t *buffer, size_t size) |
Reads data from the retention area. | |
int | retention_write (const struct device *dev, off_t offset, const uint8_t *buffer, size_t size) |
Writes data to the retention area (underlying data does not need to be cleared prior to writing), once function returns with a success code, the data will be classed as valid if queried using retention_is_valid(). | |
int | retention_clear (const struct device *dev) |
Clears all data in the retention area (sets it to 0) | |
Retention API.
typedef int(* retention_clear_api) (const struct device *dev) |
#include <zephyr/retention/retention.h>
typedef int(* retention_is_valid_api) (const struct device *dev) |
#include <zephyr/retention/retention.h>
typedef int(* retention_read_api) (const struct device *dev, off_t offset, uint8_t *buffer, size_t size) |
#include <zephyr/retention/retention.h>
#include <zephyr/retention/retention.h>
typedef int(* retention_write_api) (const struct device *dev, off_t offset, const uint8_t *buffer, size_t size) |
#include <zephyr/retention/retention.h>
int retention_clear | ( | const struct device * | dev | ) |
#include <zephyr/retention/retention.h>
Clears all data in the retention area (sets it to 0)
dev | Retention device to use. |
0 | on success else negative errno code. |
int retention_is_valid | ( | const struct device * | dev | ) |
#include <zephyr/retention/retention.h>
Checks if the underlying data in the retention area is valid or not.
dev | Retention device to use. |
1 | If successful and data is valid. |
0 | If data is not valid. |
-ENOTSUP | If there is no header/checksum configured for the retention area. |
-errno | Error code code. |
#include <zephyr/retention/retention.h>
Reads data from the retention area.
dev | Retention device to use. |
offset | Offset to read data from. |
buffer | Buffer to store read data in. |
size | Size of data to read. |
0 | If successful. |
-errno | Error code code. |
#include <zephyr/retention/retention.h>
Returns the size of the retention area.
dev | Retention device to use. |
Positive | value indicating size in bytes on success, else negative errno code. |
int retention_write | ( | const struct device * | dev, |
off_t | offset, | ||
const uint8_t * | buffer, | ||
size_t | size | ||
) |
#include <zephyr/retention/retention.h>
Writes data to the retention area (underlying data does not need to be cleared prior to writing), once function returns with a success code, the data will be classed as valid if queried using retention_is_valid().
dev | Retention device to use. |
offset | Offset to write data to. |
buffer | Data to write. |
size | Size of data to be written. |
0 | on success else negative errno code. |