aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorStefan Sørensen <stefan.sorensen@spectralink.com>2014-02-04 02:46:36 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-04 23:26:46 -0500
commit61950e82b384cbe581f7e9cb668f77dc1d8cef35 (patch)
treeecdb1d5b93c45067f59bdbba84b6fe35364822a8 /Documentation
parenta13aff0641a92dc0b95136e32526e2ce81ffc4ef (diff)
ptp: Allow selecting trigger/event index in testptp
Currently the trigger/event is hardcoded to 0, this patch adds a new command line argument -i to select an arbitrary trigger/ event. Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ptp/testptp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c
index a74d0a84d329..4aba0436da65 100644
--- a/Documentation/ptp/testptp.c
+++ b/Documentation/ptp/testptp.c
@@ -117,6 +117,7 @@ static void usage(char *progname)
117 " -f val adjust the ptp clock frequency by 'val' ppb\n" 117 " -f val adjust the ptp clock frequency by 'val' ppb\n"
118 " -g get the ptp clock time\n" 118 " -g get the ptp clock time\n"
119 " -h prints this message\n" 119 " -h prints this message\n"
120 " -i val index for event/trigger\n"
120 " -k val measure the time offset between system and phc clock\n" 121 " -k val measure the time offset between system and phc clock\n"
121 " for 'val' times (Maximum 25)\n" 122 " for 'val' times (Maximum 25)\n"
122 " -p val enable output with a period of 'val' nanoseconds\n" 123 " -p val enable output with a period of 'val' nanoseconds\n"
@@ -154,6 +155,7 @@ int main(int argc, char *argv[])
154 int capabilities = 0; 155 int capabilities = 0;
155 int extts = 0; 156 int extts = 0;
156 int gettime = 0; 157 int gettime = 0;
158 int index = 0;
157 int oneshot = 0; 159 int oneshot = 0;
158 int pct_offset = 0; 160 int pct_offset = 0;
159 int n_samples = 0; 161 int n_samples = 0;
@@ -167,7 +169,7 @@ int main(int argc, char *argv[])
167 169
168 progname = strrchr(argv[0], '/'); 170 progname = strrchr(argv[0], '/');
169 progname = progname ? 1+progname : argv[0]; 171 progname = progname ? 1+progname : argv[0];
170 while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghk:p:P:sSt:v"))) { 172 while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghi:k:p:P:sSt:v"))) {
171 switch (c) { 173 switch (c) {
172 case 'a': 174 case 'a':
173 oneshot = atoi(optarg); 175 oneshot = atoi(optarg);
@@ -190,6 +192,9 @@ int main(int argc, char *argv[])
190 case 'g': 192 case 'g':
191 gettime = 1; 193 gettime = 1;
192 break; 194 break;
195 case 'i':
196 index = atoi(optarg);
197 break;
193 case 'k': 198 case 'k':
194 pct_offset = 1; 199 pct_offset = 1;
195 n_samples = atoi(optarg); 200 n_samples = atoi(optarg);
@@ -301,7 +306,7 @@ int main(int argc, char *argv[])
301 306
302 if (extts) { 307 if (extts) {
303 memset(&extts_request, 0, sizeof(extts_request)); 308 memset(&extts_request, 0, sizeof(extts_request));
304 extts_request.index = 0; 309 extts_request.index = index;
305 extts_request.flags = PTP_ENABLE_FEATURE; 310 extts_request.flags = PTP_ENABLE_FEATURE;
306 if (ioctl(fd, PTP_EXTTS_REQUEST, &extts_request)) { 311 if (ioctl(fd, PTP_EXTTS_REQUEST, &extts_request)) {
307 perror("PTP_EXTTS_REQUEST"); 312 perror("PTP_EXTTS_REQUEST");
@@ -375,7 +380,7 @@ int main(int argc, char *argv[])
375 return -1; 380 return -1;
376 } 381 }
377 memset(&perout_request, 0, sizeof(perout_request)); 382 memset(&perout_request, 0, sizeof(perout_request));
378 perout_request.index = 0; 383 perout_request.index = index;
379 perout_request.start.sec = ts.tv_sec + 2; 384 perout_request.start.sec = ts.tv_sec + 2;
380 perout_request.start.nsec = 0; 385 perout_request.start.nsec = 0;
381 perout_request.period.sec = 0; 386 perout_request.period.sec = 0;