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

Stage-then-commit output queue for this cycle's own DECISION output (ADR-034): the peer AB_SAMPLE and the train/CTC/IL relay messages built from this cycle's own ma_logic result. Queued via ab_gp_channel_stage_peer()/_stage_relay() instead of sending immediately, then either transmitted (via the real ab_gp_channel_send_peer()/_send_relay()) or discarded once the cycle's own checkpoint rendezvous confirms - or fails to confirm. More...

#include "ab_gp_channel.h"
#include "ab_gp_channel_types.h"
Include dependency graph for ab_gp_channel_stage.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ab_gp_channel_stage_reset (ab_gp_channel_handle_t handle)
 Clears this cycle's pending-send queue.
rte_status_t ab_gp_channel_stage_peer (ab_gp_channel_handle_t handle, const uint8_t *bytes, size_t size)
 Queues a peer-link send for this cycle - does not transmit yet.
rte_status_t ab_gp_channel_stage_crosscompare (ab_gp_channel_handle_t handle, uint8_t kind, const uint8_t *payload, size_t size)
 Queues a crosscompare-link send for this cycle - does not transmit yet.
rte_status_t ab_gp_channel_stage_relay (ab_gp_channel_handle_t handle, rte_example_relay_kind_t kind, uint8_t index, const uint8_t *bytes, size_t size)
 Queues a relay-link send for this cycle - does not transmit yet.
rte_status_t ab_gp_channel_commit_pending_sends (ab_gp_channel_handle_t handle)
 Transmits every send queued this cycle (through the real ab_gp_channel_send_peer()/_send_relay()), then clears the queue.
void ab_gp_channel_discard_pending_sends (ab_gp_channel_handle_t handle)
 Discards every send queued this cycle without transmitting it, then clears the queue.

Detailed Description

Stage-then-commit output queue for this cycle's own DECISION output (ADR-034): the peer AB_SAMPLE and the train/CTC/IL relay messages built from this cycle's own ma_logic result. Queued via ab_gp_channel_stage_peer()/_stage_relay() instead of sending immediately, then either transmitted (via the real ab_gp_channel_send_peer()/_send_relay()) or discarded once the cycle's own checkpoint rendezvous confirms - or fails to confirm.

  • that both A/B channels took the same program path this cycle.

Deliberately narrow: protocol/liveness traffic that must keep flowing regardless of this cycle's own checkpoint outcome (the PEER_MSG_KIND_CHECKPOINT_REPLY reply to the peer's own request, IL keepalives, the PEER_MSG_KIND_SITE_STATE echo) is NOT staged here - it still goes out immediately via ab_gp_channel_send_peer()/_send_relay(), unchanged.

Definition in file ab_gp_channel_stage.h.

Function Documentation

◆ ab_gp_channel_stage_reset()

void ab_gp_channel_stage_reset ( ab_gp_channel_handle_t handle)

Clears this cycle's pending-send queue.

Call once per cycle, before any ab_gp_channel_stage_peer()/ ab_gp_channel_stage_relay() call this cycle - see ab_gp_channel_pre_execute()'s own call site (the natural per-cycle reset point, ahead of anything this cycle might stage).

Global functions

Definition at line 26 of file ab_gp_channel_stage.c.

◆ ab_gp_channel_stage_peer()

rte_status_t ab_gp_channel_stage_peer ( ab_gp_channel_handle_t handle,
const uint8_t * bytes,
size_t size )

Queues a peer-link send for this cycle - does not transmit yet.

Returns
RTE_STATUS_OK if queued; RTE_STATUS_INVALID_PARAM for a NULL handle/bytes or size 0; RTE_STATUS_RESOURCE_EXHAUSTED if the fixed-size queue (AB_GP_MAX_STAGED_SENDS_PER_CYCLE) is already full this cycle - a real, checked bound (MISRA: no dynamic allocation), not silently dropped.

Definition at line 37 of file ab_gp_channel_stage.c.

◆ ab_gp_channel_stage_crosscompare()

rte_status_t ab_gp_channel_stage_crosscompare ( ab_gp_channel_handle_t handle,
uint8_t kind,
const uint8_t * payload,
size_t size )

Queues a crosscompare-link send for this cycle - does not transmit yet.

Returns
Same return contract as ab_gp_channel_stage_peer().

Definition at line 48 of file ab_gp_channel_stage.c.

◆ ab_gp_channel_stage_relay()

rte_status_t ab_gp_channel_stage_relay ( ab_gp_channel_handle_t handle,
rte_example_relay_kind_t kind,
uint8_t index,
const uint8_t * bytes,
size_t size )

Queues a relay-link send for this cycle - does not transmit yet.

Returns
Same return contract as ab_gp_channel_stage_peer().

Definition at line 64 of file ab_gp_channel_stage.c.

◆ ab_gp_channel_commit_pending_sends()

rte_status_t ab_gp_channel_commit_pending_sends ( ab_gp_channel_handle_t handle)

Transmits every send queued this cycle (through the real ab_gp_channel_send_peer()/_send_relay()), then clears the queue.

Call from ab_gp_channel_on_checkpoint_result() when committed == true.

Returns
RTE_STATUS_OK if every queued send's own transport call returned OK; the first non-OK status encountered otherwise (the remaining queued sends are still attempted - a single link hiccup should not silently drop every other cycle's output too).

Definition at line 76 of file ab_gp_channel_stage.c.

◆ ab_gp_channel_discard_pending_sends()

void ab_gp_channel_discard_pending_sends ( ab_gp_channel_handle_t handle)

Discards every send queued this cycle without transmitting it, then clears the queue.

Call from ab_gp_channel_on_checkpoint_result() when committed == false (this cycle's checkpoint did not confirm both channels took the same program path - see ADR-034).

Definition at line 124 of file ab_gp_channel_stage.c.