Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef _PTP_CLOCK_H_ |
| 8 | #define _PTP_CLOCK_H_ |
| 9 | #include <linux/ioctl.h> |
| 10 | #include <linux/types.h> |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 11 | #define PTP_ENABLE_FEATURE (1 << 0) |
| 12 | #define PTP_RISING_EDGE (1 << 1) |
| 13 | #define PTP_FALLING_EDGE (1 << 2) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 14 | #define PTP_STRICT_FLAGS (1 << 3) |
| 15 | #define PTP_EXTTS_EDGES (PTP_RISING_EDGE | PTP_FALLING_EDGE) |
| 16 | #define PTP_EXTTS_VALID_FLAGS (PTP_ENABLE_FEATURE | PTP_RISING_EDGE | PTP_FALLING_EDGE | PTP_STRICT_FLAGS) |
| 17 | #define PTP_EXTTS_V1_VALID_FLAGS (PTP_ENABLE_FEATURE | PTP_RISING_EDGE | PTP_FALLING_EDGE) |
| 18 | #define PTP_PEROUT_ONE_SHOT (1 << 0) |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 19 | #define PTP_PEROUT_DUTY_CYCLE (1 << 1) |
| 20 | #define PTP_PEROUT_PHASE (1 << 2) |
| 21 | #define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT | PTP_PEROUT_DUTY_CYCLE | PTP_PEROUT_PHASE) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 22 | #define PTP_PEROUT_V1_VALID_FLAGS (0) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 23 | struct ptp_clock_time { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 24 | __s64 sec; |
| 25 | __u32 nsec; |
| 26 | __u32 reserved; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 27 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 28 | struct ptp_clock_caps { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 29 | int max_adj; |
| 30 | int n_alarm; |
| 31 | int n_ext_ts; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 32 | int n_per_out; |
| 33 | int pps; |
| 34 | int n_pins; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 35 | int cross_timestamping; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 36 | int adjust_phase; |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 37 | int max_phase_adj; |
| 38 | int rsv[11]; |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 39 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 40 | struct ptp_extts_request { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 41 | unsigned int index; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 42 | unsigned int flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 43 | unsigned int rsv[2]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 44 | }; |
| 45 | struct ptp_perout_request { |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 46 | union { |
| 47 | struct ptp_clock_time start; |
| 48 | struct ptp_clock_time phase; |
| 49 | }; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 50 | struct ptp_clock_time period; |
| 51 | unsigned int index; |
| 52 | unsigned int flags; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 53 | union { |
| 54 | struct ptp_clock_time on; |
| 55 | unsigned int rsv[4]; |
| 56 | }; |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 57 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 58 | #define PTP_MAX_SAMPLES 25 |
| 59 | struct ptp_sys_offset { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 60 | unsigned int n_samples; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 61 | unsigned int rsv[3]; |
| 62 | struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 63 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 64 | struct ptp_sys_offset_extended { |
| 65 | unsigned int n_samples; |
| 66 | unsigned int rsv[3]; |
| 67 | struct ptp_clock_time ts[PTP_MAX_SAMPLES][3]; |
| 68 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 69 | struct ptp_sys_offset_precise { |
| 70 | struct ptp_clock_time device; |
| 71 | struct ptp_clock_time sys_realtime; |
| 72 | struct ptp_clock_time sys_monoraw; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 73 | unsigned int rsv[4]; |
| 74 | }; |
| 75 | enum ptp_pin_function { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 76 | PTP_PF_NONE, |
| 77 | PTP_PF_EXTTS, |
| 78 | PTP_PF_PEROUT, |
| 79 | PTP_PF_PHYSYNC, |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 80 | }; |
| 81 | struct ptp_pin_desc { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 82 | char name[64]; |
| 83 | unsigned int index; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 84 | unsigned int func; |
| 85 | unsigned int chan; |
| 86 | unsigned int rsv[5]; |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 87 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 88 | #define PTP_CLK_MAGIC '=' |
| 89 | #define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 90 | #define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request) |
| 91 | #define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) |
| 92 | #define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) |
| 93 | #define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset) |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 94 | #define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc) |
| 95 | #define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 96 | #define PTP_SYS_OFFSET_PRECISE _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise) |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 97 | #define PTP_SYS_OFFSET_EXTENDED _IOWR(PTP_CLK_MAGIC, 9, struct ptp_sys_offset_extended) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 98 | #define PTP_CLOCK_GETCAPS2 _IOR(PTP_CLK_MAGIC, 10, struct ptp_clock_caps) |
| 99 | #define PTP_EXTTS_REQUEST2 _IOW(PTP_CLK_MAGIC, 11, struct ptp_extts_request) |
| 100 | #define PTP_PEROUT_REQUEST2 _IOW(PTP_CLK_MAGIC, 12, struct ptp_perout_request) |
| 101 | #define PTP_ENABLE_PPS2 _IOW(PTP_CLK_MAGIC, 13, int) |
| 102 | #define PTP_SYS_OFFSET2 _IOW(PTP_CLK_MAGIC, 14, struct ptp_sys_offset) |
| 103 | #define PTP_PIN_GETFUNC2 _IOWR(PTP_CLK_MAGIC, 15, struct ptp_pin_desc) |
| 104 | #define PTP_PIN_SETFUNC2 _IOW(PTP_CLK_MAGIC, 16, struct ptp_pin_desc) |
| 105 | #define PTP_SYS_OFFSET_PRECISE2 _IOWR(PTP_CLK_MAGIC, 17, struct ptp_sys_offset_precise) |
| 106 | #define PTP_SYS_OFFSET_EXTENDED2 _IOWR(PTP_CLK_MAGIC, 18, struct ptp_sys_offset_extended) |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 107 | #define PTP_MASK_CLEAR_ALL _IO(PTP_CLK_MAGIC, 19) |
| 108 | #define PTP_MASK_EN_SINGLE _IOW(PTP_CLK_MAGIC, 20, unsigned int) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 109 | struct ptp_extts_event { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 110 | struct ptp_clock_time t; |
| 111 | unsigned int index; |
| 112 | unsigned int flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 113 | unsigned int rsv[2]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 114 | }; |
| 115 | #endif |