lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Example port for a beginner


From: Goldschmidt Simon
Subject: RE: [lwip-users] Example port for a beginner
Date: Wed, 23 May 2007 10:46:45 +0200

> 4    Yes sys_timeouts  is pretty confusing but if you implement your
own api layer then you can ignore it all together 

That's not exactly true: if NO_SYS=0, you
a) have to supply a function in sys_arch.c (if NO_SYS=0) that returns a
pointer to a list of timeouts that is unique for the current thread
B) have to make sure the value returned by sys_arch_mbox_wait() (and
sys_arch_sem_wait()) is correct (the number of miliseconds waited for a
message)!

If you want to know more about timeouts: it is a linked list including
function pointers and values of miliseconds to wait before calling the
function. When waiting for a message in an mbox, the time waited is
substracted from the first timeout, and if that time is 0, the timeout
function is called and the first item is popped off the list.
This mechanism only works if NO_SYS=0 since otherwise, you don't have
mboxes. But if you have mboxes, you kind of get the timeout
functionality for free.
The downside of this approach is that the timing is pretty inaccurate.
If you have many messages in the mbox and you will not have to wait on
any message, sys_arch_mbox_wait() will always return 0 since it didn't
have to wait for the message. That way timeouts will not be called.
Another bad example are some ports that always return 1 when waiting for
a message and 0 if a message was available right away. That of course
leads to totally inaccurate timeouts.


Simon




reply via email to

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