123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #ifndef _PTP_PRIVATE_H_
- #define _PTP_PRIVATE_H_
- #include <linux/cdev.h>
- #include <linux/device.h>
- #include <linux/mutex.h>
- #include <linux/posix-clock.h>
- #include <linux/ptp_clock.h>
- #include <linux/ptp_clock_kernel.h>
- #include <linux/time.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;
- struct pps_device *pps_source;
- long dialed_frequency;
- struct timestamp_event_queue tsevq;
- struct mutex tsevq_mux;
- struct mutex pincfg_mux;
- wait_queue_head_t tsev_wq;
- int defunct;
- struct device_attribute *pin_dev_attr;
- struct attribute **pin_attr;
- struct attribute_group pin_attr_group;
- };
- static inline int queue_cnt(struct timestamp_event_queue *q)
- {
- int cnt = q->tail - q->head;
- return cnt < 0 ? PTP_MAX_TIMESTAMPS + cnt : cnt;
- }
- int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,
- enum ptp_pin_function func, unsigned int chan);
- long ptp_ioctl(struct posix_clock *pc,
- unsigned int cmd, unsigned long arg);
- int ptp_open(struct posix_clock *pc, fmode_t fmode);
- ssize_t ptp_read(struct posix_clock *pc,
- uint flags, char __user *buf, size_t cnt);
- uint ptp_poll(struct posix_clock *pc,
- struct file *fp, poll_table *wait);
- extern const struct attribute_group *ptp_groups[];
- int ptp_cleanup_sysfs(struct ptp_clock *ptp);
- int ptp_populate_sysfs(struct ptp_clock *ptp);
- #endif
|