hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/include/uapi/linux/ptp_clock.h
....@@ -25,10 +25,49 @@
2525 #include <linux/ioctl.h>
2626 #include <linux/types.h>
2727
28
-/* PTP_xxx bits, for the flags field within the request structures. */
28
+/*
29
+ * Bits of the ptp_extts_request.flags field:
30
+ */
2931 #define PTP_ENABLE_FEATURE (1<<0)
3032 #define PTP_RISING_EDGE (1<<1)
3133 #define PTP_FALLING_EDGE (1<<2)
34
+#define PTP_STRICT_FLAGS (1<<3)
35
+#define PTP_EXTTS_EDGES (PTP_RISING_EDGE | PTP_FALLING_EDGE)
36
+
37
+/*
38
+ * flag fields valid for the new PTP_EXTTS_REQUEST2 ioctl.
39
+ */
40
+#define PTP_EXTTS_VALID_FLAGS (PTP_ENABLE_FEATURE | \
41
+ PTP_RISING_EDGE | \
42
+ PTP_FALLING_EDGE | \
43
+ PTP_STRICT_FLAGS)
44
+
45
+/*
46
+ * flag fields valid for the original PTP_EXTTS_REQUEST ioctl.
47
+ * DO NOT ADD NEW FLAGS HERE.
48
+ */
49
+#define PTP_EXTTS_V1_VALID_FLAGS (PTP_ENABLE_FEATURE | \
50
+ PTP_RISING_EDGE | \
51
+ PTP_FALLING_EDGE)
52
+
53
+/*
54
+ * Bits of the ptp_perout_request.flags field:
55
+ */
56
+#define PTP_PEROUT_ONE_SHOT (1<<0)
57
+#define PTP_PEROUT_DUTY_CYCLE (1<<1)
58
+#define PTP_PEROUT_PHASE (1<<2)
59
+
60
+/*
61
+ * flag fields valid for the new PTP_PEROUT_REQUEST2 ioctl.
62
+ */
63
+#define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT | \
64
+ PTP_PEROUT_DUTY_CYCLE | \
65
+ PTP_PEROUT_PHASE)
66
+
67
+/*
68
+ * No flags are valid for the original PTP_PEROUT_REQUEST ioctl
69
+ */
70
+#define PTP_PEROUT_V1_VALID_FLAGS (0)
3271
3372 /*
3473 * struct ptp_clock_time - represents a time value
....@@ -54,7 +93,9 @@
5493 int n_pins; /* Number of input/output pins. */
5594 /* Whether the clock supports precise system-device cross timestamps */
5695 int cross_timestamping;
57
- int rsv[13]; /* Reserved for future use. */
96
+ /* Whether the clock supports adjust phase */
97
+ int adjust_phase;
98
+ int rsv[12]; /* Reserved for future use. */
5899 };
59100
60101 struct ptp_extts_request {
....@@ -64,11 +105,33 @@
64105 };
65106
66107 struct ptp_perout_request {
67
- struct ptp_clock_time start; /* Absolute start time. */
108
+ union {
109
+ /*
110
+ * Absolute start time.
111
+ * Valid only if (flags & PTP_PEROUT_PHASE) is unset.
112
+ */
113
+ struct ptp_clock_time start;
114
+ /*
115
+ * Phase offset. The signal should start toggling at an
116
+ * unspecified integer multiple of the period, plus this value.
117
+ * The start time should be "as soon as possible".
118
+ * Valid only if (flags & PTP_PEROUT_PHASE) is set.
119
+ */
120
+ struct ptp_clock_time phase;
121
+ };
68122 struct ptp_clock_time period; /* Desired period, zero means disable. */
69123 unsigned int index; /* Which channel to configure. */
70
- unsigned int flags; /* Reserved for future use. */
71
- unsigned int rsv[4]; /* Reserved for future use. */
124
+ unsigned int flags;
125
+ union {
126
+ /*
127
+ * The "on" time of the signal.
128
+ * Must be lower than the period.
129
+ * Valid only if (flags & PTP_PEROUT_DUTY_CYCLE) is set.
130
+ */
131
+ struct ptp_clock_time on;
132
+ /* Reserved for future use. */
133
+ unsigned int rsv[4];
134
+ };
72135 };
73136
74137 #define PTP_MAX_SAMPLES 25 /* Maximum allowed offset measurement samples. */
....@@ -82,6 +145,16 @@
82145 * one as a system time stamp.
83146 */
84147 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
148
+};
149
+
150
+struct ptp_sys_offset_extended {
151
+ unsigned int n_samples; /* Desired number of measurements. */
152
+ unsigned int rsv[3]; /* Reserved for future use. */
153
+ /*
154
+ * Array of [system, phc, system] time stamps. The kernel will provide
155
+ * 3*n_samples time stamps.
156
+ */
157
+ struct ptp_clock_time ts[PTP_MAX_SAMPLES][3];
85158 };
86159
87160 struct ptp_sys_offset_precise {
....@@ -136,6 +209,20 @@
136209 #define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc)
137210 #define PTP_SYS_OFFSET_PRECISE \
138211 _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise)
212
+#define PTP_SYS_OFFSET_EXTENDED \
213
+ _IOWR(PTP_CLK_MAGIC, 9, struct ptp_sys_offset_extended)
214
+
215
+#define PTP_CLOCK_GETCAPS2 _IOR(PTP_CLK_MAGIC, 10, struct ptp_clock_caps)
216
+#define PTP_EXTTS_REQUEST2 _IOW(PTP_CLK_MAGIC, 11, struct ptp_extts_request)
217
+#define PTP_PEROUT_REQUEST2 _IOW(PTP_CLK_MAGIC, 12, struct ptp_perout_request)
218
+#define PTP_ENABLE_PPS2 _IOW(PTP_CLK_MAGIC, 13, int)
219
+#define PTP_SYS_OFFSET2 _IOW(PTP_CLK_MAGIC, 14, struct ptp_sys_offset)
220
+#define PTP_PIN_GETFUNC2 _IOWR(PTP_CLK_MAGIC, 15, struct ptp_pin_desc)
221
+#define PTP_PIN_SETFUNC2 _IOW(PTP_CLK_MAGIC, 16, struct ptp_pin_desc)
222
+#define PTP_SYS_OFFSET_PRECISE2 \
223
+ _IOWR(PTP_CLK_MAGIC, 17, struct ptp_sys_offset_precise)
224
+#define PTP_SYS_OFFSET_EXTENDED2 \
225
+ _IOWR(PTP_CLK_MAGIC, 18, struct ptp_sys_offset_extended)
139226
140227 struct ptp_extts_event {
141228 struct ptp_clock_time t; /* Time event occured. */