Commit 5b875edc authored by Alessandro Rubini's avatar Alessandro Rubini

servo: pp_update_offset() takes less parameters

Now that it's clear pp_update_offset() receives t1 and t2, which are
fields of ppi itself, avoid passing them.

However now it's clear that this function might be seriously wrong,
and needs review (ofst_first_updated should die, I think, preferring
simply code to unneeded contortions).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 19e258e7
...@@ -225,8 +225,6 @@ extern void pp_init_clock(struct pp_instance *ppi); ...@@ -225,8 +225,6 @@ extern void pp_init_clock(struct pp_instance *ppi);
extern void pp_update_delay(struct pp_instance *ppi, extern void pp_update_delay(struct pp_instance *ppi,
TimeInternal *correction_field); TimeInternal *correction_field);
extern void pp_update_offset(struct pp_instance *ppi, extern void pp_update_offset(struct pp_instance *ppi,
TimeInternal *send_time,
TimeInternal *recv_time,
TimeInternal *correctionField); TimeInternal *correctionField);
extern void pp_update_clock(struct pp_instance *ppi); extern void pp_update_clock(struct pp_instance *ppi);
......
...@@ -164,8 +164,7 @@ int st_com_slave_handle_sync(struct pp_instance *ppi, unsigned char *buf, ...@@ -164,8 +164,7 @@ int st_com_slave_handle_sync(struct pp_instance *ppi, unsigned char *buf,
ppi->waiting_for_follow = FALSE; ppi->waiting_for_follow = FALSE;
to_TimeInternal(&ppi->t1, to_TimeInternal(&ppi->t1,
&sync.originTimestamp); &sync.originTimestamp);
pp_update_offset(ppi, &ppi->t1, &ppi->t2, pp_update_offset(ppi, &correction_field);
&correction_field);
pp_update_clock(ppi); pp_update_clock(ppi);
} }
} }
...@@ -222,8 +221,7 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf, ...@@ -222,8 +221,7 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
if (ret < 0) if (ret < 0)
return ret; return ret;
pp_update_offset(ppi, &ppi->t1, &ppi->t2, &correction_field); pp_update_offset(ppi, &correction_field);
pp_update_clock(ppi); pp_update_clock(ppi);
return 0; return 0;
} }
......
...@@ -100,15 +100,17 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field) ...@@ -100,15 +100,17 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
} }
} }
/* called by slave and uncalib. (through common function handle_sync/followup) */ /*
void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time, * Called by slave and uncalib.
TimeInternal *recv_time, TimeInternal *correction_field) * Please note that it only uses t1 and t2, so I think it needs review - ARub
*/
void pp_update_offset(struct pp_instance *ppi, TimeInternal *correction_field)
{ {
TimeInternal m_to_s_dly; TimeInternal m_to_s_dly;
struct pp_ofm_fltr *ofm_fltr = &SRV(ppi)->ofm_fltr; struct pp_ofm_fltr *ofm_fltr = &SRV(ppi)->ofm_fltr;
/* calc 'master_to_slave_delay' */ /* calc 'master_to_slave_delay' */
sub_TimeInternal(&m_to_s_dly, recv_time, send_time); sub_TimeInternal(&m_to_s_dly, &ppi->t2, &ppi->t1);
if (OPTS(ppi)->max_dly) { /* If maxDelay is 0 then it's OFF */ if (OPTS(ppi)->max_dly) { /* If maxDelay is 0 then it's OFF */
if (m_to_s_dly.seconds) { if (m_to_s_dly.seconds) {
...@@ -128,7 +130,7 @@ void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time, ...@@ -128,7 +130,7 @@ void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time,
SRV(ppi)->m_to_s_dly = m_to_s_dly; SRV(ppi)->m_to_s_dly = m_to_s_dly;
sub_TimeInternal(&SRV(ppi)->delay_ms, recv_time, send_time); sub_TimeInternal(&SRV(ppi)->delay_ms, &ppi->t2, &ppi->t1);
/* Used just for End to End mode. */ /* Used just for End to End mode. */
/* Take care about correctionField */ /* Take care about correctionField */
......
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