Zephyr API Documentation  3.4.0
A Scalable Open Source RTOS
3.4.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
retained_mem.h File Reference

Public API for retained memory drivers. More...

#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/types.h>
#include <zephyr/sys/math_extras.h>
#include <syscalls/retained_mem.h>

Go to the source code of this file.

Data Structures

struct  retained_mem_driver_api
 Retained memory driver API API which can be used by a device to store data in a retained memory area. Retained memory is memory that is retained while the device is powered but is lost when power to the device is lost (note that low power modes in some devices may clear the data also). This may be in a non-initialised RAM region, or in specific registers, but is not reset when a different application begins execution or the device is rebooted (without power loss). It must support byte-level reading and writing without a need to erase data before writing. More...
 

Typedefs

typedef ssize_t(* retained_mem_size_api) (const struct device *dev)
 Callback API to get size of retained memory area. See retained_mem_size() for argument description.
 
typedef int(* retained_mem_read_api) (const struct device *dev, off_t offset, uint8_t *buffer, size_t size)
 Callback API to read from retained memory area. See retained_mem_read() for argument description.
 
typedef int(* retained_mem_write_api) (const struct device *dev, off_t offset, const uint8_t *buffer, size_t size)
 Callback API to write to retained memory area. See retained_mem_write() for argument description.
 
typedef int(* retained_mem_clear_api) (const struct device *dev)
 Callback API to clear retained memory area (reset all data to 0x00). See retained_mem_clear() for argument description.
 

Functions

 sizeof (size_t))
 
ssize_t retained_mem_size (const struct device *dev)
 Returns the size of the retained memory area.
 
int retained_mem_read (const struct device *dev, off_t offset, uint8_t *buffer, size_t size)
 Reads data from the Retained memory area.
 
int retained_mem_write (const struct device *dev, off_t offset, const uint8_t *buffer, size_t size)
 Writes data to the Retained memory area - underlying data does not need to be cleared prior to writing.
 
int retained_mem_clear (const struct device *dev)
 Clears data in the retained memory area by setting it to 0x00.
 

Variables

Size of off_t must be equal or less than size of size_t
 

Detailed Description

Public API for retained memory drivers.

Function Documentation

◆ sizeof()

sizeof ( size_t  )

Variable Documentation

◆ size_t

Size of off_t must be equal or less than size of size_t