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_lifecycle.c
Go to the documentation of this file.
1
9
11
13
18static bool g_setup_locked = false;
19
21
23
24
27{
28 g_setup_locked = true;
29}
30
32{
33 g_setup_locked = false;
34}
35
37{
38 return g_setup_locked;
39}
40
42{
44
46 {
47 /* REQ-LIFECYCLE-003: report the violation (DEGRADED returns; the caller still gets INVALID_STATE and
48 * the integrator's DEGRADED handler decides what it means). */
50 (int32_t)__LINE__, "setup-only resource requested after the setup phase was locked");
52 }
53 return status;
54}
rte_status_t rte_lifecycle_check_setup_allowed(void)
Convenience check for a setup-only constructor: call this as one of the first checks in any function ...
void rte_lifecycle_lock(void)
Locks the application's setup phase.
void rte_lifecycle_unlock(void)
Unlocks the application's setup phase (setup is allowed again).
bool rte_lifecycle_is_locked(void)
#define RTE_SAFESTATE_REASON_SETUP_AFTER_INIT
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_SAF...
@ RTE_SAFESTATE_LEVEL_DEGRADED
rte_status_t
Common result/status codes.
Definition rte_status.h:27
@ RTE_STATUS_INVALID_STATE
Definition rte_status.h:40
@ RTE_STATUS_OK
Definition rte_status.h:28
static bool g_setup_locked
Single, process-wide setup-phase flag (single instance; no dynamic allocation - same posture as rte_a...
Process-wide application setup-phase lock (ADR-026).
Safe-state transitions and checked assertions (ADR-004).