From: Maciej Machnikowski <maciej.machnikow...@intel.com>

Current implementation requires specifying the -s argument for PPS
sources that don't provide ToD information and for GNSS modules.

Add ts2phc.tod_source config option to enable specifying the source
in the config file. Currently only "generic" and "nmea" options
are allowed.

v2:
 - Allow any source to be specified including PTP clocks or ETH interfaces
 - Default to generic when no other ToD source is specified
 - Rename pps_source to tod_source in main()

Signed-off-by: Maciej Machnikowski <mac...@machnikowski.net>
---
 config.c |  1 +
 ts2phc.8 | 11 ++++++++++-
 ts2phc.c |  3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/config.c b/config.c
index e454c91..33176f4 100644
--- a/config.c
+++ b/config.c
@@ -330,6 +330,7 @@ struct config_item config_tab[] = {
        PORT_ITEM_INT("ts2phc.perout_phase", -1, 0, 999999999),
        PORT_ITEM_INT("ts2phc.pin_index", 0, 0, INT_MAX),
        GLOB_ITEM_INT("ts2phc.pulsewidth", 500000000, 1000000, 999000000),
+       GLOB_ITEM_STR("ts2phc.tod_source", ""),
        PORT_ITEM_ENU("tsproc_mode", TSPROC_FILTER, tsproc_enu),
        GLOB_ITEM_INT("twoStepFlag", 1, 0, 1),
        GLOB_ITEM_INT("tx_timestamp_timeout", 10, 1, INT_MAX),
diff --git a/ts2phc.8 b/ts2phc.8
index ded6f9a..68d54a2 100644
--- a/ts2phc.8
+++ b/ts2phc.8
@@ -65,7 +65,7 @@ Prints log messages to the standard output.
 Prevents sending log messages to the system logger.
 .TP
 .BI \-s " device|name"
-Specifies the source of the PPS signal.
+Specifies the source of the Time of Day (ToD) data.
 Use the key word "generic" for an external 1-PPS without ToD information.
 When using a PHC as the time source, the clock may be identified by its 
character
 device (like /dev/ptp0) or its associated network interface (like
@@ -160,6 +160,15 @@ by changing the clock frequency instead of stepping the 
clock. When
 set to 0.0, the servo will never step the clock except on start.
 The default is 0.0.
 .TP
+.B ts2phc.tod_source
+Specifies the source of Time of Day (ToD) data.
+Use the key word "generic" for an external 1-PPS without ToD information.
+When using a PHC as the time source, the clock may be identified by its 
character
+device (like /dev/ptp0) or its associated network interface (like
+eth0).
+Use the key word "nmea" for an external 1-PPS from a GPS providing ToD
+information via the RMC NMEA sentence.
+.TP
 .B ts2phc.nmea_remote_host, ts2phc.nmea_remote_port
 Specifies the remote host providing ToD information when using the
 "nmea" PPS signal source.  Note that if these two options are both
diff --git a/ts2phc.c b/ts2phc.c
index 67f2de6..d8cea17 100644
--- a/ts2phc.c
+++ b/ts2phc.c
@@ -715,6 +715,9 @@ int main(int argc, char *argv[])
                return -1;
        }
 
+       if (!tod_source)
+               tod_source = config_get_string(cfg, NULL, "ts2phc.tod_source");
+
        if (!tod_source) {
                fprintf(stderr, "no PPS source specified\n");
                ts2phc_cleanup(&priv);
-- 
2.37.0 (Apple Git-136)



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to