Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


ptp_clock.h
01: /*
02:  * PTP 1588 clock support - user space interface
03:  *
04:  * Copyright (C) 2010 OMICRON electronics GmbH
05:  *
06:  *  This program is free software; you can redistribute it and/or modify
07:  *  it under the terms of the GNU General Public License as published by
08:  *  the Free Software Foundation; either version 2 of the License, or
09:  *  (at your option) any later version.
10:  *
11:  *  This program is distributed in the hope that it will be useful,
12:  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14:  *  GNU General Public License for more details.
15:  *
16:  *  You should have received a copy of the GNU General Public License
17:  *  along with this program; if not, write to the Free Software
18:  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19:  */
20: 
21: #ifndef _PTP_CLOCK_H_
22: #define _PTP_CLOCK_H_
23: 
24: #include <linux/ioctl.h>
25: #include <linux/types.h>
26: 
27: /* PTP_xxx bits, for the flags field within the request structures. */
28: #define PTP_ENABLE_FEATURE (1<<0)
29: #define PTP_RISING_EDGE    (1<<1)
30: #define PTP_FALLING_EDGE   (1<<2)
31: 
32: /*
33:  * struct ptp_clock_time - represents a time value
34:  *
35:  * The sign of the seconds field applies to the whole value. The
36:  * nanoseconds field is always unsigned. The reserved field is
37:  * included for sub-nanosecond resolution, should the demand for
38:  * this ever appear.
39:  *
40:  */
41: struct ptp_clock_time {
42:         __s64 sec;  /* seconds */
43:         __u32 nsec; /* nanoseconds */
44:         __u32 reserved;
45: };
46: 
47: struct ptp_clock_caps {
48:         int max_adj;   /* Maximum frequency adjustment in parts per billon. */
49:         int n_alarm;   /* Number of programmable alarms. */
50:         int n_ext_ts;  /* Number of external time stamp channels. */
51:         int n_per_out; /* Number of programmable periodic signals. */
52:         int pps;       /* Whether the clock supports a PPS callback. */
53:         int rsv[15];   /* Reserved for future use. */
54: };
55: 
56: struct ptp_extts_request {
57:         unsigned int index;  /* Which channel to configure. */
58:         unsigned int flags;  /* Bit field for PTP_xxx flags. */
59:         unsigned int rsv[2]; /* Reserved for future use. */
60: };
61: 
62: struct ptp_perout_request {
63:         struct ptp_clock_time start;  /* Absolute start time. */
64:         struct ptp_clock_time period; /* Desired period, zero means disable. */
65:         unsigned int index;           /* Which channel to configure. */
66:         unsigned int flags;           /* Reserved for future use. */
67:         unsigned int rsv[4];          /* Reserved for future use. */
68: };
69: 
70: #define PTP_CLK_MAGIC '='
71: 
72: #define PTP_CLOCK_GETCAPS  _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
73: #define PTP_EXTTS_REQUEST  _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request)
74: #define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
75: #define PTP_ENABLE_PPS     _IOW(PTP_CLK_MAGIC, 4, int)
76: 
77: struct ptp_extts_event {
78:         struct ptp_clock_time t; /* Time event occured. */
79:         unsigned int index;      /* Which channel produced the event. */
80:         unsigned int flags;      /* Reserved for future use. */
81:         unsigned int rsv[2];     /* Reserved for future use. */
82: };
83: 
84: #endif
85: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/