forked from richardcochran/linuxptp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phc_ctl.8
108 lines (94 loc) · 3.01 KB
/
phc_ctl.8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.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 cmp
Compare the PHC clock device to CLOCK_REALTIME, using the best method available.
.TP
.BI caps
Display the device capabiltiies. 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)