NVIDIA Tegra
NVIDIA DRIVE OS 5.1 Linux SDK

Developer Guide
5.1.9.0 Release


 
Using PTP Virtualization
 
Configuring Virtual PTP
On QNX
On Linux
Sample ptpd-avb Commands
Accessing the Time
The PTP virtualization service is provided as part of the Communications Services. It provides APIs for client VMs to access a common PTP time source with low latency.
Configuring Virtual PTP
The common PTP time source is configured on the Communications Virtual Machine using the EQOS hardware as controlled by ptpd-avb. The ptpd-avb tool can be configured as PTP master or PTP slave, depending on the arguments used.
For details on the ptpd-avb syntax, listed here as ptpd, consult the QNX Software Development Platform Utilities Reference:
http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.utilities/topic/p/ptpd.html
On QNX
When using ptpd-avb on QNX with EQOS, the same arguments can be used on the Communications Services. However, do not run ptpd-avb on other QNX VMs as it does not function as expected.
The QNX guest automatically sets the time-of-day from the virtual PTP, if the virtual PTP time is available.
On Linux
If you currently use ptp4l, the same arguments can also be used with ptpd-avb. For best practices, confirm the arguments against the QNX Software Development Platform documentation. Do not run ptp4l on the Linux VM as it does not function as expected.
phc2sys is not supported. However, nvptp_sync provides functionality to set the time-of-day. By default, Linux uses ntp to set the time-of-day. If you have a requirement to use virtual PTP to set the time-of-day, stop ntp with the command:
systemctl stop system-timesyncd
To start the sync application
Execute the command:
sudo nvptp sync
Sample ptpd-avb Commands
Use these sample commands to start ptpd-avb as slave or as master.
To start ptpd-avb as slave on vlan 200
Execute the command:
ptpd-avb -gKLb vlan200 &
To start ptpd-avb as master on eq0 using NTP as the initial time source
Execute the command:
ptpd-avb -GKLb eq0 &
Accessing the Time
On QNX systems, the existing nvtime library function, nvtime_gettime_real(), automatically uses PTP time when it is available. Code changes are not required to use the function.
On Linux systems, the nvptp library must be used. Include nvptp.h header file and link against nvptp_client.
To initiate the connection to the PTP server on Linux to the Communications Service
1. Execute the command:
int8_t connect_virtual_ptp_time (void);
Upon success, the system returns 0.
Upon failure, the system returns 1.
2. Initiating the connection is required once per application. After the initial call, execute the command:
int8_t get_virtual_ptp_time (nvptp_t *phc_gt);
Upon success, the system returns 0.
Upon failure, the system returns 1.
The nvptp_t structure includes these fields:
uint32_t phc_sec;
uint32_t phc_ns;
uint64_t gt;
Where:
phc_sec and phc_ns fields are the PTP hardware clock values at the time of the call.
gt field refers to the ARM Generic Timer corresponding to that PTP time.