Safe API Framework
0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Toggle main menu visibility
Loading...
Searching...
No Matches
rte_reboot.c
Go to the documentation of this file.
1
7
#include "
rte/oal/reboot/rte_reboot.h
"
8
#include "
rte/utils/lifecycle/rte_lifecycle.h
"
9
#include "
rte_osadapter/reboot/rte_osadapter_reboot.h
"
10
12
14
17
static
const
rte_osadapter_reboot_t
*
s_osadapter
= NULL;
18
20
22
23
25
rte_status_t
rte_osadapter_reboot_register
(
const
rte_osadapter_reboot_t
*osadapter)
26
{
27
rte_status_t
lifecycle_status;
28
29
if
(osadapter == NULL)
30
{
31
return
RTE_STATUS_INVALID_PARAM
;
32
}
33
/* REQ-LIFECYCLE-001 (ADR-026): registering an OSAdapter is a setup-only
34
* action - refuse once the application's setup phase has been locked. */
35
lifecycle_status =
rte_lifecycle_check_setup_allowed
();
36
if
(lifecycle_status !=
RTE_STATUS_OK
)
37
{
38
return
lifecycle_status;
39
}
40
s_osadapter
= osadapter;
41
return
RTE_STATUS_OK
;
42
}
43
44
rte_status_t
rte_reboot_request
(uint16_t reason_code)
45
{
46
if
(
s_osadapter
== NULL)
47
{
48
return
RTE_STATUS_NOT_INITIALIZED
;
49
}
50
if
(
s_osadapter
->request == NULL)
51
{
52
return
RTE_STATUS_NOT_SUPPORTED
;
53
}
54
return
s_osadapter
->request(reason_code);
55
}
rte_lifecycle_check_setup_allowed
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 ...
Definition
rte_lifecycle.c:41
rte_reboot_request
rte_status_t rte_reboot_request(uint16_t reason_code)
Requests a controlled system restart.
Definition
rte_reboot.c:44
rte_status_t
rte_status_t
Common result/status codes.
Definition
rte_status.h:27
RTE_STATUS_OK
@ RTE_STATUS_OK
Definition
rte_status.h:28
RTE_STATUS_INVALID_PARAM
@ RTE_STATUS_INVALID_PARAM
Definition
rte_status.h:29
RTE_STATUS_NOT_SUPPORTED
@ RTE_STATUS_NOT_SUPPORTED
Definition
rte_status.h:34
RTE_STATUS_NOT_INITIALIZED
@ RTE_STATUS_NOT_INITIALIZED
Definition
rte_status.h:30
s_osadapter
static const rte_osadapter_clocksync_t * s_osadapter
Definition
rte_clocksync.c:18
rte_lifecycle.h
Process-wide application setup-phase lock (ADR-026).
rte_osadapter_reboot.h
OSAdapter interface for controlled system reboot.
rte_osadapter_reboot_register
rte_status_t rte_osadapter_reboot_register(const rte_osadapter_reboot_t *adapter)
Registers the OSAdapter reboot implementation.
Definition
rte_reboot.c:25
rte_reboot.h
OS Abstraction Layer - Controlled reboot service (ADR-004 section 3).
rte_osadapter_reboot_t
OSAdapter reboot operations vtable.
Definition
rte_osadapter_reboot.h:22
src
oal
reboot
rte_reboot.c
Generated by
1.18.0