119 if ((sourcePortNumber == 0xFFFF) || (!sourcePortNumber))
122 portIndex = sourcePortNumber - 1;
137 uv16 |= ptpClock.defaultDS.twoStepFlag << 1;
138 uv16 |= (unicast != 0) << 2;
140 uv16 |= (ptpClock.timePropertiesDS.leap61 << 8)
141 | (ptpClock.timePropertiesDS.leap61 << 9)
142 | (ptpClock.timePropertiesDS.currentUtcOffsetValid << 10)
143 | (ptpClock.timePropertiesDS.ptpTimescale << 11)
144 | (ptpClock.timePropertiesDS.timeTraceable << 12)
145 | (ptpClock.timePropertiesDS.frequencyTraceable << 13);
151 ptp_snd(8, *ptpClock.defaultDS.clockIdentity);
181 v8 = ptpClock.portDS[portIndex].logAnnounceInterval;
188 v8 = ptpClock.portDS[portIndex].logAnnounceInterval;
194 v8 = ptpClock.portDS[portIndex].logMinDelayReqInterval;
322 && (ptpClock.parentDS.parentPortIdentity.clockIdentity
323 == &(ptp_foreignMaster[portNumber][0].clockIdentity))) {
340 t2->secondsField.secondsLow;
342 t2->secondsField.secondsHigh;
344 t2->nanoSecondsField;
437 ptp_meanPathDelay[portNumber] =
ptp_timeDiff(&ptp_P2Pt1, t4);
438 ptp_meanPathDelay[portNumber] -= (
ptp_rcvInt64(&(pBuf[8])));
439 ptp_meanPathDelay[portNumber] >>= 1;
445 if ((t3.secondsField.secondsLow == 0) && (t3.nanoSecondsField == 0)) {
452 && (ptpClock.parentDS.parentPortIdentity.clockIdentity
453 == &(ptp_foreignMaster[portNumber][0].clockIdentity))) {
491 ptp_sndUInt8(ptpClock.parentDS.grandMasterclockQuality.clockClass);
492 ptp_sndUInt8(ptpClock.parentDS.grandMasterclockQuality.clockAccuracy);
494 ptpClock.parentDS.grandMasterclockQuality.offsetScaledLogVariance);
498 ptp_snd(8, ptpClock.parentDS.grandMasterIdentity);
522 if ((ptpClock.portDS[0].portState == PTP_PS_INITIALIZING)
523 || (ptpClock.portDS[0].portState == PTP_PS_DISABLED))
525 if (ptpClock.portDS[0].portState == PTP_PS_FAULTY)
unsigned char ptp_boolean
ptp_uinteger8 ptp_sndInt64(ptp_integer64 *p)
Send 64 bits integer.
ptp_uinteger8 ptp_startFrame(ptp_uinteger16 destination, ptp_uinteger8 len)
Start Frame.
ptp_uinteger8 ptp_sndUInt32(ptp_uinteger32 *p)
Send unsigned 32 bits integer.
ptp_uinteger8 ptp_MsgPdelayRespSnd()
Send Pdelay_Resp message.
ptp_uinteger8 ptp_snd(ptp_uinteger8 len, void *pBuf)
Send data.
ptp_uinteger8 ptp_sndUInt16(ptp_uinteger16 v)
Send unsigned 16 bits integer.
ptp_uinteger8 ptp_MsgAnnounceSnd()
Send Announce message.
UInt8 nwk_getNeighborForeignPort(UInt8 portNumber)
Get neighbor foreign port.
void ptp_rcvOctets(ptp_uinteger8 len, ptp_octet *pBuf, ptp_octet *dest)
Receive octets.
ptp_uinteger8 ptp_sndUInt8(ptp_uinteger8 v)
Send unsigned 8 bits integer.
ptp_boolean ptp_MustAdjustAtPDelayReq
void ptp_MsgDelayRespSnd()
Send Delay_Resp message.
void ptp_MsgPdelayReqRcv(ptp_octet *pBuf, PTP_TimeStamp *t2, ptp_uinteger8 portNumber)
Receive PDelay_Req message.
void ptp_MsgAnnounceRcv(ptp_octet *pBuf, ptp_uinteger8 portNumber)
Receive Announce message.
void ptp_adjTime(PTP_TimeStamp *t1, PTP_TimeStamp *t2, ptp_uinteger8 portIndex)
Adjust the clock.
void ptp_MsgPdelayRespFollowUpSnd()
Send Pdelay_Resp_Follow_Up message.
unsigned long ptp_uinteger32
ptp_uinteger16 ptp_sequencePDelayReqId[PTP_NUMBERPORTS]
void ptp_MsgSyncRcv(ptp_octet *pBuf)
Receive Sync message.
void ptp_MsgDelayReqRcv(ptp_octet *pBuf)
Receive Delay_Req message.
void ptp_MsgPdelayRespFollowUpRcv(ptp_octet *pBuf)
Receive Pdelay_Resp_Follow_Up message.
PTP functions specific to the implementation.
PTP_P2PPDelayReqDS ptp_P2PPDelayReqQueue[PTP_P2PPDELAYREQQUEUESIZE]
ptp_uinteger8 ptp_P2PDelayReqQueueWrite
void ptp_MsgDelayRespRcv(ptp_octet *pBuf)
Receive Delay_Resp message.
void ptp_storeForeignMaster(ptp_octet *pBuf, ptp_uinteger8 portNumber)
Store foreign master.
void ptp_MsgHeaderSnd(ptp_uinteger16 sourcePortNumber, ptp_msgType msgType, ptp_uinteger16 messageLength, ptp_uinteger8 domainNumber, ptp_boolean unicast, ptp_integer64 correctionField, ptp_uinteger16 sequenceId)
Send message header.
#define PTP_P2PPDELAYREQQUEUESIZE
#define PTP_MSG_FIELDTRANSPORTSPECIFICVALUE
unsigned char ptp_uinteger8
void ptp_MsgFollowUpRcv(ptp_octet *pBuf)
Receive Follow_Up message.
void ptp_MsgManagementRcv(ptp_octet *pBuf)
Receive Management message.
ptp_integer64 ptp_timeDiff(PTP_TimeStamp *t1, PTP_TimeStamp *t2)
Time difference.
void ptp_MsgPdelayReqCheck()
Check for PDelay_Req message.
void ptp_MsgManagementSnd()
Send Management message.
void ptp_rcvUInt48sc(ptp_octet *pBuf, PTP_SecondsCount *p)
Receive seconds count value.
void ptp_getCurrentTime(PTP_TimeStamp *dest)
Get cuttent time.
ptp_uinteger8 ptp_MsgPdelayReqSnd(ptp_uinteger8 portNumber)
Send PDelay_Req message.
PTP constants that should not need to be modified.
void ptp_MsgSignalingRcv(ptp_octet *pBuf)
Receive Signaling message.
ptp_integer64 ptp_rcvInt64(ptp_octet *pBuf)
Receive 64 bits integer.
ptp_uinteger8 ptp_sndUInt48sc(PTP_SecondsCount *p)
Send a seconds count value.
void ptp_MsgDelayReqSnd()
Send Delay_Req message.
PTP configuration values to compile.
UInt16 nwk_getNeighborAddress(UInt8 portNumber)
Get neighbor address.
void ptp_MsgFollowUpSnd()
Send Follow_Up message.
void ptp_MsgPdelayRespRcv(ptp_octet *pBuf, PTP_TimeStamp *t4, ptp_uinteger8 portNumber)
Receive Pdelay_Resp message.
ptp_uinteger16 ptp_rcvUInt16(ptp_octet *pBuf)
Receive unsigned 16 bits integer.
void ptp_MsgSignalingSnd()
Send Signaling message.
unsigned short ptp_uinteger16
ptp_uinteger8 ptp_P2PDelayReqQueueRead
ptp_uinteger32 ptp_rcvUInt32(ptp_octet *pBuf)
Receive unsigned 32 bits integer.
void ptp_endFrame()
End frame.