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.h File Reference

OS Abstraction Layer - Timer service. More...

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

Go to the source code of this file.

Data Structures

struct  sapi_timer_config_t
 Configuration for sapi_timer_create(). More...

Typedefs

typedef struct sapi_timer_impl_s * sapi_timer_handle_t
typedef void(*) sapi_timer_callback_t(sapi_timer_handle_t handle, void *user_ctx)
 Signature for a timer expiry callback.

Enumerations

enum  sapi_timer_mode_t { SAPI_TIMER_MODE_ONE_SHOT = 0 , SAPI_TIMER_MODE_PERIODIC = 1 }
 Whether a timer fires once or repeatedly every period_ms. More...

Functions

 SAFEAPI_DECLARE_STORAGE (sapi_timer_storage_t, 64U)
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.

Detailed Description

OS Abstraction Layer - Timer service.

Provides one-shot and periodic timers with millisecond resolution for deadline supervision (e.g. ERTMS movement authority timeouts, cyclic task watchdogs). See ADR-001.

REQ-OAL-TIMER-001: no dynamic allocation; caller supplies storage. REQ-OAL-TIMER-002: callback execution time is the caller's responsibility to bound; the timer service itself must not block.

Definition in file sapi_timer.h.