|
Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Fixed-size memory pools reserved at initialization (ADR-001). More...
Files | |
| file | src/oal/memory/sapi_memory.c |
| Memory pool service: validates parameters, then dispatches to the backend registered via sapi_mem_pool_register_backend() (ADR-005). | |
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. | |
Fixed-size memory pools reserved at initialization (ADR-001).
| typedef struct sapi_mem_pool_impl_s* sapi_mem_pool_handle_t |
Opaque handle to a reserved pool, returned by sapi_mem_pool_create().
Definition at line 32 of file sapi_memory.h.
| 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.
| storage | Caller-owned storage for the handle's state. Must not be NULL. |
| config | Pool configuration. Must not be NULL; config->block_size and config->block_count must both be > 0. |
| out_handle | Receives the created pool's handle. Must not be NULL. |
Definition at line 44 of file sapi_memory.c.
| sapi_status_t sapi_mem_pool_acquire | ( | sapi_mem_pool_handle_t | handle, |
| void ** | out_block ) |
Acquires one fixed-size block from the pool.
| handle | Pool handle. Must not be NULL. |
| out_block | Receives a pointer to the acquired block. Must not be NULL; set to NULL on failure. |
Definition at line 77 of file sapi_memory.c.
| sapi_status_t sapi_mem_pool_release | ( | sapi_mem_pool_handle_t | handle, |
| void * | block ) |
Returns a previously acquired block to its pool.
| handle | Pool handle. Must not be NULL. |
| block | Block previously returned by sapi_mem_pool_acquire(). Must not be NULL. |
Definition at line 95 of file sapi_memory.c.
| 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.
| handle | Pool handle. Must not be NULL. |
| out_free_blocks | Receives the number of free blocks. Must not be NULL. |
| out_used_blocks | Receives the number of used blocks. Must not be NULL. |
Definition at line 112 of file sapi_memory.c.