Loading...
Searching...
No Matches

Low-level PTP clock peripheral driver interface definitions. More...

Detailed Description

Low-level PTP clock peripheral driver interface definitions.

Author
Marian Buschsieweke maria.nosp@m.n.bu.nosp@m.schsi.nosp@m.ewek.nosp@m.e@ovg.nosp@m.u.de

Definition in file ptp.h.

#include <stdint.h>
#include "periph_cpu.h"
#include "timex.h"
+ Include dependency graph for ptp.h:

Go to the source code of this file.

Data Structures

struct  ptp_timestamp_t
 A PTP timestamp in seconds + nanoseconds since UNIX epoch. More...
 

Typedefs

typedef uint32_t ptp_seconds_t
 Unsigned integer type to store seconds since epoch for use in PTP.
 

Functions

static int ptp_cmp (const ptp_timestamp_t *a, const ptp_timestamp_t *b)
 Compare two PTP timestamps.
 
static void ptp_add (ptp_timestamp_t *t, int64_t offset)
 Add a given offset onto the given timestamp.
 
static void ptp_ns2ts (ptp_timestamp_t *dest, uint64_t ns_since_epoch)
 Convert time from nanoseconds since epoch to ptp_timestamp_t format.
 
static uint64_t ptp_ts2ns (const ptp_timestamp_t *t)
 Convert time from nanoseconds since epoch to ptp_timestamp_t format.
 
void ptp_init (void)
 Initialize the given PTP peripheral.
 
void ptp_clock_adjust_speed (int32_t correction)
 Adjust the PTP clock speed as given.
 
void ptp_clock_adjust (int64_t offset)
 Adjust the PTP clock as given.
 
void ptp_clock_read (ptp_timestamp_t *timestamp)
 Get the current system time as PTP timestamp.
 
uint64_t ptp_clock_read_u64 (void)
 Get the current system time in nanosecond since UNIX epoch.
 
void ptp_clock_set (const ptp_timestamp_t *time)
 Set the current system time.
 
void ptp_clock_set_u64 (uint64_t ns_since_epoch)
 Set the current system time in nanosecond since UNIX epoch.
 
void ptp_timer_cb (void)
 External function to call when the PTP clock timer fired.
 
void ptp_timer_set_absolute (const ptp_timestamp_t *target)
 Set an absolute timeout value, possibly overwriting an existing timeout.
 
void ptp_timer_set_absolute_u64 (uint64_t target)
 Set an absolute timeout value, possibly overwriting an existing timeout.
 
void ptp_timer_set_u64 (uint64_t target)
 Set an relative timeout value, possibly overwriting an existing timeout.
 
void ptp_timer_clear (void)
 Clears any pending timeout on the PTP timer.