oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
nvs.h
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
26#ifndef OVE_NVS_H
27#define OVE_NVS_H
28
29#include "ove/types.h"
30#include "ove_config.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#ifdef CONFIG_OVE_NVS
37
47int ove_nvs_init(void);
48
58void ove_nvs_deinit(void);
59
77int ove_nvs_read(const char *key, void *buf, size_t buf_len,
78 size_t *out_len);
79
93int ove_nvs_write(const char *key, const void *data, size_t len);
94
105int ove_nvs_erase(const char *key);
106
107#else /* !CONFIG_OVE_NVS */
108
109static inline int ove_nvs_init(void) { return OVE_ERR_NOT_SUPPORTED; }
110static inline void ove_nvs_deinit(void) { }
111static inline int ove_nvs_read(const char *key, void *buf, size_t buf_len, size_t *out_len) { (void)key; (void)buf; (void)buf_len; (void)out_len; return OVE_ERR_NOT_SUPPORTED; }
112static inline int ove_nvs_write(const char *key, const void *data, size_t len) { (void)key; (void)data; (void)len; return OVE_ERR_NOT_SUPPORTED; }
113static inline int ove_nvs_erase(const char *key) { (void)key; return OVE_ERR_NOT_SUPPORTED; }
114
115#endif /* CONFIG_OVE_NVS */
116
117#ifdef __cplusplus
118}
119#endif
120
/* end of ove_nvs group */
122
123#endif /* OVE_NVS_H */
int ove_nvs_write(const char *key, const void *data, size_t len)
Write or update a value in non-volatile storage.
int ove_nvs_read(const char *key, void *buf, size_t buf_len, size_t *out_len)
Read a value from non-volatile storage by key.
int ove_nvs_erase(const char *key)
Delete a key-value pair from non-volatile storage.
void ove_nvs_deinit(void)
Deinitialise the non-volatile storage subsystem.
int ove_nvs_init(void)
Initialise the non-volatile storage subsystem.
#define OVE_ERR_NOT_SUPPORTED
The requested feature is not supported by the active backend.
Definition types.h:38