18 bool Measurement::done()
const {
66 for (
unsigned a = 0 ; a < SATCAT5_PTP_CACHE_SIZE ; ++a) {
67 if (m_buff[a].match(hdr, port))
return m_buff + a;
74 m_next_wr = modulo_add_uns(m_next_wr + 1, SATCAT5_PTP_CACHE_SIZE);
Internal buffer used by the Log class.
void wr_str(const char *str)
Write a null-terminated UTF-8 string.
Searchable cache of recent Measurement objects.
satcat5::ptp::Measurement * find(const satcat5::ptp::Header &hdr, const satcat5::ptp::PortId &port)
Find the first matching measurement in the cache.
satcat5::ptp::Measurement * push(const satcat5::ptp::Header &hdr)
Create a new measurement, overwriting the oldest.
High-precision timestamp for use with PTP / IEEE1588.
void log_to(satcat5::log::LogBuffer &wr) const
User-readable format for logging.
Diagnostic logging to UART and/or Ethernet ports.
Define the data structure for a two-way time transfer handshake.
constexpr satcat5::ptp::Time TIME_ZERO(0LL)
Common time-related constants.
Timestamps and metadata for a two-way time-transfer handshake.
satcat5::ptp::Time t1
Timestamp T1 (A to B / Tx)
bool match(const satcat5::ptp::Header &hdr, const satcat5::ptp::PortId &port) const
Check if an incoming message matches this exchange.
void log_to(satcat5::log::LogBuffer &wr) const
Write all four timestamps to the log.
void reset(const satcat5::ptp::Header &hdr)
Reset this data structure for immediate reuse.
satcat5::ptp::Time mean_link_delay() const
Calculate PTP "meanLinkDelay".
satcat5::ptp::Header ref
Reference header is copied from the initiating PTP message (i.e., SYNC or PDELAY_REQ) and used to mat...
satcat5::ptp::Time mean_path_delay() const
Calculate PTP "meanPathDelay".
satcat5::ptp::Time t2
Timestamp T2 (A to B / Rx)
satcat5::ptp::Time t4
Timestamp T4 (B to A / Rx)
satcat5::ptp::Time t3
Timestamp T3 (B to A / Tx)
satcat5::ptp::Time offset_from_master() const
Calculate PTP "offsetFromMaster".
Struct used for sourcePortIdentity and requestingPortIdentity.
Miscellaneous mathematical utility functions.
constexpr unsigned modulo_add_uns(unsigned sum, unsigned m)
Modulo addition function.