Forum Discussion
Altera_Forum
Honored Contributor
16 years agoAltera TSE driver and example program for lwIP (1.3.2)
After many many requests and complaints about lack of support and/or documentation for support of lwIP for the Altera TSE, I have developed a drop-in TSE driver and example program and made this avai...
Altera_Forum
Honored Contributor
13 years agoFor those who uses sys_timeout() as a general purpose timer -
I’ve found that under certain circumstances lwip timeouts become extremely inaccurate. The reason is that sys_timeout() effectively schedules the handler not relative to the current time (result of sys_now()), but relative to the moment, when previous handler was called (stored in timers.c: static u32_t timeouts_last_time) This does not affect internal lwip timers because they always reschedule themselves inside timeout handler routine, i.e. when timeouts_last_time is equal to sys_now(). On the contrary, if one calls sys_timeout() in arbitrary moment in time, say, inside UDP packet handler, difference between sys_now() and timeouts_last_time may be large. In such a case effective timeout value will be shorter by (sys_now() - timeouts_last_time) and all subsequent timeouts will be offset by the same value. This can be fixed at the cost of extra sys_now() call by inserting msecs += sys_now() - timeouts_last_time; in the very beginning of void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg). Igor