.. | .. |
---|
25 | 25 | #include <linux/ioctl.h> |
---|
26 | 26 | #include <linux/types.h> |
---|
27 | 27 | |
---|
28 | | -/* PTP_xxx bits, for the flags field within the request structures. */ |
---|
| 28 | +/* |
---|
| 29 | + * Bits of the ptp_extts_request.flags field: |
---|
| 30 | + */ |
---|
29 | 31 | #define PTP_ENABLE_FEATURE (1<<0) |
---|
30 | 32 | #define PTP_RISING_EDGE (1<<1) |
---|
31 | 33 | #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) |
---|
32 | 71 | |
---|
33 | 72 | /* |
---|
34 | 73 | * struct ptp_clock_time - represents a time value |
---|
.. | .. |
---|
54 | 93 | int n_pins; /* Number of input/output pins. */ |
---|
55 | 94 | /* Whether the clock supports precise system-device cross timestamps */ |
---|
56 | 95 | 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. */ |
---|
58 | 99 | }; |
---|
59 | 100 | |
---|
60 | 101 | struct ptp_extts_request { |
---|
.. | .. |
---|
64 | 105 | }; |
---|
65 | 106 | |
---|
66 | 107 | 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 | + }; |
---|
68 | 122 | struct ptp_clock_time period; /* Desired period, zero means disable. */ |
---|
69 | 123 | 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 | + }; |
---|
72 | 135 | }; |
---|
73 | 136 | |
---|
74 | 137 | #define PTP_MAX_SAMPLES 25 /* Maximum allowed offset measurement samples. */ |
---|
.. | .. |
---|
82 | 145 | * one as a system time stamp. |
---|
83 | 146 | */ |
---|
84 | 147 | 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]; |
---|
85 | 158 | }; |
---|
86 | 159 | |
---|
87 | 160 | struct ptp_sys_offset_precise { |
---|
.. | .. |
---|
136 | 209 | #define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc) |
---|
137 | 210 | #define PTP_SYS_OFFSET_PRECISE \ |
---|
138 | 211 | _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) |
---|
139 | 226 | |
---|
140 | 227 | struct ptp_extts_event { |
---|
141 | 228 | struct ptp_clock_time t; /* Time event occured. */ |
---|