lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] Port to djgpp/Watcom


From: Gisle Vanem
Subject: [lwip-devel] Port to djgpp/Watcom
Date: Thu, 12 Jan 2012 18:09:45 +0100

I've ported LwIP to djgpp (gcc 4.4.1) and OpenWatcom 1.9 on MSDOS. The main hurdle was porting the packet-driver interface and sys_arch.c. Most things work fine except timers are not very precise. On OpenWatcom sys_now() is based on _dos_gettime() which gives only 55 msec resolution.

Since 'NO_SYS=1', I have to poll everything in a tight loop called from main(). Adding some trace in my main_loop():

#define MAIN_LOOP_TIMEOUT 2000

static void main_loop_poller (void *arg)
{
 printf ("%s(%s): %lu\n", __FUNCTION__, (const char*)arg, sys_now());
 sys_timeout (MAIN_LOOP_TIMEOUT, main_loop_poller, "hello");
}

int main()
...
 sys_timeout (MAIN_LOOP_TIMEOUT, main_loop_poller, "hello");

 while (1)
 {
   main_loop();
   if (kbhit() && getch() == 'q')
      break;
 }


Results are:

main_loop_poller(hello): 2960
main_loop_poller(hello): 5160    ; diff 2200 ms
main_loop_poller(hello): 7350 ; diff 2190 ms main_loop_poller(hello): 9550 ; diff 2200 ms
main_loop_poller(hello): 11750   ; ..
main_loop_poller(hello): 13950
main_loop_poller(hello): 16140
main_loop_poller(hello): 18340
main_loop_poller(hello): 20540

As you see the time-outs happen approx. 200 msec too late.
What can be the reason for this? The timer granularity is 55
ms. Would it hurt the tcp speed?

My sys_now() == sys_jiffies() is taken straight from contrib/ports/unix/sys_arch.c except that HZ = 1000.

If there is any interest for my DOS-port, where can I send it?
I have no write access to git.savannah.gnu.org/cgit/lwip/lwip.git.
A simple .zip on my home-page?

--gv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]