gPTP Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LinuxTimestamperGeneric Class Reference

#include <linux_hal_generic.hpp>

Inheritance diagram for LinuxTimestamperGeneric:
Inheritance graph
Collaboration diagram for LinuxTimestamperGeneric:
Collaboration graph

Public Member Functions

 LinuxTimestamperGeneric ()
 
bool resetFrequencyAdjustment ()
 Resets frequency adjustment value to zero and calls linux system calls for frequency adjustment. More...
 
bool Adjust (void *tmx)
 Calls linux system call for adjusting frequency or phase. More...
 
virtual bool HWTimestamper_init (InterfaceLabel *iface_label, OSNetworkInterface *iface)
 Initializes the Hardware timestamp interface. More...
 
void pushRXTimestamp (Timestamp *tstamp)
 Inserts a new timestamp to the beginning of the RX timestamp list. More...
 
bool post_init (int ifindex, int sd, TicketingLock *lock)
 Post initialization procedure. More...
 
virtual bool HWTimestamper_gettime (Timestamp *system_time, Timestamp *device_time, uint32_t *local_clock, uint32_t *nominal_clock_rate)
 Gets the ptp clock time information. More...
 
virtual int HWTimestamper_txtimestamp (PortIdentity *identity, uint16_t sequenceId, Timestamp &timestamp, unsigned &clock_value, bool last)
 Gets the TX timestamp from hardware interface. More...
 
virtual int HWTimestamper_rxtimestamp (PortIdentity *identity, uint16_t sequenceId, Timestamp &timestamp, unsigned &clock_value, bool last)
 Gets the RX timestamp from the hardware interface. This Currently the RX timestamp is retrieved at LinuxNetworkInterface::nrecv method. More...
 
virtual bool HWTimestamper_adjclockphase (int64_t phase_adjust)
 Adjusts the clock phase. More...
 
virtual bool HWTimestamper_adjclockrate (float freq_offset)
 Adjusts the frequency. More...
 
virtual ~LinuxTimestamperGeneric ()
 
- Public Member Functions inherited from LinuxTimestamper
virtual ~LinuxTimestamper ()=0
 
- Public Member Functions inherited from HWTimestamper
virtual void HWTimestamper_final (void)
 This method is called before the object is de-allocated. More...
 
virtual bool HWTimestamper_get_extclk_offset (Timestamp *local_time, int64_t *clk_offset, int32_t *ppt_freq_offset)
 Get external clock offset. More...
 
virtual void HWTimestamper_get_extderror (char *msg)
 Gets a string with the error from the hardware timestamp block. More...
 
virtual bool HWTimestamper_PPS_start ()
 Starts the PPS (pulse per second) interface. More...
 
virtual bool HWTimestamper_PPS_stop ()
 Stops the PPS (pulse per second) interface. More...
 
int getVersion ()
 Gets the HWTimestamper version. More...
 
 HWTimestamper ()
 

Additional Inherited Members

- Protected Attributes inherited from HWTimestamper
uint8_t version
 HWTimestamper version.
 

Detailed Description

Linux timestamper generic interface

Constructor & Destructor Documentation

LinuxTimestamperGeneric::LinuxTimestamperGeneric ( )

Default constructor. Initializes internal variables

virtual LinuxTimestamperGeneric::~LinuxTimestamperGeneric ( )
virtual

deletes LinuxTimestamperGeneric object

Member Function Documentation

bool LinuxTimestamperGeneric::Adjust ( void *  tmx)

Calls linux system call for adjusting frequency or phase.

Parameters
tmx[in] Void pointer that must be cast (and filled in correctly) to the struct timex
Returns
TRUE if ok, FALSE if error.
virtual bool LinuxTimestamperGeneric::HWTimestamper_adjclockphase ( int64_t  phase_adjust)
virtual

Adjusts the clock phase.

Parameters
phase_adjustPhase adjustment
Returns
TRUE if success, FALSE if error.

Reimplemented from HWTimestamper.

virtual bool LinuxTimestamperGeneric::HWTimestamper_adjclockrate ( float  freq_offset)
virtual

Adjusts the frequency.

Parameters
freq_offsetFrequency adjustment
Returns
TRUE in case of sucess, FALSE if error.

Reimplemented from HWTimestamper.

virtual bool LinuxTimestamperGeneric::HWTimestamper_gettime ( Timestamp system_time,
Timestamp device_time,
uint32_t *  local_clock,
uint32_t *  nominal_clock_rate 
)
virtual

Gets the ptp clock time information.

Parameters
system_time[out] System time
device_time[out] Device time
local_clockNot Used
nominal_clock_rateNot Used
Returns
TRUE if got the time successfully, FALSE otherwise

Implements HWTimestamper.

virtual bool LinuxTimestamperGeneric::HWTimestamper_init ( InterfaceLabel iface_label,
OSNetworkInterface iface 
)
virtual

Initializes the Hardware timestamp interface.

Parameters
iface_label[in] Network interface label (used to find the phc index)
iface[in] Network interface
Returns
FALSE in case of error, TRUE if success.

Reimplemented from HWTimestamper.

virtual int LinuxTimestamperGeneric::HWTimestamper_rxtimestamp ( PortIdentity identity,
uint16_t  sequenceId,
Timestamp timestamp,
unsigned &  clock_value,
bool  last 
)
inlinevirtual

Gets the RX timestamp from the hardware interface. This Currently the RX timestamp is retrieved at LinuxNetworkInterface::nrecv method.

Parameters
identityPTP port identity
sequenceIdSequence ID
timestamp[out] Timestamp value
clock_value[out] Clock value
lastSignalizes that it is the last timestamp to get. When TRUE, releases the lock when its done.
Returns
0 no error, -1 error, -72 try again.

Implements HWTimestamper.

virtual int LinuxTimestamperGeneric::HWTimestamper_txtimestamp ( PortIdentity identity,
uint16_t  sequenceId,
Timestamp timestamp,
unsigned &  clock_value,
bool  last 
)
virtual

Gets the TX timestamp from hardware interface.

Parameters
identityPTP port identity
sequenceIdSequence ID
timestamp[out] Timestamp value
clock_value[out] Clock value
lastSignalizes that it is the last timestamp to get. When TRUE, releases the lock when its done.
Returns
0 no error, -1 error, -72 try again.

Implements HWTimestamper.

bool LinuxTimestamperGeneric::post_init ( int  ifindex,
int  sd,
TicketingLock lock 
)
virtual

Post initialization procedure.

Parameters
ifindexstruct ifreq.ifr_ifindex value
sdSocket file descriptor
lock[in] Instance of TicketingLock object
Returns
TRUE if ok. FALSE if error.

Implements LinuxTimestamper.

void LinuxTimestamperGeneric::pushRXTimestamp ( Timestamp tstamp)
inline

Inserts a new timestamp to the beginning of the RX timestamp list.

Parameters
tstamp[in] RX timestamp
Returns
void
bool LinuxTimestamperGeneric::resetFrequencyAdjustment ( )

Resets frequency adjustment value to zero and calls linux system calls for frequency adjustment.

Returns
TRUE if success, FALSE if error.

The documentation for this class was generated from the following file: