|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Timer provides one-shot or periodic callbacks with millisecond resolution. Caller provides storage; framework manages state. Callbacks fired by system tick (typically 1ms from monotonic clock).
Caller provides 64-byte storage via rte_timer_storage_t. Framework uses for internal state. Caller keeps valid for timer lifetime.
Called when timer expires. Runs in callback context (may be ISR on some OSAdapters). Keep execution time minimal.
Framework needs monotonic clock with ~1ms resolution. OSAdapter provides. Every tick, all active timers decrement countdown. On zero, callback fires.
| Operation | Time |
|---|---|
| create() | O(1) |
| start() | O(1) |
| stop() | O(1) |
| destroy() | O(1) |
| tick() | O(n) [n = active timers] |
Tick is only O(n) operation; typically called once per millisecond.
Min period - 1ms (timer resolution) Max period - 2^32 - 1 ms (~49 days) Storage size - 64 bytes Callback time - Caller's responsibility to bound