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_channel_crosscompare.h File Reference

The actual A-vs-B cross-compare decision: does this cycle's own M24/M15 answer match what the peer independently decided? Reads this cycle's inputs from ctx->cyc_* (populated by ab_gp_channel.c's own ab_gp_channel_read_channels()/ ab_gp_channel_read_and_stash_peer_sample()); writes ctx->cyc_agree. More...

Include dependency graph for ab_gp_channel_crosscompare.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

rte_status_t ab_gp_channel_crosscompare_init (ab_gp_channel_context_t *ctx)
 Creates this channel's rte_cross_comparator_t. Called once from ab_gp_channel_crosscompare_setup() (AB/GP/com/ab_gp_channel.c). RCA/OCORA Phase 2b: no backing rte_channel_t "sources" to register any more - ab_gp_channel_crosscompare_execute() calls rte_cross_comparator_execute_buffers() with local/peer bytes directly (see ab_gp_channel_crosscompare.c's own header).
rte_status_t ab_gp_channel_crosscompare_execute (ab_gp_channel_context_t *ctx)
 Runs one cycle's cross-compare decision - see this file's own header. This is ab_gp_channel.c's ab_gp_channel_crosscompare_run() (decision 2 of 2 behind main/execute.c's own ab_gp_channel_execute() orchestrator)'s entire body; ab_gp_channel_crosscompare_run() itself is a thin wrapper that just calls this.
void ab_gp_channel_crosscompare_check_site_state (ab_gp_channel_context_t *ctx)
 Reacts to the A/B role agreement verdict: this channel's own independently-negotiated {online, single_mode} against whatever the local A<->B peer most recently sent via PEER_MSG_KIND_SITE_STATE (ctx->peer_site_state, read by Platform_RTE's rte_site_role through the sibling source). The rule, its 3-strike count, the NEGOTIATION_MISMATCH event and the cached sibling facts live in rte_site_role (REQ-SITEROLE-014/016, ADR-040 step 5b), which runs the check inside rte_site_role_execute(); this function only reads rte_site_role_sibling_verdict(). A confirmed mismatch reacts exactly like a genuine M24/M15 DISAGREE (FAULTED, REBOOT - see RTE_EXAMPLE_REASON_AB_SITE_STATE_MISMATCH's own doc) and never returns in that case (REQ-COMMON-SAFESTATE-002). Called from ab_gp_channel_read_channels(), after this cycle's own negotiate step (ab_gp_channel_negotiate_execute()) has run, so the verdict is that execute's.

Detailed Description

The actual A-vs-B cross-compare decision: does this cycle's own M24/M15 answer match what the peer independently decided? Reads this cycle's inputs from ctx->cyc_* (populated by ab_gp_channel.c's own ab_gp_channel_read_channels()/ ab_gp_channel_read_and_stash_peer_sample()); writes ctx->cyc_agree.

The actual AGREED/DISAGREED decision is delegated to a real framework rte_cross_comparator_t (ADR-025) - see ab_gp_channel_crosscompare_init() - rather than a hand-rolled local == peer check: this is exactly the 2-way independent- peer-consistency use case that module exists for. The "not comparable this cycle" pre-checks (no data yet, CRC not ok, cycle-skew too large) stay outside the comparator - those are "don't compare at all" cases, not "compared and disagreed" ones.

A genuine, CRC-clean logical DISAGREE (both messages verify fine, but a different M24/M15 decision) is treated as a fault requiring this site to stop influencing the live output: it sets ctx->own_faulted, shuts this process's own links/tasks down cleanly, and diverts into RTE_SAFESTATE_LEVEL_REBOOT - never returning control (REQ-COMMON-SAFESTATE-002). This channel's own inter-site negotiation link (ab_gp_channel_negotiate.c) relays ctx->own_faulted to its counterpart on the other site the next cycle, which promotes itself to ONLINE if it was STANDBY. Because that reaction is REBOOT (not the comparator's own built-in SAFE trigger) and needs this file's own cleanup first (ab_gp_channel_shutdown()), the comparator is configured with trigger_safestate_on_disagreement = false and this reaction instead lives entirely in the on_disagreement callback - see ab_gp_channel_crosscompare.c's xcompare_on_disagreement().

This file also reacts the same way to a NEGOTIATION mismatch: A's and B's own independently-negotiated {is_online, single_mode} (each via its own separate inter-site link) are cross-checked every cycle over the existing local A<->B peer link (PEER_MSG_KIND_SITE_STATE) - see ab_gp_channel_crosscompare_check_site_state(). A judgment call (see RTE_EXAMPLE_REASON_AB_SITE_STATE_MISMATCH's own doc, common_config.h): trades some availability for never letting A and B act on a disagreed site-role.

Definition in file ab_gp_channel_crosscompare.h.

Function Documentation

◆ ab_gp_channel_crosscompare_init()

rte_status_t ab_gp_channel_crosscompare_init ( ab_gp_channel_context_t * ctx)

Creates this channel's rte_cross_comparator_t. Called once from ab_gp_channel_crosscompare_setup() (AB/GP/com/ab_gp_channel.c). RCA/OCORA Phase 2b: no backing rte_channel_t "sources" to register any more - ab_gp_channel_crosscompare_execute() calls rte_cross_comparator_execute_buffers() with local/peer bytes directly (see ab_gp_channel_crosscompare.c's own header).

Parameters
ctxContext to initialize the comparator into (ctx->xcompare_cmp). Must not be NULL.
Returns
RTE_STATUS_OK on success; the underlying rte_cross_comparator_init() status on failure (this is a fixed, always-valid local configuration, so failure here would indicate a genuine programming error, not a runtime condition - see the call site's own handling).

Definition at line 237 of file ab_gp_channel_crosscompare.c.

◆ ab_gp_channel_crosscompare_execute()

rte_status_t ab_gp_channel_crosscompare_execute ( ab_gp_channel_context_t * ctx)

Runs one cycle's cross-compare decision - see this file's own header. This is ab_gp_channel.c's ab_gp_channel_crosscompare_run() (decision 2 of 2 behind main/execute.c's own ab_gp_channel_execute() orchestrator)'s entire body; ab_gp_channel_crosscompare_run() itself is a thin wrapper that just calls this.

Parameters
ctxInitialized context, with this cycle's ctx->cyc_* fields already populated by ab_gp_channel_read_channels()/ ab_gp_channel_read_and_stash_peer_sample().
Returns
RTE_STATUS_OK for every outcome that returns at all (including "nothing to compare this cycle") - see this file's own header for the one outcome (DISAGREE) that never returns.

Definition at line 420 of file ab_gp_channel_crosscompare.c.

◆ ab_gp_channel_crosscompare_check_site_state()

void ab_gp_channel_crosscompare_check_site_state ( ab_gp_channel_context_t * ctx)

Reacts to the A/B role agreement verdict: this channel's own independently-negotiated {online, single_mode} against whatever the local A<->B peer most recently sent via PEER_MSG_KIND_SITE_STATE (ctx->peer_site_state, read by Platform_RTE's rte_site_role through the sibling source). The rule, its 3-strike count, the NEGOTIATION_MISMATCH event and the cached sibling facts live in rte_site_role (REQ-SITEROLE-014/016, ADR-040 step 5b), which runs the check inside rte_site_role_execute(); this function only reads rte_site_role_sibling_verdict(). A confirmed mismatch reacts exactly like a genuine M24/M15 DISAGREE (FAULTED, REBOOT - see RTE_EXAMPLE_REASON_AB_SITE_STATE_MISMATCH's own doc) and never returns in that case (REQ-COMMON-SAFESTATE-002). Called from ab_gp_channel_read_channels(), after this cycle's own negotiate step (ab_gp_channel_negotiate_execute()) has run, so the verdict is that execute's.

Parameters
ctxInitialized context. Must not be NULL.

Definition at line 501 of file ab_gp_channel_crosscompare.c.