This document provides a brief description of the LinuxPTP OpEN APIs. It provides the following services:
- Set the linuxPTP global admin mode.
- Get the linuxPTP global admin mode.
- Set the linuxPTP interface admin mode.
- Get the linuxPTP interface admin mode.
- Get the E2E mean path delay.
- Get the linuxPTP port state.
- Get the P2P mean path delay.
- Get the statistics for the given type on an interface.
- Get (parent or GM or local) clock identity.
- Get (parent or GM or local) clock parameters.
- Set priority value of the local clock.
- Get priority value of the local clock.
- Set linuxPTP clock operation mode.
- Get linuxPTP clock operation mode.
- Set source IPv4 address to be used for linuxPTP communication.
- Get the source IPv4 address used for linuxPTP communication.
- Set source IPv6 address to be used for linuxPTP communication.
- Get the source IPv6 address used for linuxPTP communication.
- Set linuxPTP profile.
- Get the active linuxPTP profile.
- Set linuxPTP profile's transport mode.
- Get the linuxPTP transport mode for a given profile.
- Set announce interval for given linuxPTP profile.
- Get the configured linuxPTP announce interval for a given profile.
- Set announce timeout for given linuxPTP profile.
- Get the linuxPTP announce timeout value for a given profile.
- Set sync interval for given linuxPTP profile.
- Get the linuxPTP Sync Interval for a given profile.
- Set delay request interval for given linuxPTP profile.
- Get the linuxPTP delay request Interval for a given profile.
- Set peer delay request interval for given linuxPTP profile.
- Get the linuxPTP peer delay request Interval for a given profile.
- Set domain number for given linuxPTP profile.
- Get the linuxPTP Domain for a given profile.
- Set linuxPTP delay mechanism.
- Get the linuxPTP delay mechanism for a given profile.
- Configure linuxPTP logging severity level.
- Fetch linuxPTP logging severity level.
- Clear linuxPTP statistics on an interface.
- Get linuxPTP interface operational status.
- Check whether the interface is eligible for linuxptp operation.
- Check if the passed domain identifier is configured.
- Get time properties information.
- Get number of boundary clocks between local clock and foreign master.
- Get current clock offset in time between slave and master.
- Status of the mode the clock is operating in master or slave.
- Set linuxPTP path trace TLV.
- Get linuxPTP path trace TLV status.
- Get next clock identity in the path.
Example C Application linuxptp_example
Initialization
In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.
linuxptp_example
linuxptp_example.c is a sample application that demonstrates the use of OpEN's LinuxPTP APIs. linuxptp_example is started from the command line and can be used to exercise the various APIs by specifying arguments on the command line.
Sample Output
- Usage: ./linuxptp_example <test#> <arg1> <arg2> ...
- Test 1: Set the linuxPTP global admin mode: linuxptp_example 1 <mode>
- Test 2: Get the linuxPTP global admin mode: linuxptp_example 2
- Test 3: Set the linuxPTP interface admin mode: linuxptp_example 3 <ifNum> <mode>
- Test 4: Get the linuxPTP interface admin mode: linuxptp_example 4 <ifNum>
- Test 5: Get the E2E mean path delay: linuxptp_example 5
- Test 6: Get the linuxPTP port state: linuxptp_example 6 <ifNum>
- Test 7: Get the P2P mean path delay: linuxptp_example 7 <ifNum>
- Test 8: Get the statistics for the given type on an interface: linuxptp_example 8 <ifNum> <statType>
- Test 9: Get (parent or GM or local) clock identity: linuxptp_example 9 <type>
- Test 10: Get (parent or GM or local) clock parameters: linuxptp_example 10 <type>
- Test 11: Set priority value of the local clock: linuxptp_example 11 <prioType> <prioVal>
- Test 12: Get priority value of the local clock: linuxptp_example 12 <prioType>
- Test 13: Set linuxPTP clock operation mode: linuxptp_example 13 <operMode>
- Test 14: Get linuxPTP clock operation mode: linuxptp_example 14
- Test 15: Set source IPv4 address to be used for linuxPTP communication: linuxptp_example 15 <ipAddr>
- Test 16: Get the source IPv4 address used for linuxPTP communication: linuxptp_example 16
- Test 17: Set source IPv6 address to be used for linuxPTP communication: linuxptp_example 17 <ipAddr>
- Test 18: Get the source IPv6 address used for linuxPTP communication: linuxptp_example 18
- Test 19: Set linuxPTP profile: linuxptp_example 19 <ptpProfile>
- Test 20: Get the active linuxPTP profile: linuxptp_example 20 <ptpProfile>
- Test 21: Set linuxPTP profile's transport mode: linuxptp_example 21 <ptpProfile> <transMode>
- Test 22: Get the linuxPTP transport mode for a given profile: linuxptp_example 22 <ptpProfile>
- Test 23: Set announce interval for given linuxPTP profile: linuxptp_example 23 <ptpProfile> <announceInterval>
- Test 24: Get the configured linuxPTP announce interval for a given profile: linuxptp_example 24 <ptpProfile>
- Test 25: Set announce timeout for given linuxPTP profile: linuxptp_example 25 <ptpProfile> <announceTimeout>
- Test 26: Get the linuxPTP announce timeout value for a given profile: linuxptp_example 26 <ptpProfile>
- Test 27: Set sync interval for given linuxPTP profile: linuxptp_example 27 <ptpProfile> <syncInterval>
- Test 28: Get the linuxPTP Sync Interval for a given profile: linuxptp_example 28 <ptpProfile>
- Test 29: Set delay request interval for given linuxPTP profile: linuxptp_example 29 <ptpProfile> <delayReqInterval>
- Test 30: Get the linuxPTP delay request Interval for a given profile: linuxptp_example 30 <ptpProfile>
- Test 31: Set peer delay request interval for given linuxPTP profile: linuxptp_example 31 <ptpProfile> <pDelayReqInterval>
- Test 32: Get the linuxPTP peer delay request Interval for a given profile: linuxptp_example 32 <ptpProfile>
- Test 33: Set domain number for given linuxPTP profile: linuxptp_example 33 <ptpProfile> <domain>
- Test 34: Get the linuxPTP Domain for a given profile: linuxptp_example 34 <ptpProfile>
- Test 35: Set linuxPTP delay mechanism: linuxptp_example 35 <ptpProfile> <delayMech>
- Test 36: Get the linuxPTP delay mechanism for a given profile: linuxptp_example 36 <ptpProfile>
- Test 37: Configure linuxPTP logging severity level: linuxptp_example 37 <level>
- Test 38: Fetch linuxPTP logging severity level: linuxptp_example 38 <level>
- Test 39: Clear linuxPTP statistics on an interface: linuxptp_example 39 <ifNum>
- Test 40: Get linuxPTP interface operational status: linuxptp_example 40 <ifNum>
- Test 41: Check whether the interface is eligible for linuxptp operation: linuxptp_example 41 <ifNum>
- Test 42: Check if the passed domain identifier is configured: linuxptp_example 42 <domain>
- Test 43: Get time properties information: linuxptp_example 43 <type>
- Test 44: Get number of boundary clocks between local clock and foreign master: linuxptp_example 44
- Test 45: Get current clock offset in time between slave and master: linuxptp_example 45
- Test 46: Status of the mode the clock is operating in master or slave: linuxptp_example 46
- Test 47: Set linuxPTP path trace TLV: linuxptp_example 47 <traceMode>
- Test 48: Get linuxPTP path trace TLV status: linuxptp_example 48
- Test 49: Get next clock identity in the path: linuxptp_example 49 <type>
LinuxPTP CLI/API Cross Reference