|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
Interfaces for Precision Time Protocol (PTP) clocks. More...
Topics | |
| PTP Clock Driver Backend API | |
Files | |
| file | ptp_clock.h |
| Main header file for PTP (Precision Time Protocol) clock driver API. | |
Macros | |
| #define | PTP_CLOCK_NAME "PTP_CLOCK" |
| #define | PTP_CLOCK_SCALED_PPM_SHIFT 16 |
| Number of fractional bits in a scaled parts-per-million rate adjustment. | |
| #define | PTP_CLOCK_SCALED_PPM_ONE (INT64_C(1) << PTP_CLOCK_SCALED_PPM_SHIFT) |
| One part per million in the scaled rate-adjustment representation. | |
Functions | |
| static int | ptp_clock_set (const struct device *dev, struct net_ptp_time *tm) |
| Set the time of the PTP clock. | |
| int | ptp_clock_get (const struct device *dev, struct net_ptp_time *tm) |
| Get the time of the PTP clock. | |
| static int | ptp_clock_adjust (const struct device *dev, int increment) |
| Adjust the PTP clock time. | |
| static int | ptp_clock_rate_adjust (const struct device *dev, double rate) |
| Adjust the PTP clock rate ratio based on its nominal frequency. | |
| static int | ptp_clock_adjust_rate (const struct device *dev, int64_t scaled_ppm) |
| Adjust the PTP clock rate by an offset from its nominal frequency. | |
Interfaces for Precision Time Protocol (PTP) clocks.
| #define PTP_CLOCK_NAME "PTP_CLOCK" |
#include <zephyr/drivers/ptp_clock.h>
| #define PTP_CLOCK_SCALED_PPM_ONE (INT64_C(1) << PTP_CLOCK_SCALED_PPM_SHIFT) |
#include <zephyr/drivers/ptp_clock.h>
One part per million in the scaled rate-adjustment representation.
| #define PTP_CLOCK_SCALED_PPM_SHIFT 16 |
#include <zephyr/drivers/ptp_clock.h>
Number of fractional bits in a scaled parts-per-million rate adjustment.
|
inlinestatic |
#include <zephyr/drivers/ptp_clock.h>
Adjust the PTP clock time.
| dev | PTP clock device |
| increment | Increment of the clock in nanoseconds |
#include <zephyr/drivers/ptp_clock.h>
Adjust the PTP clock rate by an offset from its nominal frequency.
The offset is not cumulative, it always refers to the nominal frequency of the clock. If the driver only implements the rate ratio operation, the offset is converted and passed to that one.
| dev | PTP clock device |
| scaled_ppm | Signed frequency offset from nominal in parts per million with a 16-bit binary fractional field. For example, PTP_CLOCK_SCALED_PPM_ONE represents 1 ppm. |
| 0 | Success |
| -errno | Negative errno code on failure |
| int ptp_clock_get | ( | const struct device * | dev, |
| struct net_ptp_time * | tm ) |
#include <zephyr/drivers/ptp_clock.h>
Get the time of the PTP clock.
| dev | PTP clock device |
| tm | Where to store the current time. |
|
inlinestatic |
#include <zephyr/drivers/ptp_clock.h>
Adjust the PTP clock rate ratio based on its nominal frequency.
If the driver only implements the scaled parts-per-million operation, the ratio is converted and passed to that one.
| dev | PTP clock device |
| rate | Rate ratio based on its nominal frequency |
| 0 | Success |
| -ERANGE | Rate ratio is not representable as scaled parts per million |
| -errno | Other negative errno code on failure |
|
inlinestatic |
#include <zephyr/drivers/ptp_clock.h>
Set the time of the PTP clock.
| dev | PTP clock device |
| tm | Time to set |