Go to the source code of this file.
Functions | |
void | TimeSync_resetIEP (TimeSync_ParamsHandle_t timeSyncHandle) |
Resets CMP1 once first adjustment is done, else 1PPS signal doesn't trigger. More... | |
void | TimeSync_doFirstAdjustment (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum) |
Do initial adjustment for the IEP based on sync timestamp. 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... | |
void | TimeSync_getTxTS (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum, ptpFrameTypes_t frameType) |
void | TimeSync_lineDelayCalc (TimeSync_ParamsHandle_t timeSyncHandle) |
void | TimeSync_peerDelayCalc (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t twoStep, uint8_t portNum) |
void | TimeSync_processSyncFrame (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t followUp, uint8_t portNum, uint16_t size) |
void | TimeSync_processDelayResFrame (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t portNum) |
void | TimeSync_processPdelayReqFrame (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t portNum) |
void | TimeSync_processPdelayRespFrame (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t followUp, uint8_t portNum) |
void | TimeSync_forced2StepBDCalc (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum) |
void | TimeSync_synchronizeClock (TimeSync_ParamsHandle_t timeSyncHandle) |
void | TimeSync_calcNRR (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum) |
void | TimeSync_updateNRRParams (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum) |
void | TimeSync_calcRcfAndSyncInterval (TimeSync_ParamsHandle_t timeSyncHandle) |
void | TimeSync_writeTS_SingleStep_Sync (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum) |
void | TimeSync_dummyBMCA (TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *pktBuffer) |
uint64_t | getIEPTimestamp (TimeSync_ParamsHandle_t timeSyncHandle) |
#define TIME_SYNC_OK (1) |
Success.
#define TIME_SYNC_UNABLE_TO_CREATE_TASK (-1) |
Time Sync module is unable to create a Task.
#define TIME_SYNC_UNABLE_TO_CREATE_SEMAPHORE (-2) |
Time Sync module is unable to create a Semaphore.
#define TIME_SYNC_UNABLE_TO_CREATE_INTERRUPT (-3) |
Time Sync module is unable to create an interrupt.
#define TIME_SYNC_UNABLE_TO_ALLOC_MEM (-4) |
Time Sync module is unable to allocate memory.
#define TIME_SYNC_UNABLE_TO_CREATE_CLOCK (-5) |
Time Sync module is unable to create timer.
#define TIME_SYNC_UNABLE_TO_CREATE_MAILBOX (-6) |
Time Sync module is unable to create a mailbox.
#define TIME_SYNC_UNABLE_TO_CREATE_EVENT (-7) |
Time Sync module is unable to create an event.
#define TIME_SYNC_UNSUPPORTED_FORMAT (-8) |
Time Sync unsupported format.
#define TIME_SYNC_EDMA_INIT_FAILED (-9) |
Time Sync not able to initialize EDMA.
#define TIME_SYNC_FEATURE_NOT_ENABLED (-10) |
Time Sync feature disabled.
#define TIME_SYNC_HANDLE_NOT_INITIALIZED (-11) |
Time Sync handle uninitialized.
#define DEFAULT_PDELAY_REQ_LOG_INTERVAL 3 |
Default PDelay Request packet interval. Actual value is 2^value seconds
#define DEFAULT_SYNC_SEND_LOG_INTERVAL 0 |
Default Sync transmit interval. Actual value is 2^value seconds
#define DEFAULT_ANNOUNCE_SEND_LOG_INTERVAL 1 |
Default Announce packet transmit interval. Actual value is 2^value seconds
#define DEFAULT_ANNOUNCE_TIMEOUT_LOG_INTERVAL 3 |
Default Announce packet timeout. Actual value is 2^value seconds
#define TIMESYNC_SYNC_ISR_MASK_P1 0x400000 |
Interrupt mask for PRU event 22
#define TIMESYNC_SYNC_ISR_MASK_P2 0x2000000 |
Interrupt mask for PRU event 25
#define TIMESYNC_TX_TS_ISR_MASK_P1 0x800000 |
#define TIMESYNC_TX_TS_ISR_MASK_P2 0x1000000 |
Interrupt mask for PRU event 24
#define PTP_SYNC_MSG_ID 0x00 |
Sync message ID value
#define PTP_DLY_REQ_MSG_ID 0x01 |
Delay request message ID value
#define PTP_PDLY_REQ_MSG_ID 0x02 |
PDelay request message ID value
#define PTP_PDLY_RSP_MSG_ID 0x03 |
PDelay response message ID value
#define PTP_FOLLOW_UP_MSG_ID 0x08 |
Follow up message ID value
#define PTP_DLY_RESP_MSG_ID 0x09 |
Delay response message ID value
#define PTP_PDLY_RESP_FLW_UP_MSG_ID 0x0A |
PDelay response follow up message ID value
#define PTP_ANNOUNCE_MSG_ID 0x0B |
Announce message ID value
#define PTP_MGMT_MSG_ID 0x0D |
Management message ID value
#define PTP_FLW_UP_CTRL_MSG_ID 0x02 |
Control message ID value for Follow Up
#define SEC_TO_NS 1000000000 |
Value of seconds in nanoseconds. Useful for calculations
#define FILTER_ALPHA_COEFF 0.85 |
Alpha coefficient for sync interval exponential filter and other filters
#define PTP_SYNC0_PERIOD_DIVIDER 4 |
CMP1 period divided by this number makes the width of the Sync pulse
#define OFFSET_THRESHOLD_FOR_RESET 10000 |
If offset from Master goes above this threshold it will trigger a reset. Value is in nanoseconds
#define STABLE_FILTER_THRESHOLD 100 |
When clock drift goes below this value it indicates drift has stabilized and SMA filter can kick in
#define TIMESYNC_PEER_DELAY_ERROR_THRESHOLD 10000 |
When peer delay exceeds this value it gets reset to 0 Sometimes wrong values are calculated when doing peer delay calculation when clock on peer changes in between peer delay messages and because of the filter this value stays for a long time This helps in fixing it. This is set to a value much higher than max peer delay (of a 100 mtr cable)
#define NUM_SYNC_MISSED_THRESHOLD 3 |
If this many consecutive sync frames are missed the DUT gets reset
#define AVG_NUM_DELAY_MEASUREMENTS 3 |
Number of values in the running average
#define SRC_MAC_OFFSET 6 |
Source MAC address offset
#define IP_DSCP_OFFSET 15 |
Differentiated Services Code Point (DSCP) offset in IP4/UDP
#define SRC_IP_OFFSET 26 |
Source IP address offset in IP4/UDP
#define DST_IP_OFFSET 30 |
Destination IP address offset in IP4/UDP
#define IP_CHKSUM_OFFSET 40 |
IP4 checksum offset in IP4/UDP
#define PTP_MSG_ID_OFFSET 42 |
PTP message ID offset
#define PTP_DOMAIN_NUM_OFFSET 46 |
PTP domain number offset
#define PTP_FLAG_OFFSET 48 |
Offset for PTP flags (including 2 step)
#define PTP_CORRECTION_OFFSET 50 |
Offset for PTP correction field
#define PTP_SRC_CLK_IDENTITY 62 |
Offset for PTP source clock identity (MAC + protocol id)
#define PTP_SRC_PORT_ID_OFFSET 70 |
Offset source port id
#define PTP_SEQ_ID_OFFSET 72 |
Offset for sequence identifier (incremented every frame)
#define PTP_CONTROL_MSG_ID_OFFSET 74 |
Offset for message id. This categorizes frames into two groups time critical and non time critical
#define PTP_LOG_MSG_PERIOD 75 |
Log message interval offset
#define PTP_REQ_RCPT_TS_SEC_OFFSET 76 |
Offset for seconds timestamp
#define PTP_REQ_RCPT_TS_NSEC_OFFSET 82 |
Offset for nanoseconds timestamp
#define PTP_REQ_SRC_PORT_IDENTITY 86 |
Offset for requestor clock identity
#define PTP_REQ_SRC_PORT_ID 94 |
Offset for requestor port identity
#define PTP_UTC_OFFSET 86 |
Offset for UTC offset in Announce frame
#define PTP_PRIORITY1_OFFSET 89 |
Offset for Priority 1 field in Announce frame
#define PTP_GM_CLK_CLASS_OFFSET 90 |
Offset for GM clock class field in Announce frame
#define PTP_GM_CLK_ACCU_OFFSET 91 |
Offset for GM clock accuracy field in Announce frame
#define PTP_GM_CLK_VARIANCE_OFFSET 92 |
Offset for GM clock variance field in Announce frame
#define PTP_PRIORITY2_OFFSET 94 |
Offset for priority 2 field in Announce frame
#define PTP_GM_CLK_IDENTITY_OFFSET 95 |
Offset for GM clock identity field in Announce frame
#define PTP_STEPS_REMOVED_OFFSET 103 |
Offset for steps removed field in Announce frame
#define PTP_TIME_SRC_OFFSET 105 |
Offset for GM time source field in Announce frame
#define PTP_E2E_BUFFER_OFFSET 42 |
Offset for start of PTP data in UDP/IP4 frame
#define PTP_P2P_BUFFER_OFFSET 14 |
Offset for start of PTP data in 802.3 frame
#define ANNEX_D_ANNEX_F_DIFF 28 |
Number of Extra bytes from Annex F(802.1) to Annex E(UDP)
#define HSR_CORRECTION 6 |
Number of bytes in HSR Header
#define SRC_DST_MAC_SIZE 12 |
Num bytes in source plus destination MAC
#define PTP_LEAP_61_MASK (1<<0) |
Mask for Leap 61 status in PTP Flags
#define PTP_LEAP_59_MASK (1<<1) |
Mask for Leap 59 status in PTP Flags
#define PTP_UTC_REASONABLE_MASK (1<<2) |
Mask for UTC reasonable value in PTP Flags
#define PTP_TIMESCALE_MASK (1<<3) |
Mask for value indicating whether PTP Timescale in PTP Flags
#define PTP_TIME_TRACEABLE_MASK (1<<4) |
Mask for value indicating whether time traceable in PTP Flags
#define PTP_FREQ_TRACEABLE_MASK (1<<5) |
Mask for value indicating whether freq traceable in PTP Flags
#define PTP_ALTERNATE_MASTER_MASK (1<<8) |
Mask for value indicating whether alternate master in PTP Flags
#define PTP_TWO_STEP_MASK (1<<9) |
Mask for value indicating whether two step sync in PTP Flags
#define PTP_UNICAST_MASK (1<<10) |
Mask for value indicating whether messaging is unicast in PTP Flags
#define PTP_PROFILE_SPECIFIC_1_MASK (1<<13) |
Mask for value indicating alternate PTP Profile in PTP Flags
#define PTP_PROFILE_SPECIFIC_2_MASK (1<<14) |
Mask for value indicating alternate PTP Profile in PTP Flags
#define PTP_SECURITY_MASK (1<<15) |
Mask for value indicating whether PTP security is enabled or not in PTP Flags
#define SYNC_INTERVAL_PERIOD_CHANGE_THRESHOLD 60 |
If current sync interval varies from previously measured sync interval by this much percentage then it triggers a PTP reset
#define GPTP_NUM_DOMAINS 2 |
Number of domains supported by GPTP implementation
#define PTP_FLAG_SIZE (2) |
Size for PTP flags (including 2 step)
#define PTP_SRC_CLK_IDENTITY_SIZE (8) |
Size for PTP source clock identity (MAC + protocol id)
#define PTP_SRC_PORT_ID_SIZE (2) |
Size for source port id field
#define PTP_GM_CLK_IDENTITY_SIZE (8) |
Size for GM clock identity field in Announce frame
#define PTP_GM_CLK_CLASS_SIZE (1) |
Size for GM clock class field in Announce frame
#define PTP_GM_CLK_ACCU_SIZE (1) |
Size for GM clock accuracy field in Announce frame
#define PTP_GM_CLK_VARIANCE_SIZE (2) |
Size for GM clock variance field in Announce frame
#define PTP_UTC_SIZE (2) |
Size for UTC offset in Announce frame
#define PTP_TIME_SRC_SIZE (1) |
Size for GM time source field in Announce frame
#define PTP_PRIORITY1_SIZE (1) |
Size for Priority 1 field in Announce frame
#define PTP_PRIORITY2_SIZE (1) |
Size for Priority 2 field in Announce frame
#define PTP_STEPS_REMOVED_SIZE (2) |
Offset for steps removed field in Announce frame
void TimeSync_resetIEP | ( | TimeSync_ParamsHandle_t | timeSyncHandle | ) |
Resets CMP1 once first adjustment is done, else 1PPS signal doesn't trigger.
timeSyncHandle | pointer to PTP Handle structure |
void TimeSync_doFirstAdjustment | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t | portNum | ||
) |
Do initial adjustment for the IEP based on sync timestamp.
timeSyncHandle | pointer to PTP Handle structure |
portNum | ICSS_EMAC_PORT_1 or ICSS_EMAC_PORT_2 |
void TimeSync_getTxTS | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t | portNum, | ||
ptpFrameTypes_t | frameType | ||
) |
void TimeSync_lineDelayCalc | ( | TimeSync_ParamsHandle_t | timeSyncHandle | ) |
void TimeSync_peerDelayCalc | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t | twoStep, | ||
uint8_t | portNum | ||
) |
void TimeSync_processSyncFrame | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t * | buff, | ||
uint8_t | followUp, | ||
uint8_t | portNum, | ||
uint16_t | size | ||
) |
void TimeSync_processDelayResFrame | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t * | buff, | ||
uint8_t | portNum | ||
) |
void TimeSync_processPdelayReqFrame | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t * | buff, | ||
uint8_t | portNum | ||
) |
void TimeSync_processPdelayRespFrame | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t * | buff, | ||
uint8_t | followUp, | ||
uint8_t | portNum | ||
) |
void TimeSync_forced2StepBDCalc | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t | portNum | ||
) |
void TimeSync_synchronizeClock | ( | TimeSync_ParamsHandle_t | timeSyncHandle | ) |
void TimeSync_calcNRR | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t | portNum | ||
) |
void TimeSync_updateNRRParams | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t | portNum | ||
) |
void TimeSync_calcRcfAndSyncInterval | ( | TimeSync_ParamsHandle_t | timeSyncHandle | ) |
void TimeSync_writeTS_SingleStep_Sync | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t | portNum | ||
) |
void TimeSync_dummyBMCA | ( | TimeSync_ParamsHandle_t | timeSyncHandle, |
uint8_t * | pktBuffer | ||
) |
uint64_t getIEPTimestamp | ( | TimeSync_ParamsHandle_t | timeSyncHandle | ) |