Donny9 opened a new pull request, #17498:
URL: https://github.com/apache/nuttx/pull/17498
## Summary
1. PTP 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.*
This framework provides the base for PTP clock implementations, allowing
hardware-specific drivers to register and provide precise time services
through a standardized interface.
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
3). 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
2. ptp clock dummy driver:
This patch adds a dummy PTP clock driver implementation that provides
a software-based PTP clock for testing and development purposes.
This dummy driver enables development and testing of PTP clock applications
on platforms without dedicated PTP hardware support.
3. support using CLOCKFD to call clock_gettime/settime
This patch implements POSIX-compliant CLOCKFD support, enabling user
applications to access dynamic PTP clocks through file descriptors
combined with clock_gettime() and clock_settime() system calls.
4. sched/clock: support using CLOCKFD to call clock_getres
This patch extends CLOCKFD support to clock_getres(), allowing
applications to query the resolution of PTP clocks through file
descriptors using the standard POSIX clock API.
5. sched/clock: support using CLOCKFD to call clock_adjtime
This patch implements clock_adjtime() with CLOCKFD support, enabling
precise time and frequency adjustments for PTP clocks through the
standard POSIX clock API.
6. Documentation: Add PTP clock driver framework documentation
This patch adds comprehensive documentation for the PTP (Precision Time
Protocol) clock driver framework in NuttX.
## Impact
New ptp driver model
change api: clock_gettime/clock_settime/clock_adjtime/clock_getres/....
## Testing
posix clock test and ptp test case、ptpd demon test pass
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]