diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /Documentation/ptp | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'Documentation/ptp')
-rw-r--r-- | Documentation/ptp/testptp.c | 65 |
1 files changed, 2 insertions, 63 deletions
diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c index a74d0a8..f59ded0 100644 --- a/Documentation/ptp/testptp.c +++ b/Documentation/ptp/testptp.c @@ -100,11 +100,6 @@ static long ppb_to_scaled_ppm(int ppb) return (long) (ppb * 65.536); } -static int64_t pctns(struct ptp_clock_time *t) -{ - return t->sec * 1000000000LL + t->nsec; -} - static void usage(char *progname) { fprintf(stderr, @@ -117,8 +112,6 @@ static void usage(char *progname) " -f val adjust the ptp clock frequency by 'val' ppb\n" " -g get the ptp clock time\n" " -h prints this message\n" - " -k val measure the time offset between system and phc clock\n" - " for 'val' times (Maximum 25)\n" " -p val enable output with a period of 'val' nanoseconds\n" " -P val enable or disable (val=1|0) the system clock PPS\n" " -s set the ptp clock time from the system time\n" @@ -140,12 +133,8 @@ int main(int argc, char *argv[]) struct itimerspec timeout; struct sigevent sigevent; - struct ptp_clock_time *pct; - struct ptp_sys_offset *sysoff; - - char *progname; - int i, c, cnt, fd; + int c, cnt, fd; char *device = DEVICE; clockid_t clkid; @@ -155,19 +144,14 @@ int main(int argc, char *argv[]) int extts = 0; int gettime = 0; int oneshot = 0; - int pct_offset = 0; - int n_samples = 0; int periodic = 0; int perout = -1; int pps = -1; int settime = 0; - int64_t t1, t2, tp; - int64_t interval, offset; - progname = strrchr(argv[0], '/'); progname = progname ? 1+progname : argv[0]; - while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghk:p:P:sSt:v"))) { + while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghp:P:sSt:v"))) { switch (c) { case 'a': oneshot = atoi(optarg); @@ -190,10 +174,6 @@ int main(int argc, char *argv[]) case 'g': gettime = 1; break; - case 'k': - pct_offset = 1; - n_samples = atoi(optarg); - break; case 'p': perout = atoi(optarg); break; @@ -396,47 +376,6 @@ int main(int argc, char *argv[]) } } - if (pct_offset) { - if (n_samples <= 0 || n_samples > 25) { - puts("n_samples should be between 1 and 25"); - usage(progname); - return -1; - } - - sysoff = calloc(1, sizeof(*sysoff)); - if (!sysoff) { - perror("calloc"); - return -1; - } - sysoff->n_samples = n_samples; - - if (ioctl(fd, PTP_SYS_OFFSET, sysoff)) - perror("PTP_SYS_OFFSET"); - else - puts("system and phc clock time offset request okay"); - - pct = &sysoff->ts[0]; - for (i = 0; i < sysoff->n_samples; i++) { - t1 = pctns(pct+2*i); - tp = pctns(pct+2*i+1); - t2 = pctns(pct+2*i+2); - interval = t2 - t1; - offset = (t2 + t1) / 2 - tp; - - printf("system time: %ld.%ld\n", - (pct+2*i)->sec, (pct+2*i)->nsec); - printf("phc time: %ld.%ld\n", - (pct+2*i+1)->sec, (pct+2*i+1)->nsec); - printf("system time: %ld.%ld\n", - (pct+2*i+2)->sec, (pct+2*i+2)->nsec); - printf("system/phc clock time offset is %ld ns\n" - "system clock time delay is %ld ns\n", - offset, interval); - } - - free(sysoff); - } - close(fd); return 0; } |