Commit ec537cd1 authored by Alessandro Rubini's avatar Alessandro Rubini

servo: when setting time, make no calculations

When offset from master is more than one second, the code used to
time->get, subtract and then time->set.

However, in white rabbit we cannot get the WR time and time->get
returns the unix time instead. The only way to have hardware time is
timestamping a frame.  Thus, use the master's "T4" that we just
received plus the one-way-delay as an approximation of the current
hardware time. Later T1..T4 tuples will complete the fine
synchronization.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 8146c5e4
......@@ -206,9 +206,10 @@ void pp_servo_got_resp(struct pp_instance *ppi)
/* if secs, reset clock or set freq adjustment to max */
if (!OPTS(ppi)->no_adjust) {
if (!OPTS(ppi)->no_rst_clk) {
/* FIXME: use adjust instead of set? */
ppi->t_ops->get(ppi, &time_tmp);
sub_TimeInternal(&time_tmp, &time_tmp, ofm);
/* Can't use "adjust, limited to +/- 2s */
time_tmp = ppi->t4;
add_TimeInternal(&time_tmp, &time_tmp,
&DSCUR(ppi)->oneWayDelay);
ppi->t_ops->set(ppi, &time_tmp);
pp_servo_init(ppi);
} else {
......
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