Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_nvm.h
Go to the documentation of this file.
1
16#ifndef SAFEAPI_OS_NVM_H
17#define SAFEAPI_OS_NVM_H
18
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27SAFEAPI_DECLARE_STORAGE(sapi_nvm_storage_t, 64U);
28
30typedef struct sapi_nvm_impl_s *sapi_nvm_handle_t;
31
33typedef struct sapi_nvm_config_s
34{
35 const char *region_name;
36 size_t region_size;
38
51sapi_status_t sapi_nvm_open(sapi_nvm_storage_t *storage,
52 const sapi_nvm_config_t *config,
53 sapi_nvm_handle_t *out_handle);
54
68 size_t offset,
69 void *out_buffer,
70 size_t buffer_size);
71
83 size_t offset,
84 const void *buffer,
85 size_t buffer_size);
86
95
104
105/*
106 * The backend vtable (sapi_nvm_backend_t) and sapi_nvm_register_backend()
107 * live in safeapi_backend/nvm/sapi_nvm_backend.h, not here (ADR-021).
108 * This header is the consumer-facing surface only.
109 */
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif /* SAFEAPI_OS_NVM_H */
116 /* NVM */
sapi_status_t sapi_nvm_open(sapi_nvm_storage_t *storage, const sapi_nvm_config_t *config, sapi_nvm_handle_t *out_handle)
Opens (creating if necessary) a named NVM region.
Definition sapi_nvm.c:44
sapi_status_t sapi_nvm_sync(sapi_nvm_handle_t handle)
Forces any buffered writes to durable storage.
Definition sapi_nvm.c:108
sapi_status_t sapi_nvm_close(sapi_nvm_handle_t handle)
Closes an NVM region handle.
Definition sapi_nvm.c:125
sapi_status_t sapi_nvm_read(sapi_nvm_handle_t handle, size_t offset, void *out_buffer, size_t buffer_size)
Reads and integrity-checks data from an NVM region.
Definition sapi_nvm.c:68
struct sapi_nvm_impl_s * sapi_nvm_handle_t
Opaque handle to an open NVM region, returned by sapi_nvm_open().
Definition sapi_nvm.h:30
sapi_status_t sapi_nvm_write(sapi_nvm_handle_t handle, size_t offset, const void *buffer, size_t buffer_size)
Writes data and its integrity metadata to an NVM region.
Definition sapi_nvm.c:88
sapi_status_t
Common result/status codes.
Definition sapi_status.h:27
#define SAFEAPI_DECLARE_STORAGE(type_name, byte_size)
Declares an opaque, fixed-size, aligned storage type for a service's handle. The real internal layout...
Definition sapi_types.h:69
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
Configuration for sapi_nvm_open().
Definition sapi_nvm.h:34
const char * region_name
Definition sapi_nvm.h:35
size_t region_size
Definition sapi_nvm.h:36