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_platform.c
Go to the documentation of this file.
1
8
#include "
rte/oal/platform/rte_platform.h
"
9
#include "
rte/utils/lifecycle/rte_lifecycle.h
"
10
#include "
rte_osadapter/platform/rte_osadapter_platform.h
"
11
14
#define RTE_PLATFORM_RT_PRIORITY_MAX 99U
15
17
20
static
const
rte_osadapter_platform_t
*
s_osadapter
= NULL;
21
23
25
26
28
rte_status_t
rte_osadapter_platform_register
(
const
rte_osadapter_platform_t
*osadapter)
29
{
30
rte_status_t
lifecycle_status;
31
32
if
(osadapter == NULL)
33
{
34
return
RTE_STATUS_INVALID_PARAM
;
35
}
36
/* REQ-LIFECYCLE-001 (ADR-026): registering an OSAdapter is a setup-only
37
* action - refuse once the application's setup phase has been locked. */
38
lifecycle_status =
rte_lifecycle_check_setup_allowed
();
39
if
(lifecycle_status !=
RTE_STATUS_OK
)
40
{
41
return
lifecycle_status;
42
}
43
s_osadapter
= osadapter;
44
return
RTE_STATUS_OK
;
45
}
46
47
rte_status_t
rte_platform_realtime_init
(uint32_t rt_priority)
48
{
49
if
(rt_priority >
RTE_PLATFORM_RT_PRIORITY_MAX
)
50
{
51
return
RTE_STATUS_INVALID_PARAM
;
52
}
53
if
(
s_osadapter
== NULL)
54
{
55
return
RTE_STATUS_NOT_INITIALIZED
;
56
}
57
if
(
s_osadapter
->realtime_init == NULL)
58
{
59
return
RTE_STATUS_NOT_SUPPORTED
;
60
}
61
return
s_osadapter
->realtime_init(rt_priority);
62
}
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_platform_realtime_init
rte_status_t rte_platform_realtime_init(uint32_t rt_priority)
Applies the registered OSAdapter's real-time platform configuration for the calling process/thread....
Definition
rte_platform.c:47
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_platform.h
OSAdapter interface for real-time platform configuration.
rte_osadapter_platform_register
rte_status_t rte_osadapter_platform_register(const rte_osadapter_platform_t *adapter)
Registers the OSAdapter platform implementation.
Definition
rte_platform.c:28
RTE_PLATFORM_RT_PRIORITY_MAX
#define RTE_PLATFORM_RT_PRIORITY_MAX
Highest real-time priority rte_platform_realtime_init() accepts.
Definition
rte_platform.c:14
rte_platform.h
OS Abstraction Layer - Real-time platform configuration service (ADR-035).
rte_osadapter_platform_t
OSAdapter platform operations vtable.
Definition
rte_osadapter_platform.h:23
src
oal
platform
rte_platform.c
Generated by
1.18.0