|
AM263x MCU+ SDK
10.00.00
|
|
Go to the documentation of this file.
33 #ifndef ICSS_TIMESYNC_H_
34 #define ICSS_TIMESYNC_H_
56 #define TIME_SYNC_OK (1)
60 #define TIME_SYNC_UNABLE_TO_CREATE_TASK (-1)
64 #define TIME_SYNC_UNABLE_TO_CREATE_SEMAPHORE (-2)
68 #define TIME_SYNC_UNABLE_TO_CREATE_INTERRUPT (-3)
72 #define TIME_SYNC_UNABLE_TO_ALLOC_MEM (-4)
76 #define TIME_SYNC_UNABLE_TO_CREATE_CLOCK (-5)
80 #define TIME_SYNC_UNABLE_TO_CREATE_MAILBOX (-6)
84 #define TIME_SYNC_UNABLE_TO_CREATE_EVENT (-7)
88 #define TIME_SYNC_UNSUPPORTED_FORMAT (-8)
92 #define TIME_SYNC_EDMA_INIT_FAILED (-9)
96 #define TIME_SYNC_FEATURE_NOT_ENABLED (-10)
100 #define TIME_SYNC_HANDLE_NOT_INITIALIZED (-11)
110 #define DEFAULT_PDELAY_REQ_LOG_INTERVAL 3
115 #define DEFAULT_SYNC_SEND_LOG_INTERVAL 0
120 #define DEFAULT_ANNOUNCE_SEND_LOG_INTERVAL 1
125 #define DEFAULT_ANNOUNCE_TIMEOUT_LOG_INTERVAL 3
131 #define TIMESYNC_SYNC_ISR_MASK_P1 0x400000
137 #define TIMESYNC_SYNC_ISR_MASK_P2 0x2000000
143 #define TIMESYNC_TX_TS_ISR_MASK_P1 0x800000
148 #define TIMESYNC_TX_TS_ISR_MASK_P2 0x1000000
154 #define PTP_SYNC_MSG_ID 0x00
159 #define PTP_DLY_REQ_MSG_ID 0x01
164 #define PTP_PDLY_REQ_MSG_ID 0x02
169 #define PTP_PDLY_RSP_MSG_ID 0x03
174 #define PTP_FOLLOW_UP_MSG_ID 0x08
179 #define PTP_DLY_RESP_MSG_ID 0x09
184 #define PTP_PDLY_RESP_FLW_UP_MSG_ID 0x0A
189 #define PTP_ANNOUNCE_MSG_ID 0x0B
194 #define PTP_MGMT_MSG_ID 0x0D
200 #define PTP_FLW_UP_CTRL_MSG_ID 0x02
206 #define SEC_TO_NS 1000000000
212 #define FILTER_ALPHA_COEFF 0.85
218 #define PTP_SYNC0_PERIOD_DIVIDER 4
225 #define OFFSET_THRESHOLD_FOR_RESET 10000
232 #define STABLE_FILTER_THRESHOLD 100
243 #define TIMESYNC_PEER_DELAY_ERROR_THRESHOLD 10000
250 #define NUM_SYNC_MISSED_THRESHOLD 3
256 #define AVG_NUM_DELAY_MEASUREMENTS 3
265 #define SRC_MAC_OFFSET 6
270 #define IP_DSCP_OFFSET 15
275 #define SRC_IP_OFFSET 26
280 #define DST_IP_OFFSET 30
285 #define IP_CHKSUM_OFFSET 40
290 #define PTP_MSG_ID_OFFSET 42
295 #define PTP_DOMAIN_NUM_OFFSET 46
300 #define PTP_FLAG_OFFSET 48
305 #define PTP_CORRECTION_OFFSET 50
310 #define PTP_SRC_CLK_IDENTITY 62
315 #define PTP_SRC_PORT_ID_OFFSET 70
320 #define PTP_SEQ_ID_OFFSET 72
326 #define PTP_CONTROL_MSG_ID_OFFSET 74
331 #define PTP_LOG_MSG_PERIOD 75
336 #define PTP_REQ_RCPT_TS_SEC_OFFSET 76
341 #define PTP_REQ_RCPT_TS_NSEC_OFFSET 82
346 #define PTP_REQ_SRC_PORT_IDENTITY 86
351 #define PTP_REQ_SRC_PORT_ID 94
357 #define PTP_UTC_OFFSET 86
363 #define PTP_PRIORITY1_OFFSET 89
369 #define PTP_GM_CLK_CLASS_OFFSET 90
375 #define PTP_GM_CLK_ACCU_OFFSET 91
381 #define PTP_GM_CLK_VARIANCE_OFFSET 92
387 #define PTP_PRIORITY2_OFFSET 94
393 #define PTP_GM_CLK_IDENTITY_OFFSET 95
399 #define PTP_STEPS_REMOVED_OFFSET 103
405 #define PTP_TIME_SRC_OFFSET 105
411 #define PTP_E2E_BUFFER_OFFSET 42
416 #define PTP_P2P_BUFFER_OFFSET 14
422 #define ANNEX_D_ANNEX_F_DIFF 28
427 #define HSR_CORRECTION 6
433 #define SRC_DST_MAC_SIZE 12
439 #define PTP_LEAP_61_MASK (1<<0)
444 #define PTP_LEAP_59_MASK (1<<1)
449 #define PTP_UTC_REASONABLE_MASK (1<<2)
455 #define PTP_TIMESCALE_MASK (1<<3)
461 #define PTP_TIME_TRACEABLE_MASK (1<<4)
467 #define PTP_FREQ_TRACEABLE_MASK (1<<5)
473 #define PTP_ALTERNATE_MASTER_MASK (1<<8)
480 #define PTP_TWO_STEP_MASK (1<<9)
486 #define PTP_UNICAST_MASK (1<<10)
493 #define PTP_PROFILE_SPECIFIC_1_MASK (1<<13)
500 #define PTP_PROFILE_SPECIFIC_2_MASK (1<<14)
506 #define PTP_SECURITY_MASK (1<<15)
513 #define SYNC_INTERVAL_PERIOD_CHANGE_THRESHOLD 60
519 #define GPTP_NUM_DOMAINS 2
525 #define PTP_FLAG_SIZE (2)
531 #define PTP_SRC_CLK_IDENTITY_SIZE (8)
536 #define PTP_SRC_PORT_ID_SIZE (2)
542 #define PTP_GM_CLK_IDENTITY_SIZE (8)
548 #define PTP_GM_CLK_CLASS_SIZE (1)
554 #define PTP_GM_CLK_ACCU_SIZE (1)
560 #define PTP_GM_CLK_VARIANCE_SIZE (2)
566 #define PTP_UTC_SIZE (2)
572 #define PTP_TIME_SRC_SIZE (1)
578 #define PTP_PRIORITY1_SIZE (1)
584 #define PTP_PRIORITY2_SIZE (1)
590 #define PTP_STEPS_REMOVED_SIZE (2)
649 uint8_t *pktBuffer, \
650 uint8_t portNum, uint16_t size, uint8_t isLinkLocal);
716 uint8_t twoStep, uint8_t portNum);
728 uint8_t followUp, uint8_t portNum, uint16_t size);
759 uint8_t followUp, 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_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:962
ptpFrameTypes_t
PTP Delay Mechanism Type. From Table 9 of Standard.
Definition: icss_timeSyncApi.h:203