nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
emds.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef EMDS_H__
15#define EMDS_H__
16
17#include <stddef.h>
18#include <sys/types.h>
19#include <zephyr/sys/util.h>
20#include <zephyr/sys/slist.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
31struct emds_entry {
33 uint16_t id;
35 uint8_t *data;
37 size_t len;
38};
39
48 sys_snode_t node;
49};
50
62#define EMDS_STATIC_ENTRY_DEFINE(_name, _id, _data, _len) \
63 static const STRUCT_SECTION_ITERABLE(emds_entry, emds_##_name) = { \
64 .id = _id, \
65 .data = (uint8_t *)_data, \
66 .len = _len, \
67 }
68
81typedef void (*emds_store_cb_t)(void);
82
96
112
136int emds_store(void);
137
151int emds_load(void);
152
164int emds_clear(void);
165
180int emds_prepare(void);
181
195int emds_store_time_get(uint32_t *store_time_us);
196
208int emds_store_size_get(size_t *store_size);
209
218bool emds_is_ready(void);
219
220#ifdef __cplusplus
221}
222#endif
223
224#endif /* EMDS_H__ */
225
int emds_store_time_get(uint32_t *store_time_us)
Estimate the time needed to store the registered data.
int emds_store_size_get(size_t *store_size)
Calculate the size needed to store the registered data.
bool emds_is_ready(void)
Check if the store operation can be run.
int emds_entry_add(struct emds_dynamic_entry *entry)
Add entry to be saved/restored when emergency data storage is called.
int emds_store(void)
Start the emergency data storage process.
void(* emds_store_cb_t)(void)
Callback for application commands when storing has been executed.
Definition emds.h:81
int emds_clear(void)
Clear flash areas allocated for the emergency data storage.
int emds_load(void)
Load all static data from the emergency data storage.
int emds_init(emds_store_cb_t cb)
Initialize the emergency data storage.
int emds_prepare(void)
Prepare flash area for the next emergency data storage.
struct emds_entry entry
Definition emds.h:47
sys_snode_t node
Definition emds.h:48
Definition emds.h:46
uint16_t id
Definition emds.h:33
size_t len
Definition emds.h:37
uint8_t * data
Definition emds.h:35
Definition emds.h:31