|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
Data Structures | |
| struct | ptp_clock_driver_api |
| Driver Operations PTP Clock driver operations More... | |
Typedefs | |
| typedef int(* | ptp_clock_api_set_t) (const struct device *dev, struct net_ptp_time *tm) |
| Set the time of the PTP clock. | |
| typedef int(* | ptp_clock_api_get_t) (const struct device *dev, struct net_ptp_time *tm) |
| Get the time of the PTP clock. | |
| typedef int(* | ptp_clock_api_adjust_t) (const struct device *dev, int increment) |
| Adjust the PTP clock time. | |
| typedef int(* | ptp_clock_api_rate_adjust_t) (const struct device *dev, double ratio) |
| Adjust the PTP clock rate ratio based on its nominal frequency. | |
| typedef int(* | ptp_clock_api_adjust_rate_t) (const struct device *dev, int64_t scaled_ppm) |
| Adjust the PTP clock rate by an offset from its nominal frequency. | |
Functions | |
| static int64_t | ptp_clock_scaled_ppm_to_ppb (int64_t scaled_ppm) |
| Convert a scaled parts-per-million rate offset to parts per billion. | |
| static int | ptp_clock_adjust_by_scaled_ppm (uint32_t base, int64_t scaled_ppm, uint32_t *result) |
| Apply a scaled parts-per-million rate offset to a nominal value. | |
This group contains the API type definitions, callback signatures, and other helpers required to implement a PTP Clock driver.
#include <zephyr/drivers/ptp_clock.h>
Adjust the PTP clock rate by an offset from its nominal frequency.
See ptp_clock_adjust_rate() for argument description.
| typedef int(* ptp_clock_api_adjust_t) (const struct device *dev, int increment) |
#include <zephyr/drivers/ptp_clock.h>
Adjust the PTP clock time.
See ptp_clock_adjust() for argument description.
| typedef int(* ptp_clock_api_get_t) (const struct device *dev, struct net_ptp_time *tm) |
#include <zephyr/drivers/ptp_clock.h>
Get the time of the PTP clock.
See ptp_clock_get() for argument description.
| typedef int(* ptp_clock_api_rate_adjust_t) (const struct device *dev, double ratio) |
#include <zephyr/drivers/ptp_clock.h>
Adjust the PTP clock rate ratio based on its nominal frequency.
See ptp_clock_rate_adjust() for argument description.
| typedef int(* ptp_clock_api_set_t) (const struct device *dev, struct net_ptp_time *tm) |
#include <zephyr/drivers/ptp_clock.h>
Set the time of the PTP clock.
See ptp_clock_set() for argument description.
|
inlinestatic |
#include <zephyr/drivers/ptp_clock.h>
Apply a scaled parts-per-million rate offset to a nominal value.
Computes base * (1 + scaled_ppm / (1000000 * 2^16)) with integer arithmetic, rounded to nearest. Meant for drivers that tune the clock rate through an addend register.
| base | Nominal value |
| scaled_ppm | Rate offset in parts per million with a 16-bit binary fractional field |
| result | Where to store the adjusted value |
| 0 | Success |
| -ERANGE | Rate offset is beyond +-100 % or the adjusted value does not fit in 32 bits |
#include <zephyr/drivers/ptp_clock.h>
Convert a scaled parts-per-million rate offset to parts per billion.
| scaled_ppm | Rate offset in parts per million with a 16-bit binary fractional field |