Blame phc_ctl.8

Packit 9c3e7e
.TH PHC_CTL 8 "June 2014" "linuxptp"
Packit 9c3e7e
.SH NAME
Packit 9c3e7e
phc_ctl \- directly control PHC device clock
Packit 9c3e7e
Packit 9c3e7e
.SH SYNOPSIS
Packit 9c3e7e
.B phc_ctl
Packit 9c3e7e
[ options ] <device> [ commands ]
Packit 9c3e7e
Packit 9c3e7e
.SH DESCRIPTION
Packit 9c3e7e
.B phc_ctl
Packit 9c3e7e
is a program which can be used to directly control a PHC clock device.
Packit 9c3e7e
Typically, it is used for debugging purposes, and has little use for general
Packit 9c3e7e
control of the device. For general control of PHC clock devices,
Packit 9c3e7e
.B phc2sys (8)
Packit 9c3e7e
should be preferred.
Packit 9c3e7e
Packit 9c3e7e
<device> may be either CLOCK_REALTIME, any /dev/ptpX device, or any ethernet
Packit 9c3e7e
device which supports ethtool's get_ts_info ioctl.
Packit 9c3e7e
Packit 9c3e7e
.SH OPTIONS
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-l " print-level"
Packit 9c3e7e
Set the maximum syslog level of messages which should be printed or sent to the
Packit 9c3e7e
system logger. The default is 6 (LOG_INFO).
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-q
Packit 9c3e7e
Do not send messages to syslog. By default messages will be sent.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-Q
Packit 9c3e7e
Do not print messages to standard output. By default messages will be printed.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI \-h
Packit 9c3e7e
Display a help message.
Packit 9c3e7e
.TP
Packit 9c3e7e
.B \-v
Packit 9c3e7e
Prints the software version and exits.
Packit 9c3e7e
Packit 9c3e7e
.SH COMMANDS
Packit 9c3e7e
Packit 9c3e7e
.B phc_ctl
Packit 9c3e7e
is controlled by passing commands which take either an optional or required
Packit 9c3e7e
parameter. The commands (outlined below) will control aspects of the PHC clock
Packit 9c3e7e
device. These commands may be useful for inspecting or debugging the PHC
Packit 9c3e7e
driver, but may have adverse side effects on running instances of
Packit 9c3e7e
.B ptp4l (8)
Packit 9c3e7e
or
Packit 9c3e7e
.B phc2sys (8)
Packit 9c3e7e
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI set " seconds"
Packit 9c3e7e
Set the PHC clock time to the value specified in seconds. Defaults to reading
Packit 9c3e7e
CLOCK_REALTIME if no value is provided.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI get
Packit 9c3e7e
Get the current time of the PHC clock device.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI adj " seconds"
Packit 9c3e7e
Adjust the PHC clock by an amount of seconds provided. This argument is required.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI freq " ppb"
Packit 9c3e7e
Adjust the frequency of the PHC clock by the specified parts per billion. If no
Packit 9c3e7e
argument is provided, it will attempt to read the current frequency and report
Packit 9c3e7e
it.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI cmp
Packit 9c3e7e
Compare the PHC clock device to CLOCK_REALTIME, using the best method available.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI caps
Packit 9c3e7e
Display the device capabiltiies. This is the default command if no commands are
Packit 9c3e7e
provided.
Packit 9c3e7e
.TP
Packit 9c3e7e
.BI wait " seconds"
Packit 9c3e7e
Sleep the process for the specified period of time, waking up and resuming
Packit 9c3e7e
afterwards. This command may be useful for sanity checking whether the PHC
Packit 9c3e7e
clock is running as expected.
Packit 9c3e7e
Packit 9c3e7e
The arguments specified in seconds are read as double precision floating point
Packit 9c3e7e
values, and will scale to nanoseconds. This means providing a value of 5.5
Packit 9c3e7e
means 5 and one half seconds. This allows specifying fairly precise values for time.
Packit 9c3e7e
Packit 9c3e7e
.SH EXAMPLES
Packit 9c3e7e
Packit 9c3e7e
Read the current clock time from the device
Packit 9c3e7e
.RS
Packit 9c3e7e
\f(CWphc_ctl /dev/ptp0 get\fP
Packit 9c3e7e
.RE
Packit 9c3e7e
Packit 9c3e7e
Set the PHC clock time to CLOCK_REALTIME
Packit 9c3e7e
.RS
Packit 9c3e7e
\f(CWphc_ctl /dev/ptp0 set\fP
Packit 9c3e7e
.RE
Packit 9c3e7e
Packit 9c3e7e
Set PHC clock time to 0 (seconds since Epoch)
Packit 9c3e7e
.RS
Packit 9c3e7e
\f(CWphc_ctl /dev/ptp0 set 0.0\fP
Packit 9c3e7e
.RE
Packit 9c3e7e
Packit 9c3e7e
Quickly sanity check frequency slewing by setting slewing frequency by positive
Packit 9c3e7e
10%, resetting clock to 0.0 time, waiting for 10 seconds, and then reading
Packit 9c3e7e
time. The time read back should be (roughly) 11 seconds, since the clock was
Packit 9c3e7e
slewed 10% faster.
Packit 9c3e7e
.RS
Packit 9c3e7e
\f(CWphc_ctl /dev/ptp0 freq 100000000 set 0.0 wait 10.0 get
Packit 9c3e7e
.RE
Packit 9c3e7e
Packit 9c3e7e
.SH SEE ALSO
Packit 9c3e7e
.BR ptp4l (8)
Packit 9c3e7e
.BR phc2sys (8)