|
AM64x MCU+ SDK
08.02.00
|
|
Go to the documentation of this file.
33 #ifndef ICSS_TIMESYNC_H_
34 #define ICSS_TIMESYNC_H_
50 #define TIME_SYNC_OK (1)
54 #define TIME_SYNC_UNABLE_TO_CREATE_TASK (-1)
58 #define TIME_SYNC_UNABLE_TO_CREATE_SEMAPHORE (-2)
62 #define TIME_SYNC_UNABLE_TO_CREATE_INTERRUPT (-3)
66 #define TIME_SYNC_UNABLE_TO_ALLOC_MEM (-4)
70 #define TIME_SYNC_UNABLE_TO_CREATE_CLOCK (-5)
74 #define TIME_SYNC_UNABLE_TO_CREATE_MAILBOX (-6)
78 #define TIME_SYNC_UNABLE_TO_CREATE_EVENT (-7)
82 #define TIME_SYNC_UNSUPPORTED_FORMAT (-8)
86 #define TIME_SYNC_EDMA_INIT_FAILED (-9)
90 #define TIME_SYNC_FEATURE_NOT_ENABLED (-10)
94 #define TIME_SYNC_HANDLE_NOT_INITIALIZED (-11)
104 #define DEFAULT_PDELAY_REQ_LOG_INTERVAL 3
109 #define DEFAULT_SYNC_SEND_LOG_INTERVAL 0
114 #define DEFAULT_ANNOUNCE_SEND_LOG_INTERVAL 1
119 #define DEFAULT_ANNOUNCE_TIMEOUT_LOG_INTERVAL 3
125 #define TIMESYNC_SYNC_ISR_MASK_P1 0x400000
131 #define TIMESYNC_SYNC_ISR_MASK_P2 0x2000000
137 #define TIMESYNC_TX_TS_ISR_MASK_P1 0x800000
142 #define TIMESYNC_TX_TS_ISR_MASK_P2 0x1000000
148 #define PTP_SYNC_MSG_ID 0x00
153 #define PTP_DLY_REQ_MSG_ID 0x01
158 #define PTP_PDLY_REQ_MSG_ID 0x02
163 #define PTP_PDLY_RSP_MSG_ID 0x03
168 #define PTP_FOLLOW_UP_MSG_ID 0x08
173 #define PTP_DLY_RESP_MSG_ID 0x09
178 #define PTP_PDLY_RESP_FLW_UP_MSG_ID 0x0A
183 #define PTP_ANNOUNCE_MSG_ID 0x0B
188 #define PTP_MGMT_MSG_ID 0x0D
194 #define PTP_FLW_UP_CTRL_MSG_ID 0x02
200 #define SEC_TO_NS 1000000000
206 #define FILTER_ALPHA_COEFF 0.85
212 #define PTP_SYNC0_PERIOD_DIVIDER 4
219 #define OFFSET_THRESHOLD_FOR_RESET 10000
226 #define STABLE_FILTER_THRESHOLD 100
237 #define TIMESYNC_PEER_DELAY_ERROR_THRESHOLD 10000
244 #define NUM_SYNC_MISSED_THRESHOLD 3
250 #define AVG_NUM_DELAY_MEASUREMENTS 3
259 #define SRC_MAC_OFFSET 6
264 #define IP_DSCP_OFFSET 15
269 #define SRC_IP_OFFSET 26
274 #define DST_IP_OFFSET 30
279 #define IP_CHKSUM_OFFSET 40
284 #define PTP_MSG_ID_OFFSET 42
289 #define PTP_DOMAIN_NUM_OFFSET 46
294 #define PTP_FLAG_OFFSET 48
299 #define PTP_CORRECTION_OFFSET 50
304 #define PTP_SRC_CLK_IDENTITY 62
309 #define PTP_SRC_PORT_ID_OFFSET 70
314 #define PTP_SEQ_ID_OFFSET 72
320 #define PTP_CONTROL_MSG_ID_OFFSET 74
325 #define PTP_LOG_MSG_PERIOD 75
330 #define PTP_REQ_RCPT_TS_SEC_OFFSET 76
335 #define PTP_REQ_RCPT_TS_NSEC_OFFSET 82
340 #define PTP_REQ_SRC_PORT_IDENTITY 86
345 #define PTP_REQ_SRC_PORT_ID 94
351 #define PTP_UTC_OFFSET 86
357 #define PTP_PRIORITY1_OFFSET 89
363 #define PTP_GM_CLK_CLASS_OFFSET 90
369 #define PTP_GM_CLK_ACCU_OFFSET 91
375 #define PTP_GM_CLK_VARIANCE_OFFSET 92
381 #define PTP_PRIORITY2_OFFSET 94
387 #define PTP_GM_CLK_IDENTITY_OFFSET 95
393 #define PTP_STEPS_REMOVED_OFFSET 103
399 #define PTP_TIME_SRC_OFFSET 105
405 #define PTP_E2E_BUFFER_OFFSET 42
410 #define PTP_P2P_BUFFER_OFFSET 14
416 #define ANNEX_D_ANNEX_F_DIFF 28
421 #define HSR_CORRECTION 6
427 #define SRC_DST_MAC_SIZE 12
433 #define PTP_LEAP_61_MASK (1<<0)
438 #define PTP_LEAP_59_MASK (1<<1)
443 #define PTP_UTC_REASONABLE_MASK (1<<2)
449 #define PTP_TIMESCALE_MASK (1<<3)
455 #define PTP_TIME_TRACEABLE_MASK (1<<4)
461 #define PTP_FREQ_TRACEABLE_MASK (1<<5)
467 #define PTP_ALTERNATE_MASTER_MASK (1<<8)
474 #define PTP_TWO_STEP_MASK (1<<9)
480 #define PTP_UNICAST_MASK (1<<10)
487 #define PTP_PROFILE_SPECIFIC_1_MASK (1<<13)
494 #define PTP_PROFILE_SPECIFIC_2_MASK (1<<14)
500 #define PTP_SECURITY_MASK (1<<15)
507 #define SYNC_INTERVAL_PERIOD_CHANGE_THRESHOLD 60
513 #define GPTP_NUM_DOMAINS 2
519 #define PTP_FLAG_SIZE (2)
525 #define PTP_SRC_CLK_IDENTITY_SIZE (8)
530 #define PTP_SRC_PORT_ID_SIZE (2)
536 #define PTP_GM_CLK_IDENTITY_SIZE (8)
542 #define PTP_GM_CLK_CLASS_SIZE (1)
548 #define PTP_GM_CLK_ACCU_SIZE (1)
554 #define PTP_GM_CLK_VARIANCE_SIZE (2)
560 #define PTP_UTC_SIZE (2)
566 #define PTP_TIME_SRC_SIZE (1)
572 #define PTP_PRIORITY1_SIZE (1)
578 #define PTP_PRIORITY2_SIZE (1)
584 #define PTP_STEPS_REMOVED_SIZE (2)
643 uint8_t *pktBuffer, \
644 uint8_t portNum, uint16_t
size, uint8_t isLinkLocal);
710 uint8_t twoStep, uint8_t portNum);
722 uint8_t followUp, uint8_t portNum, uint16_t
size);
753 uint8_t followUp, uint8_t portNum);
void TimeSync_processPdelayRespFrame(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t followUp, uint8_t portNum)
uint16_t size
Definition: tisci_boardcfg.h:1
void TimeSync_forced2StepBDCalc(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum)
void TimeSync_Port1linkResetCallBack(uint8_t linkStatus, void *arg2)
Callback for link status change on Port 1.
void TimeSync_getPrevAddress(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *prevMac)
Retuns the previous master's MAC ID.
void TimeSync_dummyBMCA(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *pktBuffer)
void TimeSync_lineDelayCalc(TimeSync_ParamsHandle_t timeSyncHandle)
void TimeSync_processSyncFrame(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t followUp, uint8_t portNum, uint16_t size)
void TimeSync_writeTS_SingleStep_Sync(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum)
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.
void TimeSync_calcRcfAndSyncInterval(TimeSync_ParamsHandle_t timeSyncHandle)
void TimeSync_Port2linkResetCallBack(uint8_t linkStatus, void *arg2)
Callback for link status change on Port 2.
void TimeSync_processPdelayReqFrame(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t portNum)
void TimeSync_resetIEP(TimeSync_ParamsHandle_t timeSyncHandle)
Resets CMP1 once first adjustment is done, else 1PPS signal doesn't trigger.
void TimeSync_updateNRRParams(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum)
uint64_t getIEPTimestamp(TimeSync_ParamsHandle_t timeSyncHandle)
uint8_t TimeSync_isEnabled(TimeSync_ParamsHandle_t timeSyncHandle)
Return True/False 1/0 if timeSync module is enabled.
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.
void TimeSync_calcNRR(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum)
void TimeSync_doFirstAdjustment(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum)
Do initial adjustment for the IEP based on sync timestamp.
void TimeSync_peerDelayCalc(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t twoStep, uint8_t portNum)
void TimeSync_synchronizeClock(TimeSync_ParamsHandle_t timeSyncHandle)
void TimeSync_processDelayResFrame(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t *buff, uint8_t portNum)
void TimeSync_getTxTS(TimeSync_ParamsHandle_t timeSyncHandle, uint8_t portNum, ptpFrameTypes_t frameType)
void TimeSync_getGeneralMessage(TimeSync_ParamsHandle_t timeSyncHandle, int8_t *buff)
Copies the PTP announce message data to PTP stack buffer.
void TimeSync_reset(TimeSync_ParamsHandle_t timeSyncHandle)
Reset the state machine in firmware to restart synchronization (First adjustment happens again)
void TimeSync_rxPhyDelayCorrection(TimeSync_ParamsHandle_t timeSyncHandle)
Performs PHY delay correction on Rx timestamp Assumption : The function expects the timestamp in rxTi...
struct TimeSync_ParamsHandle_s * TimeSync_ParamsHandle_t
Definition: icss_timeSyncApi.h:1016
ptpFrameTypes_t
PTP Delay Mechanism Type. From Table 9 of Standard.
Definition: icss_timeSyncApi.h:203