lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] HOWTO LwIP if NO_SYS = 1


From: Niraj Kulkarni
Subject: Re: [lwip-users] HOWTO LwIP if NO_SYS = 1
Date: Fri, 29 Apr 2011 10:41:15 +0000

In continuation with pervious questions, I have few more

1.      What is the significance of "ram" variable in mem_init().
        I am referring : LwIP_M16C (although it is for uCos OS and my system is 
NO OS),
        here "ram" is a well array defined by user of size MEM_SIZE
        In lwip-1.4.0.rc2 source code : "ram" is a static u8_t pointer.

        I guess MEM_SIZE is the maximum heap memory (or say buffer ) lwip will 
use and I have to configure
        "memp" and "pbuf_pool" considering MEM_SIZE in mind.

        Should I assign my controllers RAM memory to this "ram" variable?

2.      As I will be using NO_SYS = 1 , in a single-threaded (non-OS) 
environment,
        What will be my "input_function" in netif_add : ip_input() or 
tcpip_input() ?

        Ref: http://www.sics.se/~adam/lwip/os.html

-----Original Message-----
From: Jeff Barber [mailto:address@hidden
Sent: 28 April, 2011 10:52 PM
To: Niraj Kulkarni
Subject: Re: HOWTO LwIP if NO_SYS = 1

On Thu, Apr 28, 2011 at 10:15 AM, Niraj Kulkarni
<address@hidden> wrote:
[snip]
> I have following quires:
>
> 1.       Do I have to implement etharp_tmr(), ip_reass_tmr(), tcp_tmr(), etc
> using some way ( may be Hardware time of the controller).

No, you do not have to implement them.  They are provided by lwip.
You just need to determine when it's time to call them.  Assuming you
have a periodic clock interrupt, you could just count interrupts and
determine how long it's been since the last time you called them.


> 2.       I could not understand arguments of "netif_add" function ;
> specially first and last two arguments. Out of the last two functions which
> one I have  to implement.

The first argument is to a netif structure that you allocate. It will
be filled in partly by lwip itself in netif_add and partly in your
driver initialization function.

The last two arguments are pointers to (a) your network driver's
initialization function, and (b) the input function that is to be
called from your driver.

The init function, (a), should intiialize your driver and should also
fill in various fields of the netif:
  name = the network device name (something like 'e0')
  link_output = the function (in your driver) to call to actually
enqueue a frame for transmission
  output = function to call to output an IP frame (this is typically
the lwip-provided etharp_output to allow ARP to work -- it will
eventually call your driver via link_output).
  mtu = your network MTU
  flags = NETIF_FLAG_* (BROADCAST, ETHARP, etc.)
  hwaddr_len = (typically ETHARP_HWADDR_LEN=6 for ethernet)
  hwaddr = your device's MAC address

The input function, (b), is what will be assigned to the netif->input
field (the assignment is done inside of netif_add) and what your
driver should invoke to pass frames into the lwip stack (typically you
will pass the lwip-provided function ethernet_input as this argument).

So, something like this:
   if (netif_add(&my_netif, &my_ip_addr, &my_netmask, &my_gateway,
my_private_data_structure, my_driver_init_function, ethernet_input) ==
NULL)
     handle_error();


> 3.       Is there any code ported on any controller with LwIP on it with
> NO_SYS = 1 , available for download.

There are various partial examples in the contrib directory on the web site.


Larsen & Toubro Limited

www.larsentoubro.com

This Email may contain confidential or privileged information for the intended 
recipient (s) If you are not the intended recipient, please do not use or 
disseminate the information, notify the sender and delete it from your system.



reply via email to

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