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

Timer service: validates parameters, then dispatches to the backend registered via sapi_timer_register_backend() (ADR-005). More...

Include dependency graph for sapi_timer.c:

Go to the source code of this file.

Functions

sapi_status_t sapi_timer_register_backend (const sapi_timer_backend_t *backend)
 Registers the backend implementation used by every sapi_timer_* call. This is how an integrator supplies their own timer implementation (ADR-005 section 2.1) - call once at startup, before any other sapi_timer_* function.
sapi_status_t sapi_timer_create (sapi_timer_storage_t *storage, const sapi_timer_config_t *config, sapi_timer_handle_t *out_handle)
 Creates a timer bound to caller-owned storage. Does not start it.
sapi_status_t sapi_timer_start (sapi_timer_handle_t handle)
 Starts (or restarts) a created timer.
sapi_status_t sapi_timer_stop (sapi_timer_handle_t handle)
 Stops a running timer; safe to call on an already-stopped timer.
sapi_status_t sapi_timer_destroy (sapi_timer_handle_t handle)
 Destroys a timer, releasing any backend resources bound to it.
sapi_status_t sapi_timer_now (sapi_timestamp_ms_t *out_now_ms)
 Returns the current monotonic time base used by all timers.

Variables

static const sapi_timer_backend_ts_backend = NULL
 Currently registered backend, or NULL if none (ADR-005).

Detailed Description

Timer service: validates parameters, then dispatches to the backend registered via sapi_timer_register_backend() (ADR-005).

Definition in file sapi_timer.c.

Variable Documentation

◆ s_backend

const sapi_timer_backend_t* s_backend = NULL
static

Currently registered backend, or NULL if none (ADR-005).

Local makros Local types declarations Local variables declarations

Definition at line 17 of file sapi_timer.c.