|
From: | Bernhard 'Gustl' Bauer |
Subject: | Re: [lwip-users] SNTP |
Date: | Tue, 04 May 2010 12:16:36 +0200 |
User-agent: | Thunderbird 2.0.0.24 (Windows/20100228) |
address@hidden schrieb:
Bernhard 'Gustl' Bauer wrote:I don't think I understand you: which configuration is not covered by CVS HEAD? Anyway, without having sys_timeout() for NO_SYS=1, you have to implement timeouts yourself, it's as simple as that. Just create a function 'sntmp_timeout' and call it at the necessary interval. It's what you have to do for other modules, too, isn't it??'sys_timeout()' and 'sys_untimeout()' do not exist, because NO_SYS=1. I'm not sure what to do about this. I don't want to change to NO_SYS=0. I think this configuration is not covered by CVS HEAD so far.
'timers.c' was not included in LWIP 1.3.2 - is this correct? I plan to add it to my port.
There is sys_now() needed for this. I don't think it must return system time. A ms counter would be ok, wouldn't it.
A problem would be wrap around. It would happen after 49 days (I remember win95 crashing after this period). Here a code snippet how I would do it:
void sys_check_timeouts(void) { struct sys_timeo *tmptimeout; u32_t diff; sys_timeout_handler h; void *arg; int had_one; u32_t now; #if LWIP_DEBUG_TIMERNAMES const char *handler_name; #endif /* LWIP_DEBUG_TIMERNAMES */ now = sys_now(); if (next_timeout) { /* @todo: wrap around? */ // --------- new code if (now < timeouts_last_time) diff = ( 0xFFFFFFFF - timeouts_last_time ) + now + 1 ; else // --------- end of new code diff = now - timeouts_last_time;
[Prev in Thread] | Current Thread | [Next in Thread] |