mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 13:13:08 +08:00
drivers/timers/ptp: support ptp clock driver model
This patch introduces the foundational PTP (Precision Time Protocol) clock driver framework for NuttX, enabling precise time synchronization support based on IEEE 1588 standard. Key changes include: 1. New PTP clock driver infrastructure: - Added drivers/timers/ptp_clock.c implementing upper-half driver - Created include/nuttx/timers/ptp_clock.h with PTP clock interfaces - Implemented upper/lower half driver architecture for hardware abstraction 2. Core functionality: - Clock time get/set operations (gettime, settime) - Frequency adjustment support (adjtime, adjfine) - Phase adjustment capabilities - System-device cross-timestamping for precise synchronization 3. IOCTL commands: - PTP_CLOCK_SETTIME/GETTIME for time manipulation - PTP_CLOCK_GETRES for resolution queries - PTP_CLOCK_ADJTIME for time adjustment - PTP_CLOCK_GETCAPS for capability queries - PTP_SYS_OFFSET* for system offset measurements 4. Supporting structures: - struct ptp_lowerhalf_s: lower-half driver interface - struct ptp_clock_caps: clock capabilities descriptor - struct ptp_sys_offset: system time offset measurement - Added timex structures in include/sys/timex.h for ADJ_* operations 5. Build system integration: - Added CONFIG_PTP_CLOCK Kconfig option - Updated CMakeLists.txt and Make.defs - Added PTPCLK debug macros in include/debug.h This framework provides the base for PTP clock implementations, allowing hardware-specific drivers to register and provide precise time services through a standardized interface. Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
committed by
Alan C. Assis
parent
7298977894
commit
31eb339356
@@ -1031,6 +1031,24 @@
|
||||
# define csinfo _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_PTP_ERROR
|
||||
# define ptperr _err
|
||||
#else
|
||||
# define ptperr _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_PTP_WARN
|
||||
# define ptpwarn _warn
|
||||
#else
|
||||
# define ptpwarn _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_PTP_INFO
|
||||
# define ptpinfo _info
|
||||
#else
|
||||
# define ptpinfo _none
|
||||
#endif
|
||||
|
||||
/* Buffer dumping macros do not depend on varargs */
|
||||
|
||||
#ifdef CONFIG_DEBUG_ERROR
|
||||
|
||||
Reference in New Issue
Block a user