Commit b668917b authored by Alessandro Rubini's avatar Alessandro Rubini

white-rabbit: fix stamp correct/incorrect for non-wr mode

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 06cb0670
...@@ -115,14 +115,14 @@ static int wr_handle_resp(struct pp_instance *ppi) ...@@ -115,14 +115,14 @@ static int wr_handle_resp(struct pp_instance *ppi)
cField_to_TimeInternal(&correction_field, hdr->correctionfield); cField_to_TimeInternal(&correction_field, hdr->correctionfield);
/* /*
* If no WR mode is on, run normal code, it T3 is valid. * If no WR mode is on, run normal code, if T2/T3 are valid.
* After we adjusted the pps counter, stamps are invalid, so * After we adjusted the pps counter, stamps are invalid, so
* we'll have the Unix time instead, marked by "correct" * we'll have the Unix time instead, marked by "correct"
*/ */
if (!WR_DSPOR(ppi)->wrModeOn) { if (!WR_DSPOR(ppi)->wrModeOn) {
if (!ppi->t3.correct) { if (!ppi->t2.correct || !ppi->t3.correct) {
pp_diag(ppi, servo, 1, pp_diag(ppi, servo, 1,
"T3 incorrect, discarding tuple\n"); "T2 or T3 incorrect, discarding tuple\n");
return 0; return 0;
} }
pp_servo_got_resp(ppi); pp_servo_got_resp(ppi);
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <ppsi-wrs.h> #include <ppsi-wrs.h>
#include <hal_exports.h> #include <hal_exports.h>
#include "../proto-ext-whiterabbit/wr-api.h"
extern struct minipc_pd __rpcdef_get_port_state; extern struct minipc_pd __rpcdef_get_port_state;
#define ETHER_MTU 1518 #define ETHER_MTU 1518
...@@ -219,6 +221,11 @@ int wrs_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int _len, ...@@ -219,6 +221,11 @@ int wrs_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int _len,
t->raw_ahead = cntr_ahead; t->raw_ahead = cntr_ahead;
update_dmtd(s, ppi->iface_name); update_dmtd(s, ppi->iface_name);
if (!WR_DSPOR(ppi)->wrModeOn) {
/* for non-wr-mode any reported stamp is correct */
t->correct = 1;
return ret;
}
if (s->dmtd_phase_valid) if (s->dmtd_phase_valid)
{ {
wrs_linearize_rx_timestamp(t, s->dmtd_phase, wrs_linearize_rx_timestamp(t, s->dmtd_phase,
......
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