Lines Matching +full:tx +full:- +full:sec
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * PTP 1588 clock support - User space test program
35 #define CLOCK_INVALID -1
43 static int clock_adjtime(clockid_t id, struct timex *tx) in clock_adjtime() argument
45 return syscall(__NR_clock_adjtime, id, tx); in clock_adjtime()
113 return t->sec * 1000000000LL + t->nsec; in pctns()
120 " -c query the ptp clock's capabilities\n" in usage()
121 " -d name device to open\n" in usage()
122 " -e val read 'val' external time stamp events\n" in usage()
123 " -f val adjust the ptp clock frequency by 'val' ppb\n" in usage()
124 " -g get the ptp clock time\n" in usage()
125 " -h prints this message\n" in usage()
126 " -i val index for event/trigger\n" in usage()
127 " -k val measure the time offset between system and phc clock\n" in usage()
129 " -l list the current pin configuration\n" in usage()
130 " -L pin,val configure pin index 'pin' with function 'val'\n" in usage()
131 " the channel index is taken from the '-i' option\n" in usage()
133 " 0 - none\n" in usage()
134 " 1 - external time stamp\n" in usage()
135 " 2 - periodic output\n" in usage()
136 " -p val enable output with a period of 'val' nanoseconds\n" in usage()
137 " -H val set output phase to 'val' nanoseconds (requires -p)\n" in usage()
138 " -w val set output pulse width to 'val' nanoseconds (requires -p)\n" in usage()
139 " -P val enable or disable (val=1|0) the system clock PPS\n" in usage()
140 " -s set the ptp clock time from the system time\n" in usage()
141 " -S set the system time from the ptp clock time\n" in usage()
142 " -t val shift the ptp clock time by 'val' seconds\n" in usage()
143 " -T val set the ptp clock time to 'val' seconds\n" in usage()
144 " -z test combinations of rising/falling external time stamp flags\n", in usage()
156 struct timex tx; in main() local
176 int pin_index = -1, pin_func; in main()
177 int pps = -1; in main()
183 int64_t perout_phase = -1; in main()
184 int64_t pulsewidth = -1; in main()
185 int64_t perout = -1; in main()
223 return -1; in main()
257 return -1; in main()
264 return -1; in main()
270 return -1; in main()
298 memset(&tx, 0, sizeof(tx)); in main()
299 tx.modes = ADJ_FREQUENCY; in main()
300 tx.freq = ppb_to_scaled_ppm(adjfreq); in main()
301 if (clock_adjtime(clkid, &tx)) { in main()
309 memset(&tx, 0, sizeof(tx)); in main()
310 tx.modes = ADJ_SETOFFSET; in main()
311 tx.time.tv_sec = adjtime; in main()
312 tx.time.tv_usec = 0; in main()
313 if (clock_adjtime(clkid, &tx) < 0) { in main()
367 for (; extts; extts--) { in main()
374 event.t.sec, event.t.nsec); in main()
407 puts("-w can only be specified together with -p"); in main()
408 return -1; in main()
412 puts("-H can only be specified together with -p"); in main()
413 return -1; in main()
419 return -1; in main()
423 perout_request.period.sec = perout / NSEC_PER_SEC; in main()
428 perout_request.on.sec = pulsewidth / NSEC_PER_SEC; in main()
433 perout_request.phase.sec = perout_phase / NSEC_PER_SEC; in main()
436 perout_request.start.sec = ts.tv_sec + 2; in main()
459 if (pps != -1) { in main()
472 return -1; in main()
478 return -1; in main()
480 sysoff->n_samples = n_samples; in main()
487 pct = &sysoff->ts[0]; in main()
488 for (i = 0; i < sysoff->n_samples; i++) { in main()
492 interval = t2 - t1; in main()
493 offset = (t2 + t1) / 2 - tp; in main()
496 (pct+2*i)->sec, (pct+2*i)->nsec); in main()
498 (pct+2*i+1)->sec, (pct+2*i+1)->nsec); in main()
500 (pct+2*i+2)->sec, (pct+2*i+2)->nsec); in main()