Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Toggle main menu visibility
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
19
#include "
safeapi/utils/status/sapi_status.h
"
20
#include "
safeapi/utils/types/sapi_types.h
"
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
27
SAFEAPI_DECLARE_STORAGE
(sapi_nvm_storage_t, 64U);
28
30
typedef
struct
sapi_nvm_impl_s *
sapi_nvm_handle_t
;
31
33
typedef
struct
sapi_nvm_config_s
34
{
35
const
char
*
region_name
;
36
size_t
region_size
;
37
}
sapi_nvm_config_t
;
38
51
sapi_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
67
sapi_status_t
sapi_nvm_read
(
sapi_nvm_handle_t
handle,
68
size_t
offset,
69
void
*out_buffer,
70
size_t
buffer_size);
71
82
sapi_status_t
sapi_nvm_write
(
sapi_nvm_handle_t
handle,
83
size_t
offset,
84
const
void
*buffer,
85
size_t
buffer_size);
86
94
sapi_status_t
sapi_nvm_sync
(
sapi_nvm_handle_t
handle);
95
103
sapi_status_t
sapi_nvm_close
(
sapi_nvm_handle_t
handle);
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_nvm_open
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_nvm_sync
sapi_status_t sapi_nvm_sync(sapi_nvm_handle_t handle)
Forces any buffered writes to durable storage.
Definition
sapi_nvm.c:108
sapi_nvm_close
sapi_status_t sapi_nvm_close(sapi_nvm_handle_t handle)
Closes an NVM region handle.
Definition
sapi_nvm.c:125
sapi_nvm_read
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
sapi_nvm_handle_t
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_nvm_write
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
sapi_status_t
Common result/status codes.
Definition
sapi_status.h:27
SAFEAPI_DECLARE_STORAGE
#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
sapi_status.h
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
sapi_types.h
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
sapi_nvm_config_t
Configuration for sapi_nvm_open().
Definition
sapi_nvm.h:34
sapi_nvm_config_t::region_name
const char * region_name
Definition
sapi_nvm.h:35
sapi_nvm_config_t::region_size
size_t region_size
Definition
sapi_nvm.h:36
include
safeapi
oal
nvm
sapi_nvm.h
Generated by
1.18.0