lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] port for lwip


From: address@hidden
Subject: Re: [lwip-users] port for lwip
Date: Sun, 03 Jul 2011 12:24:45 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0

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



reply via email to

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