![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 0002 /* 0003 * PPS API header 0004 * 0005 * Copyright (C) 2005-2009 Rodolfo Giometti <giometti@linux.it> 0006 * 0007 * This program is free software; you can redistribute it and/or modify 0008 * it under the terms of the GNU General Public License as published by 0009 * the Free Software Foundation; either version 2 of the License, or 0010 * (at your option) any later version. 0011 * 0012 * This program is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 * GNU General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU General Public License 0018 * along with this program; if not, write to the Free Software 0019 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 0020 */ 0021 0022 0023 #ifndef _PPS_H_ 0024 #define _PPS_H_ 0025 0026 #include <linux/types.h> 0027 0028 #define PPS_VERSION "5.3.6" 0029 #define PPS_MAX_SOURCES 16 /* should be enough... */ 0030 0031 /* Implementation note: the logical states ``assert'' and ``clear'' 0032 * are implemented in terms of the chip register, i.e. ``assert'' 0033 * means the bit is set. */ 0034 0035 /* 0036 * 3.2 New data structures 0037 */ 0038 0039 #define PPS_API_VERS_1 1 0040 #define PPS_API_VERS PPS_API_VERS_1 /* we use API version 1 */ 0041 #define PPS_MAX_NAME_LEN 32 0042 0043 /* 32-bit vs. 64-bit compatibility. 0044 * 0045 * 0n i386, the alignment of a uint64_t is only 4 bytes, while on most other 0046 * architectures it's 8 bytes. On i386, there will be no padding between the 0047 * two consecutive 'struct pps_ktime' members of struct pps_kinfo and struct 0048 * pps_kparams. But on most platforms there will be padding to ensure correct 0049 * alignment. 0050 * 0051 * The simple fix is probably to add an explicit padding. 0052 * [David Woodhouse] 0053 */ 0054 struct pps_ktime { 0055 __s64 sec; 0056 __s32 nsec; 0057 __u32 flags; 0058 }; 0059 0060 struct pps_ktime_compat { 0061 __s64 sec; 0062 __s32 nsec; 0063 __u32 flags; 0064 } __attribute__((packed, aligned(4))); 0065 #define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */ 0066 0067 struct pps_kinfo { 0068 __u32 assert_sequence; /* seq. num. of assert event */ 0069 __u32 clear_sequence; /* seq. num. of clear event */ 0070 struct pps_ktime assert_tu; /* time of assert event */ 0071 struct pps_ktime clear_tu; /* time of clear event */ 0072 int current_mode; /* current mode bits */ 0073 }; 0074 0075 struct pps_kinfo_compat { 0076 __u32 assert_sequence; /* seq. num. of assert event */ 0077 __u32 clear_sequence; /* seq. num. of clear event */ 0078 struct pps_ktime_compat assert_tu; /* time of assert event */ 0079 struct pps_ktime_compat clear_tu; /* time of clear event */ 0080 int current_mode; /* current mode bits */ 0081 }; 0082 0083 struct pps_kparams { 0084 int api_version; /* API version # */ 0085 int mode; /* mode bits */ 0086 struct pps_ktime assert_off_tu; /* offset compensation for assert */ 0087 struct pps_ktime clear_off_tu; /* offset compensation for clear */ 0088 }; 0089 0090 /* 0091 * 3.3 Mode bit definitions 0092 */ 0093 0094 /* Device/implementation parameters */ 0095 #define PPS_CAPTUREASSERT 0x01 /* capture assert events */ 0096 #define PPS_CAPTURECLEAR 0x02 /* capture clear events */ 0097 #define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */ 0098 0099 #define PPS_OFFSETASSERT 0x10 /* apply compensation for assert event */ 0100 #define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear event */ 0101 0102 #define PPS_CANWAIT 0x100 /* can we wait for an event? */ 0103 #define PPS_CANPOLL 0x200 /* bit reserved for future use */ 0104 0105 /* Kernel actions */ 0106 #define PPS_ECHOASSERT 0x40 /* feed back assert event to output */ 0107 #define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */ 0108 0109 /* Timestamp formats */ 0110 #define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */ 0111 #define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */ 0112 0113 /* 0114 * 3.4.4 New functions: disciplining the kernel timebase 0115 */ 0116 0117 /* Kernel consumers */ 0118 #define PPS_KC_HARDPPS 0 /* hardpps() (or equivalent) */ 0119 #define PPS_KC_HARDPPS_PLL 1 /* hardpps() constrained to 0120 use a phase-locked loop */ 0121 #define PPS_KC_HARDPPS_FLL 2 /* hardpps() constrained to 0122 use a frequency-locked loop */ 0123 /* 0124 * Here begins the implementation-specific part! 0125 */ 0126 0127 struct pps_fdata { 0128 struct pps_kinfo info; 0129 struct pps_ktime timeout; 0130 }; 0131 0132 struct pps_fdata_compat { 0133 struct pps_kinfo_compat info; 0134 struct pps_ktime_compat timeout; 0135 }; 0136 0137 struct pps_bind_args { 0138 int tsformat; /* format of time stamps */ 0139 int edge; /* selected event type */ 0140 int consumer; /* selected kernel consumer */ 0141 }; 0142 0143 #include <linux/ioctl.h> 0144 0145 #define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *) 0146 #define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *) 0147 #define PPS_GETCAP _IOR('p', 0xa3, int *) 0148 #define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *) 0149 #define PPS_KC_BIND _IOW('p', 0xa5, struct pps_bind_args *) 0150 0151 #endif /* _PPS_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |