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.h
Go to the documentation of this file.
1
28#ifndef RTE_COMMON_SAFESTATE_H
29#define RTE_COMMON_SAFESTATE_H
30
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
55
63typedef uint16_t rte_safestate_reason_t;
64
66#define RTE_SAFESTATE_REASON_UNSPECIFIED ((rte_safestate_reason_t)0U)
68#define RTE_SAFESTATE_REASON_ASSERT_FAILED ((rte_safestate_reason_t)1U)
71#define RTE_SAFESTATE_REASON_CHECKPOINT_TIMEOUT ((rte_safestate_reason_t)2U)
75#define RTE_SAFESTATE_REASON_SETUP_AFTER_INIT ((rte_safestate_reason_t)3U)
78#define RTE_SAFESTATE_REASON_OSA_RT_ATTRIBUTE ((rte_safestate_reason_t)4U)
82#define RTE_SAFESTATE_REASON_CLOCK_FAILED ((rte_safestate_reason_t)5U)
84#define RTE_SAFESTATE_REASON_APPLICATION_BASE ((rte_safestate_reason_t)4096U)
85
104 const char *file,
105 int32_t line,
106 const char *message);
107
123
144 const char *file,
145 int32_t line,
146 const char *message);
147
156#define RTE_ASSERT(cond) \
157 do \
158 { \
159 if (!(cond)) \
160 { \
161 rte_safestate_enter(RTE_SAFESTATE_LEVEL_SAFE, \
162 RTE_SAFESTATE_REASON_ASSERT_FAILED, \
163 __FILE__, (int32_t)__LINE__, #cond); \
164 } \
165 } while (0)
166
172#define RTE_SAFESTATE(level, reason) \
173 rte_safestate_enter((level), (reason), __FILE__, (int32_t)__LINE__, NULL)
174
180#define RTE_REBOOT(reason) \
181 rte_safestate_enter(RTE_SAFESTATE_LEVEL_REBOOT, (reason), __FILE__, (int32_t)__LINE__, NULL)
182
183#ifdef __cplusplus
184}
185#endif
186
187#endif /* RTE_COMMON_SAFESTATE_H */
188 /* SAFESTATE */
rte_safestate_level_t
Safe-state severity levels (ADR-004 section 2.1).
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...
uint16_t rte_safestate_reason_t
Diagnostic reason code accompanying a safe-state transition.
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...
void(*) rte_safestate_handler_t(rte_safestate_level_t level, rte_safestate_reason_t reason, const char *file, int32_t line, const char *message)
Application-supplied reaction for one safe-state level.
@ RTE_SAFESTATE_LEVEL_REBOOT
@ RTE_SAFESTATE_LEVEL_DEGRADED
@ RTE_SAFESTATE_LEVEL_SAFE
rte_status_t
Common result/status codes.
Definition rte_status.h:27
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...