Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_memory.h File Reference

OS Abstraction Layer - Static memory reservation service. More...

Include dependency graph for sapi_memory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sapi_mem_pool_config_t
 Configuration for sapi_mem_pool_create(). More...

Typedefs

typedef struct sapi_mem_pool_impl_s * sapi_mem_pool_handle_t
 Opaque handle to a reserved pool, returned by sapi_mem_pool_create().

Functions

 SAFEAPI_DECLARE_STORAGE (sapi_mem_pool_storage_t, 64U)
 Caller-owned, fixed-size storage backing one sapi_mem_pool_handle_t.
sapi_status_t sapi_mem_pool_create (sapi_mem_pool_storage_t *storage, const sapi_mem_pool_config_t *config, sapi_mem_pool_handle_t *out_handle)
 Reserves a fixed-size-block memory pool.
sapi_status_t sapi_mem_pool_acquire (sapi_mem_pool_handle_t handle, void **out_block)
 Acquires one fixed-size block from the pool.
sapi_status_t sapi_mem_pool_release (sapi_mem_pool_handle_t handle, void *block)
 Returns a previously acquired block to its pool.
sapi_status_t sapi_mem_pool_stats (sapi_mem_pool_handle_t handle, size_t *out_free_blocks, size_t *out_used_blocks)
 Reports current free/used block counts for diagnostics.

Detailed Description

OS Abstraction Layer - Static memory reservation service.

Reserves fixed-size memory pools/partitions at initialization time. There is deliberately no free-form malloc/free in this API: safety-related code shall only draw fixed-size blocks from pools sized and reserved up front. See ADR-001, section 3.2.

REQ-OAL-MEM-001: all pools are reserved during system initialization; reservation after the init phase is backend-defined and may be refused (SAPI_STATUS_NOT_SUPPORTED).

Definition in file sapi_memory.h.