RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Loading...
Searching...
No Matches
ab_gp_standby_policy.c File Reference

See ab_gp_standby_policy.h. More...

#include "ab_gp_standby_policy.h"
#include <stddef.h>
Include dependency graph for ab_gp_standby_policy.c:

Go to the source code of this file.

Functions

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.
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 contact.

Detailed Description

Function Documentation

◆ 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.

A channel that starts receiving later than its sibling (after a staggered restart, its relay from the Gateway is not flowing yet) can miss a train's connect; the session tables then differ and the A/B cross-compare would declare a divergence and reboot a channel. Within the join window, a session the sibling holds and this channel lacks is copied (the same kind of state transfer as at a promotion); everything after that is computed independently and cross-compared as usual. Anything else that differs is NOT adopted: it is a real divergence.

Parameters
join_leftcycles left in the join window (0 = closed)
local_in_usethis channel holds the session
peer_in_usethe A/B sibling holds the session
Returns
true to copy the sibling's session

Definition at line 9 of file ab_gp_standby_policy.c.

◆ 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 contact.

The rule of the stall detector in ab_gp_channel_wait_cycle_tick(): an ONLINE channel whose previous cycle tick is more than AB_GP_STALL_LOST_CONTACT_MS back treats itself as having lost contact (the caller then calls rte_site_role_note_lost_contact()). Both times are the full 64-bit monotonic time; the previous tick used to be kept in 32 bits, which made the difference wrong from 2^32 ms of monotonic time on (ISS-052).

now_ms smaller than last_ms gives a large unsigned difference, so the answer is true. That only happens when rte_timer_now() fails and leaves 0 in the caller's variable; the ignored status is ISS-036 and this function keeps the behaviour the detector had before.

Parameters
last_msmonotonic time of the previous cycle tick (0 = no cycle yet)
now_msmonotonic time of this cycle tick
is_onlinethis channel is ONLINE
stalled_msout, may be NULL: now_ms - last_ms, written only when the result is true
Returns
true when the channel is ONLINE, has a previous cycle tick and that tick is more than AB_GP_STALL_LOST_CONTACT_MS back; false otherwise

Definition at line 14 of file ab_gp_standby_policy.c.