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_clocksync.c
Go to the documentation of this file.
1
6
#include "
rte/oal/clocksync/rte_clocksync.h
"
7
#include "
rte/utils/lifecycle/rte_lifecycle.h
"
8
#include "
rte_osadapter/clocksync/rte_osadapter_clocksync.h
"
9
11
13
18
static
const
rte_osadapter_clocksync_t
*
s_osadapter
= NULL;
19
21
23
24
26
rte_status_t
rte_osadapter_clocksync_register
(
const
rte_osadapter_clocksync_t
*osadapter)
27
{
28
rte_status_t
status =
RTE_STATUS_OK
;
29
30
if
(osadapter == NULL)
31
{
32
status =
RTE_STATUS_INVALID_PARAM
;
33
}
34
else
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
status =
rte_lifecycle_check_setup_allowed
();
39
if
(status ==
RTE_STATUS_OK
)
40
{
41
s_osadapter
= osadapter;
42
}
43
}
44
45
return
status;
46
}
47
48
rte_status_t
rte_clocksync_get_offset_ms
(int64_t *out_offset_ms)
49
{
50
rte_status_t
status =
RTE_STATUS_OK
;
51
52
if
(out_offset_ms == NULL)
53
{
54
status =
RTE_STATUS_INVALID_PARAM
;
55
}
56
else
if
(
s_osadapter
== NULL)
57
{
58
status =
RTE_STATUS_NOT_INITIALIZED
;
59
}
60
else
if
(
s_osadapter
->get_offset_ms == NULL)
61
{
62
status =
RTE_STATUS_NOT_SUPPORTED
;
63
}
64
else
65
{
66
status =
s_osadapter
->get_offset_ms(out_offset_ms);
67
}
68
69
return
status;
70
}
71
72
rte_status_t
rte_clocksync_get_quality
(
rte_clocksync_quality_t
*out_quality)
73
{
74
rte_status_t
status =
RTE_STATUS_OK
;
75
76
if
(out_quality == NULL)
77
{
78
status =
RTE_STATUS_INVALID_PARAM
;
79
}
80
else
if
(
s_osadapter
== NULL)
81
{
82
status =
RTE_STATUS_NOT_INITIALIZED
;
83
}
84
else
if
(
s_osadapter
->get_quality == NULL)
85
{
86
status =
RTE_STATUS_NOT_SUPPORTED
;
87
}
88
else
89
{
90
status =
s_osadapter
->get_quality(out_quality);
91
}
92
93
return
status;
94
}
rte_clocksync_quality_t
rte_clocksync_quality_t
Coarse quality/confidence of the current clock synchronization.
Definition
rte_clocksync.h:60
rte_clocksync_get_quality
rte_status_t rte_clocksync_get_quality(rte_clocksync_quality_t *out_quality)
Reports the OSAdapter's current confidence in the clock offset.
Definition
rte_clocksync.c:72
rte_clocksync_get_offset_ms
rte_status_t rte_clocksync_get_offset_ms(int64_t *out_offset_ms)
Reports this node's estimated clock offset (diagnostic/timeout- sizing only - see the file-level note...
Definition
rte_clocksync.c:48
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_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_clocksync.h
Pluggable wall-clock synchronization OSAdapter (ADR-017).
rte_lifecycle.h
Process-wide application setup-phase lock (ADR-026).
rte_osadapter_clocksync.h
OSAdapter interface for clock synchronization.
rte_osadapter_clocksync_register
rte_status_t rte_osadapter_clocksync_register(const rte_osadapter_clocksync_t *adapter)
Registers the OSAdapter clock synchronization implementation.
Definition
rte_clocksync.c:26
rte_osadapter_clocksync_t
OSAdapter clock synchronization operations vtable.
Definition
rte_osadapter_clocksync.h:22
src
oal
clocksync
rte_clocksync.c
Generated by
1.18.0