Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
retention.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_RETENTION_
13#define ZEPHYR_INCLUDE_RETENTION_
14
15#include <stdint.h>
16#include <stddef.h>
17#include <sys/types.h>
18#include <zephyr/kernel.h>
19#include <zephyr/device.h>
20#include <zephyr/types.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
35typedef ssize_t (*retention_size_api)(const struct device *dev);
36typedef int (*retention_is_valid_api)(const struct device *dev);
37typedef int (*retention_read_api)(const struct device *dev, off_t offset, uint8_t *buffer,
38 size_t size);
39typedef int (*retention_write_api)(const struct device *dev, off_t offset,
40 const uint8_t *buffer, size_t size);
41typedef int (*retention_clear_api)(const struct device *dev);
42
50
59ssize_t retention_size(const struct device *dev);
60
71int retention_is_valid(const struct device *dev);
72
84int retention_read(const struct device *dev, off_t offset, uint8_t *buffer, size_t size);
85
98int retention_write(const struct device *dev, off_t offset, const uint8_t *buffer, size_t size);
99
107int retention_clear(const struct device *dev);
108
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* ZEPHYR_INCLUDE_RETENTION_ */
int(* retention_write_api)(const struct device *dev, off_t offset, const uint8_t *buffer, size_t size)
Definition retention.h:39
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),...
int(* retention_read_api)(const struct device *dev, off_t offset, uint8_t *buffer, size_t size)
Definition retention.h:37
ssize_t(* retention_size_api)(const struct device *dev)
Definition retention.h:35
int retention_read(const struct device *dev, off_t offset, uint8_t *buffer, size_t size)
Reads data from the retention area.
int(* retention_clear_api)(const struct device *dev)
Definition retention.h:41
int retention_is_valid(const struct device *dev)
Checks if the underlying data in the retention area is valid or not.
int retention_clear(const struct device *dev)
Clears all data in the retention area (sets it to 0)
int(* retention_is_valid_api)(const struct device *dev)
Definition retention.h:36
ssize_t retention_size(const struct device *dev)
Returns the size of the retention area.
Public kernel APIs.
__SIZE_TYPE__ ssize_t
Definition types.h:28
__INTPTR_TYPE__ off_t
Definition types.h:36
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
Definition retention.h:43
retention_write_api write
Definition retention.h:47
retention_is_valid_api is_valid
Definition retention.h:45
retention_clear_api clear
Definition retention.h:48
retention_size_api size
Definition retention.h:44
retention_read_api read
Definition retention.h:46