Blame sysoff.h

Packit 9c3e7e
/**
Packit 9c3e7e
 * @file sysoff.h
Packit 9c3e7e
 * @brief Implements the system offset estimation method.
Packit 9c3e7e
 * @note Copyright (C) 2012 Richard Cochran <richardcochran@gmail.com>
Packit 9c3e7e
 *
Packit 9c3e7e
 * This program is free software; you can redistribute it and/or modify
Packit 9c3e7e
 * it under the terms of the GNU General Public License as published by
Packit 9c3e7e
 * the Free Software Foundation; either version 2 of the License, or
Packit 9c3e7e
 * (at your option) any later version.
Packit 9c3e7e
 *
Packit 9c3e7e
 * This program is distributed in the hope that it will be useful,
Packit 9c3e7e
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 9c3e7e
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 9c3e7e
 * GNU General Public License for more details.
Packit 9c3e7e
 *
Packit 9c3e7e
 * You should have received a copy of the GNU General Public License along
Packit 9c3e7e
 * with this program; if not, write to the Free Software Foundation, Inc.,
Packit 9c3e7e
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Packit 9c3e7e
 */
Packit 9c3e7e
Packit 9c3e7e
#include <stdint.h>
Packit 9c3e7e
Packit 9c3e7e
enum {
Packit d33695
	SYSOFF_COMPILE_TIME_MISSING = -2,
Packit d33695
	SYSOFF_RUN_TIME_MISSING = -1,
Packit d33695
	SYSOFF_PRECISE,
Packit d33695
	SYSOFF_EXTENDED,
Packit d33695
	SYSOFF_BASIC,
Packit d33695
	SYSOFF_LAST,
Packit 9c3e7e
};
Packit 9c3e7e
Packit 9c3e7e
/**
Packit d33695
 * Check to see if a PTP_SYS_OFFSET ioctl is supported.
Packit 9c3e7e
 * @param fd  An open file descriptor to a PHC device.
Packit 9c3e7e
 * @return  One of the SYSOFF_ enumeration values.
Packit 9c3e7e
 */
Packit 9c3e7e
int sysoff_probe(int fd, int n_samples);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Measure the offset between a PHC and the system time.
Packit 9c3e7e
 * @param fd         An open file descriptor to a PHC device.
Packit d33695
 * @param method     A non-negative SYSOFF_ value returned by sysoff_probe().
Packit 9c3e7e
 * @param n_samples  The number of consecutive readings to make.
Packit 9c3e7e
 * @param result     The estimated offset in nanoseconds.
Packit 9c3e7e
 * @param ts         The system time corresponding to the 'result'.
Packit 9c3e7e
 * @param delay      The delay in reading of the clock in nanoseconds.
Packit 9c3e7e
 * @return  One of the SYSOFF_ enumeration values.
Packit 9c3e7e
 */
Packit d33695
int sysoff_measure(int fd, int method, int n_samples,
Packit 9c3e7e
		   int64_t *result, uint64_t *ts, int64_t *delay);