[dm][ptp] support Precision Time Protocol (PTP) IEEE 1588 clock

Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
GuEe-GUI
2026-06-29 16:55:18 +08:00
committed by Rbb666
parent 1f9146897b
commit 11ca166006
10 changed files with 1439 additions and 0 deletions
@@ -198,6 +198,14 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#define CLOCK_TAI 11 // newlib says they don't have this definition, make the compiler happy
#endif /* CLOCK_TAI */
#ifdef RT_USING_PTP
#ifndef CLOCKFD
#define CLOCKFD 3
#endif /* CLOCKFD */
#define FD_TO_CLOCKID(fd) ((clockid_t)((~(clockid_t)(fd) << 3) | CLOCKFD))
#define CLOCKID_TO_FD(clk) ((unsigned int)(~((unsigned int)(clk) >> 3)))
#endif /* RT_USING_PTP */
#endif /* defined(RT_USING_POSIX_CLOCK) || defined (RT_USING_POSIX_TIMER) */
#ifdef RT_USING_POSIX_CLOCK