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