AM64x MCU+ SDK  10.00.00
APIs for ICSS TimeSync

Introduction

APIs for PTP/1588 v2 slave implementation on PRU-ICSS

Functions

int8_t TimeSync_drvInit (TimeSync_ParamsHandle_t timeSyncHandle)
 Initializes variables and timers & clocks, call once at the beginning. More...
 
int8_t TimeSync_alloc_PktBuffer (TimeSync_ParamsHandle_t timeSyncHandle)
 Allocate Rx and Tx buffers for frames like Sync, Announce etc. More...
 
void TimeSync_unAlloc_PktBuffer (TimeSync_ParamsHandle_t timeSyncHandle)
 Unallocate Rx and Tx buffers for frames like Sync, Announce etc. More...
 
void TimeSync_drvEnable (TimeSync_ParamsHandle_t timeSyncHandle)
 Enable PTP firmware. More...
 
void TimeSync_drvDisable (TimeSync_ParamsHandle_t timeSyncHandle)
 Disable PTP firmware. More...
 
void TimeSync_dramInit (TimeSync_ParamsHandle_t timeSyncHandle)
 Initialize PTP stored variables in the DRAM. More...
 
void TimeSync_setDefaultValue (TimeSync_ParamsHandle_t timeSyncHandle)
 Set Default values for the PTP Object based on clock type. More...
 
void TimeSync_formatPTPFrames (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *ifMacID)
 Prepare PTP frames with fields, mac addresses etc. More...
 
void TimeSync_initializeFollowUp (TimeSync_ParamsHandle_t timeSyncHandle)
 Populate MAC ID, clock identity etc in Follow Up frame. Should be called everytime we change to Master from Slave. More...
 
void TimeSync_addIP (TimeSync_ParamsHandle_t timeSyncHandle, uint32_t IP)
 Update IP and Modify checksum whenever IP is assigned or changed. More...
 
void TimeSync_addWord (uint8_t *src, uint32_t word)
 Add a word to the packet stream. More...
 
void TimeSync_addHalfWord (volatile uint8_t *src, uint16_t halfWord)
 Add a half word to the packet stream. More...
 
uint32_t TimeSync_calcChecksum (uint8_t *packet, uint16_t len)
 Compute checksum used in IP/UDP packets for a given stream. More...
 
void TimeSync_calcIPChecksum (uint8_t *packet)
 Compute checksum for IP Header and modify in place. More...
 
void TimeSync_convEndianess (volatile void *src, volatile void *dst, uint8_t numBytes)
 Convert specified number of bytes in source from big endian bytes to little endian and vice versa. Assumption : More...
 
void TimeSync_convEnd6to8 (volatile void *src, void *dst)
 Takes in a 6 byte reverse byte endian source and puts it in an 64 bit double word with correct endianness. This function is specific to PTP Assumption : More...
 
void TimeSync_Port1linkResetCallBack (uint8_t linkStatus, void *arg2)
 Callback for link status change on Port 1. More...
 
void TimeSync_Port2linkResetCallBack (uint8_t linkStatus, void *arg2)
 Callback for link status change on Port 2. More...
 
void TimeSync_reset (TimeSync_ParamsHandle_t timeSyncHandle)
 Reset the state machine in firmware to restart synchronization (First adjustment happens again) More...
 
void TimeSync_processPTPFrame (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *pktBuffer, uint8_t portNum, uint16_t size, uint8_t isLinkLocal)
 Processes a PTP message and extract fields. More...
 
uint8_t TimeSync_isEnabled (TimeSync_ParamsHandle_t timeSyncHandle)
 Return True/False 1/0 if timeSync module is enabled. More...
 
void TimeSync_updateParentAddress (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *parentMac)
 Write the MAC ID of PTP master to Firmware. BMC Algorithm should call this API. More...
 
void TimeSync_getPrevAddress (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *prevMac)
 Retuns the previous master's MAC ID. More...
 
void TimeSync_getGeneralMessage (TimeSync_ParamsHandle_t timeSyncHandle, int8_t *buff)
 Copies the PTP announce message data to PTP stack buffer. More...
 
void TimeSync_rxPhyDelayCorrection (TimeSync_ParamsHandle_t timeSyncHandle)
 Performs PHY delay correction on Rx timestamp Assumption : The function expects the timestamp in rxTimestamp_gPTP field on which it does correction. More...
 
int32_t TimeSync_getRxTimestamp (TimeSync_ParamsHandle_t timeSyncParamsHandle, ptpFrameTypes_t rxFrameType, uint8_t rxPort, uint32_t *nanoseconds, uint64_t *seconds)
 Reads and provides timestamp of a received event message. More...
 
int32_t TimeSync_getRxTimestampFromFrame (TimeSync_ParamsHandle_t timeSyncParamsHandle, uint8_t rxPort, uint32_t *nanoseconds, uint64_t *seconds, uint8_t *TimeStampFromFrame)
 Reads and provides timestamp of a received event message. More...
 
int32_t TimeSync_config (TimeSync_ParamsHandle_t timeSyncHandle)
 Function to configure domain number and/or log message intervals and/or sync0 signal start time, pulse width. More...
 
int32_t TimeSync_getTxTimestamp (TimeSync_ParamsHandle_t timeSyncParamsHandle, ptpFrameTypes_t txFrameType, uint8_t txPort, uint32_t *nanoseconds, uint64_t *seconds)
 Reads and provides timestamp of a transmitted event message. More...
 
int8_t TimeSync_adjTimeSlowComp (TimeSync_ParamsHandle_t timeSyncParamsHandle, int32_t adjOffset)
 Adjusts the IEP clock by the drift value over one Sync interval. More...
 
int32_t TimeSync_setClockTime (TimeSync_ParamsHandle_t timeSyncParamsHandle)
 Configures the driver memory. More...
 
void TimeSync_getCurrentTime (TimeSync_ParamsHandle_t timeSyncParamsHandle, uint32_t *nanoseconds, uint64_t *seconds)
 Returns the current time on device. More...
 
void TimeSync_updateDomainNumberInPTPFrames (TimeSync_ParamsHandle_t timeSyncHandle)
 Update PTP domain number in TX Buffers. More...
 
void TimeSync_updateLogMessageIntervalInPTPFrames (TimeSync_ParamsHandle_t timeSyncHandle)
 Update log message interval in PTP TX buffers. More...
 
void TimeSync_updateDscpValueInDelayRequestFrame (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t dscpValue)
 Update DSCP value in IP header in PTP Delay Request buffer. More...
 

Macros

#define TS_LEAP_61_INDEX   0
 
#define TS_LEAP_59_INDEX   1
 
#define TS_UTC_REASONABLE_INDEX   2
 
#define TS_PTP_TIMESCALE_INDEX   3
 
#define TS_TIME_TRACEABLE_INDEX   4
 
#define TS_FREQ_TRACEABLE_INDEX   5
 
#define TS_ALTERNATE_MASTER_INDEX   6
 
#define TS_PTP_TWO_STEP_INDEX   7
 
#define TS_PTP_UNICAST   8
 
#define TS_PROFILE_SPECIFIC_1_INDEX   9
 
#define TS_PROFILE_SPECIFIC_2_INDEX   10
 
#define TS_PTP_SECURITY_INDEX   11
 
#define TS_SYNC_BYTE0_MASK   0xFF
 
#define TS_ANNOUNCE_BYTE0_MASK   0xFD
 
#define TS_FOLLOW_UP_BYTE0_MASK   0xFD
 
#define TS_PDELAY_RESP_BYTE0_MASK   0xFE
 
#define TS_DELAY_RESP_BYTE0_MASK   0xFD
 
#define TS_OTHER_FRAMES_BYTE0_MASK   0xFC
 
#define TIMESYNC_PDELAY_BUF_SIZE   68
 
#define TIMESYNC_SYNC_BUF_ANNEX_F_SIZE   58
 
#define TIMESYNC_FOLLOW_UP_BUF_ANNEX_F_SIZE   63
 
#define TIMESYNC_ANNOUNCE_BUF_ANNEX_F_SIZE   78
 
#define TIMESYNC_SYNC_BUF_ANNEX_E_SIZE   86
 
#define TIMESYNC_FOLLOW_UP_BUF_ANNEX_E_SIZE   86
 
#define TIMESYNC_ANNOUNCE_BUF_ANNEX_E_SIZE   106
 
#define TIMESYNC_DELAY_REQ_BUF_SIZE   86
 
#define TIMESYNC_DEFAULT_PRIO_1   128
 
#define TIMESYNC_DEFAULT_PRIO_2   128
 
#define TIMESYNC_DEFAULT_CLOCK_ACCURACY   0x31
 
#define TIMESYNC_DEFAULT_CLOCK_CLASS   248
 
#define TIMESYNC_DEFAULT_CLOCK_VARIANCE   0
 
#define TIMESYNC_DEFAULT_STEPS_REMOVED   0
 
#define TIMESYNC_UTC_OFFSET   0
 
#define TIMESYNC_DEFAULT_TIME_SOURCE   0xa0
 
#define TIMESYNC_OFFSET_STABLE_ALGO_THRESHOLD   15
 

Macro Definition Documentation

◆ TS_LEAP_61_INDEX

#define TS_LEAP_61_INDEX   0

Index for Leap 61 status in ptp_flags[] array

◆ TS_LEAP_59_INDEX

#define TS_LEAP_59_INDEX   1

Index for Leap 59 status

◆ TS_UTC_REASONABLE_INDEX

#define TS_UTC_REASONABLE_INDEX   2

Index for UTC reasonable value in ptp_flags[] array

◆ TS_PTP_TIMESCALE_INDEX

#define TS_PTP_TIMESCALE_INDEX   3

Index for value indicating whether PTP Timescale in ptp_flags[] array

◆ TS_TIME_TRACEABLE_INDEX

#define TS_TIME_TRACEABLE_INDEX   4

Index for value indicating whether time traceable in ptp_flags[] array

◆ TS_FREQ_TRACEABLE_INDEX

#define TS_FREQ_TRACEABLE_INDEX   5

Index for value indicating whether freq traceable in ptp_flags[] array

◆ TS_ALTERNATE_MASTER_INDEX

#define TS_ALTERNATE_MASTER_INDEX   6

Index for value indicating whether alternate master in ptp_flags[] array

◆ TS_PTP_TWO_STEP_INDEX

#define TS_PTP_TWO_STEP_INDEX   7

Index for value indicating whether two step sync in ptp_flags[] array

◆ TS_PTP_UNICAST

#define TS_PTP_UNICAST   8

Index for value indicating whether messaging is unicast in ptp_flags[] array

◆ TS_PROFILE_SPECIFIC_1_INDEX

#define TS_PROFILE_SPECIFIC_1_INDEX   9

Index for value indicating alternate PTP Profile in ptp_flags[] array

◆ TS_PROFILE_SPECIFIC_2_INDEX

#define TS_PROFILE_SPECIFIC_2_INDEX   10

Index for value indicating alternate PTP Profile in ptp_flags[] array

◆ TS_PTP_SECURITY_INDEX

#define TS_PTP_SECURITY_INDEX   11

Index for value indicating whether PTP security is enabled or not in ptp_flags[] array

◆ TS_SYNC_BYTE0_MASK

#define TS_SYNC_BYTE0_MASK   0xFF

selects the flags relevant to Sync frame for first byte of the 2 byte flag

◆ TS_ANNOUNCE_BYTE0_MASK

#define TS_ANNOUNCE_BYTE0_MASK   0xFD

selects the flags relevant to Announce frame for first byte of the 2 byte flag

◆ TS_FOLLOW_UP_BYTE0_MASK

#define TS_FOLLOW_UP_BYTE0_MASK   0xFD

selects the flags relevant to Follow Up frame for first byte of the 2 byte flag

◆ TS_PDELAY_RESP_BYTE0_MASK

#define TS_PDELAY_RESP_BYTE0_MASK   0xFE

selects the flags relevant to Pdelay Resp frame for first byte of the 2 byte flag

◆ TS_DELAY_RESP_BYTE0_MASK

#define TS_DELAY_RESP_BYTE0_MASK   0xFD

selects the flags relevant to Delay Resp frame for first byte of the 2 byte flag

◆ TS_OTHER_FRAMES_BYTE0_MASK

#define TS_OTHER_FRAMES_BYTE0_MASK   0xFC

selects the flags relevant to Pdelay Req and Delay Request for first byte of the 2 byte flag

◆ TIMESYNC_PDELAY_BUF_SIZE

#define TIMESYNC_PDELAY_BUF_SIZE   68

Size of peer delay buffers on DUT This includes peer delay request, response and respone follow up

◆ TIMESYNC_SYNC_BUF_ANNEX_F_SIZE

#define TIMESYNC_SYNC_BUF_ANNEX_F_SIZE   58

Size of Sync buffers on DUT for Annex F mode

◆ TIMESYNC_FOLLOW_UP_BUF_ANNEX_F_SIZE

#define TIMESYNC_FOLLOW_UP_BUF_ANNEX_F_SIZE   63

Size of Follow Up buffers on DUT for Annex F mode

◆ TIMESYNC_ANNOUNCE_BUF_ANNEX_F_SIZE

#define TIMESYNC_ANNOUNCE_BUF_ANNEX_F_SIZE   78

Size of Announce Up buffers on DUT for Annex F mode

◆ TIMESYNC_SYNC_BUF_ANNEX_E_SIZE

#define TIMESYNC_SYNC_BUF_ANNEX_E_SIZE   86

Size of Sync buffers on DUT for Annex E mode

◆ TIMESYNC_FOLLOW_UP_BUF_ANNEX_E_SIZE

#define TIMESYNC_FOLLOW_UP_BUF_ANNEX_E_SIZE   86

Size of Follow Up buffers on DUT for Annex E mode

◆ TIMESYNC_ANNOUNCE_BUF_ANNEX_E_SIZE

#define TIMESYNC_ANNOUNCE_BUF_ANNEX_E_SIZE   106

Size of Announce Up buffers on DUT for Annex E mode.

◆ TIMESYNC_DELAY_REQ_BUF_SIZE

#define TIMESYNC_DELAY_REQ_BUF_SIZE   86

Size of Delay Request buffer on DUT (only applicable to E2E).

◆ TIMESYNC_DEFAULT_PRIO_1

#define TIMESYNC_DEFAULT_PRIO_1   128

◆ TIMESYNC_DEFAULT_PRIO_2

#define TIMESYNC_DEFAULT_PRIO_2   128

◆ TIMESYNC_DEFAULT_CLOCK_ACCURACY

#define TIMESYNC_DEFAULT_CLOCK_ACCURACY   0x31

◆ TIMESYNC_DEFAULT_CLOCK_CLASS

#define TIMESYNC_DEFAULT_CLOCK_CLASS   248

◆ TIMESYNC_DEFAULT_CLOCK_VARIANCE

#define TIMESYNC_DEFAULT_CLOCK_VARIANCE   0

◆ TIMESYNC_DEFAULT_STEPS_REMOVED

#define TIMESYNC_DEFAULT_STEPS_REMOVED   0

◆ TIMESYNC_UTC_OFFSET

#define TIMESYNC_UTC_OFFSET   0

◆ TIMESYNC_DEFAULT_TIME_SOURCE

#define TIMESYNC_DEFAULT_TIME_SOURCE   0xa0

◆ TIMESYNC_OFFSET_STABLE_ALGO_THRESHOLD

#define TIMESYNC_OFFSET_STABLE_ALGO_THRESHOLD   15

Function Documentation

◆ TimeSync_drvInit()

int8_t TimeSync_drvInit ( TimeSync_ParamsHandle_t  timeSyncHandle)

Initializes variables and timers & clocks, call once at the beginning.

Parameters
timeSyncHandlepointer to PTP Handle structure
Returns
Error Value

◆ TimeSync_alloc_PktBuffer()

int8_t TimeSync_alloc_PktBuffer ( TimeSync_ParamsHandle_t  timeSyncHandle)

Allocate Rx and Tx buffers for frames like Sync, Announce etc.

Parameters
timeSyncHandlepointer to PTP Handle structure
Returns
Error Value

◆ TimeSync_unAlloc_PktBuffer()

void TimeSync_unAlloc_PktBuffer ( TimeSync_ParamsHandle_t  timeSyncHandle)

Unallocate Rx and Tx buffers for frames like Sync, Announce etc.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_drvEnable()

void TimeSync_drvEnable ( TimeSync_ParamsHandle_t  timeSyncHandle)

Enable PTP firmware.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_drvDisable()

void TimeSync_drvDisable ( TimeSync_ParamsHandle_t  timeSyncHandle)

Disable PTP firmware.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_dramInit()

void TimeSync_dramInit ( TimeSync_ParamsHandle_t  timeSyncHandle)

Initialize PTP stored variables in the DRAM.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_setDefaultValue()

void TimeSync_setDefaultValue ( TimeSync_ParamsHandle_t  timeSyncHandle)

Set Default values for the PTP Object based on clock type.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_formatPTPFrames()

void TimeSync_formatPTPFrames ( TimeSync_ParamsHandle_t  timeSyncHandle,
uint8_t *  ifMacID 
)

Prepare PTP frames with fields, mac addresses etc.

Parameters
timeSyncHandlepointer to PTP Handle structure
ifMacIDpointer to MAC ID

◆ TimeSync_initializeFollowUp()

void TimeSync_initializeFollowUp ( TimeSync_ParamsHandle_t  timeSyncHandle)

Populate MAC ID, clock identity etc in Follow Up frame. Should be called everytime we change to Master from Slave.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_addIP()

void TimeSync_addIP ( TimeSync_ParamsHandle_t  timeSyncHandle,
uint32_t  IP 
)

Update IP and Modify checksum whenever IP is assigned or changed.

Parameters
timeSyncHandlepointer to PTP Handle structure
IPIP address in unsigned 32 bit format.

◆ TimeSync_addWord()

void TimeSync_addWord ( uint8_t *  src,
uint32_t  word 
)

Add a word to the packet stream.

Parameters
srcpointer to the packet stream
wordthe word which is to be added

◆ TimeSync_addHalfWord()

void TimeSync_addHalfWord ( volatile uint8_t *  src,
uint16_t  halfWord 
)

Add a half word to the packet stream.

Parameters
srcpointer to the packet stream
halfWordthe 16 bit word which is to be added

◆ TimeSync_calcChecksum()

uint32_t TimeSync_calcChecksum ( uint8_t *  packet,
uint16_t  len 
)

Compute checksum used in IP/UDP packets for a given stream.

Parameters
packetpointer to the packet stream
lenlength of stream
Returns
Checksum computed

◆ TimeSync_calcIPChecksum()

void TimeSync_calcIPChecksum ( uint8_t *  packet)

Compute checksum for IP Header and modify in place.

Parameters
packetpointer to the packet stream

◆ TimeSync_convEndianess()

void TimeSync_convEndianess ( volatile void *  src,
volatile void *  dst,
uint8_t  numBytes 
)

Convert specified number of bytes in source from big endian bytes to little endian and vice versa. Assumption :

  1. Source and Destination are different
  2. Memory is properly allocated (!Function does not check for memory overrun)
  3. Number of bytes is even
    Parameters
    srcpointer to source byte stream
    dstpointer to destination byte stream
    numBytesnumber of bytes to convert and copy

◆ TimeSync_convEnd6to8()

void TimeSync_convEnd6to8 ( volatile void *  src,
void *  dst 
)

Takes in a 6 byte reverse byte endian source and puts it in an 64 bit double word with correct endianness. This function is specific to PTP Assumption :

  1. Source and Destination are different
  2. Memory is properly allocated (!Function does not check for memory overrun)
    Parameters
    srcpointer to source byte stream
    dstpointer to destination byte stream

◆ TimeSync_Port1linkResetCallBack()

void TimeSync_Port1linkResetCallBack ( uint8_t  linkStatus,
void *  arg2 
)

Callback for link status change on Port 1.

Parameters
linkStatus1/0 whether up or down
arg2timeSyncHandle pointer to PTP Handle structure

◆ TimeSync_Port2linkResetCallBack()

void TimeSync_Port2linkResetCallBack ( uint8_t  linkStatus,
void *  arg2 
)

Callback for link status change on Port 2.

Parameters
linkStatus1/0 whether up or down
arg2timeSyncHandle pointer to PTP Handle structure

◆ TimeSync_reset()

void TimeSync_reset ( TimeSync_ParamsHandle_t  timeSyncHandle)

Reset the state machine in firmware to restart synchronization (First adjustment happens again)

    If Sync interval changes or link break happens or there is a large adjustment in time
    this function is called.
Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_processPTPFrame()

void TimeSync_processPTPFrame ( TimeSync_ParamsHandle_t  timeSyncHandle,
uint8_t *  pktBuffer,
uint8_t  portNum,
uint16_t  size,
uint8_t  isLinkLocal 
)

Processes a PTP message and extract fields.

Parameters
timeSyncHandlepointer to PTP Handle structure
pktBufferpointer to packet data
portNumport number on which the packet was received
sizesize of the packet
isLinkLocal

◆ TimeSync_isEnabled()

uint8_t TimeSync_isEnabled ( TimeSync_ParamsHandle_t  timeSyncHandle)

Return True/False 1/0 if timeSync module is enabled.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_updateParentAddress()

void TimeSync_updateParentAddress ( TimeSync_ParamsHandle_t  timeSyncHandle,
uint8_t *  parentMac 
)

Write the MAC ID of PTP master to Firmware. BMC Algorithm should call this API.

Parameters
timeSyncHandlepointer to PTP Handle structure
parentMacPointer to MAC ID of master.

◆ TimeSync_getPrevAddress()

void TimeSync_getPrevAddress ( TimeSync_ParamsHandle_t  timeSyncHandle,
uint8_t *  prevMac 
)

Retuns the previous master's MAC ID.

Parameters
timeSyncHandlepointer to PTP Handle structure
prevMacPointer to MAC ID of previous master.

◆ TimeSync_getGeneralMessage()

void TimeSync_getGeneralMessage ( TimeSync_ParamsHandle_t  timeSyncHandle,
int8_t *  buff 
)

Copies the PTP announce message data to PTP stack buffer.

Parameters
timeSyncHandlepointer to PTP Handle structure
buffPointer to buffer of PTP Stack.

◆ TimeSync_rxPhyDelayCorrection()

void TimeSync_rxPhyDelayCorrection ( TimeSync_ParamsHandle_t  timeSyncHandle)

Performs PHY delay correction on Rx timestamp Assumption : The function expects the timestamp in rxTimestamp_gPTP field on which it does correction.

Parameters
timeSyncHandlepointer to PTP Handle structure

◆ TimeSync_getRxTimestamp()

int32_t TimeSync_getRxTimestamp ( TimeSync_ParamsHandle_t  timeSyncParamsHandle,
ptpFrameTypes_t  rxFrameType,
uint8_t  rxPort,
uint32_t *  nanoseconds,
uint64_t *  seconds 
)

Reads and provides timestamp of a received event message.

Parameters
[in]timeSyncParamsHandleStructure of type TimeSync_ParamsHandle_t
[in]rxFrameType(INPUT) frame type received Valid values: 0,1,2,3
[in]rxPort(INPUT) Port used for receive ICSS_EMAC_PORT_1/ ICSS_EMAC_PORT_2
[out]nanoseconds(OUTPUT) ptr to 32 bit nanoseconds field
[out]seconds(OUTPUT) ptr to 64 bit(48 used) seconds field
Return values
<0value on error
0on success

◆ TimeSync_getRxTimestampFromFrame()

int32_t TimeSync_getRxTimestampFromFrame ( TimeSync_ParamsHandle_t  timeSyncParamsHandle,
uint8_t  rxPort,
uint32_t *  nanoseconds,
uint64_t *  seconds,
uint8_t *  TimeStampFromFrame 
)

Reads and provides timestamp of a received event message.

Parameters
[in]timeSyncParamsHandleStructure of type TimeSync_ParamsHandle_t
[in]rxPort(INPUT) Port used for receive ICSS_EMAC_PORT_1/ ICSS_EMAC_PORT_2
[out]nanoseconds(OUTPUT) ptr to 32 bit nanoseconds field
[out]seconds(OUTPUT) ptr to 64 bit(48 used) seconds field
[out]TimeStampFromFrame(OUTPUT) frame timestamp
Return values
<0value on error
0on success

◆ TimeSync_config()

int32_t TimeSync_config ( TimeSync_ParamsHandle_t  timeSyncHandle)

Function to configure domain number and/or log message intervals and/or sync0 signal start time, pulse width.

Parameters
[in]timeSyncHandlepointer to PTP Handle structure with updated values in following members : timeSyncHandle->timeSyncConfig.domainNumber, and/or timeSyncHandle->timeSyncConfig.logSyncInterval, and/or timeSyncHandle->timeSyncConfig.logAnnounceSendInterval, and/or timeSyncHandle->timeSyncConfig.syncOut_sync0Start, and/or timeSyncHandle->timeSyncConfig.syncOut_sync0PWidth.
Return values
<0value on error
0on success

◆ TimeSync_getTxTimestamp()

int32_t TimeSync_getTxTimestamp ( TimeSync_ParamsHandle_t  timeSyncParamsHandle,
ptpFrameTypes_t  txFrameType,
uint8_t  txPort,
uint32_t *  nanoseconds,
uint64_t *  seconds 
)

Reads and provides timestamp of a transmitted event message.

Parameters
[in]timeSyncParamsHandleStructure of type TimeSync_ParamsHandle_t
[in]txFrameType(INPUT) frame type transmitted Valid values: 0,1,2,3
[in]txPort(INPUT) Port used for transmit ICSS_EMAC_PORT_1/ ICSS_EMAC_PORT_2
[out]nanoseconds(OUTPUT) ptr to 32 bit nanoseconds field
[out]seconds(OUTPUT) ptr to 64 bit(48 used) seconds field
Return values
<0value on error
0on success

◆ TimeSync_adjTimeSlowComp()

int8_t TimeSync_adjTimeSlowComp ( TimeSync_ParamsHandle_t  timeSyncParamsHandle,
int32_t  adjOffset 
)

Adjusts the IEP clock by the drift value over one Sync interval.

Parameters
[in]timeSyncParamsHandleStructure of type TimeSync_ParamsHandle_t
[in]adjOffset(filtered offset from master in nanoseconds)
Return values
<0value on error
0on success

Adjustment Offset (INPUT) Set drift value Example: 300 (300ns)
syncInterval (INPUT) Set sync interval Example: 30000000 (30ms)

Writes the IEP compensation registers to adjust the IEP counter by adjustment offset value provided in nanoseconds over one Sync interval. syncInterval/drift value will be written to PRUSS_IEP_SLOW_COMPENSATION register. Compensation increment (10 or 0) will be written to CMP_INC field of PRUSS_IEP_GLOBAL_CFG register.

◆ TimeSync_setClockTime()

int32_t TimeSync_setClockTime ( TimeSync_ParamsHandle_t  timeSyncParamsHandle)

Configures the driver memory.

Parameters
[in]timeSyncParamsHandleStructure of type TimeSync_ParamsHandle_t
Return values
<0value on error
0on success

clockTime (INPUT) Clock time to set. Provide in Timestamp format

◆ TimeSync_getCurrentTime()

void TimeSync_getCurrentTime ( TimeSync_ParamsHandle_t  timeSyncParamsHandle,
uint32_t *  nanoseconds,
uint64_t *  seconds 
)

Returns the current time on device.

    Returns the current time in
    1. Seconds : Seconds as on master
    2. Nanoseconds : Current nanoseconds as on master
    The format is identical to the one followed in PTP frames for origin timestamp
    The time is returned in timeSyncParamsHandle->clockTime
Parameters
[in]timeSyncParamsHandlePointer to PTP Handle
[out]nanosecondsPointer to nanoseconds field which is updated by API
[out]secondsPointer to seconds field which is updated by API

◆ TimeSync_updateDomainNumberInPTPFrames()

void TimeSync_updateDomainNumberInPTPFrames ( TimeSync_ParamsHandle_t  timeSyncHandle)

Update PTP domain number in TX Buffers.

Parameters
timeSyncHandlepointer to PTP Handle structure with updated value in timeSyncHandle->timeSyncConfig.domainNumber

◆ TimeSync_updateLogMessageIntervalInPTPFrames()

void TimeSync_updateLogMessageIntervalInPTPFrames ( TimeSync_ParamsHandle_t  timeSyncHandle)

Update log message interval in PTP TX buffers.

Parameters
timeSyncHandlepointer to PTP Handle structure with updated values in timeSyncHandle->timeSyncConfig.logSyncInterval and timeSyncHandle->timeSyncConfig.logAnnounceSendInterval

◆ TimeSync_updateDscpValueInDelayRequestFrame()

void TimeSync_updateDscpValueInDelayRequestFrame ( TimeSync_ParamsHandle_t  timeSyncHandle,
uint8_t  dscpValue 
)

Update DSCP value in IP header in PTP Delay Request buffer.

Parameters
timeSyncHandlePointer to PTP Handle
dscpValueNew 6-bit DSCP value to be set