/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * PTP 1588 clock support - user space interface * * Copyright (C) 2010 OMICRON electronics GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _PTP_CLOCK_H_ #define _PTP_CLOCK_H_ #include <linux/ioctl.h> #include <linux/types.h> /* * Bits of the ptp_extts_request.flags field: */ #define PTP_ENABLE_FEATURE … #define PTP_RISING_EDGE … #define PTP_FALLING_EDGE … #define PTP_STRICT_FLAGS … #define PTP_EXT_OFFSET … #define PTP_EXTTS_EDGES … /* * flag fields valid for the new PTP_EXTTS_REQUEST2 ioctl. */ #define PTP_EXTTS_VALID_FLAGS … /* * flag fields valid for the original PTP_EXTTS_REQUEST ioctl. * DO NOT ADD NEW FLAGS HERE. */ #define PTP_EXTTS_V1_VALID_FLAGS … /* * flag fields valid for the ptp_extts_event report. */ #define PTP_EXTTS_EVENT_VALID … /* * Bits of the ptp_perout_request.flags field: */ #define PTP_PEROUT_ONE_SHOT … #define PTP_PEROUT_DUTY_CYCLE … #define PTP_PEROUT_PHASE … /* * flag fields valid for the new PTP_PEROUT_REQUEST2 ioctl. */ #define PTP_PEROUT_VALID_FLAGS … /* * No flags are valid for the original PTP_PEROUT_REQUEST ioctl */ #define PTP_PEROUT_V1_VALID_FLAGS … /* * struct ptp_clock_time - represents a time value * * The sign of the seconds field applies to the whole value. The * nanoseconds field is always unsigned. The reserved field is * included for sub-nanosecond resolution, should the demand for * this ever appear. * */ struct ptp_clock_time { … }; struct ptp_clock_caps { … }; struct ptp_extts_request { … }; struct ptp_perout_request { … }; #define PTP_MAX_SAMPLES … struct ptp_sys_offset { … }; /* * ptp_sys_offset_extended - data structure for IOCTL operation * PTP_SYS_OFFSET_EXTENDED * * @n_samples: Desired number of measurements. * @clockid: clockid of a clock-base used for pre/post timestamps. * @rsv: Reserved for future use. * @ts: Array of samples in the form [pre-TS, PHC, post-TS]. The * kernel provides @n_samples. * * Starting from kernel 6.12 and onwards, the first word of the reserved-field * is used for @clockid. That's backward compatible since previous kernel * expect all three reserved words (@rsv[3]) to be 0 while the clockid (first * word in the new structure) for CLOCK_REALTIME is '0'. */ struct ptp_sys_offset_extended { … }; struct ptp_sys_offset_precise { … }; enum ptp_pin_function { … }; struct ptp_pin_desc { … }; #define PTP_CLK_MAGIC … #define PTP_CLOCK_GETCAPS … #define PTP_EXTTS_REQUEST … #define PTP_PEROUT_REQUEST … #define PTP_ENABLE_PPS … #define PTP_SYS_OFFSET … #define PTP_PIN_GETFUNC … #define PTP_PIN_SETFUNC … #define PTP_SYS_OFFSET_PRECISE … #define PTP_SYS_OFFSET_EXTENDED … #define PTP_CLOCK_GETCAPS2 … #define PTP_EXTTS_REQUEST2 … #define PTP_PEROUT_REQUEST2 … #define PTP_ENABLE_PPS2 … #define PTP_SYS_OFFSET2 … #define PTP_PIN_GETFUNC2 … #define PTP_PIN_SETFUNC2 … #define PTP_SYS_OFFSET_PRECISE2 … #define PTP_SYS_OFFSET_EXTENDED2 … #define PTP_MASK_CLEAR_ALL … #define PTP_MASK_EN_SINGLE … struct ptp_extts_event { … }; #endif