This patch adds comprehensive documentation for the PTP (Precision Time
Protocol) clock driver framework in NuttX.
The documentation covers:
1. Overview and Architecture:
- IEEE 1588 PTP clock framework introduction
- Upper-half and lower-half driver architecture
- Integration with POSIX clock APIs
2. Configuration Options:
- CONFIG_PTP_CLOCK: Main framework configuration
- CONFIG_PTP_CLOCK_DUMMY: Dummy driver for testing
- CONFIG_CLOCK_ADJTIME: clock_adjtime() system call support
3. Device Interface:
- Character device interface (/dev/ptpN)
- IOCTL commands: PTP_CLOCK_GETTIME, PTP_CLOCK_SETTIME,
PTP_CLOCK_GETRES, PTP_CLOCK_ADJTIME, PTP_CLOCK_GETCAPS,
PTP_SYS_OFFSET, PTP_SYS_OFFSET_PRECISE
4. POSIX Clock API (CLOCKFD):
- Using CLOCKFD() macro to access PTP clocks
- clock_gettime(), clock_settime(), clock_getres() examples
- clock_adjtime() with various adjustment modes
- ADJ_OFFSET, ADJ_FREQUENCY, ADJ_SETOFFSET support
5. Dummy PTP Clock Driver:
- Software-based implementation for testing
- Features and initialization details
6. Example Usage:
- Basic time operations
- Frequency adjustment examples
- Time offset adjustment examples
7. Implementing Lower-Half Drivers:
- Step-by-step guide for hardware driver implementation
- Required operations and structures
- Registration process
8. Integration with PTP Daemons:
- ptp4l, timemaster, ptpd compatibility
- Standard POSIX clock API usage
9. Performance Considerations:
- Hardware timestamping requirements
- Cross-timestamping support
- Frequency adjustment resolution
10. Debugging:
- Debug configuration options
- Debug output examples
The documentation is added to:
- Documentation/components/drivers/special/ptp.rst (new file)
- Documentation/components/drivers/special/index.rst (updated)
This provides developers with complete reference material for using
and implementing PTP clock drivers in NuttX.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).
For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.
Getting Started
First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.
Documentation
You can find the current NuttX documentation on the Documentation Page.
Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.
The old NuttX documentation is still available in the Apache wiki.
Supported Boards
NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.
Contributing
If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.
License
The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.
