lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] Porting lwIP for a OS less environment


From: Bill Auerbach
Subject: RE: [lwip-devel] Porting lwIP for a OS less environment
Date: Fri, 11 Jul 2008 11:24:50 -0400

You have to poll for Ethernet packets and handle the lwIP timers yourself.
Here's how I do it:

static unsigned volatile lwip_mStimer;

void    ProcessLwip( void )
{
int                     buffered_mS;

        while( ethernetif_input( netif_default ) )
                ;                                       // Read data while
data is available

        //      Update lwIP timer and call timer functions
        if( (buffered_mS = (int) (TimerGetTimer() - lwip_mStimer)) > 0 )
                {
                while( buffered_mS-- )
                        {
                        ++lwip_mStimer;

                        if( (lwip_mStimer % TCP_TMR_INTERVAL) == 0 )
tcp_tmr();
                        if( (lwip_mStimer % ARP_TMR_INTERVAL) == 0 )
etharp_tmr();
#if IP_REASSEMBLY
                        if( (lwip_mStimer % IP_TMR_INTERVAL) == 0 )
ip_reass_tmr();
#endif
#if LWIP_AUTOIP
                        if( (lwip_mStimer % AUTOIP_TMR_INTERVAL ) == 0 )
autoip_tmr();
#endif
#if LWIP_IGMP
                        if( (lwip_mStimer % IGMP_TMR_INTERVAL ) == 0 )
igmp_tmr(); 
#endif
#if LWIP_DHCP
                        if( (lwip_mStimer % DHCP_FINE_TIMER_MSECS ) == 0 )
dhcp_fine_tmr();
                        if( (lwip_mStimer % (DHCP_COARSE_TIMER_SECS*1000) )
== 0 ) dhcp_coarse_tmr();
#endif
#if LWIP_DNS
                        if( (lwip_mStimer % DNS_TMR_INTERVAL) == 0 )
dns_tmr();
#endif
                        }
                }
} 

I changed ethernetif_input to return non-0 if a packet was processed - this
way all buffered packets are processed in the while loop.  If you don't make
this change, just call ethernetif_input and remove the while.
TimerGetTimer() gets my system's 1mS timer.

Call this function periodically and lwIP runs just fine.

Performance?  It depends on how fast you process packets - i.e. call the
above function.  If you call the function from an MS timer interrupt (be
sure to block reentrancy in the ISR) and you process multiple packets as
above, bandwidth will be excellent.  In my product, all left over processor
time goes to processing TCP/IP (so we call this function very often) and we
can receive large blocks of data (2-4MB) well above 900MbS on a GBE
platform.

Bill

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Ashish P. Chavan
> Sent: Friday, July 11, 2008 2:51 AM
> To: address@hidden
> Subject: [lwip-devel] Porting lwIP for a OS less environment
> 
> 
> Hi,
>       I am new to lwIP and this mailing list. We are planning to port
> lwIP-1.3.0 for some 16 and 32 bit MCUs without an operating system.
> Before starting; I would like to go through similar kind of work done
> by
> some one else. I browsed through latest contrib i.e. contrib.-1.3.0 but
> didn't find anything similar.
> 
> Can anyone point me towards any effort already made for porting and
> using lwIP in an OS less environment? It could be anything from
> code/design/documentation/comments-feedback/etc.
> 
> I would really appreciate if someone can comment on functionality Vs.
> performance of lwIP in an OS less environment.
> 
> Thanks for your time,
> 
> Ashish Chavan
> 
> || Linux Is User Friendly, It's Just Selective About Who Its Friends
> Are
> :-) ||
> 
> 
> 
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-devel





reply via email to

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