1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _PTP_CLOCK_H_
20 #define _PTP_CLOCK_H_
21 #include <linux/ioctl.h>
22 #include <linux/types.h>
23 #define PTP_ENABLE_FEATURE (1 << 0)
24 #define PTP_RISING_EDGE (1 << 1)
25 #define PTP_FALLING_EDGE (1 << 2)
26 #define PTP_STRICT_FLAGS (1 << 3)
27 #define PTP_EXTTS_EDGES (PTP_RISING_EDGE | PTP_FALLING_EDGE)
28 #define PTP_EXTTS_VALID_FLAGS (PTP_ENABLE_FEATURE | PTP_RISING_EDGE | PTP_FALLING_EDGE | PTP_STRICT_FLAGS)
29 #define PTP_EXTTS_V1_VALID_FLAGS (PTP_ENABLE_FEATURE | PTP_RISING_EDGE | PTP_FALLING_EDGE)
30 #define PTP_PEROUT_ONE_SHOT (1 << 0)
31 #define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT)
32 #define PTP_PEROUT_V1_VALID_FLAGS (0)
33 struct ptp_clock_time {
34   __s64 sec;
35   __u32 nsec;
36   __u32 reserved;
37 };
38 struct ptp_clock_caps {
39   int max_adj;
40   int n_alarm;
41   int n_ext_ts;
42   int n_per_out;
43   int pps;
44   int n_pins;
45   int cross_timestamping;
46   int rsv[13];
47 };
48 struct ptp_extts_request {
49   unsigned int index;
50   unsigned int flags;
51   unsigned int rsv[2];
52 };
53 struct ptp_perout_request {
54   struct ptp_clock_time start;
55   struct ptp_clock_time period;
56   unsigned int index;
57   unsigned int flags;
58   unsigned int rsv[4];
59 };
60 #define PTP_MAX_SAMPLES 25
61 struct ptp_sys_offset {
62   unsigned int n_samples;
63   unsigned int rsv[3];
64   struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
65 };
66 struct ptp_sys_offset_extended {
67   unsigned int n_samples;
68   unsigned int rsv[3];
69   struct ptp_clock_time ts[PTP_MAX_SAMPLES][3];
70 };
71 struct ptp_sys_offset_precise {
72   struct ptp_clock_time device;
73   struct ptp_clock_time sys_realtime;
74   struct ptp_clock_time sys_monoraw;
75   unsigned int rsv[4];
76 };
77 enum ptp_pin_function {
78   PTP_PF_NONE,
79   PTP_PF_EXTTS,
80   PTP_PF_PEROUT,
81   PTP_PF_PHYSYNC,
82 };
83 struct ptp_pin_desc {
84   char name[64];
85   unsigned int index;
86   unsigned int func;
87   unsigned int chan;
88   unsigned int rsv[5];
89 };
90 #define PTP_CLK_MAGIC '='
91 #define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
92 #define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request)
93 #define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
94 #define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int)
95 #define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset)
96 #define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc)
97 #define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc)
98 #define PTP_SYS_OFFSET_PRECISE _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise)
99 #define PTP_SYS_OFFSET_EXTENDED _IOWR(PTP_CLK_MAGIC, 9, struct ptp_sys_offset_extended)
100 #define PTP_CLOCK_GETCAPS2 _IOR(PTP_CLK_MAGIC, 10, struct ptp_clock_caps)
101 #define PTP_EXTTS_REQUEST2 _IOW(PTP_CLK_MAGIC, 11, struct ptp_extts_request)
102 #define PTP_PEROUT_REQUEST2 _IOW(PTP_CLK_MAGIC, 12, struct ptp_perout_request)
103 #define PTP_ENABLE_PPS2 _IOW(PTP_CLK_MAGIC, 13, int)
104 #define PTP_SYS_OFFSET2 _IOW(PTP_CLK_MAGIC, 14, struct ptp_sys_offset)
105 #define PTP_PIN_GETFUNC2 _IOWR(PTP_CLK_MAGIC, 15, struct ptp_pin_desc)
106 #define PTP_PIN_SETFUNC2 _IOW(PTP_CLK_MAGIC, 16, struct ptp_pin_desc)
107 #define PTP_SYS_OFFSET_PRECISE2 _IOWR(PTP_CLK_MAGIC, 17, struct ptp_sys_offset_precise)
108 #define PTP_SYS_OFFSET_EXTENDED2 _IOWR(PTP_CLK_MAGIC, 18, struct ptp_sys_offset_extended)
109 struct ptp_extts_event {
110   struct ptp_clock_time t;
111   unsigned int index;
112   unsigned int flags;
113   unsigned int rsv[2];
114 };
115 #endif
116