|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
#include <stdio.h>#include "rte/utils/safestate/rte_safestate.h"#include "rte/oal/timer/rte_timer.h"#include "rte/oal/log/rte_log.h"Go to the source code of this file.
Enumerations | |
| enum | rte_example_transfer_policy_t { RTE_EXAMPLE_TRANSFER_POLICY_RESTART = 0 , RTE_EXAMPLE_TRANSFER_POLICY_CONTINUE = 1 , RTE_EXAMPLE_TRANSFER_POLICY_ASK_USER = 2 } |
| Policy applied to the transferred cycle counter at the moment a standby channel is promoted to ONLINE - see ab_gp_channel_negotiate.c's own apply_state_transfer(). More... | |
| #define RTE_EXAMPLE_LOG | ( | ... | ) |
Millisecond-resolution timestamp prefix for every console log line in this example, sourced from the same rte_timer_now() the structured rte_log_write_event() lines already stamp themselves with (see common_config.h's own users) - so a raw stdout/log-file capture is orderable and diffable by time even without the structured log line next to it (e.g. skimming dist/logs/<role>.log by eye). Degrades to 0 if no timer OSAdapter is registered, same best-effort convention rte_log_write_event()'s own Timestamp field already uses. Used in place of a bare printf() everywhere in this example's own console output.
Definition at line 20 of file common_config.h.
| #define RTE_LOG_WRITE_EVENT | ( | level, | |
| site, | |||
| cycle, | |||
| source, | |||
| dest, | |||
| type, | |||
| info, | |||
| extra ) |
Structured-event log for this reference app.
RTE_LOG_WRITE_EVENT(level, site, cycle, source, dest, type, info, extra)
RTE_LOG_WRITE_EVENT_F(level, site, cycle, source, dest, type, info_fmt, ...)
Definition at line 47 of file common_config.h.
| #define RTE_LOG_WRITE_EVENT_F | ( | level, | |
| site, | |||
| cycle, | |||
| source, | |||
| dest, | |||
| type, | |||
| info_fmt, | |||
| ... ) |
Definition at line 50 of file common_config.h.
| #define RTE_EXAMPLE_WEST_PORT_BASE 15001U |
Definition at line 98 of file common_config.h.
| #define RTE_EXAMPLE_EAST_PORT_BASE 15101U |
Definition at line 99 of file common_config.h.
| #define RTE_EXAMPLE_MAX_TRAINS 2U |
Definition at line 107 of file common_config.h.
| #define RTE_EXAMPLE_MAX_ROUTES 8U |
Definition at line 121 of file common_config.h.
| #define RTE_EXAMPLE_MAX_ROUTES_PER_TRAIN 4U |
Definition at line 130 of file common_config.h.
| #define RTE_EXAMPLE_AB_PORT_OFFSET 0U |
Definition at line 139 of file common_config.h.
| #define RTE_EXAMPLE_AB_CROSSCOMPARE_PORT_OFFSET 16U |
Definition at line 140 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_A_TRAIN_PORT_OFFSET 1U |
Definition at line 152 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_A_IL_PORT_OFFSET (RTE_EXAMPLE_C_FOR_A_TRAIN_PORT_OFFSET + 1U) |
Definition at line 153 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_A_CTC_PORT_OFFSET (RTE_EXAMPLE_C_FOR_A_IL_PORT_OFFSET + 1U) |
Definition at line 155 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_A_UTIL_PORT_OFFSET (RTE_EXAMPLE_C_FOR_A_CTC_PORT_OFFSET + 1U) |
Definition at line 157 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_B_TRAIN_PORT_OFFSET (RTE_EXAMPLE_C_FOR_A_UTIL_PORT_OFFSET + 1U) |
Definition at line 158 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_B_IL_PORT_OFFSET (RTE_EXAMPLE_C_FOR_B_TRAIN_PORT_OFFSET + 1U) |
Definition at line 159 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_B_CTC_PORT_OFFSET (RTE_EXAMPLE_C_FOR_B_IL_PORT_OFFSET + 1U) |
Definition at line 161 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_B_UTIL_PORT_OFFSET (RTE_EXAMPLE_C_FOR_B_CTC_PORT_OFFSET + 1U) |
Definition at line 162 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_TRAIN_PORT_OFFSET (RTE_EXAMPLE_C_FOR_B_UTIL_PORT_OFFSET + 1U) |
Definition at line 170 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_IL_PORT_OFFSET (RTE_EXAMPLE_C_FOR_TRAIN_PORT_OFFSET + 1U) |
Definition at line 176 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_CTC_PORT_OFFSET (RTE_EXAMPLE_C_FOR_IL_PORT_OFFSET + 1U) |
Definition at line 180 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_BROKER_TRAIN_PORT_OFFSET (RTE_EXAMPLE_C_FOR_CTC_PORT_OFFSET + 1U) |
Definition at line 185 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_BROKER_IL_PORT_OFFSET (RTE_EXAMPLE_C_FOR_BROKER_TRAIN_PORT_OFFSET + 1U) |
Definition at line 186 of file common_config.h.
| #define RTE_EXAMPLE_C_FOR_BROKER_CTC_PORT_OFFSET (RTE_EXAMPLE_C_FOR_BROKER_IL_PORT_OFFSET + 1U) |
Definition at line 187 of file common_config.h.
| #define RTE_EXAMPLE_A_NEGOTIATION_PORT 15021U |
Definition at line 198 of file common_config.h.
| #define RTE_EXAMPLE_B_NEGOTIATION_PORT 15022U |
Definition at line 199 of file common_config.h.
| #define RTE_EXAMPLE_LOCALHOST "127.0.0.1" |
Definition at line 201 of file common_config.h.
| #define RTE_EXAMPLE_C_HOST_ENV "RTE_EXAMPLE_C_HOST" |
Definition at line 216 of file common_config.h.
| #define RTE_EXAMPLE_A_HOST_ENV "RTE_EXAMPLE_A_HOST" |
Definition at line 217 of file common_config.h.
| #define RTE_EXAMPLE_REMOTE_A_HOST_ENV "RTE_EXAMPLE_REMOTE_A_HOST" |
Definition at line 218 of file common_config.h.
| #define RTE_EXAMPLE_REMOTE_B_HOST_ENV "RTE_EXAMPLE_REMOTE_B_HOST" |
Definition at line 219 of file common_config.h.
| #define RTE_EXAMPLE_LINK_TIMEOUT_MS 300U |
Definition at line 239 of file common_config.h.
| #define RTE_EXAMPLE_NEG_ACK_TIMEOUT_MS 50U |
Definition at line 240 of file common_config.h.
| #define RTE_EXAMPLE_UTIL_REOPEN_BACKOFF_MS 5000U |
Definition at line 255 of file common_config.h.
| #define RTE_EXAMPLE_UTIL_OPEN_ATTEMPT_TIMEOUT_MS 20U |
Definition at line 256 of file common_config.h.
| #define RTE_EXAMPLE_ERTMS_CONTACT_TIMEOUT_MS 20000U |
Definition at line 272 of file common_config.h.
| #define RTE_EXAMPLE_STATUS_PERIOD_MS 5000U |
Definition at line 278 of file common_config.h.
| #define RTE_EXAMPLE_STATUS_STALE_MS 15000U |
Definition at line 279 of file common_config.h.
| #define RTE_EXAMPLE_CONNECT_TIMEOUT_MS 10000U |
Definition at line 310 of file common_config.h.
| #define RTE_EXAMPLE_RECONNECT_ATTEMPT_TIMEOUT_MS 1000U |
Definition at line 320 of file common_config.h.
| #define RTE_EXAMPLE_LINK_STALE_TIMEOUT_COUNT 4U |
Definition at line 356 of file common_config.h.
| #define RTE_EXAMPLE_CHECKPOINT_REENABLE_GRACE_MS 15000U |
Definition at line 389 of file common_config.h.
| #define RTE_EXAMPLE_CHANNEL_DOWN_REBOOT_MS 20000U |
Definition at line 419 of file common_config.h.
| #define RTE_EXAMPLE_NEG_SEND_MISS_THRESHOLD 3U |
Definition at line 428 of file common_config.h.
| #define RTE_EXAMPLE_AB_CYCLE_PERIOD_MS 500U |
Definition at line 500 of file common_config.h.
| #define RTE_EXAMPLE_AB_WATCHDOG_TIMEOUT_MS 600U |
Definition at line 501 of file common_config.h.
| #define RTE_EXAMPLE_AB_CHECKPOINT_MAX_DELAY_MS 400U |
Definition at line 546 of file common_config.h.
| #define RTE_EXAMPLE_AB_CHECKPOINT_RELAXED_MAX_DELAY_MS 10000U |
Definition at line 568 of file common_config.h.
| #define RTE_EXAMPLE_CHECKPOINT_RELAX_DURATION_MS 15000U |
Definition at line 578 of file common_config.h.
| #define RTE_EXAMPLE_AB_CHECKPOINT_LOOKBACK_CYCLES 2U |
Definition at line 603 of file common_config.h.
| #define RTE_EXAMPLE_AB_DUAL_TRANSFER_TIMEOUT_MS (RTE_EXAMPLE_AB_CYCLE_PERIOD_MS * 20U) |
Definition at line 637 of file common_config.h.
| #define RTE_EXAMPLE_C_A_STALE_CYCLE_LIMIT (RTE_EXAMPLE_AB_DUAL_TRANSFER_TIMEOUT_MS / RTE_EXAMPLE_C_REPORT_PERIOD_MS) |
Definition at line 652 of file common_config.h.
| #define RTE_EXAMPLE_C_REPORT_PERIOD_MS 600U |
Definition at line 664 of file common_config.h.
| #define RTE_EXAMPLE_AB_CYCLE_SKEW_TOLERANCE 20U |
Definition at line 698 of file common_config.h.
| #define RTE_EXAMPLE_XCOMPARE_SYNC_SKIP_LIMIT 10U |
Definition at line 713 of file common_config.h.
| #define RTE_EXAMPLE_NEGOTIATION_WATCHDOG_TIMEOUT_MS |
Definition at line 740 of file common_config.h.
| #define RTE_EXAMPLE_SITE_ROLE_ONLINE 1U |
Definition at line 761 of file common_config.h.
| #define RTE_EXAMPLE_SITE_ROLE_STANDBY 0U |
Definition at line 762 of file common_config.h.
| #define RTE_EXAMPLE_SITE_ROLE_FAULTED 2U |
Definition at line 763 of file common_config.h.
| #define RTE_EXAMPLE_SITE_ROLE_VALID_MARKER 0xA5U |
Wire "this payload's fields are meaningful" sentinel - see RTE_EXAMPLE_SITE_EXTRA_PAYLOAD_SIZE's own doc. A purely wire-level valid/not-yet-populated flag byte (there is no NVM region to validate), same value used for this kind of sentinel elsewhere in this codebase's own conventions.
Definition at line 769 of file common_config.h.
| #define RTE_EXAMPLE_SINGLE_MODE_FLAG_DUAL 0U |
Normal: both A and B answering each other.
Definition at line 770 of file common_config.h.
| #define RTE_EXAMPLE_SINGLE_MODE_FLAG_SINGLE 1U |
Degraded: this site's A/B lost its cross-compare peer.
Definition at line 771 of file common_config.h.
| #define RTE_EXAMPLE_DB_ROUTE_WIRE_SIZE 12U |
Definition at line 809 of file common_config.h.
| #define RTE_EXAMPLE_DB_TRAIN_WIRE_SIZE 16U |
Definition at line 810 of file common_config.h.
| #define RTE_EXAMPLE_DB_WIRE_SIZE |
Definition at line 811 of file common_config.h.
| #define RTE_EXAMPLE_SITE_EXTRA_PAYLOAD_SESSION_SIZE 19U |
Definition at line 815 of file common_config.h.
| #define RTE_EXAMPLE_SITE_EXTRA_PAYLOAD_SIZE |
Definition at line 816 of file common_config.h.
| #define RTE_EXAMPLE_AB_SITE_STATE_WIRE_SIZE 3U |
Definition at line 827 of file common_config.h.
| #define RTE_EXAMPLE_TRANSFER_POLICY_ENV "RTE_EXAMPLE_TRANSFER_POLICY" |
Optional env var override, same pattern as RTE_EXAMPLE_C_POSITION_START_ENV: "restart"/"continue"/"ask" (case-insensitive), unset or unrecognized -> RTE_EXAMPLE_TRANSFER_POLICY_CONTINUE.
Definition at line 842 of file common_config.h.
| #define RTE_EXAMPLE_TRANSFER_ASK_USER_TIMEOUT_MS 2000U |
Bounded wait for the ASK_USER stdin prompt - short enough that a non-interactive run (e.g. .claude/skills/run-safeAPIRBC2oo2/smoke.sh, which doesn't attach a TTY) doesn't stall the whole demo; stdin is simply closed/empty in that case, so select() returns immediately and the fallback-to-CONTINUE path logs and moves on.
Definition at line 849 of file common_config.h.
| #define RTE_EXAMPLE_CRC64_POLYNOMIAL RTE_CRC64_ERTMS |
Definition at line 856 of file common_config.h.
| #define RTE_EXAMPLE_REASON_AB_CRC_MISMATCH ((rte_safestate_reason_t)(RTE_SAFESTATE_REASON_APPLICATION_BASE + 1U)) |
Definition at line 868 of file common_config.h.
| #define RTE_EXAMPLE_REASON_AB_MTYPE_DISAGREE ((rte_safestate_reason_t)(RTE_SAFESTATE_REASON_APPLICATION_BASE + 2U)) |
Definition at line 881 of file common_config.h.
| #define RTE_EXAMPLE_REASON_NEGOTIATION_LINK_LOST ((rte_safestate_reason_t)(RTE_SAFESTATE_REASON_APPLICATION_BASE + 3U)) |
Definition at line 910 of file common_config.h.
| #define RTE_EXAMPLE_REASON_AB_SITE_STATE_MISMATCH ((rte_safestate_reason_t)(RTE_SAFESTATE_REASON_APPLICATION_BASE + 4U)) |
Definition at line 923 of file common_config.h.
| #define RTE_EXAMPLE_REASON_AB_PEER_LINK_DOWN ((rte_safestate_reason_t)(RTE_SAFESTATE_REASON_APPLICATION_BASE + 5U)) |
Definition at line 938 of file common_config.h.
| #define RTE_EXAMPLE_REASON_C_LINK_DOWN ((rte_safestate_reason_t)(RTE_SAFESTATE_REASON_APPLICATION_BASE + 6U)) |
Definition at line 949 of file common_config.h.
| #define RTE_EXAMPLE_REASON_C_MONITOR_LINK_DOWN ((rte_safestate_reason_t)(RTE_SAFESTATE_REASON_APPLICATION_BASE + 7U)) |
Definition at line 960 of file common_config.h.
| #define RTE_EXAMPLE_MSG_M136 136U |
Definition at line 984 of file common_config.h.
| #define RTE_EXAMPLE_MSG_M24 24U |
Definition at line 985 of file common_config.h.
| #define RTE_EXAMPLE_MSG_P0 0U |
Definition at line 1001 of file common_config.h.
| #define RTE_EXAMPLE_MSG_M3 3U |
Definition at line 1002 of file common_config.h.
| #define RTE_EXAMPLE_MSG_M146 146U |
Definition at line 1003 of file common_config.h.
| #define RTE_EXAMPLE_MA_ROUTE_LENGTH_M 500U |
Definition at line 1009 of file common_config.h.
| #define RTE_EXAMPLE_MA_OVERLAP_M 0U |
Definition at line 1024 of file common_config.h.
| #define RBC_ENVELOPE_WIRE_SIZE 96U |
Definition at line 1074 of file common_config.h.
| #define RBC_TRAIN_ENVELOPE_WIRE_SIZE 512U |
Definition at line 1096 of file common_config.h.
| #define RTE_EXAMPLE_REBOOT_DELAY_MS 5000U |
Definition at line 1116 of file common_config.h.
Policy applied to the transferred cycle counter at the moment a standby channel is promoted to ONLINE - see ab_gp_channel_negotiate.c's own apply_state_transfer().
Definition at line 832 of file common_config.h.