7 #include <satcat5/ptp_header.h>
48 case TYPE_DELAY_REQ:
return 10;
49 case TYPE_PDELAY_REQ:
return 20;
50 case TYPE_PDELAY_RESP:
return 20;
51 case TYPE_FOLLOW_UP:
return 10;
52 case TYPE_DELAY_RESP:
return 20;
53 case TYPE_PDELAY_RFU:
return 20;
54 case TYPE_ANNOUNCE:
return 30;
55 case TYPE_SIGNALING:
return 10;
56 case TYPE_MANAGEMENT:
return 14;
86 flags = rd->read_u16();
93 type = sdo_type & 0x0F;
94 sdo_id = ((sdo_type & 0xF0) << 8) | minor_sdo;
108 wr->write_u16(
flags);
146 u16 satcat5::ptp::calc_log_variance(u64 variance_ps) {
147 u64 log2_var = satcat5::util::log2_ceil<u64>(variance_ps);
149 return (u16) satcat5::util::min_u64(field, ClockInfo::VARIANCE_MAX);
Abstract API for reading byte-streams and packets.
bool read_obj(T &t)
Templated wrapper for any object with the following method: bool read_from(satcat5::io::Readable* rd)...
u8 read_u8()
One of many functions for reading integer/floating point values, see details.
virtual unsigned get_read_ready() const =0
How many bytes can be read without blocking?
Abstract API for writing byte-streams and packets.
void write_u8(u8 data)
One of many functions for writing integer/floating point values, see details.
void write_obj(const T &obj)
Templated wrapper for any object with the following method: void write_to(satcat5::io::Writeable* wr)...
Internal buffer used by the Log class.
void wr_d64(u64 val, unsigned zpad=0)
Write an unsigned integer (u64) in decimal format.
void wr_h32(u32 val, unsigned nhex=8)
Write an integer (u32) in hexadecimal format.
void wr_str(const char *str)
Write a null-terminated UTF-8 string.
void wr_d32(u32 val, unsigned zpad=0)
Write an unsigned integer (u32) in decimal format.
Diagnostic logging to UART and/or Ethernet ports.
Clock configuration metadata for the ANNOUNCE message.
u16 stepsRemoved
Fields defined in Section 13.5.1, Table 43.
u8 grandmasterPriority1
Fields defined in Section 13.5.1, Table 43.
static constexpr u16 VARIANCE_1PSEC
The "offsetScaledLogVariance" metric.
u64 grandmasterIdentity
Fields defined in Section 13.5.1, Table 43.
u8 timeSource
Fields defined in Section 13.5.1, Table 43.
bool read_from(satcat5::io::Readable *rd)
Read clock information from a given source.
u8 grandmasterClass
Fields defined in Section 13.5.1, Table 43.
u8 grandmasterAccuracy
Fields defined in Section 13.5.1, Table 43.
u16 grandmasterVariance
Fields defined in Section 13.5.1, Table 43.
void write_to(satcat5::io::Writeable *wr) const
Write clock information to the given sink.
u8 grandmasterPriority2
Fields defined in Section 13.5.1, Table 43.
Struct used for sourcePortIdentity and requestingPortIdentity.
bool read_from(satcat5::io::Readable *rd)
Read port-identifier from a given source.
u64 clock_id
Clock identifier.
void write_to(satcat5::io::Writeable *wr) const
Write port-identifier to the given sink.
void log_to(satcat5::log::LogBuffer &wr) const
Log human-readable information about this port-identity.
Miscellaneous mathematical utility functions.
unsigned log2_ceil(T x)
Calculate log2(x), rounding up.
constexpr u64 min_u64(u64 a, u64 b)
Min and max functions.