1 /* 2 * This header was generated from the Linux kernel headers by update_headers.py, 3 * to provide necessary information from kernel to userspace, such as constants, 4 * structures, and macros, and thus, contains no copyrightable information. 5 */ 6 #ifndef _PTP_CLOCK_H_ 7 #define _PTP_CLOCK_H_ 8 #include <linux/ioctl.h> 9 #include <linux/types.h> 10 #define PTP_ENABLE_FEATURE (1<<0) 11 #define PTP_RISING_EDGE (1<<1) 12 #define PTP_FALLING_EDGE (1<<2) 13 struct ptp_clock_time { 14 __s64 sec; 15 __u32 nsec; 16 __u32 reserved; 17 }; 18 struct ptp_clock_caps { 19 int max_adj; 20 int n_alarm; 21 int n_ext_ts; 22 int n_per_out; 23 int pps; 24 int n_pins; 25 26 int cross_timestamping; 27 int rsv[13]; 28 }; 29 struct ptp_extts_request { 30 unsigned int index; 31 unsigned int flags; 32 unsigned int rsv[2]; 33 }; 34 struct ptp_perout_request { 35 struct ptp_clock_time start; 36 struct ptp_clock_time period; 37 unsigned int index; 38 unsigned int flags; 39 unsigned int rsv[4]; 40 }; 41 #define PTP_MAX_SAMPLES 25 42 struct ptp_sys_offset { 43 unsigned int n_samples; 44 unsigned int rsv[3]; 45 46 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; 47 }; 48 struct ptp_sys_offset_precise { 49 struct ptp_clock_time device; 50 struct ptp_clock_time sys_realtime; 51 struct ptp_clock_time sys_monoraw; 52 unsigned int rsv[4]; 53 }; 54 enum ptp_pin_function { 55 PTP_PF_NONE, 56 PTP_PF_EXTTS, 57 PTP_PF_PEROUT, 58 PTP_PF_PHYSYNC, 59 }; 60 struct ptp_pin_desc { 61 62 char name[64]; 63 64 unsigned int index; 65 66 unsigned int func; 67 68 unsigned int chan; 69 70 unsigned int rsv[5]; 71 }; 72 #define PTP_CLK_MAGIC '=' 73 #define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) 74 #define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request) 75 #define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) 76 #define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) 77 #define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset) 78 #define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc) 79 #define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc) 80 #define PTP_SYS_OFFSET_PRECISE \ 81 _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise) 82 struct ptp_extts_event { 83 struct ptp_clock_time t; 84 unsigned int index; 85 unsigned int flags; 86 unsigned int rsv[2]; 87 }; 88 #endif 89