|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
One-shot and periodic timers with millisecond resolution (ADR-001). More...
Files | |
| file | src/oal/timer/rte_timer.c |
| Timer service: validates parameters, then dispatches to the OSAdapter registered via rte_osadapter_timer_register() (ADR-005). | |
Data Structures | |
| struct | rte_timer_config_t |
| Configuration for rte_timer_create(). More... | |
Typedefs | |
| typedef struct rte_timer_impl_s * | rte_timer_handle_t |
| typedef void(*) | rte_timer_callback_t(rte_timer_handle_t handle, void *user_ctx) |
| Signature for a timer expiry callback. | |
Enumerations | |
| enum | rte_timer_mode_t { RTE_TIMER_MODE_ONE_SHOT = 0 , RTE_TIMER_MODE_PERIODIC = 1 } |
| Whether a timer fires once or repeatedly every period_ms. More... | |
Functions | |
| RTE_DECLARE_STORAGE (rte_timer_storage_t, 64U) | |
| rte_status_t | rte_timer_create (rte_timer_storage_t *storage, const rte_timer_config_t *config, rte_timer_handle_t *out_handle) |
| Creates a timer bound to caller-owned storage. Does not start it. | |
| rte_status_t | rte_timer_start (rte_timer_handle_t handle) |
| Starts (or restarts) a created timer. | |
| rte_status_t | rte_timer_stop (rte_timer_handle_t handle) |
| Stops a running timer; safe to call on an already-stopped timer. | |
| rte_status_t | rte_timer_destroy (rte_timer_handle_t handle) |
| Destroys a timer, releasing any OSAdapter resources bound to it. | |
| rte_status_t | rte_timer_now (rte_timestamp_ms_t *out_now_ms) |
| Returns the current monotonic time base used by all timers. | |
One-shot and periodic timers with millisecond resolution (ADR-001).
| typedef struct rte_timer_impl_s* rte_timer_handle_t |
Opaque handle bound to a rte_timer_storage_t after rte_timer_create().
Definition at line 31 of file rte_timer.h.
| typedef void(*) rte_timer_callback_t(rte_timer_handle_t handle, void *user_ctx) |
Signature for a timer expiry callback.
| handle | The timer that expired. |
| user_ctx | Opaque context pointer supplied at creation time. |
REQ-OAL-TIMER-003: the callback executes in a bounded-time, non-blocking context (exact context - task/ISR - is osadapter-defined and documented by the OSAdapter implementation).
Definition at line 49 of file rte_timer.h.
| enum rte_timer_mode_t |
Whether a timer fires once or repeatedly every period_ms.
| Enumerator | |
|---|---|
| RTE_TIMER_MODE_ONE_SHOT | Fires once after period_ms, then stops. |
| RTE_TIMER_MODE_PERIODIC | Fires every period_ms until stopped. |
Definition at line 34 of file rte_timer.h.
| RTE_DECLARE_STORAGE | ( | rte_timer_storage_t | , |
| 64U | ) |
Opaque caller-owned storage for one timer instance. Size is part of the ABI.
| rte_status_t rte_timer_create | ( | rte_timer_storage_t * | storage, |
| const rte_timer_config_t * | config, | ||
| rte_timer_handle_t * | out_handle ) |
Creates a timer bound to caller-owned storage. Does not start it.
| storage | Caller-owned storage the timer's state is placed into. Must not be NULL and must outlive the timer. |
| config | Timer configuration. Must not be NULL; config->callback must not be NULL and config->period_ms must be > 0. |
| out_handle | Receives the created timer's handle. Must not be NULL. |
Definition at line 44 of file rte_timer.c.
| rte_status_t rte_timer_start | ( | rte_timer_handle_t | handle | ) |
Starts (or restarts) a created timer.
| handle | Timer to start. Must not be NULL. |
Definition at line 79 of file rte_timer.c.
| rte_status_t rte_timer_stop | ( | rte_timer_handle_t | handle | ) |
Stops a running timer; safe to call on an already-stopped timer.
| handle | Timer to stop. Must not be NULL. |
Definition at line 105 of file rte_timer.c.
| rte_status_t rte_timer_destroy | ( | rte_timer_handle_t | handle | ) |
Destroys a timer, releasing any OSAdapter resources bound to it.
| handle | Timer to destroy. Must not be NULL. Invalid to use after this call. |
Definition at line 122 of file rte_timer.c.
| rte_status_t rte_timer_now | ( | rte_timestamp_ms_t * | out_now_ms | ) |
Returns the current monotonic time base used by all timers.
| out_now_ms | Receives the current time in milliseconds. Must not be NULL; set to 0 if this call fails. |
Definition at line 139 of file rte_timer.c.