Commit 4b270c41 authored by Omar Gabella's avatar Omar Gabella

KM3NET BROADCAST : Follow the 'handshake' WITHOUT exchange any WR message.

parent 41bccf4e
...@@ -199,14 +199,9 @@ static int wr_handle_announce(struct pp_instance *ppi) ...@@ -199,14 +199,9 @@ static int wr_handle_announce(struct pp_instance *ppi)
(1 /* FIXME: Recommended State, see page 33*/) && (1 /* FIXME: Recommended State, see page 33*/) &&
(WR_DSPOR(ppi)->parentWrConfig & WR_M_ONLY) && (WR_DSPOR(ppi)->parentWrConfig & WR_M_ONLY) &&
(!WR_DSPOR(ppi)->wrModeOn || !WR_DSPOR(ppi)->parentWrModeOn)) { (!WR_DSPOR(ppi)->wrModeOn || !WR_DSPOR(ppi)->parentWrModeOn)) {
#ifdef BROADCAST
/* We don't want to start the handshake procedure in broadcast mode. */
WR_DSPOR(ppi)->wrMode = WR_SLAVE; // Normally done in wr_handshake_init
ppi->next_state = WRS_WR_LINK_ON;
#else
/* We must start the handshake as a WR slave */ /* We must start the handshake as a WR slave */
wr_handshake_init(ppi, PPS_SLAVE); wr_handshake_init(ppi, PPS_SLAVE);
#endif
} }
return 0; return 0;
} }
......
...@@ -30,7 +30,10 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -30,7 +30,10 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
wr_handshake_fail(ppi); wr_handshake_fail(ppi);
return 0; /* non-wr */ return 0; /* non-wr */
} }
#ifdef BROADCAST
// In broadcast mode we don't wait for WR_MODE_ON message.
ppi->next_state = WRS_WR_LINK_ON;
#else
if (ppi->received_ptp_header.messageType == PPM_SIGNALING) { if (ppi->received_ptp_header.messageType == PPM_SIGNALING) {
msg_unpack_wrsig(ppi, pkt, &wrsig_msg, msg_unpack_wrsig(ppi, pkt, &wrsig_msg,
&(wrp->msgTmpWrMessageID)); &(wrp->msgTmpWrMessageID));
...@@ -42,6 +45,7 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -42,6 +45,7 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
(wrp->wrMode == WR_SLAVE)) (wrp->wrMode == WR_SLAVE))
ppi->next_state = WRS_WR_LINK_ON; ppi->next_state = WRS_WR_LINK_ON;
} }
#endif // BROADCAST
ppi->next_delay = wrp->wrStateTimeout; ppi->next_delay = wrp->wrStateTimeout;
return 0; return 0;
......
...@@ -21,14 +21,11 @@ int wr_link_on(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -21,14 +21,11 @@ int wr_link_on(struct pp_instance *ppi, unsigned char *pkt, int plen)
wrp->wrModeOn = TRUE; wrp->wrModeOn = TRUE;
#ifdef BROADCAST #ifdef BROADCAST
/* FOR TEST: spll stay locked because not new phase_target after unplug/plug or disable enable
* master coming port. */
wrp->ops->locking_enable(ppi);
wrp->wrPortState = WRS_BROADCAST; // For KM3NeT monitoring wrp->wrPortState = WRS_BROADCAST; // For KM3NeT monitoring
#else
wrp->ops->enable_ptracker(ppi); // enable_ptracker done in wrp->ops->locking_enable(ppi);
#endif // BROADCAST #endif // BROADCAST
wrp->ops->enable_ptracker(ppi);
if (wrp->wrMode == WR_MASTER) if (wrp->wrMode == WR_MASTER)
e = msg_issue_wrsig(ppi, WR_MODE_ON); e = msg_issue_wrsig(ppi, WR_MODE_ON);
......
...@@ -29,6 +29,10 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -29,6 +29,10 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen)
return 0; /* non-wr already */ return 0; /* non-wr already */
} }
#ifdef BROADCAST
// In broadcast mode we don't send LOCKED message & don't wait for the CALIBRATE message.
ppi->next_state = WRS_RESP_CALIB_REQ;
#else
if (sendmsg) { if (sendmsg) {
__pp_timeout_set(ppi, PP_TO_EXT_0, wrp->wrStateTimeout); __pp_timeout_set(ppi, PP_TO_EXT_0, wrp->wrStateTimeout);
e = msg_issue_wrsig(ppi, LOCKED); e = msg_issue_wrsig(ppi, LOCKED);
...@@ -42,6 +46,7 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -42,6 +46,7 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (wrp->msgTmpWrMessageID == CALIBRATE) if (wrp->msgTmpWrMessageID == CALIBRATE)
ppi->next_state = WRS_RESP_CALIB_REQ; ppi->next_state = WRS_RESP_CALIB_REQ;
} }
#endif // BROADCAST
ppi->next_delay = wrp->wrStateTimeout; ppi->next_delay = wrp->wrStateTimeout;
......
...@@ -33,6 +33,10 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -33,6 +33,10 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
return 0; /* non-wr already */ return 0; /* non-wr already */
} }
#ifdef BROADCAST
// In broadcast mode we don't send SLAVE_PRESENT message & don't wait for the LOCK message.
ppi->next_state = WRS_S_LOCK;
#else
if (sendmsg) { if (sendmsg) {
__pp_timeout_set(ppi, PP_TO_EXT_0, WR_WRS_PRESENT_TIMEOUT_MS); __pp_timeout_set(ppi, PP_TO_EXT_0, WR_WRS_PRESENT_TIMEOUT_MS);
e = msg_issue_wrsig(ppi, SLAVE_PRESENT); e = msg_issue_wrsig(ppi, SLAVE_PRESENT);
...@@ -46,6 +50,7 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -46,6 +50,7 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (wrp->msgTmpWrMessageID == LOCK) if (wrp->msgTmpWrMessageID == LOCK)
ppi->next_state = WRS_S_LOCK; ppi->next_state = WRS_S_LOCK;
} }
#endif // BROADCAST
if (e == 0) if (e == 0)
st_com_execute_slave(ppi); st_com_execute_slave(ppi);
......
...@@ -35,6 +35,10 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -35,6 +35,10 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen)
wrp->otherNodeCalPeriod / 1000); wrp->otherNodeCalPeriod / 1000);
} }
#ifdef BROADCAST
// In broadcast mode we don't wait for CALIBRATED message.
ppi->next_state = WRS_CALIBRATION;
#else
if (ppi->received_ptp_header.messageType == PPM_SIGNALING) { if (ppi->received_ptp_header.messageType == PPM_SIGNALING) {
msg_unpack_wrsig(ppi, pkt, &wrsig_msg, msg_unpack_wrsig(ppi, pkt, &wrsig_msg,
...@@ -49,6 +53,7 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen) ...@@ -49,6 +53,7 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->next_state = WRS_CALIBRATION; ppi->next_state = WRS_CALIBRATION;
} }
} }
#endif // BROADCAST
ppi->next_delay = wrp->wrStateTimeout; ppi->next_delay = wrp->wrStateTimeout;
return e; return e;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment