~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/pps.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2 /*
  3  * PPS API header
  4  *
  5  * Copyright (C) 2005-2009   Rodolfo Giometti <giometti@linux.it>
  6  *
  7  *   This program is free software; you can redistribute it and/or modify
  8  *   it under the terms of the GNU General Public License as published by
  9  *   the Free Software Foundation; either version 2 of the License, or
 10  *   (at your option) any later version.
 11  *
 12  *   This program is distributed in the hope that it will be useful,
 13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15  *   GNU General Public License for more details.
 16  *
 17  *   You should have received a copy of the GNU General Public License
 18  *   along with this program; if not, write to the Free Software
 19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 20  */
 21 
 22 
 23 #ifndef _PPS_H_
 24 #define _PPS_H_
 25 
 26 #include <linux/types.h>
 27 
 28 #define PPS_VERSION             "5.3.6"
 29 #define PPS_MAX_SOURCES         16              /* should be enough... */
 30 
 31 /* Implementation note: the logical states ``assert'' and ``clear''
 32  * are implemented in terms of the chip register, i.e. ``assert''
 33  * means the bit is set.  */
 34 
 35 /*
 36  * 3.2 New data structures
 37  */
 38 
 39 #define PPS_API_VERS_1          1
 40 #define PPS_API_VERS            PPS_API_VERS_1  /* we use API version 1 */
 41 #define PPS_MAX_NAME_LEN        32
 42 
 43 /* 32-bit vs. 64-bit compatibility.
 44  *
 45  * 0n i386, the alignment of a uint64_t is only 4 bytes, while on most other
 46  * architectures it's 8 bytes. On i386, there will be no padding between the
 47  * two consecutive 'struct pps_ktime' members of struct pps_kinfo and struct
 48  * pps_kparams. But on most platforms there will be padding to ensure correct
 49  * alignment.
 50  *
 51  * The simple fix is probably to add an explicit padding.
 52  *                                                      [David Woodhouse]
 53  */
 54 struct pps_ktime {
 55         __s64 sec;
 56         __s32 nsec;
 57         __u32 flags;
 58 };
 59 
 60 struct pps_ktime_compat {
 61         __s64 sec;
 62         __s32 nsec;
 63         __u32 flags;
 64 } __attribute__((packed, aligned(4)));
 65 #define PPS_TIME_INVALID        (1<<0)  /* used to specify timeout==NULL */
 66 
 67 struct pps_kinfo {
 68         __u32 assert_sequence;          /* seq. num. of assert event */
 69         __u32 clear_sequence;           /* seq. num. of clear event */
 70         struct pps_ktime assert_tu;     /* time of assert event */
 71         struct pps_ktime clear_tu;      /* time of clear event */
 72         int current_mode;               /* current mode bits */
 73 };
 74 
 75 struct pps_kinfo_compat {
 76         __u32 assert_sequence;                  /* seq. num. of assert event */
 77         __u32 clear_sequence;                   /* seq. num. of clear event */
 78         struct pps_ktime_compat assert_tu;      /* time of assert event */
 79         struct pps_ktime_compat clear_tu;       /* time of clear event */
 80         int current_mode;                       /* current mode bits */
 81 };
 82 
 83 struct pps_kparams {
 84         int api_version;                /* API version # */
 85         int mode;                       /* mode bits */
 86         struct pps_ktime assert_off_tu; /* offset compensation for assert */
 87         struct pps_ktime clear_off_tu;  /* offset compensation for clear */
 88 };
 89 
 90 /*
 91  * 3.3 Mode bit definitions
 92  */
 93 
 94 /* Device/implementation parameters */
 95 #define PPS_CAPTUREASSERT       0x01    /* capture assert events */
 96 #define PPS_CAPTURECLEAR        0x02    /* capture clear events */
 97 #define PPS_CAPTUREBOTH         0x03    /* capture assert and clear events */
 98 
 99 #define PPS_OFFSETASSERT        0x10    /* apply compensation for assert event */
100 #define PPS_OFFSETCLEAR         0x20    /* apply compensation for clear event */
101 
102 #define PPS_CANWAIT             0x100   /* can we wait for an event? */
103 #define PPS_CANPOLL             0x200   /* bit reserved for future use */
104 
105 /* Kernel actions */
106 #define PPS_ECHOASSERT          0x40    /* feed back assert event to output */
107 #define PPS_ECHOCLEAR           0x80    /* feed back clear event to output */
108 
109 /* Timestamp formats */
110 #define PPS_TSFMT_TSPEC         0x1000  /* select timespec format */
111 #define PPS_TSFMT_NTPFP         0x2000  /* select NTP format */
112 
113 /*
114  * 3.4.4 New functions: disciplining the kernel timebase
115  */
116 
117 /* Kernel consumers */
118 #define PPS_KC_HARDPPS          0       /* hardpps() (or equivalent) */
119 #define PPS_KC_HARDPPS_PLL      1       /* hardpps() constrained to
120                                            use a phase-locked loop */
121 #define PPS_KC_HARDPPS_FLL      2       /* hardpps() constrained to
122                                            use a frequency-locked loop */
123 /*
124  * Here begins the implementation-specific part!
125  */
126 
127 struct pps_fdata {
128         struct pps_kinfo info;
129         struct pps_ktime timeout;
130 };
131 
132 struct pps_fdata_compat {
133         struct pps_kinfo_compat info;
134         struct pps_ktime_compat timeout;
135 };
136 
137 struct pps_bind_args {
138         int tsformat;   /* format of time stamps */
139         int edge;       /* selected event type */
140         int consumer;   /* selected kernel consumer */
141 };
142 
143 #include <linux/ioctl.h>
144 
145 #define PPS_GETPARAMS           _IOR('p', 0xa1, struct pps_kparams *)
146 #define PPS_SETPARAMS           _IOW('p', 0xa2, struct pps_kparams *)
147 #define PPS_GETCAP              _IOR('p', 0xa3, int *)
148 #define PPS_FETCH               _IOWR('p', 0xa4, struct pps_fdata *)
149 #define PPS_KC_BIND             _IOW('p', 0xa5, struct pps_bind_args *)
150 
151 #endif /* _PPS_H_ */
152 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php