xl4-shiro / excelfore-gptp

gPTP, IEEE 802.1AS-REV implementation
GNU General Public License v2.0
62 stars 38 forks source link

Excelfore gPTP - IEEE 802.1AS

Prerequisites

To run 'gptp2d' on a Linux platform, the kernel must support HW timestamping on PTP event messages.
'ethtool' command can check it as follows:
(the information is provided by the kernel driver, and it is most likely correct but not 100%.)

 $ ethtool -T eth0
 Time stamping parameters for eth0:
 Capabilities:
    hardware-transmit     (SOF_TIMESTAMPING_TX_HARDWARE)
    software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
    hardware-receive      (SOF_TIMESTAMPING_RX_HARDWARE)
    software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
    hardware-raw-clock    (SOF_TIMESTAMPING_RAW_HARDWARE)
 PTP Hardware Clock: 0
 ...

Build

When xl4unibase and xl4combase are not installed, install them first.

$ git clone git@github.com:xl4-shiro/xl4unibase.git
$ cd xl4unibase
$ ./autogetn.sh; cd buid; ../configure; make install

$ git clone git@github.com:xl4-shiro/xl4combase.git
$ cd xl4combase
$ ./autogetn.sh; cd buid; ../configure; make install

Then, in this gptp2 directory,

$ ./autogetn.sh
$ mkdir build
$ cd build
$ ../configure
$ make

To run unit tests,

$ make check

Some of the unit tests do timing checks which possibly fail under some conditions;
e.g. if the build machine runs a heavy task in the background, the timing measurement
can't be accurate and the result may be out of the criterion.
Such fails won't affect on the performance of 'gptp2d'.

Run gptp2d daemon process

Run simply from a console as follows:

$ sudo gptp2d -d eth0

For multiple ethernet devices(bridge mode):

$ sudo gptp2d -d eth0,eth1,eth2,...

In the slave mode, the console will show the frequency adjustment rate in ppb as follows:

INF:domainNumber=0, clock_master_sync_receive:the master clock rate to 21344ppb

Running on SW timestamping port is possible, but such a port unlikely has ptp clock.
Adding a virtual port like 'cbeth0' creates a virtual ptp clock, and gptp2d can proceed to run.
'neighborPropDelayThresh' must be adjust on the other side of the connection.

$ sudo gptp2d -d cbeth0,eth0

get gptp time in application

Any applications which use the gPTP clock values need to link to 'libx4gptp2'.
'gptpmasterclock.h' shows what functions are available in the library.
To get gptp clock value, 'gptpmasterclock_getts64()' can be called.

To check the status of 'gptp2d', use IPC functions.
'gptpipc.h' shows such functions and data structures.
To understand IPC functions, check 'gptpipcmon.c' as a reference.

Configurations

'gptp2.conf' is generated by the build.
All the configuration items are commented out in the file.
You can un-comment and set values on any items you want to configure.

Set an option in the gptp2d command line to use the config file as follows:

$ sudo gptp2d -c gptp2.conf -d eth0

License

All files in this project are released under 'GNU General Public License Version 2'.
If you want to use the files under a different license, please contact to Excelfore
sales representatives.

Contact Us

Excelfore Corporation
sales@excelfore.com / support@excelfore.com
3155 Kerney Street
Freemont, California 94538 USA
+1-510-868-2500