summaryrefslogtreecommitdiff
path: root/backport-include/linux/ptp_clock_kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'backport-include/linux/ptp_clock_kernel.h')
-rw-r--r--backport-include/linux/ptp_clock_kernel.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/backport-include/linux/ptp_clock_kernel.h b/backport-include/linux/ptp_clock_kernel.h
new file mode 100644
index 0000000..e4483c0
--- /dev/null
+++ b/backport-include/linux/ptp_clock_kernel.h
@@ -0,0 +1,40 @@
+#ifndef __BACKPORT_PTP_CLOCK_KERNEL_H
+#define __BACKPORT_PTP_CLOCK_KERNEL_H
+
+#include <linux/version.h>
+#include_next <linux/ptp_clock_kernel.h>
+
+#if LINUX_VERSION_IS_LESS(3,5,0)
+#include <linux/posix-clock.h>
+
+#define PTP_MAX_TIMESTAMPS 128
+#define PTP_BUF_TIMESTAMPS 30
+
+struct timestamp_event_queue {
+ struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS];
+ int head;
+ int tail;
+ spinlock_t lock;
+};
+
+struct ptp_clock {
+ struct posix_clock clock;
+ struct device *dev;
+ struct ptp_clock_info *info;
+ dev_t devid;
+ int index; /* index into clocks.map */
+ struct pps_device *pps_source;
+ struct timestamp_event_queue tsevq; /* simple fifo for time stamps */
+ struct mutex tsevq_mux; /* one process at a time reading the fifo */
+ wait_queue_head_t tsev_wq;
+ int defunct; /* tells readers to go away when clock is being removed */
+};
+
+extern int ptp_clock_index(struct ptp_clock *ptp);
+#endif /* LINUX_VERSION_IS_LESS(3,5,0) */
+
+#if LINUX_VERSION_IS_LESS(3,7,0) && !defined(CONFIG_SUSE_KERNEL)
+#define ptp_clock_register(info,parent) ptp_clock_register(info)
+#endif /* LINUX_VERSION_IS_LESS(3,7,0) */
+
+#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */