ambarisha b wrote:
I am working on a OS independent port for lwip. I have a couple of
issues with this.
Which version of lwIP are you using? I'm assuming 1.4.0 for the rest of
this mail.
The function declarations for semaphores and mailboxes are different
in sys_arch.txt and from lwip/sys.h. For example:
sys_sem_t sys_sem_new(u8_t count);
err_t sys_sem_new(sys_sem_t *sem, u8_t count);
Why is this difference? Am I missing something here?
No, it's us that have been missing something: updating the docs. Theses
functions have been changed to take a pointer so that sys_sem_t can be
directly mapped to a preallocated OS-struct. Before this change
sys_sem_new() could only return a pointer to such a structure that had
to be allocated somewhere else. This should make OS ports both smaller
and easier. I'll update the docs in CVS.
Another is that sys_mbox_post takes the pointer to the message. But
the size of the message isn't passed. If the size of the message is
passed in the buffer it self, it hasn't been documented. So, how does
this work?
An mbox always contains 'void*' messages. The function that reads
messages from the mbox knows which type is allowed for this mbox and
casts to the correct type. If multiple messages are allowed in an mbox,
we pass a struct that contains type information. Since only pointers are
passed through the mbox, allocation/deallocation is taken care of
outside the mbox implementation.
A couple of functions require that time spent waiting, be returned in
milliseconds. How accurate should this be? What are the practical
limits that you would suggest?
First, you never should return '0' if you waited, even if you spent far
less than a millisecond waiting. As to accuracy, that's difficult to
say. It should be as accurate as you can get it to, but just returning
OS ticks here (which are normally in a range of 1 to 20ms) should
probably be good enough...
Simon
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users