Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gPTP support

generic Precision Time Protocol (gPTP) support More...

Data Structures

struct  gptp_scaled_ns
 Scaled Nanoseconds. More...
 
struct  gptp_uscaled_ns
 UScaled Nanoseconds. More...
 
struct  gptp_port_identity
 Port Identity. More...
 
struct  gptp_flags
 gPTP message flags More...
 
struct  gptp_hdr
 gPTP message header More...
 
struct  gptp_phase_dis_cb
 Phase discontinuity callback structure. More...
 
struct  gptp_clk_src_time_invoke_params
 ClockSourceTime.invoke function parameters. More...
 

Typedefs

typedef void(* gptp_phase_dis_callback_t) (uint8_t *gm_identity, uint16_t *time_base, struct gptp_scaled_ns *last_gm_ph_change, double *last_gm_freq_change)
 Define callback that is called after a phase discontinuity has been sent by the grandmaster.
 
typedef void(* gptp_port_cb_t) (int port, struct net_if *iface, void *user_data)
 Callback used while iterating over gPTP ports.
 

Functions

void gptp_register_phase_dis_cb (struct gptp_phase_dis_cb *phase_dis, gptp_phase_dis_callback_t cb)
 Register a phase discontinuity callback.
 
void gptp_unregister_phase_dis_cb (struct gptp_phase_dis_cb *phase_dis)
 Unregister a phase discontinuity callback.
 
void gptp_call_phase_dis_cb (void)
 Call a phase discontinuity callback function.
 
int gptp_event_capture (struct net_ptp_time *slave_time, bool *gm_present)
 Get gPTP time.
 
char * gptp_sprint_clock_id (const uint8_t *clk_id, char *output, size_t output_len)
 Utility function to print clock id to a user supplied buffer.
 
void gptp_foreach_port (gptp_port_cb_t cb, void *user_data)
 Go through all the gPTP ports and call callback for each of them.
 
struct gptp_domain * gptp_get_domain (void)
 Get gPTP domain.
 
void gptp_clk_src_time_invoke (struct gptp_clk_src_time_invoke_params *arg)
 This interface is used by the ClockSource entity to provide time to the ClockMaster entity of a time-aware system.
 
struct gptp_hdrgptp_get_hdr (struct net_pkt *pkt)
 Return pointer to gPTP packet header in network packet.
 

Detailed Description

generic Precision Time Protocol (gPTP) support

Typedef Documentation

◆ gptp_phase_dis_callback_t

gptp_phase_dis_callback_t

#include <zephyr/net/gptp.h>

Define callback that is called after a phase discontinuity has been sent by the grandmaster.

Parameters
gm_identityA pointer to first element of a ClockIdentity array. The size of the array is GPTP_CLOCK_ID_LEN.
time_baseA pointer to the value of timeBaseIndicator of the current grandmaster.
last_gm_ph_changeA pointer to the value of lastGmPhaseChange received from grandmaster.
last_gm_freq_changeA pointer to the value of lastGmFreqChange received from the grandmaster.

◆ gptp_port_cb_t

gptp_port_cb_t

#include <zephyr/net/gptp.h>

Callback used while iterating over gPTP ports.

Parameters
portPort number
ifacePointer to network interface
user_dataA valid pointer to user data or NULL

Function Documentation

◆ gptp_call_phase_dis_cb()

void gptp_call_phase_dis_cb ( void  )

#include <zephyr/net/gptp.h>

Call a phase discontinuity callback function.

◆ gptp_clk_src_time_invoke()

void gptp_clk_src_time_invoke ( struct gptp_clk_src_time_invoke_params arg)

#include <zephyr/net/gptp.h>

This interface is used by the ClockSource entity to provide time to the ClockMaster entity of a time-aware system.

Parameters
argCurrent state and parameters of the ClockSource entity.

◆ gptp_event_capture()

int gptp_event_capture ( struct net_ptp_time slave_time,
bool gm_present 
)

#include <zephyr/net/gptp.h>

Get gPTP time.

Parameters
slave_timeA pointer to structure where timestamp will be saved.
gm_presentA pointer to a boolean where status of the presence of a grand master will be saved.
Returns
Error code. 0 if no error.

◆ gptp_foreach_port()

void gptp_foreach_port ( gptp_port_cb_t  cb,
void *  user_data 
)

#include <zephyr/net/gptp.h>

Go through all the gPTP ports and call callback for each of them.

Parameters
cbUser-supplied callback function to call
user_dataUser specified data

◆ gptp_get_domain()

struct gptp_domain * gptp_get_domain ( void  )

#include <zephyr/net/gptp.h>

Get gPTP domain.

This contains all the configuration / status of the gPTP domain.

Returns
Pointer to domain or NULL if not found.

◆ gptp_get_hdr()

struct gptp_hdr * gptp_get_hdr ( struct net_pkt pkt)

#include <zephyr/net/gptp.h>

Return pointer to gPTP packet header in network packet.

Parameters
pktNetwork packet (received or sent)
Returns
Pointer to gPTP header.

◆ gptp_register_phase_dis_cb()

void gptp_register_phase_dis_cb ( struct gptp_phase_dis_cb phase_dis,
gptp_phase_dis_callback_t  cb 
)

#include <zephyr/net/gptp.h>

Register a phase discontinuity callback.

Parameters
phase_disCaller specified handler for the callback.
cbCallback to register.

◆ gptp_sprint_clock_id()

char * gptp_sprint_clock_id ( const uint8_t clk_id,
char *  output,
size_t  output_len 
)

#include <zephyr/net/gptp.h>

Utility function to print clock id to a user supplied buffer.

Parameters
clk_idClock id
outputOutput buffer
output_lenOutput buffer len
Returns
Pointer to output buffer

◆ gptp_unregister_phase_dis_cb()

void gptp_unregister_phase_dis_cb ( struct gptp_phase_dis_cb phase_dis)

#include <zephyr/net/gptp.h>

Unregister a phase discontinuity callback.

Parameters
phase_disCaller specified handler for the callback.