RTE RBC 2oo2 Reference Application
0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Toggle main menu visibility
Loading...
Searching...
No Matches
ab_gp_standby_policy.c
Go to the documentation of this file.
1
5
#include "
ab_gp_standby_policy.h
"
6
7
#include <stddef.h>
8
9
bool
ab_gp_session_adopt_allowed
(uint32_t join_left,
bool
local_in_use,
bool
peer_in_use)
10
{
11
return
(join_left > 0U) && !local_in_use && peer_in_use;
12
}
13
14
bool
ab_gp_stall_lost_contact
(rte_timestamp_ms_t last_ms, rte_timestamp_ms_t now_ms,
bool
is_online,
15
rte_timestamp_ms_t *stalled_ms)
16
{
17
bool
lost =
false
;
18
19
if
((last_ms != 0U) && is_online)
20
{
21
/* Unsigned 64-bit difference: now_ms < last_ms wraps to a large value (see the header, ISS-036). */
22
const
rte_timestamp_ms_t elapsed_ms = now_ms - last_ms;
23
24
if
(elapsed_ms > (rte_timestamp_ms_t)
AB_GP_STALL_LOST_CONTACT_MS
)
25
{
26
lost =
true
;
27
if
(stalled_ms != NULL)
28
{
29
*stalled_ms = elapsed_ms;
30
}
31
}
32
}
33
return
lost;
34
}
ab_gp_stall_lost_contact
bool ab_gp_stall_lost_contact(rte_timestamp_ms_t last_ms, rte_timestamp_ms_t now_ms, bool is_online, rte_timestamp_ms_t *stalled_ms)
Whether a channel that wakes up at a cycle tick has stalled long enough to count as having lost conta...
Definition
ab_gp_standby_policy.c:14
ab_gp_session_adopt_allowed
bool ab_gp_session_adopt_allowed(uint32_t join_left, bool local_in_use, bool peer_in_use)
Whether a channel that has just become ONLINE adopts one train session from its A/B sibling.
Definition
ab_gp_standby_policy.c:9
ab_gp_standby_policy.h
GP-specific standby and site-link constants, the session-adoption rule and the stall rule.
AB_GP_STALL_LOST_CONTACT_MS
#define AB_GP_STALL_LOST_CONTACT_MS
Definition
ab_gp_standby_policy.h:22
src
application
AB
GP
com
ab_gp_standby_policy.c
Generated by
1.18.0