Upcoming functionality will need to configure the input and output pins of PHC devices. However, this requires fairly recent kernel support. This patch adds the needed definitions for compiling with older kernel headers.
In addition, kernel v5.4 introduced a second set of ioctls for the ancillary PTP Hardware Clock functionality. The original ioctls failed to enforce the various flags and reversed fields, but the second version has fixed the issues. Going forward, our user space PTP stack ought to use the newer ioctls (if available) from day one. Signed-off-by: Richard Cochran <[email protected]> --- missing.h | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/missing.h b/missing.h index 8f92079..310c4b3 100644 --- a/missing.h +++ b/missing.h @@ -23,9 +23,10 @@ #ifndef HAVE_MISSING_H #define HAVE_MISSING_H -#include <time.h> +#include <linux/ptp_clock.h> #include <sys/syscall.h> #include <sys/timex.h> +#include <time.h> #include <unistd.h> #ifndef ADJ_TAI @@ -60,6 +61,47 @@ enum { }; #endif +#ifdef PTP_EXTTS_REQUEST2 +#define PTP_EXTTS_REQUEST_FAILED "PTP_EXTTS_REQUEST2 failed: %m" +#else +#define PTP_EXTTS_REQUEST_FAILED "PTP_EXTTS_REQUEST failed: %m" +#define PTP_EXTTS_REQUEST2 PTP_EXTTS_REQUEST +#endif + +#ifdef PTP_PEROUT_REQUEST2 +#define PTP_PEROUT_REQUEST_FAILED "PTP_PEROUT_REQUEST2 failed: %m" +#else +#define PTP_PEROUT_REQUEST_FAILED "PTP_PEROUT_REQUEST failed: %m" +#define PTP_PEROUT_REQUEST2 PTP_PEROUT_REQUEST +#endif + +#ifdef PTP_PIN_SETFUNC + +#define HAVE_PIN_SETFUNC + +#ifdef PTP_PIN_SETFUNC2 +#define PTP_PIN_SETFUNC_FAILED "PTP_PIN_SETFUNC2 failed: %m" +#else +#define PTP_PIN_SETFUNC_FAILED "PTP_PIN_SETFUNC failed: %m" +#define PTP_PIN_SETFUNC2 PTP_PIN_SETFUNC +#endif + +#else /*PTP_PIN_SETFUNC*/ +enum ptp_pin_function { + PTP_PF_NONE, + PTP_PF_EXTTS, + PTP_PF_PEROUT, + PTP_PF_PHYSYNC, +}; +struct ptp_pin_desc { + char name[64]; + unsigned int index; + unsigned int func; + unsigned int chan; + unsigned int rsv[5]; +}; +#endif /*!PTP_PIN_SETFUNC*/ + #ifndef LIST_FOREACH_SAFE #define LIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = LIST_FIRST((head)); \ -- 2.20.1 _______________________________________________ Linuxptp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
