blob: 3d0dc24d67749b1352c8fcdf238c501f068854b7 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
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>
Tao Baod7db5942015-01-28 10:07:51 -080023#define PTP_ENABLE_FEATURE (1 << 0)
24#define PTP_RISING_EDGE (1 << 1)
25#define PTP_FALLING_EDGE (1 << 2)
Christopher Ferris9584fa42019-12-09 15:36:13 -080026#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)
Ben Cheng655a7c02013-10-16 16:09:24 -070033struct ptp_clock_time {
Tao Baod7db5942015-01-28 10:07:51 -080034 __s64 sec;
35 __u32 nsec;
36 __u32 reserved;
Ben Cheng655a7c02013-10-16 16:09:24 -070037};
Ben Cheng655a7c02013-10-16 16:09:24 -070038struct ptp_clock_caps {
Tao Baod7db5942015-01-28 10:07:51 -080039 int max_adj;
40 int n_alarm;
41 int n_ext_ts;
Tao Baod7db5942015-01-28 10:07:51 -080042 int n_per_out;
43 int pps;
44 int n_pins;
Christopher Ferris106b3a82016-08-24 12:15:38 -070045 int cross_timestamping;
Christopher Ferris8177cdf2020-08-03 11:53:55 -070046 int adjust_phase;
47 int rsv[12];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070048};
Ben Cheng655a7c02013-10-16 16:09:24 -070049struct ptp_extts_request {
Tao Baod7db5942015-01-28 10:07:51 -080050 unsigned int index;
Christopher Ferris106b3a82016-08-24 12:15:38 -070051 unsigned int flags;
Tao Baod7db5942015-01-28 10:07:51 -080052 unsigned int rsv[2];
Ben Cheng655a7c02013-10-16 16:09:24 -070053};
54struct ptp_perout_request {
Christopher Ferris106b3a82016-08-24 12:15:38 -070055 struct ptp_clock_time start;
Tao Baod7db5942015-01-28 10:07:51 -080056 struct ptp_clock_time period;
57 unsigned int index;
58 unsigned int flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -070059 unsigned int rsv[4];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070060};
Ben Cheng655a7c02013-10-16 16:09:24 -070061#define PTP_MAX_SAMPLES 25
62struct ptp_sys_offset {
Christopher Ferris106b3a82016-08-24 12:15:38 -070063 unsigned int n_samples;
Tao Baod7db5942015-01-28 10:07:51 -080064 unsigned int rsv[3];
65 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
Ben Cheng655a7c02013-10-16 16:09:24 -070066};
Christopher Ferrisd842e432019-03-07 10:21:59 -080067struct ptp_sys_offset_extended {
68 unsigned int n_samples;
69 unsigned int rsv[3];
70 struct ptp_clock_time ts[PTP_MAX_SAMPLES][3];
71};
Christopher Ferris106b3a82016-08-24 12:15:38 -070072struct ptp_sys_offset_precise {
73 struct ptp_clock_time device;
74 struct ptp_clock_time sys_realtime;
75 struct ptp_clock_time sys_monoraw;
Christopher Ferris106b3a82016-08-24 12:15:38 -070076 unsigned int rsv[4];
77};
78enum ptp_pin_function {
Tao Baod7db5942015-01-28 10:07:51 -080079 PTP_PF_NONE,
80 PTP_PF_EXTTS,
81 PTP_PF_PEROUT,
82 PTP_PF_PHYSYNC,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070083};
84struct ptp_pin_desc {
Tao Baod7db5942015-01-28 10:07:51 -080085 char name[64];
86 unsigned int index;
Tao Baod7db5942015-01-28 10:07:51 -080087 unsigned int func;
88 unsigned int chan;
89 unsigned int rsv[5];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070090};
Ben Cheng655a7c02013-10-16 16:09:24 -070091#define PTP_CLK_MAGIC '='
92#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
Ben Cheng655a7c02013-10-16 16:09:24 -070093#define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request)
94#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
95#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int)
96#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070097#define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc)
98#define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc)
Christopher Ferris106b3a82016-08-24 12:15:38 -070099#define PTP_SYS_OFFSET_PRECISE _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise)
Christopher Ferrisd842e432019-03-07 10:21:59 -0800100#define PTP_SYS_OFFSET_EXTENDED _IOWR(PTP_CLK_MAGIC, 9, struct ptp_sys_offset_extended)
Christopher Ferris9584fa42019-12-09 15:36:13 -0800101#define PTP_CLOCK_GETCAPS2 _IOR(PTP_CLK_MAGIC, 10, struct ptp_clock_caps)
102#define PTP_EXTTS_REQUEST2 _IOW(PTP_CLK_MAGIC, 11, struct ptp_extts_request)
103#define PTP_PEROUT_REQUEST2 _IOW(PTP_CLK_MAGIC, 12, struct ptp_perout_request)
104#define PTP_ENABLE_PPS2 _IOW(PTP_CLK_MAGIC, 13, int)
105#define PTP_SYS_OFFSET2 _IOW(PTP_CLK_MAGIC, 14, struct ptp_sys_offset)
106#define PTP_PIN_GETFUNC2 _IOWR(PTP_CLK_MAGIC, 15, struct ptp_pin_desc)
107#define PTP_PIN_SETFUNC2 _IOW(PTP_CLK_MAGIC, 16, struct ptp_pin_desc)
108#define PTP_SYS_OFFSET_PRECISE2 _IOWR(PTP_CLK_MAGIC, 17, struct ptp_sys_offset_precise)
109#define PTP_SYS_OFFSET_EXTENDED2 _IOWR(PTP_CLK_MAGIC, 18, struct ptp_sys_offset_extended)
Ben Cheng655a7c02013-10-16 16:09:24 -0700110struct ptp_extts_event {
Tao Baod7db5942015-01-28 10:07:51 -0800111 struct ptp_clock_time t;
112 unsigned int index;
113 unsigned int flags;
Tao Baod7db5942015-01-28 10:07:51 -0800114 unsigned int rsv[2];
Ben Cheng655a7c02013-10-16 16:09:24 -0700115};
116#endif