flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
settings_interface.c File Reference
#include "settings_interface.h"
#include "flexptp/ptp_defs.h"
#include "ptp_types.h"
#include "ptp_core.h"
#include <string.h>

Go to the source code of this file.

Functions

void ptp_set_clock_offset (int32_t offset)
 
int32_t ptp_get_clock_offset ()
 
void ptp_prefer_master_clock (uint64_t clockId)
 
void ptp_unprefer_master_clock ()
 
uint64_t ptp_get_current_master_clock_identity ()
 
uint64_t ptp_get_own_clock_identity ()
 
void ptp_set_domain (uint8_t domain)
 
uint8_t ptp_get_domain ()
 
void ptp_set_addend (uint32_t addend)
 
uint32_t ptp_get_addend ()
 
PtpTransportType ptp_get_transport_type ()
 
void ptp_set_transport_type (PtpTransportType tp)
 
void ptp_set_delay_mechanism (PtpDelayMechanism dm)
 
PtpDelayMechanism ptp_get_delay_mechanism ()
 
void ptp_set_transport_specific (PtpTransportSpecific tspec)
 
PtpTransportSpecific ptp_get_transport_specific ()
 
void ptp_set_profile_flags (uint8_t flags)
 
uint8_t ptp_get_profile_flags ()
 
void ptp_set_tlv_chain_by_name (const char *tlvSet)
 
const char * ptp_get_loaded_tlv_chain ()
 
void ptp_load_profile (const PtpProfile *pProfile)
 
int8_t ptp_get_delay_req_log_period ()
 
void ptp_set_delay_req_log_period (int8_t drlp)
 
int8_t ptp_get_sync_log_period ()
 
void ptp_set_sync_log_period (int8_t slp)
 
int8_t ptp_get_announce_log_period ()
 
void ptp_set_announce_log_period (int8_t alp)
 
void ptp_set_coarse_threshold (uint64_t ns)
 
uint64_t ptp_get_coarse_threshold ()
 
void ptp_set_priority1 (uint8_t p1)
 
uint8_t ptp_get_priority1 ()
 
void ptp_set_priority2 (uint8_t p2)
 
uint8_t ptp_get_priority2 ()
 
void ptp_set_clock_class (PtpClockClass cc)
 
PtpClockClass ptp_get_clock_class ()
 
void ptp_set_clock_accuracy (PtpClockAccuracy ca)
 
PtpClockAccuracy ptp_get_clock_accuracy ()
 
void ptp_set_clock_variance (uint16_t var)
 
uint16_t ptp_get_clock_variance ()
 
void ptp_set_local_steps_removed (uint16_t lsr)
 
uint16_t ptp_get_local_steps_removed ()
 
void ptp_time (TimestampU *pT)
 

Function Documentation

◆ ptp_get_addend()

uint32_t ptp_get_addend ( )

Get addend.

Returns
addend

Definition at line 50 of file settings_interface.c.

◆ ptp_get_announce_log_period()

int8_t ptp_get_announce_log_period ( )

Get the logarithmic Announce period code.

Returns
logarithmic period code

Definition at line 121 of file settings_interface.c.

◆ ptp_get_clock_accuracy()

PtpClockAccuracy ptp_get_clock_accuracy ( )

Get clock accuracy.

Returns
accuracy class of the clock

Definition at line 168 of file settings_interface.c.

◆ ptp_get_clock_class()

PtpClockClass ptp_get_clock_class ( )

Get device clock class.

Returns
device clock class

Definition at line 160 of file settings_interface.c.

◆ ptp_get_clock_offset()

int32_t ptp_get_clock_offset ( )

Get clock offset in nanoseconds.

Returns
clock offset in nanoseconds

Definition at line 17 of file settings_interface.c.

◆ ptp_get_clock_variance()

uint16_t ptp_get_clock_variance ( )

Get clock variance.

Returns
clock variance OR 0xFFFF indicating no calculation took place

Definition at line 176 of file settings_interface.c.

◆ ptp_get_coarse_threshold()

uint64_t ptp_get_coarse_threshold ( )

Get PTP coarse correction time error tigger value.

Returns
coarse correction kick-in theshold in nanosconds

Definition at line 134 of file settings_interface.c.

◆ ptp_get_current_master_clock_identity()

uint64_t ptp_get_current_master_clock_identity ( )

Get clock ID of the master that the PTP engine currently follows.

Returns
clock ID of the followed master

Definition at line 30 of file settings_interface.c.

◆ ptp_get_delay_mechanism()

PtpDelayMechanism ptp_get_delay_mechanism ( )

Get the PTP delay mechanism.

Returns
delay mechanism (E2E/P2P)

Definition at line 67 of file settings_interface.c.

◆ ptp_get_delay_req_log_period()

int8_t ptp_get_delay_req_log_period ( )

Get logarithmic PTP message period designator code of Delay_Request queries.

Returns
logarithmic period code

Definition at line 103 of file settings_interface.c.

◆ ptp_get_domain()

uint8_t ptp_get_domain ( )

Get the PTP domain the engine operates in.

Returns
PTP domain

Definition at line 42 of file settings_interface.c.

◆ ptp_get_loaded_tlv_chain()

const char * ptp_get_loaded_tlv_chain ( )

Get the name of the loaded TLV-chain preset.

Returns
name of the current TLV-chain preset OR an empty ("") string if nothing was loaded before

Definition at line 94 of file settings_interface.c.

◆ ptp_get_local_steps_removed()

uint16_t ptp_get_local_steps_removed ( )

Get number of local steps removed.

Returns
number of local steps removed

Definition at line 184 of file settings_interface.c.

◆ ptp_get_own_clock_identity()

uint64_t ptp_get_own_clock_identity ( )

Get our own clock identity.

Returns
our own clock identity

Definition at line 34 of file settings_interface.c.

◆ ptp_get_priority1()

uint8_t ptp_get_priority1 ( )

Get master dataset Priority1 field.

Returns
Priority1 field

Definition at line 143 of file settings_interface.c.

◆ ptp_get_priority2()

uint8_t ptp_get_priority2 ( )

Get master dataset Priority2 field.

Returns
Priority2 field

Definition at line 152 of file settings_interface.c.

◆ ptp_get_profile_flags()

uint8_t ptp_get_profile_flags ( )

Get profile flags.

Returns
combination of PtpProfileFlags

Definition at line 85 of file settings_interface.c.

◆ ptp_get_sync_log_period()

int8_t ptp_get_sync_log_period ( )

Get the logarithmic Sync period code.

Returns
logarithmic period code

Definition at line 112 of file settings_interface.c.

◆ ptp_get_transport_specific()

PtpTransportSpecific ptp_get_transport_specific ( )

Get the transport specific field.

Returns
value of transport specific field

Definition at line 76 of file settings_interface.c.

◆ ptp_get_transport_type()

PtpTransportType ptp_get_transport_type ( )

Get PTP transport type.

Returns
PTP transport type (L2/L4).

Definition at line 54 of file settings_interface.c.

◆ ptp_load_profile()

void ptp_load_profile ( const PtpProfile pProfile)

Load profile preset.

Parameters
pProfilepointer an existing profile preset.

Definition at line 99 of file settings_interface.c.

◆ ptp_prefer_master_clock()

void ptp_prefer_master_clock ( uint64_t  clockId)

Make the PTP engine to expect messages from a particular master.

Parameters
clockIdclock ID of the master we want to follow

Definition at line 21 of file settings_interface.c.

◆ ptp_set_addend()

void ptp_set_addend ( uint32_t  addend)

Set addend, the frequency tuning word.

Parameters
addendaddend

Definition at line 46 of file settings_interface.c.

◆ ptp_set_announce_log_period()

void ptp_set_announce_log_period ( int8_t  alp)

Set the logarithmic Announce period code.

Parameters
alplogarithmic period code

Definition at line 125 of file settings_interface.c.

◆ ptp_set_clock_accuracy()

void ptp_set_clock_accuracy ( PtpClockAccuracy  ca)

Set clock accuracy.

Definition at line 164 of file settings_interface.c.

◆ ptp_set_clock_class()

void ptp_set_clock_class ( PtpClockClass  cc)

Set device clock class.

Definition at line 156 of file settings_interface.c.

◆ ptp_set_clock_offset()

void ptp_set_clock_offset ( int32_t  offset)

Set clock offset in nanoseconds.

Parameters
offsetoffset in nanoseconds

Definition at line 13 of file settings_interface.c.

◆ ptp_set_clock_variance()

void ptp_set_clock_variance ( uint16_t  var)

Set clock variance.

Definition at line 172 of file settings_interface.c.

◆ ptp_set_coarse_threshold()

void ptp_set_coarse_threshold ( uint64_t  ns)

Set PTP coarse correction time error tigger value.

Parameters
nscoarse correction kick-in threshold in nanoseconds

Definition at line 130 of file settings_interface.c.

◆ ptp_set_delay_mechanism()

void ptp_set_delay_mechanism ( PtpDelayMechanism  dm)

Set the PTP delay mechanism (E2E/P2P).

Parameters
dmdelay mechanism

Definition at line 62 of file settings_interface.c.

◆ ptp_set_delay_req_log_period()

void ptp_set_delay_req_log_period ( int8_t  drlp)

Set logarithmic PTP message period designator code of Delay_Requests.

Parameters
drlplogarithmic period code

Definition at line 107 of file settings_interface.c.

◆ ptp_set_domain()

void ptp_set_domain ( uint8_t  domain)

Set PTP domain which the PTP engine listens to.

Parameters
domainPTP domain

Definition at line 38 of file settings_interface.c.

◆ ptp_set_local_steps_removed()

void ptp_set_local_steps_removed ( uint16_t  lsr)

Set number of local steps removed.

Definition at line 180 of file settings_interface.c.

◆ ptp_set_priority1()

void ptp_set_priority1 ( uint8_t  p1)

Set master dataset Priority1 field.

Definition at line 138 of file settings_interface.c.

◆ ptp_set_priority2()

void ptp_set_priority2 ( uint8_t  p2)

Set master dataset Priority2 field.

Definition at line 147 of file settings_interface.c.

◆ ptp_set_profile_flags()

void ptp_set_profile_flags ( uint8_t  flags)

Set profile flags.

Parameters
flagscombination of PtpProfileFlags

Definition at line 80 of file settings_interface.c.

◆ ptp_set_sync_log_period()

void ptp_set_sync_log_period ( int8_t  slp)

Set the logarithmic Sync period code.

Parameters
slplogarithmic period code

Definition at line 116 of file settings_interface.c.

◆ ptp_set_tlv_chain_by_name()

void ptp_set_tlv_chain_by_name ( const char *  tlvSet)

Load TLV-chain preset fetched by name.

Parameters
tlvSetname of the TLV-chain preset, pass an empty string ("") to unload everything

Definition at line 89 of file settings_interface.c.

◆ ptp_set_transport_specific()

void ptp_set_transport_specific ( PtpTransportSpecific  tspec)

Set transport specific field.

Parameters
tspecvalue of transport specific field

Definition at line 71 of file settings_interface.c.

◆ ptp_set_transport_type()

void ptp_set_transport_type ( PtpTransportType  tp)

Set PTP transport type.

Parameters
tptransport type (L2/L4)

Definition at line 58 of file settings_interface.c.

◆ ptp_time()

void ptp_time ( TimestampU pT)

Get PTP time right from the hardware clock.

Parameters
pTpointer to an existing TimestampU object, that is going to be overwritten with the current time

Definition at line 188 of file settings_interface.c.

◆ ptp_unprefer_master_clock()

void ptp_unprefer_master_clock ( )

Allow the PTP engine to follow the best master on the network.

Definition at line 26 of file settings_interface.c.