lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Questions on initializing and testing lwip


From: Bilahari Akkiraju
Subject: [lwip-users] Questions on initializing and testing lwip
Date: Wed, 6 Jun 2007 15:40:16 -0500

 Hello all,

  My question is on how to initialize lwip before I can start using its
API. Here is what I am doing,
Am I doing it right?

void lwip_init()
{

  struct ip_addr ipaddr, netmask, gw;
 
  struct netif *eth_if;

  struct tcp_pcb *pcb;

  mem_init();

  memp_init();

  pbuf_init(); 

  //ip_init();

  //udp_init();

  //tcp_init();

  tcpip_init(NULL,NULL);

  netif_init(); // sets up and initializes global netif linked list 
  
  myPrintf("TCP initialized \n");

  IP4_ADDR(&gw,134,177,221,1);

  IP4_ADDR(&ipaddr,134,177,221,230);

  IP4_ADDR(&netmask,255,255,255,0);

  extern err_t ethernetif_init(struct netif *netif);

  eth_if = netif_add(&mynetif, &ipaddr, &netmask,&gw,NULL,
ethernetif_init, ip_input);

  netif_set_default(&mynetif);

  netif_set_up(&mynetif);

}
 

And then to test my port, I have copied web server code example from
lwip documentation

 /* Create a new TCP connection handle. */
    conn = netconn_new(NETCONN_TCP);

    /* Bind the connection to port 80 on any local IP address. */
    netconn_bind(conn, NULL, 80);

    /* Put the connection into LISTEN state. */
    netconn_listen(conn);

    /* Loop forever. */

    while(1) 
    {

        /* Accept a new connection. */
        newconn = netconn_accept(conn);

        /* Process the incomming connection. */
        process_connection(newconn);

        /* Deallocate connection handle. */
        netconn_delete(newconn);
    }


  return(OK);
}

Currently it doesn't work as it crashes after sys_mbox_fetch() call in
while(1){ } main loop of  tcpip_thread() function in (tcpip.c). I still
do not properly understand the underlying mechanism of how different
modules interact in lwip. I have written my sys_arch.c and a ethrnetif.c
(glue to my  eth driver) and currently trying to run some examples to
test if my port works. Any kind of feed back will be highly helpful

Thanks
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
address@hidden
Sent: Wednesday, June 06, 2007 9:00 AM
To: address@hidden
Subject: lwip-users Digest, Vol 46, Issue 7

Send lwip-users mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific than
"Re: Contents of lwip-users digest..."


Today's Topics:

   1. Debugging Levels (Spies, Dominik)
   2. Re: Debugging Levels (Juri Haberland)


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

Message: 1
Date: Wed, 6 Jun 2007 11:08:49 +0200
From: "Spies, Dominik" <address@hidden>
Subject: [lwip-users] Debugging Levels
To: "Mailing list for lwIP users" <address@hidden>
Message-ID:
        
<address@hidden>
Content-Type: text/plain; charset="us-ascii"

Hi!
 
I don't understand debugging completely, what are the different levels
for? It seems that they are never used and so every call to debug has
level 0 (DBG_LEVEL_OFF) by default and onw has to set min level to
DBG_LEVEL_OFF. Strange behaviour. So, but when I understand it
correctly, onw could specify a level other than 0 in the call and then
it would only be printed if that level is matched be min level?

DBG_TYPES_ON is by default 0, what means no debugging at all, right? so,
setting it to DBG_ON enables all types which are set to DBG_ON. Setting
it also to STATE, TRACE and/or FRESH would enable also these messages
independent if the debug type, e.g. IP_DEBUG is set to off.
But why is DBG_TYPES_ON not by default set to DBG_ON ?
 
I need this for my thesis, even tough it is in german maybe I have time
to write some debug-guide. It would be extremly heplfull for beginners.
Or is there already one?
 
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.gnu.org/pipermail/lwip-users/attachments/20070606/77d9e233/
attachment.html

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

Message: 2
Date: Wed, 06 Jun 2007 13:40:42 +0200
From: Juri Haberland <address@hidden>
Subject: Re: [lwip-users] Debugging Levels
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-15

Spies, Dominik wrote:
> Hi!

Hi Dominik,

> I don't understand debugging completely, what are the different levels

> for? It seems that they are never used and so every call to debug has 
> level 0 (DBG_LEVEL_OFF) by default and onw has to set min level to 
> DBG_LEVEL_OFF. Strange behaviour. So, but when I understand it 
> correctly, onw could specify a level other than 0 in the call and then

> it would only be printed if that level is matched be min level?
> 
> DBG_TYPES_ON is by default 0, what means no debugging at all, right? 
> so, setting it to DBG_ON enables all types which are set to DBG_ON. 
> Setting it also to STATE, TRACE and/or FRESH would enable also these 
> messages independent if the debug type, e.g. IP_DEBUG is set to off.
> But why is DBG_TYPES_ON not by default set to DBG_ON ?

As far as I understand the debugging code, it goes like this:

- DBG_TYPES_ON should be either DBG_OFF/0, DBG_ON or a combination of
DBG_TRACE, DBG_STATE and DBG_FRESH.
DBG_OFF/0 would effectively disable debugging, DBG_ON would enable full
debugging and a combination of DBG_TRACE, DBG_STATE and DBG_FRESH would
enable only those types of messages (hence the name DBG_TYPES_ON)

- for all of those IP_DEBUG, TCP_DEBUG, ... you can either enable or
disable them completely with DBG_ON/DBG_OFF, regardless of the settings
in DBG_TYPES_ON

- with DBG_MIN_LEVEL you can decrease the debugging level to e.g.
DBG_LEVEL_SERIOUS (and so on).

Cheers,
Juri (also working on my thesis ;)




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

_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users

End of lwip-users Digest, Vol 46, Issue 7
*****************************************




reply via email to

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