libptpmgmt  1.4
libptpmgmt library that provides the functionality of linuxptp pmc
Public Attributes | List of all members
ptpmgmt_clock_t Struct Reference

#include <ptp.h>

Public Attributes

void(* free )(ptpmgmt_clock clk)
 
struct timespec(* getTime )(const_ptpmgmt_clock clk)
 
bool(* setTime )(const_ptpmgmt_clock clk, const struct timespec *ts)
 
bool(* offsetClock )(const_ptpmgmt_clock clk, int64_t offset)
 
double(* getFreq )(const_ptpmgmt_clock clk)
 
bool(* setFreq )(const_ptpmgmt_clock clk, double freq)
 
bool(* setPhase )(const_ptpmgmt_clock clk, int64_t offset)
 
bool(* isCharFile )(const char *file)
 
bool(* initUsingDevice )(ptpmgmt_clock clk, const char *device, bool readonly)
 
bool(* initUsingIndex )(ptpmgmt_clock clk, int ptpIndex, bool readonly)
 
bool(* isInit )(const_ptpmgmt_clock clk)
 
clockid_t(* clkId )(const_ptpmgmt_clock clk)
 
int(* getFd )(const_ptpmgmt_clock clk)
 
int(* fileno )(const_ptpmgmt_clock clk)
 
int(* ptpIndex )(const_ptpmgmt_clock clk)
 
const char *(* device )(const_ptpmgmt_clock clk)
 
bool(* setTimeFromSys )(const_ptpmgmt_clock clk)
 
bool(* setTimeToSys )(const_ptpmgmt_clock clk)
 
bool(* fetchCaps )(const_ptpmgmt_clock clk, struct ptp_clock_caps *caps)
 
bool(* readPin )(const_ptpmgmt_clock clk, unsigned int index, struct ptp_pin_desc *pin)
 
bool(* writePin )(const_ptpmgmt_clock clk, struct ptp_pin_desc *pin)
 
bool(* ExternTSEbable )(const_ptpmgmt_clock clk, unsigned int index, uint8_t flags)
 
bool(* ExternTSDisable )(const_ptpmgmt_clock clk, unsigned int index)
 
bool(* MaskClearAll )(const_ptpmgmt_clock clk)
 
bool(* MaskEnable )(const_ptpmgmt_clock clk, unsigned int index)
 
bool(* readEvent )(const_ptpmgmt_clock clk, struct ptp_extts_event *event)
 
bool(* readEvents )(const_ptpmgmt_clock clk, struct ptp_extts_event *events, size_t *size)
 
bool(* setPinPeriod )(const_ptpmgmt_clock clk, unsigned int index, struct ptp_perout_request *times)
 
bool(* setPtpPpsEvent )(const_ptpmgmt_clock clk, bool enable)
 
bool(* samplePtpSys )(const_ptpmgmt_clock clk, size_t count, struct ptp_sys_offset *samples)
 
bool(* extSamplePtpSys )(const_ptpmgmt_clock clk, size_t count, struct ptp_sys_offset_extended *samples)
 
bool(* preciseSamplePtpSys )(const_ptpmgmt_clock clk, struct ptp_sys_offset_precise *sample)
 

Detailed Description

the ptpmgmt clock structure hold the clock object and call backs to call c++ methods

Member Data Documentation

◆ clkId

clockid_t(* ptpmgmt_clock_t::clkId) (const_ptpmgmt_clock clk)

Get dynamic clock id

Parameters
[in]clkpointer to clock structure
Returns
dynamic clock id or CLOCK_INVALID if not initialized

◆ device

const char*(* ptpmgmt_clock_t::device) (const_ptpmgmt_clock clk)

Get POSIX device name

Parameters
[in]clkpointer to clock structure
Returns
device name or empty string if not initialized

◆ ExternTSDisable

bool(* ptpmgmt_clock_t::ExternTSDisable) (const_ptpmgmt_clock clk, unsigned int index)

Disable PHC pin external events

Parameters
[in]clkpointer to clock structure
[in]indexpin index to enable
Returns
true for success
Note
Pin index should be in the range (0, ptp_clock_caps.num_pins]

◆ ExternTSEbable

bool(* ptpmgmt_clock_t::ExternTSEbable) (const_ptpmgmt_clock clk, unsigned int index, uint8_t flags)

Enable PHC pin external events

Parameters
[in]clkpointer to clock structure
[in]indexpin index to enable
[in]flagsusing the PTP_EXTERN_TS_xxx flags
Returns
true for success
Note
Pin index should be in the range (0, ptp_clock_caps.num_pins]
old kernel do not support PTP_EXTERN_TS_STRICT

◆ extSamplePtpSys

bool(* ptpmgmt_clock_t::extSamplePtpSys) (const_ptpmgmt_clock clk, size_t count, struct ptp_sys_offset_extended *samples)

Extended sample the PHC and system clock So caller can compare offset and frequancy

Parameters
[in]clkpointer to clock structure
[in]countnumber of sample to measure
[out]samplestaken by kernel
Returns
true for success
Note
old kernel do not support

◆ fetchCaps

bool(* ptpmgmt_clock_t::fetchCaps) (const_ptpmgmt_clock clk, struct ptp_clock_caps *caps)

Get PTP clock capabilities

Parameters
[in]clkpointer to clock structure
[out]capscapabilities
Returns
true for success

◆ fileno

int(* ptpmgmt_clock_t::fileno) (const_ptpmgmt_clock clk)

Get file description

Parameters
[in]clkpointer to clock structure
Returns
file description

◆ free

void(* ptpmgmt_clock_t::free) (ptpmgmt_clock clk)

< Free a clock object

Parameters
[in,out]clkpointer to clock structure

◆ getFd

int(* ptpmgmt_clock_t::getFd) (const_ptpmgmt_clock clk)

Get file description

Parameters
[in]clkpointer to clock structure
Returns
file description

◆ getFreq

double(* ptpmgmt_clock_t::getFreq) (const_ptpmgmt_clock clk)

Get clock adjustment frequancy

Parameters
[in]clkpointer to clock structure
Returns
freq frequancy in ppb

◆ getTime

struct timespec(* ptpmgmt_clock_t::getTime) (const_ptpmgmt_clock clk)

Get clock time

Parameters
[in]clkpointer to clock structure
Returns
clock time or zero on error

◆ initUsingDevice

bool(* ptpmgmt_clock_t::initUsingDevice) (ptpmgmt_clock clk, const char *device, bool readonly)

Initialize a POSIX clock based on its device name

Parameters
[in,out]clkpointer to clock structure
[in]devicename
[in]readonlyopen clock to read only
Returns
true if device is a POSIX clock

◆ initUsingIndex

bool(* ptpmgmt_clock_t::initUsingIndex) (ptpmgmt_clock clk, int ptpIndex, bool readonly)

Initialize a PTP clock based on its index

Parameters
[in,out]clkpointer to clock structure
[in]ptpIndexclock PTP index
[in]readonlyopen clock to read only
Returns
true if network interface exists

◆ isCharFile

bool(* ptpmgmt_clock_t::isCharFile) (const char *file)

Check file is a char file

Parameters
[in]filename to check
Returns
true if file is char device
Note
function will follow a symbolic link

◆ isInit

bool(* ptpmgmt_clock_t::isInit) (const_ptpmgmt_clock clk)

Is object initialized

Parameters
[in]clkpointer to clock structure
Returns
true if PTP clock exist and object was successfully initialized

◆ MaskClearAll

bool(* ptpmgmt_clock_t::MaskClearAll) (const_ptpmgmt_clock clk)

PHC clear all mask

Parameters
[in]clkpointer to clock structure
Returns
true for success

◆ MaskEnable

bool(* ptpmgmt_clock_t::MaskEnable) (const_ptpmgmt_clock clk, unsigned int index)

PHC ebable single pin mask

Parameters
[in]clkpointer to clock structure
[in]indexpin index in mask to enable
Returns
true for success
Note
Pin index should be in the range (0, PtpCaps_t.num_pins]

◆ offsetClock

bool(* ptpmgmt_clock_t::offsetClock) (const_ptpmgmt_clock clk, int64_t offset)

Offset clock time

Parameters
[in]clkpointer to clock structure
[in]offsetin nanoseconeds
Returns
true for success

◆ preciseSamplePtpSys

bool(* ptpmgmt_clock_t::preciseSamplePtpSys) (const_ptpmgmt_clock clk, struct ptp_sys_offset_precise *sample)

Precise sample the PHC using PCI cross time stamp

Parameters
[in]clkpointer to clock structure
[out]sampletaken by kernel
Returns
true for success
Note
old kernel do not support

◆ ptpIndex

int(* ptpmgmt_clock_t::ptpIndex) (const_ptpmgmt_clock clk)

Get PTP index

Parameters
[in]clkpointer to clock structure
Returns
index or NO_SUCH_PTP if not initialized or clock do not have PTP index

◆ readEvent

bool(* ptpmgmt_clock_t::readEvent) (const_ptpmgmt_clock clk, struct ptp_extts_event *event)

Read single external event

Parameters
[in]clkpointer to clock structure
[out]eventretrieved event
Returns
true for success

◆ readEvents

bool(* ptpmgmt_clock_t::readEvents) (const_ptpmgmt_clock clk, struct ptp_extts_event *events, size_t *size)

Read external events

Parameters
[in]clkpointer to clock structure
[out]eventspointer to array of retrieved events
[in,out]sizeinput: array size, output: actual number of events
Returns
true for success
Note
the maximum is trunced to 30 events

◆ readPin

bool(* ptpmgmt_clock_t::readPin) (const_ptpmgmt_clock clk, unsigned int index, struct ptp_pin_desc *pin)

Read PHC clock pin current functional state

Parameters
[in]clkpointer to clock structure
[in]indexpin index to read
[out]pinhardware functional state
Returns
true for success
Note
Pin index should be in the range (0, ptp_clock_caps.num_pins]

◆ samplePtpSys

bool(* ptpmgmt_clock_t::samplePtpSys) (const_ptpmgmt_clock clk, size_t count, struct ptp_sys_offset *samples)

Sample the PHC and system clock So caller can compare offset and frequancy

Parameters
[in]clkpointer to clock structure
[in]countnumber of sample to measure
[out]samplestaken by kernel
Returns
true for success

◆ setFreq

bool(* ptpmgmt_clock_t::setFreq) (const_ptpmgmt_clock clk, double freq)

Set clock adjustment frequancy

Parameters
[in]clkpointer to clock structure
[in]freqfrequancy in ppb
Returns
true for success

◆ setPhase

bool(* ptpmgmt_clock_t::setPhase) (const_ptpmgmt_clock clk, int64_t offset)

Set clock phase offset

Parameters
[in]clkpointer to clock structure
[in]offsetin nanoseconeds
Returns
true for success

◆ setPinPeriod

bool(* ptpmgmt_clock_t::setPinPeriod) (const_ptpmgmt_clock clk, unsigned int index, struct ptp_perout_request *times)

Set PHC pin period signal

Parameters
[in]clkpointer to clock structure
[in]indexpin index
[in]timesprovides the times and flags used for the period
Returns
true for success
Note
Pin index should be in the range (0, ptp_clock_caps.num_pins]
old kernel do not support flags

◆ setPtpPpsEvent

bool(* ptpmgmt_clock_t::setPtpPpsEvent) (const_ptpmgmt_clock clk, bool enable)

Enable or disable Linux pulse per second event

Parameters
[in]clkpointer to clock structure
[in]enableflag
Returns
true for success
Note
Linux will create a pps device /dev/ppsN User can use the 'pps-tools' to use the device.

◆ setTime

bool(* ptpmgmt_clock_t::setTime) (const_ptpmgmt_clock clk, const struct timespec *ts)

Set clock time

Parameters
[in]clkpointer to clock structure
[out]tsnew clock time
Returns
true for success

◆ setTimeFromSys

bool(* ptpmgmt_clock_t::setTimeFromSys) (const_ptpmgmt_clock clk)

Set PHC time using the system clock

Parameters
[in]clkpointer to clock structure
Returns
true for success

◆ setTimeToSys

bool(* ptpmgmt_clock_t::setTimeToSys) (const_ptpmgmt_clock clk)

Set system clock using the PHC as source time

Parameters
[in]clkpointer to clock structure
Returns
true for success

◆ writePin

bool(* ptpmgmt_clock_t::writePin) (const_ptpmgmt_clock clk, struct ptp_pin_desc *pin)

Set PHC clock pin functional state

Parameters
[in]clkpointer to clock structure
[in]pinhardware functional state
Returns
true for success
Note
Pin index comes from ptp_pin_desc!
Pin index should be in the range (0, ptp_clock_caps.num_pins]

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