|
SatCat5
|
Clock controller handling coarse and fine discipline.
High-level control for initial acquisition and tracking, applying a chain of ptp::Filter objects to derive the final control signal from a raw series of measurements. See also: "ptp_filters.h". The output is passed to a TrackingClock object.
Definition at line 89 of file ptp_tracking.h.
#include <ptp_tracking.h>
Public Member Functions | |
| TrackingController (satcat5::ptp::TrackingClock *clk, satcat5::ptp::Source *source=0) | |
| Constructor links to a specific TrackingClock target. More... | |
| void | ptp_ready (const satcat5::ptp::Measurement &data) override |
| Event handler for ptp::Callback. More... | |
| void | add_clock (satcat5::ptp::TrackingClock *clock) |
| Add to the list of attached clocks. More... | |
| void | remove_clock (satcat5::ptp::TrackingClock *clock) |
| Remove an item from the list of attached clocks. | |
| void | add_filter (satcat5::ptp::Filter *filter) |
| Add to the chain of processing filters. More... | |
| void | remove_filter (satcat5::ptp::Filter *filter) |
| Remove a filter from the chain, leaving others as-is. More... | |
| void | reset (bool linear=false) |
| Reset tracking filter(s) and begin free-wheeling. More... | |
| void | reacquire () |
| Indicate to the controller than an external event has happened that should trigger a re-acquisition without fully resetting the system, such as a short disruption of an external reference. | |
| void | update (const satcat5::ptp::Time &delta) |
| Update filter state with a new measurement from the PTP client. More... | |
| bool | is_locked () const |
| Check if the controller is currently locked. More... | |
Protected Types | |
| enum class | LockState { RESET , ACQUIRE , TRACK , LINEAR } |
Protected Member Functions | |
| s64 | coarse (const satcat5::ptp::Time &delta) |
| void | filter (u32 elapsed_usec, s64 delta_subns) |
| satcat5::ptp::Time | clock_adjust (const satcat5::ptp::Time &amount) |
| void | clock_rate (s64 offset) |
| void | pps_event (satcat5::ptp::Time &ts, satcat5::ptp::Time &delta) override |
Protected Attributes | |
| satcat5::util::List< satcat5::ptp::TrackingClock > | m_clocks |
| satcat5::util::List< satcat5::ptp::Filter > | m_filters |
| satcat5::util::TimeVal | m_tref |
| s64 | m_freq_accum |
| u32 | m_lock_alarm |
| u32 | m_lock_usec |
| satcat5::ptp::TrackingController::LockState | m_lock_state |
| satcat5::ptp::Source *const | m_source |
Private Attributes | |
| satcat5::ptp::Callback * | m_next |
| TrackingController::TrackingController | ( | satcat5::ptp::TrackingClock * | clk, |
| satcat5::ptp::Source * | source = 0 |
||
| ) |
Constructor links to a specific TrackingClock target.
Note: It is safe to provide a null TrackingClock pointer.
Definition at line 36 of file ptp_tracking.cc.
|
inline |
Add to the list of attached clocks.
All will receive the same frequency adjustments and will be frequency-locked, but only the primary clock (constructor or first add_clock) will be phase-locked.
Definition at line 107 of file ptp_tracking.h.
|
inline |
Add to the chain of processing filters.
Definition at line 118 of file ptp_tracking.h.
|
inline |
Check if the controller is currently locked.
Note that in linear mode, no lock detection exists and this always returns true.
Definition at line 146 of file ptp_tracking.h.
|
overridevirtual |
Event handler for ptp::Callback.
This calculates offsetFromMaster and calls "update".
Implements satcat5::ptp::Callback.
Definition at line 48 of file ptp_tracking.cc.
|
inline |
Remove a filter from the chain, leaving others as-is.
e.g., Starting from A->B->C, removing B results in A->C.
Definition at line 123 of file ptp_tracking.h.
| void TrackingController::reset | ( | bool | linear = false | ) |
Reset tracking filter(s) and begin free-wheeling.
| linear | Disables nonlinear coarse acquisition. |
Definition at line 53 of file ptp_tracking.cc.
| void TrackingController::update | ( | const satcat5::ptp::Time & | delta | ) |
Update filter state with a new measurement from the PTP client.
Specify the measured clock offset (delta = remote - local). (Call this directly or use the ptp::Callback event handler.)
Definition at line 73 of file ptp_tracking.cc.