This propagates the use of "struct ts2phc_private" all the way into the
master API, in preparation of a new use case that will be supported
soon: some PPS masters (to be precise, the "PHC" kind) instantiate a
struct clock which could be disciplined by ts2phc.
When a PHC A emits a pulse and another PHC B timestamps it, the offset
between their precise timestamps can be used to synchronize either one
of them. So far in ts2phc, only the slave PHC (the one using extts) has
been synchronized to the master (the one using perout).
This is partly because there is no proper kernel API to report the
precise timestamp of a perout pulse. We only have the periodic API, and
that doesn't report precise timestamps either; we just use vague
approximations of what the PPS master PHC's time was, based on reading
that PHC immediately after a slave extts event was received by the
application. While this is far from ideal, it does work, and does allow
PHC A to be synchronized to B.
This is particularly useful with the yet-to-be-introduced "automatic"
mode of ts2phc (similar to '-a' of phc2sys), and the PPS distribution
tree is fixed in hardware (as opposed to port states, which in
"automatic" mode are dynamic, as the name suggests).
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Many GPS radios provide both a 1-PPS and time of day information via
NMEA sentences. This patch introduces a ts2phc master that decodes
the "recommended minimum data" sentence, RMC, which provides UTC time
and a validity flag. Together with the file based leap second table,
this sentence provides adequate time of day for determining the time
of the PPS edge.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch introduces a new ts2phc source using a PHC device. There
are multiple use cases for such a master. By connecting pins of two
or more separate PHC devices together, one may act as the source, and
the others may be synchronized to it in hardware. In this way, "just
a bunch of devices" together forms a Transparent Clock. If the master
clock is synchronized to a global time source (like a PPS from a GPS),
then the system becomes a mutli-port Grand Master or a Boundary Clock
with GM capability.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Some PTP Hardware Clocks have input pins that can generate time stamps
on the edges of external signals. This functionality can be used in
various ways. For example, one can synchronize a PHC device to a
global time source by taking a Pulse Per Second signal from the source
into the PHC. This patch adds support for synchronizing one or more
PHC slaves to a given master clock.
The implementation follows a modular design that allows adding
different kinds of master clocks in the future. This patch starts off
with a single "generic" PPS master, meaning a PPS signal that lacks
and time or date information. The generic master assumes that the
Linux system time is approximately correct (by NTP or RTC for example)
in order to calculate the time of the incoming PPS edges.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Balint Ferencz <fernya@gmail.com>