Commit 22fac7c2 authored by Alessandro Rubini's avatar Alessandro Rubini

ppsi.h: add pp_ms_to_timeout

The new function reports how many ms in the future is a timeout event,
to be able to correctly time when we should re-entering the state machine
and correctly spread our frames according to the specification.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 0443dc94
......@@ -362,6 +362,18 @@ static inline int pp_timeout_z(struct pp_instance *ppi, int index)
return ret;
}
/* how many ms to wait for the timeout to happen, for ppi->next_delay */
static inline int pp_ms_to_timeout(struct pp_instance *ppi, int index)
{
signed long ret;
if (!ppi->timeouts[index]) /* not pending, nothing to wait for */
return 0;
ret = ppi->timeouts[index] - ppi->t_ops->calc_timeout(0);
return ret <= 0 ? 0 : ret;
}
/* called several times, only sets a timeout, so inline it here */
static inline void pp_timeout_restart_annrec(struct pp_instance *ppi)
{
......
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