gPTP Documentation
|
#include <avbts_clock.hpp>
Public Member Functions | |
IEEE1588Clock (bool forceOrdinarySlave, bool syntonize, uint8_t priority1, HWTimestamper *timestamper, OSTimerQueueFactory *timerq_factory, OS_IPC *ipc, OSLockFactory *lock_factory) | |
Instantiates a IEEE 1588 Clock. More... | |
bool | serializeState (void *buf, long *count) |
Updates the frequencyRatio information. More... | |
bool | restoreSerializedState (void *buf, long *count) |
Restores the frequencyRatio with the serialized input buffer data. More... | |
Timestamp | getTime (void) |
Gets the current time from system clock. More... | |
Timestamp | getPreciseTime (void) |
Gets the timestamp from hardware (Deprecated) More... | |
bool | isBetterThan (PTPMessageAnnounce *msg) |
Compares the 1588 Clock to the grandmaster clock. More... | |
ClockIdentity | getLastEBestIdentity (void) |
Gets the Last Best clock identity. More... | |
void | setLastEBestIdentity (ClockIdentity id) |
Sets the last Best clock identity. More... | |
void | setClockIdentity (char *id) |
Sets clock identity by id. More... | |
void | setClockIdentity (LinkLayerAddress *addr) |
Set clock id based on the link layer address. Clock id is 8 octets long whereas link layer address is 6 octets long and it is turned into a clock identity as per the 802.1AS standard described in clause 8.5.2.2. More... | |
unsigned char | getDomain (void) |
Gets the domain number. More... | |
ClockIdentity | getGrandmasterClockIdentity (void) |
Gets grandmaster clock ID. More... | |
void | setGrandmasterClockIdentity (ClockIdentity id) |
Sets a new GM clock ID. More... | |
ClockQuality | getGrandmasterClockQuality (void) |
Gets grandmaster clock quality object. More... | |
void | setGrandmasterClockQuality (ClockQuality clock_quality) |
Sets grandmaster clock quality. More... | |
ClockQuality | getClockQuality (void) |
Gets the IEEE 1588 Clock quality. More... | |
unsigned char | getGrandmasterPriority1 (void) |
Gets grandmaster priority1 attribute (IEEE 802.1AS clause 10.5.3.2.2) More... | |
unsigned char | getGrandmasterPriority2 (void) |
Gets grandmaster priotity2 attribute (IEEE 802.1AS clause 10.5.3.2.4) More... | |
void | setGrandmasterPriority1 (unsigned char priority1) |
Sets grandmaster's priority1 attribute (IEEE 802.1AS clause 10.5.3.2.2) More... | |
void | setGrandmasterPriority2 (unsigned char priority2) |
Sets grandmaster's priority2 attribute (IEEE 802.1AS clause 10.5.3.2.4) More... | |
uint16_t | getMasterStepsRemoved (void) |
Gets master steps removed (IEEE 802.1AS clause 10.3.3) More... | |
uint16_t | getCurrentUtcOffset (void) |
Gets the currentUtcOffset attribute (IEEE 802.1AS clause 10.3.8.9) More... | |
uint8_t | getTimeSource (void) |
Gets the TimeSource attribute (IEEE 802.1AS-2011 clause 10.3.8.10) More... | |
unsigned char | getPriority1 (void) |
Gets IEEE1588Clock priority1 value (IEEE 802.1AS clause 8.6.2.1) More... | |
unsigned char | getPriority2 (void) |
Gets IEEE1588Clock priority2 attribute (IEEE 802.1AS clause 8.6.2.5) More... | |
uint16_t | getNextPortId (void) |
Gets nextPortId value. More... | |
void | registerPort (IEEE1588Port *port, uint16_t index) |
Registers a new IEEE1588 port. More... | |
void | getPortList (int &count, IEEE1588Port **&ports) |
Gets the current port list instance. More... | |
void | addEventTimer (IEEE1588Port *target, Event e, unsigned long long time_ns) |
Add a new event to the timer queue. More... | |
void | deleteEventTimer (IEEE1588Port *target, Event e) |
Deletes an event from the timer queue. More... | |
void | addEventTimerLocked (IEEE1588Port *target, Event e, unsigned long long time_ns) |
Adds an event to the timer queue using a lock. More... | |
void | deleteEventTimerLocked (IEEE1588Port *target, Event e) |
Deletes and event from the timer queue using a lock. More... | |
FrequencyRatio | calcMasterLocalClockRateDifference (Timestamp master_time, Timestamp sync_time) |
Calculates the master to local clock rate difference. More... | |
FrequencyRatio | calcLocalSystemClockRateDifference (Timestamp local_time, Timestamp system_time) |
Calculates the local to system clock rate difference. More... | |
void | setMasterOffset (int64_t master_local_offset, Timestamp local_time, FrequencyRatio master_local_freq_offset, int64_t local_system_offset, Timestamp system_time, FrequencyRatio local_system_freq_offset, unsigned sync_count, unsigned pdelay_count, PortState port_state) |
Sets the master offset, sintonyze and adjusts the frequency offset. More... | |
ClockIdentity | getClockIdentity () |
Get the IEEE1588Clock identity value. More... | |
void | newSyntonizationSetPoint () |
Sets a flag that will allow syntonization during setMasterOffset calls. More... | |
int | getTxLockAll () |
Gets all TX locks. More... | |
int | putTxLockAll () |
Release all TX locks. More... | |
OSLockResult | getTimerQLock () |
Gets the timer queue lock. More... | |
OSLockResult | putTimerQLock () |
Releases the timer queue lock. More... | |
OSLock * | timerQLock () |
Gets a pointer to the timer queue lock object. More... | |
Static Public Member Functions | |
static Timestamp | getSystemTime (void) |
Gets current system time. More... | |
Friends | |
void | tick_handler (int sig) |
Declares a friend instance of tick_handler method. More... | |
Provides the 1588 clock interface
IEEE1588Clock::IEEE1588Clock | ( | bool | forceOrdinarySlave, |
bool | syntonize, | ||
uint8_t | priority1, | ||
HWTimestamper * | timestamper, | ||
OSTimerQueueFactory * | timerq_factory, | ||
OS_IPC * | ipc, | ||
OSLockFactory * | lock_factory | ||
) |
Instantiates a IEEE 1588 Clock.
forceOrdinarySlave | Forces it to be an ordinary slave |
syntonize | if TRUE, clock will syntonize to the master clock |
priority1 | It is used in the execution of BCMA. See IEEE 802.1AS Clause 10.3 |
timestamper | [in] Provides an object for hardware timestamp |
timerq_factory | [in] Provides a factory object for creating timer queues (managing events) |
ipc | [in] Inter process communication object |
lock_factory | [in] Provides a factory object for creating locking a locking mechanism |
void IEEE1588Clock::addEventTimer | ( | IEEE1588Port * | target, |
Event | e, | ||
unsigned long long | time_ns | ||
) |
Add a new event to the timer queue.
target | IEEE1588Port target |
e | Event to be added |
time_ns | Time in nanoseconds |
void IEEE1588Clock::addEventTimerLocked | ( | IEEE1588Port * | target, |
Event | e, | ||
unsigned long long | time_ns | ||
) |
Adds an event to the timer queue using a lock.
target | IEEE1588Port target |
e | Event to be added |
time_ns | current time in nanoseconds |
FrequencyRatio IEEE1588Clock::calcLocalSystemClockRateDifference | ( | Timestamp | local_time, |
Timestamp | system_time | ||
) |
Calculates the local to system clock rate difference.
local_time | Local time |
system_time | System time |
FrequencyRatio IEEE1588Clock::calcMasterLocalClockRateDifference | ( | Timestamp | master_time, |
Timestamp | sync_time | ||
) |
Calculates the master to local clock rate difference.
master_time | Master time |
sync_time | Local time |
void IEEE1588Clock::deleteEventTimer | ( | IEEE1588Port * | target, |
Event | e | ||
) |
Deletes an event from the timer queue.
target | Target port to remove the event from |
e | Event to be removed |
void IEEE1588Clock::deleteEventTimerLocked | ( | IEEE1588Port * | target, |
Event | e | ||
) |
Deletes and event from the timer queue using a lock.
target | Target port to remove the event from |
e | Event to be deleted |
|
inline |
Get the IEEE1588Clock identity value.
|
inline |
Gets the IEEE 1588 Clock quality.
|
inline |
Gets the currentUtcOffset attribute (IEEE 802.1AS clause 10.3.8.9)
|
inline |
Gets the domain number.
|
inline |
Gets grandmaster clock ID.
|
inline |
Gets grandmaster clock quality object.
|
inline |
Gets grandmaster priority1 attribute (IEEE 802.1AS clause 10.5.3.2.2)
|
inline |
Gets grandmaster priotity2 attribute (IEEE 802.1AS clause 10.5.3.2.4)
|
inline |
Gets the Last Best clock identity.
|
inline |
Gets master steps removed (IEEE 802.1AS clause 10.3.3)
|
inline |
Gets nextPortId value.
|
inline |
Gets the current port list instance.
count | [out] Number of ports |
ports | [out] Pointer to the port list |
Timestamp IEEE1588Clock::getPreciseTime | ( | void | ) |
Gets the timestamp from hardware (Deprecated)
|
inline |
Gets IEEE1588Clock priority1 value (IEEE 802.1AS clause 8.6.2.1)
|
inline |
Gets IEEE1588Clock priority2 attribute (IEEE 802.1AS clause 8.6.2.5)
|
static |
Gets current system time.
Timestamp IEEE1588Clock::getTime | ( | void | ) |
Gets the current time from system clock.
|
inline |
Gets the timer queue lock.
|
inline |
Gets the TimeSource attribute (IEEE 802.1AS-2011 clause 10.3.8.10)
|
inline |
Gets all TX locks.
bool IEEE1588Clock::isBetterThan | ( | PTPMessageAnnounce * | msg | ) |
Compares the 1588 Clock to the grandmaster clock.
msg | [in] PTP announce message |
|
inline |
Sets a flag that will allow syntonization during setMasterOffset calls.
|
inline |
Releases the timer queue lock.
|
inline |
Release all TX locks.
|
inline |
Registers a new IEEE1588 port.
port | [in] IEEE1588port instance |
index | Port's index |
bool IEEE1588Clock::restoreSerializedState | ( | void * | buf, |
long * | count | ||
) |
Restores the frequencyRatio with the serialized input buffer data.
buf | [in] serialized frequencyRatio information |
count | [inout] Size of buffer. It is incremented internally |
bool IEEE1588Clock::serializeState | ( | void * | buf, |
long * | count | ||
) |
Updates the frequencyRatio information.
buf | [out] Stores the serialized clock quality state |
count | [inout] Provides the size of buffer. Its decremented internally |
|
inline |
Sets clock identity by id.
id | [id] Clock identity (as an octet array) |
|
inline |
Set clock id based on the link layer address. Clock id is 8 octets long whereas link layer address is 6 octets long and it is turned into a clock identity as per the 802.1AS standard described in clause 8.5.2.2.
addr | Link layer address |
|
inline |
Sets a new GM clock ID.
id | New id |
|
inline |
|
inline |
Sets grandmaster's priority1 attribute (IEEE 802.1AS clause 10.5.3.2.2)
priority1 | value to be set |
|
inline |
Sets grandmaster's priority2 attribute (IEEE 802.1AS clause 10.5.3.2.4)
priority2 | Value to be set |
|
inline |
void IEEE1588Clock::setMasterOffset | ( | int64_t | master_local_offset, |
Timestamp | local_time, | ||
FrequencyRatio | master_local_freq_offset, | ||
int64_t | local_system_offset, | ||
Timestamp | system_time, | ||
FrequencyRatio | local_system_freq_offset, | ||
unsigned | sync_count, | ||
unsigned | pdelay_count, | ||
PortState | port_state | ||
) |
Sets the master offset, sintonyze and adjusts the frequency offset.
master_local_offset | Master to local phase offset |
local_time | Local time |
master_local_freq_offset | Master to local frequency offset |
local_system_offset | Local time to system time phase offset |
system_time | System time |
local_system_freq_offset | Local to system frequency offset |
sync_count | Sync messages count |
pdelay_count | PDelay messages count |
port_state | PortState instance |
|
inline |
Gets a pointer to the timer queue lock object.
|
friend |
Declares a friend instance of tick_handler method.
sig | Signal |