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)
26struct ptp_clock_time {
27  __s64 sec;
28  __u32 nsec;
29  __u32 reserved;
30};
31struct ptp_clock_caps {
32  int max_adj;
33  int n_alarm;
34  int n_ext_ts;
35  int n_per_out;
36  int pps;
37  int n_pins;
38  int cross_timestamping;
39  int rsv[13];
40};
41struct ptp_extts_request {
42  unsigned int index;
43  unsigned int flags;
44  unsigned int rsv[2];
45};
46struct ptp_perout_request {
47  struct ptp_clock_time start;
48  struct ptp_clock_time period;
49  unsigned int index;
50  unsigned int flags;
51  unsigned int rsv[4];
52};
53#define PTP_MAX_SAMPLES 25
54struct ptp_sys_offset {
55  unsigned int n_samples;
56  unsigned int rsv[3];
57  struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
58};
59struct ptp_sys_offset_precise {
60  struct ptp_clock_time device;
61  struct ptp_clock_time sys_realtime;
62  struct ptp_clock_time sys_monoraw;
63  unsigned int rsv[4];
64};
65enum ptp_pin_function {
66  PTP_PF_NONE,
67  PTP_PF_EXTTS,
68  PTP_PF_PEROUT,
69  PTP_PF_PHYSYNC,
70};
71struct ptp_pin_desc {
72  char name[64];
73  unsigned int index;
74  unsigned int func;
75  unsigned int chan;
76  unsigned int rsv[5];
77};
78#define PTP_CLK_MAGIC '='
79#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
80#define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request)
81#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
82#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int)
83#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset)
84#define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc)
85#define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc)
86#define PTP_SYS_OFFSET_PRECISE _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise)
87struct ptp_extts_event {
88  struct ptp_clock_time t;
89  unsigned int index;
90  unsigned int flags;
91  unsigned int rsv[2];
92};
93#endif
94