|
Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Implementation of the safe-state transition facility (ADR-004). More...
#include "safeapi/utils/safestate/sapi_safestate.h"#include "safeapi/utils/lifecycle/sapi_lifecycle.h"Go to the source code of this file.
Functions | |
| static bool | sapi_safestate_level_to_index (sapi_safestate_level_t level, size_t *out_index) |
| Maps a level enumerator to its handler-array index. | |
| sapi_status_t | sapi_safestate_register_handler (sapi_safestate_level_t level, sapi_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 | sapi_safestate_enter (sapi_safestate_level_t level, sapi_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 SAPI_SAFESTATE_LEVEL_SAFE and SAPI_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 sapi_safestate_handler_t | s_handlers [3] = { NULL, NULL, NULL } |
Implementation of the safe-state transition facility (ADR-004).
Definition in file sapi_safestate.c.
|
static |
Maps a level enumerator to its handler-array index.
Global variables declarations Local function declarations
| level | Level to map. |
| out_index | Receives the handler-array index. Must not be NULL. |
Definition at line 96 of file sapi_safestate.c.
|
static |
Local makros Local types declarations Local variables declarations One handler slot per sapi_safestate_level_t value; no dynamic allocation.
Definition at line 15 of file sapi_safestate.c.