SatCat5
satcat5::cfg::PtpReference Class Reference

Detailed Description

PTP reference counter with rate-control only.

See also
cfgbus_ptpref.h, cfg::PtpRealtime.

Definition at line 27 of file cfgbus_ptpref.h.

#include <cfgbus_ptpref.h>

Inheritance diagram for satcat5::cfg::PtpReference:
[legend]
Collaboration diagram for satcat5::cfg::PtpReference:
[legend]

Public Member Functions

constexpr PtpReference (const satcat5::cfg::Register &reg, double ref_clk_hz, unsigned scale=40)
 PtpReference is a thin-wrapper for a single control register. More...
 
satcat5::ptp::Time clock_adjust (const satcat5::ptp::Time &amount) override
 Make a one-time adjustment of the specified magnitude. More...
 
void clock_rate (s64 offset) override
 Adjust rate by a normalized frequency offset. More...
 
satcat5::ptp::Time clock_now () override
 Return the current time if available, TIME_ZERO otherwise.
 
void clock_rate_raw (s64 rate)
 Legacy API for rate-control without additional scaling.
 
s64 get_rate () const
 Read the current clock-tuning parameter. More...
 

Protected Attributes

satcat5::cfg::Register m_reg
 
const satcat5::ptp::RateConversion m_rate
 
s64 m_offset
 

Private Attributes

satcat5::ptp::TrackingClockm_next
 

Constructor & Destructor Documentation

◆ PtpReference()

constexpr satcat5::cfg::PtpReference::PtpReference ( const satcat5::cfg::Register reg,
double  ref_clk_hz,
unsigned  scale = 40 
)
inlineconstexpr

PtpReference is a thin-wrapper for a single control register.

Clock rate is required to renormalize frequency adjustments. Default scale parameter matches "ptp_counter_free.vhd".

Definition at line 32 of file cfgbus_ptpref.h.

Member Function Documentation

◆ clock_adjust()

Time PtpReference::clock_adjust ( const satcat5::ptp::Time amount)
overridevirtual

Make a one-time adjustment of the specified magnitude.

Positive quantities indicate the clock should move forward. Return value is the estimated remainder or residual error.

Implements satcat5::ptp::TrackingClock.

Definition at line 35 of file cfgbus_ptpref.cc.

◆ clock_rate()

void PtpReference::clock_rate ( s64  offset)
overridevirtual

Adjust rate by a normalized frequency offset.

Positive offsets command the clock to run faster. (See discussion above, near definition of RATE_ONE_PPB.)

Implements satcat5::ptp::TrackingClock.

Definition at line 41 of file cfgbus_ptpref.cc.

◆ get_rate()

s64 satcat5::ptp::TrackingClock::get_rate ( ) const
inlineinherited

Read the current clock-tuning parameter.

Returns
The most recent value passed to "clock_rate", above.

Definition at line 70 of file ptp_tracking.h.


The documentation for this class was generated from the following files: