Skip to content

Commit 76aaf67

Browse files
authored
- P2P Sync-FollowUp-PDelReq separation
Sync-FollowUp-PDelReq separation fixed, no PDelReq will be issued between corresponding Sync and FollowUp messages.
1 parent 3601a6f commit 76aaf67

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/flexptp/master.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void ptp_send_sync_message() {
165165
sync_.pTxCb = ptp_send_follow_up;
166166
sync_.tx_dm = S.profile.delayMechanism;
167167
sync_.tx_mc = PTP_MC_EVENT;
168-
sync_.ttl = FLEXPTP_RANDOM_TAGGED_MESSAGE_TTL_TICKS; //S.master.syncTickPeriod;
168+
sync_.ttl = FLEXPTP_RANDOM_TAGGED_MESSAGE_TTL_TICKS; // S.master.syncTickPeriod;
169169

170170
// send message
171171
ptp_transmit_enqueue(&sync_);
@@ -317,7 +317,7 @@ void ptp_master_process_message(RawPtpMessage *pRawMsg, PtpHeader *pHeader) {
317317
return;
318318
}
319319

320-
PtpDelay_RespIdentification delay_respID; // acquire PDelay_Resp(_Follow_Up) identification info
320+
PtpDelay_RespIdentification delay_respID; // acquire PDelay_Resp(_Follow_Up) identification info
321321
ptp_read_delay_resp_id_data(&delay_respID, pRawMsg->data);
322322

323323
if ((delay_respID.requestingSourceClockIdentity == S.hwoptions.clockIdentity) &&
@@ -439,19 +439,22 @@ void ptp_master_tick() {
439439
// gating signal for Sync and Announce transmission
440440
bool infoEn = (dm == PTP_DM_E2E) || ((dm == PTP_DM_P2P) && ((S.master.p2pSlave.state == PTP_P2PSS_ESTABLISHED) || (!(S.profile.flags & PTP_PF_ISSUE_SYNC_FOR_COMPLIANT_SLAVE_ONLY_IN_P2P))));
441441

442-
if (infoEn) {
443-
// Sync transmission
444-
if (++S.master.syncTmr >= S.master.syncTickPeriod) {
445-
S.master.syncTmr = 0;
442+
// Sync transmission
443+
if (++S.master.syncTmr >= S.master.syncTickPeriod) {
444+
S.master.syncTmr = 0;
445+
446+
if (infoEn) {
446447
ptp_send_sync_message();
447448
PTP_IUEV(PTP_UEV_SYNC_SENT);
448449
}
450+
}
449451

450-
// Announce transmission
451-
if (++S.master.announceTmr >= S.master.announceTickPeriod) { // advance Announce timer
452-
S.master.announceTmr = 0;
453-
}
452+
// Announce transmission
453+
if (++S.master.announceTmr >= S.master.announceTickPeriod) { // advance Announce timer
454+
S.master.announceTmr = 0;
455+
}
454456

457+
if (infoEn) {
455458
// shift Announce transmission phase with 1 tick
456459
if (S.master.announceTmr == 1) {
457460
ptp_send_announce_message();

src/flexptp/ptp_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extern const uint8_t PTP_ETHERNET_PEER_DELAY[6]; ///< PTP's L2 Peer_Delay Ethern
125125
#endif
126126

127127
#ifndef PTP_HEARTBEAT_TICKRATE_MS
128-
#define PTP_HEARTBEAT_TICKRATE_MS (62) ///< Heartbeat ticking period
128+
#define PTP_HEARTBEAT_TICKRATE_MS (31) ///< Heartbeat ticking period
129129
#endif
130130

131131
#ifndef PTP_PORT_ID

0 commit comments

Comments
 (0)