Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_reboot.c
Go to the documentation of this file.
1
10
12
14
17static const sapi_reboot_backend_t *s_backend = NULL;
18
20
22
23
26{
27 sapi_status_t lifecycle_status;
28
29 if (backend == NULL)
30 {
32 }
33 /* REQ-LIFECYCLE-001 (ADR-026): registering a backend is a setup-only
34 * action - refuse once the application's setup phase has been locked. */
35 lifecycle_status = sapi_lifecycle_check_setup_allowed();
36 if (lifecycle_status != SAPI_STATUS_OK)
37 {
38 return lifecycle_status;
39 }
40 s_backend = backend;
41 return SAPI_STATUS_OK;
42}
43
45{
46 if (s_backend == NULL)
47 {
49 }
50 if (s_backend->request == NULL)
51 {
53 }
54 return s_backend->request(reason_code);
55}
sapi_status_t sapi_lifecycle_check_setup_allowed(void)
Convenience check for a setup-only constructor: call this as one of the first checks in any function ...
sapi_status_t sapi_reboot_register_backend(const sapi_reboot_backend_t *backend)
Registers the backend implementation used by sapi_reboot_request() (ADR-005 section 2....
Definition sapi_reboot.c:25
sapi_status_t sapi_reboot_request(uint16_t reason_code)
Requests a controlled system restart.
Definition sapi_reboot.c:44
sapi_status_t
Common result/status codes.
Definition sapi_status.h:27
@ SAPI_STATUS_NOT_SUPPORTED
Definition sapi_status.h:34
@ SAPI_STATUS_INVALID_PARAM
Definition sapi_status.h:29
@ SAPI_STATUS_NOT_INITIALIZED
Definition sapi_status.h:30
@ SAPI_STATUS_OK
Definition sapi_status.h:28
static const sapi_clocksync_backend_t * s_backend
Process-wide application setup-phase lock (ADR-026).
OS Abstraction Layer - Controlled reboot service (ADR-004 section 3).
OS-backend adaptation surface for the Controlled Reboot service (ADR-004 section 3,...
Backend vtable: an integrator's implementation of the reboot mechanism for a specific target (ADR-005...
sapi_status_t(*) request(uint16_t reason_code)
Backend implementation of sapi_reboot_request(). May be NULL.