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_startup_timestamp.c File Reference

See ab_gp_startup_timestamp.h. More...

Include dependency graph for ab_gp_startup_timestamp.c:

Go to the source code of this file.

Functions

rte_timestamp_ms_t ab_gp_startup_timestamp_agree (rte_timestamp_ms_t own_now_ms, rte_timestamp_ms_t sibling_ts_ms, bool have_sibling)
 The site startup timestamp this channel uses given its own clock and the sibling's value.
void ab_gp_startup_timestamp_encode (uint8_t *buf, bool is_reply, rte_timestamp_ms_t ts_ms)
 Encodes a STARTUP_TS payload.
bool ab_gp_startup_timestamp_decode (const uint8_t *buf, size_t size, bool *is_reply, rte_timestamp_ms_t *ts_ms)
 Decodes a STARTUP_TS payload.

Detailed Description

Function Documentation

◆ ab_gp_startup_timestamp_agree()

rte_timestamp_ms_t ab_gp_startup_timestamp_agree ( rte_timestamp_ms_t own_now_ms,
rte_timestamp_ms_t sibling_ts_ms,
bool have_sibling )

The site startup timestamp this channel uses given its own clock and the sibling's value.

Parameters
own_now_msthis process's own monotonic time at start-up
sibling_ts_msthe sibling's startup timestamp (ignored when have_sibling is false)
have_siblinga sibling value was received
Returns
sibling_ts_ms when have_sibling, sibling_ts_ms <= own_now_ms and (own_now_ms - sibling_ts_ms) < AB_GP_STARTUP_TS_FRESH_MS; own_now_ms otherwise

Definition at line 7 of file ab_gp_startup_timestamp.c.

◆ ab_gp_startup_timestamp_encode()

void ab_gp_startup_timestamp_encode ( uint8_t * buf,
bool is_reply,
rte_timestamp_ms_t ts_ms )

Encodes a STARTUP_TS payload.

Parameters
bufout, at least AB_GP_STARTUP_TS_PAYLOAD_SIZE bytes
is_replyfalse for a request, true for the reply
ts_msthe timestamp carried

Definition at line 20 of file ab_gp_startup_timestamp.c.

◆ ab_gp_startup_timestamp_decode()

bool ab_gp_startup_timestamp_decode ( const uint8_t * buf,
size_t size,
bool * is_reply,
rte_timestamp_ms_t * ts_ms )

Decodes a STARTUP_TS payload.

Parameters
bufthe payload bytes
sizenumber of bytes available in buf
is_replyout: false for a request, true for a reply
ts_msout: the timestamp carried
Returns
true when size is at least AB_GP_STARTUP_TS_PAYLOAD_SIZE and the is_reply byte is 0 or 1; false otherwise (the out parameters are then left unchanged)

Definition at line 36 of file ab_gp_startup_timestamp.c.