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

Implementation of the safe-state transition facility (ADR-004). More...

Include dependency graph for rte_safestate.c:

Go to the source code of this file.

Functions

static bool rte_safestate_level_to_index (rte_safestate_level_t level, size_t *out_index)
 Maps a level enumerator to its handler-array index.
rte_status_t rte_safestate_register_handler (rte_safestate_level_t level, rte_safestate_handler_t handler)
 Registers the reaction handler for one safe-state level. This is how an integrator supplies their own implementation of "what happens when this level is entered" (ADR-004 section 2.2).
void rte_safestate_enter (rte_safestate_level_t level, rte_safestate_reason_t reason, const char *file, int32_t line, const char *message)
 Enters a safe-state level: invokes the registered handler (if any), then, for RTE_SAFESTATE_LEVEL_SAFE and RTE_SAFESTATE_LEVEL_REBOOT, guarantees the call never returns (REQ-COMMON-SAFESTATE-002) even if no handler was registered or the handler itself returns.

Variables

static rte_safestate_handler_t s_handlers [3] = { NULL, NULL, NULL }

Detailed Description

Implementation of the safe-state transition facility (ADR-004).

Definition in file rte_safestate.c.

Function Documentation

◆ rte_safestate_level_to_index()

bool rte_safestate_level_to_index ( rte_safestate_level_t level,
size_t * out_index )
static

Maps a level enumerator to its handler-array index.

Global variables declarations Local function declarations

Parameters
levelLevel to map.
out_indexReceives the handler-array index. Must not be NULL.
Returns
true and sets *out_index if level is a known value; false (index left unset) otherwise.

Definition at line 96 of file rte_safestate.c.

Variable Documentation

◆ s_handlers

rte_safestate_handler_t s_handlers[3] = { NULL, NULL, NULL }
static

Local makros Local types declarations Local variables declarations One handler slot per rte_safestate_level_t value; no dynamic allocation.

Definition at line 15 of file rte_safestate.c.