Zephyr API 3.6.99
Loading...
Searching...
No Matches

Retention API . More...

Topics

 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)
 

Detailed Description

Retention API .

Since
3.4
Version
0.1.0

Typedef Documentation

◆ retention_clear_api

typedef int(* retention_clear_api) (const struct device *dev)

◆ retention_is_valid_api

typedef int(* retention_is_valid_api) (const struct device *dev)

◆ retention_read_api

typedef int(* retention_read_api) (const struct device *dev, off_t offset, uint8_t *buffer, size_t size)

◆ retention_size_api

typedef ssize_t(* retention_size_api) (const struct device *dev)

◆ retention_write_api

typedef int(* retention_write_api) (const struct device *dev, off_t offset, const uint8_t *buffer, size_t size)

Function Documentation

◆ retention_clear()

int retention_clear ( const struct device * dev)

#include <zephyr/retention/retention.h>

Clears all data in the retention area (sets it to 0)

Parameters
devRetention device to use.
Return values
0on success else negative errno code.

◆ retention_is_valid()

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.

Parameters
devRetention device to use.
Return values
1If successful and data is valid.
0If data is not valid.
-ENOTSUPIf there is no header/checksum configured for the retention area.
-errnoError code code.

◆ retention_read()

int retention_read ( const struct device * dev,
off_t offset,
uint8_t * buffer,
size_t size )

#include <zephyr/retention/retention.h>

Reads data from the retention area.

Parameters
devRetention device to use.
offsetOffset to read data from.
bufferBuffer to store read data in.
sizeSize of data to read.
Return values
0If successful.
-errnoError code code.

◆ retention_size()

ssize_t retention_size ( const struct device * dev)

#include <zephyr/retention/retention.h>

Returns the size of the retention area.

Parameters
devRetention device to use.
Return values
Positivevalue indicating size in bytes on success, else negative errno code.

◆ retention_write()

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().

Parameters
devRetention device to use.
offsetOffset to write data to.
bufferData to write.
sizeSize of data to be written.
Return values
0on success else negative errno code.