Example port for a beginner

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Example port for a beginner

Bilahari Akkiraju-3
Example port for a beginner

 
  Hello all ,  I have few questions on lwip-1.2.0 ( I hope I have chosen a minimum risk version, is it a stable version)

1 . Any good example of a port that’s available for a beginenr who is trying to port lwip to ppc 83xx.

2. Can I port lwip stack without implementing sys_arch.c at all. I mean without impelementing semaphore and mailbox funcs.

3 . Should I change or add some stuff in sys.c like in sys_arch.c.

4. And what exactly does sys_timeouts structure in sys.h signify  ? I see that it’s a linked list with each node having time value, handler and its arguments. Whats the logic behind duch design, why is it a linked list, does it store different timers each with its own base value, handler that fires when it hits low or a high ?. I am throughly confused about this way of dealing with timeouts.

Thanks.


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Example port for a beginner

Mumtaz Ahmad
Example port for a beginner
1    In my point of view windows port is the most simple port to start with .
2    Yes lwip stack can be implemented without sys_arch.c provided that you understand where the stack should be made thread safe . I have done it by myself and implemented my own api layer as well .
4    Yes sys_timeouts  is pretty confusing but if you implement your own api layer then you can ignore it all together
 
----- Original Message -----
Sent: Wednesday, May 23, 2007 3:19 AM
Subject: [lwip-users] Example port for a beginner


  Hello all ,  I have few questions on lwip-1.2.0 ( I hope I have chosen a minimum risk version, is it a stable version)

1 . Any good example of a port that’s available for a beginenr who is trying to port lwip to ppc 83xx.

2. Can I port lwip stack without implementing sys_arch.c at all. I mean without impelementing semaphore and mailbox funcs.

3 . Should I change or add some stuff in sys.c like in sys_arch.c.

4. And what exactly does sys_timeouts structure in sys.h signify  ? I see that it’s a linked list with each node having time value, handler and its arguments. Whats the logic behind duch design, why is it a linked list, does it store different timers each with its own base value, handler that fires when it hits low or a high ?. I am throughly confused about this way of dealing with timeouts.

Thanks.


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE : Example port for a beginner

Frédéric BERNON
In reply to this post by Bilahari Akkiraju-3
Message
Look  http://www.sics.se/~adam/lwip/os.html. It's old, but most of the document is always valid. It explain "how" implement lwip with or without OS. Be careful about multithreading if you use it (lwip core have to be protected against concurrent access), but it's not your case I think.
 
 
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : [hidden email]r
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
 
-----Message d'origine-----
De : lwip-users-bounces+frederic.bernon=[hidden email] [mailto:lwip-users-bounces+frederic.bernon=[hidden email]] De la part de Mumtaz Ahmad
Envoyé : mercredi 23 mai 2007 06:26
À : Mailing list for lwIP users
Objet : Re: [lwip-users] Example port for a beginner

1    In my point of view windows port is the most simple port to start with .
2    Yes lwip stack can be implemented without sys_arch.c provided that you understand where the stack should be made thread safe . I have done it by myself and implemented my own api layer as well .
4    Yes sys_timeouts  is pretty confusing but if you implement your own api layer then you can ignore it all together
 
----- Original Message -----
Sent: Wednesday, May 23, 2007 3:19 AM
Subject: [lwip-users] Example port for a beginner


  Hello all ,  I have few questions on lwip-1.2.0 ( I hope I have chosen a minimum risk version, is it a stable version)

1 . Any good example of a port that’s available for a beginenr who is trying to port lwip to ppc 83xx.

2. Can I port lwip stack without implementing sys_arch.c at all. I mean without impelementing semaphore and mailbox funcs.

3 . Should I change or add some stuff in sys.c like in sys_arch.c.

4. And what exactly does sys_timeouts structure in sys.h signify  ? I see that it’s a linked list with each node having time value, handler and its arguments. Whats the logic behind duch design, why is it a linked list, does it store different timers each with its own base value, handler that fires when it hits low or a high ?. I am throughly confused about this way of dealing with timeouts.

Thanks.


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

=?iso-8859-1?Q?Fr=E9d=E9ric_BERNON=2Evcf?= (810 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Example port for a beginner

Goldschmidt Simon
In reply to this post by Bilahari Akkiraju-3
> 2. Can I port lwip stack without implementing sys_arch.c at all. I
mean without impelementing semaphore and mailbox funcs.

For that you have to set NO_SYS to 1 in lwipopts.h but you can only use
the callback API then (no sockets, no netconn API). You also don't need
the sys_arch.h and sys_arch.c file (if you take other ports as an
example).

> 3 . Should I change or add some stuff in sys.c like in sys_arch.c.

You should not need to change sys.c! sys_arch.c is dependent on your OS.


Simon


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: Example port for a beginner

Goldschmidt Simon
In reply to this post by Mumtaz Ahmad
> 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


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE : Example port for a beginner

Frédéric BERNON
In reply to this post by Bilahari Akkiraju-3
>That's not exactly true...
I suppose that Mumtaz talk to a "full" api layer, even without api_msg.c & tcpip.c, so, I think in this case, it''s right

>If you want to know more about timeouts:  
It's a good explain, I think it will be good to copy/paste it in sys_arch.txt and sys.c...
 
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : [hidden email]
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : lwip-users-bounces+frederic.bernon=[hidden email] [mailto:lwip-users-bounces+frederic.bernon=[hidden email]] De la part de Goldschmidt Simon
Envoyé : mercredi 23 mai 2007 10:47
À : Mailing list for lwIP users
Objet : RE: [lwip-users] Example port for a beginner


> 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


_______________________________________________
lwip-users mailing list
[hidden email] http://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

=?iso-8859-1?Q?Fr=E9d=E9ric_BERNON=2Evcf?= (810 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: RE : Example port for a beginner

Goldschmidt Simon

> >That's not exactly true...
> I suppose that Mumtaz talk to a "full" api layer, even
> without api_msg.c & tcpip.c, so, I think in this case, it''s right

That's what I meant with "if NO_SYS=0". But you're right, maybe for a
beginner, that's not as clear as I wanted it to be...

>
> >If you want to know more about timeouts:  
> It's a good explain, I think it will be good to copy/paste it
> in sys_arch.txt and sys.c...

In that way, we finally get some documentation done ;-)


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: RE : Example port for a beginner

Kieran Mansley
On Wed, 2007-05-23 at 11:12 +0200, Goldschmidt Simon wrote:
> > >If you want to know more about timeouts:  
> > It's a good explain, I think it will be good to copy/paste it
> > in sys_arch.txt and sys.c...
>
> In that way, we finally get some documentation done ;-)

Yes please - there have been a number of good explanations recently
(particularly from Simon) that I've thought would make good beginnings
of documentation.  I suggest that for now we create something in CVS (if
there's no relevant place already) so that you can easily copy and past
these things in when writing such stuff to the mailing list.  This will
be much easier than trying to find them later when writing docs!

Kieran



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Example port for a beginner

Mumtaz Ahmad
In reply to this post by Frédéric BERNON
You are right ,i was talking about full api layer .

----- Original Message -----
From: "Frédéric BERNON" <[hidden email]>
To: "Mailing list for lwIP users" <[hidden email]>
Sent: Wednesday, May 23, 2007 1:56 PM
Subject: RE : [lwip-users] Example port for a beginner


>That's not exactly true...
I suppose that Mumtaz talk to a "full" api layer, even without api_msg.c &
tcpip.c, so, I think in this case, it''s right

>If you want to know more about timeouts:
It's a good explain, I think it will be good to copy/paste it in
sys_arch.txt and sys.c...

====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : [hidden email]
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement



-----Message d'origine-----
De : lwip-users-bounces+frederic.bernon=[hidden email]
[mailto:lwip-users-bounces+frederic.bernon=[hidden email]] De la part
de Goldschmidt Simon
Envoyé : mercredi 23 mai 2007 10:47
À : Mailing list for lwIP users
Objet : RE: [lwip-users] Example port for a beginner


> 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


_______________________________________________
lwip-users mailing list
[hidden email] http://lists.nongnu.org/mailman/listinfo/lwip-users



----------------------------------------------------------------------------
----


> _______________________________________________
> lwip-users mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: Example port for a beginner

Goldschmidt Simon

> You are right ,i was talking about full api layer .

I'm sorry. Seems I did not understand what you were saying about your own api layer ;-)
You'd have to point out (I think it's clear for you, but maybe not for beginners), that
in this case, you mustn't use the files in the api directory!

>
> ----- Original Message -----
> From: "Frédéric BERNON" <[hidden email]>
> To: "Mailing list for lwIP users" <[hidden email]>
> Sent: Wednesday, May 23, 2007 1:56 PM
> Subject: RE : [lwip-users] Example port for a beginner
>
>
> >That's not exactly true...
> I suppose that Mumtaz talk to a "full" api layer, even
> without api_msg.c &
> tcpip.c, so, I think in this case, it''s right
>
> >If you want to know more about timeouts:
> It's a good explain, I think it will be good to copy/paste it in
> sys_arch.txt and sys.c...
>
> ====================================
> Frédéric BERNON
> HYMATOM SA
> Chef de projet informatique
> Microsoft Certified Professional
> Tél. : +33 (0)4-67-87-61-10
> Fax. : +33 (0)4-67-70-85-44
> Email : [hidden email]
> Web Site : http://www.hymatom.fr
> ====================================
> P Avant d'imprimer, penser à l'environnement
>
>
>
> -----Message d'origine-----
> De : lwip-users-bounces+frederic.bernon=[hidden email]
> [mailto:lwip-users-bounces+frederic.bernon=[hidden email]
> rg] De la part
> de Goldschmidt Simon
> Envoyé : mercredi 23 mai 2007 10:47
> À : Mailing list for lwIP users
> Objet : RE: [lwip-users] Example port for a beginner
>
>
> > 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
>
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> --------------------------------------------------------------
> --------------
> ----
>
>
> > _______________________________________________
> > lwip-users mailing list
> > [hidden email]
> > http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users