3 #include <linux/ptp_clock.h>
5 #include "xlat/ptp_flags_options.h"
8 ptp_ioctl(struct tcb *tcp, const unsigned int code, long arg)
14 case PTP_CLOCK_GETCAPS: /* decode on exit */
16 struct ptp_clock_caps caps;
18 if (entering(tcp) || syserror(tcp) ||
19 umove(tcp, arg, &caps) < 0)
22 tprintf(", {max_adj=%d, n_alarm=%d, n_ext_ts=%d, n_per_out=%d, pps=%d}",
23 caps.max_adj, caps.n_alarm, caps.n_ext_ts,
24 caps.n_per_out, caps.pps);
28 case PTP_EXTTS_REQUEST: /* decode on enter */
30 struct ptp_extts_request extts;
34 if (umove(tcp, arg, &extts) < 0) {
35 tprintf(", %#lx", arg);
38 tprintf(", {index=%d, flags=", extts.index);
39 printflags(ptp_flags_options, extts.flags, "PTP_???");
44 case PTP_PEROUT_REQUEST: /* decode on enter */
46 struct ptp_perout_request perout;
50 if (umove(tcp, arg, &perout) < 0) {
51 tprintf(", %#lx", arg);
55 tprintf(", {start={%" PRId64 ", %" PRIu32 "}"
56 ", period={%" PRId64 ", %" PRIu32 "}"
58 (int64_t)perout.start.sec, perout.start.nsec,
59 (int64_t)perout.period.sec, perout.period.nsec,
61 printflags(ptp_flags_options, perout.flags, "PTP_???");
66 case PTP_ENABLE_PPS: /* decode on enter */
68 tprintf(", %ld", arg);
71 case PTP_SYS_OFFSET: /* decode on exit */
73 struct ptp_sys_offset sysoff;
76 if (entering(tcp) || umove(tcp, arg, &sysoff) < 0)
79 tprintf(", {n_samples=%u, ts={", sysoff.n_samples);
84 if (sysoff.n_samples > PTP_MAX_SAMPLES)
85 sysoff.n_samples = PTP_MAX_SAMPLES;
86 tprintf("{%" PRId64 ", %" PRIu32 "}",
87 (int64_t)sysoff.ts[0].sec, sysoff.ts[0].nsec);
88 for (i = 1; i < 2*sysoff.n_samples+1; ++i)
89 tprintf(", {%" PRId64 ", %" PRIu32 "}",
90 (int64_t)sysoff.ts[i].sec, sysoff.ts[i].nsec);
95 default: /* decode on exit */