This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: [PATCH] LWIP over SLIP
- From: "David Ho" <davidkwho at gmail dot com>
- To: "Andrew Lunn" <andrew at lunn dot ch>
- Cc: ecos-patches at sourceware dot org
- Date: Mon, 28 Aug 2006 15:56:13 -0400
- Subject: Re: [PATCH] LWIP over SLIP
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=t8Vjnm3LPRUBg4NKwV1Y+NVhRSsDmmMIDHoAqy7cWrCWjkSp8n/+gaWxAOy4WaVUmBvXYHoPIdDjOCV7qczYh39N6Jlmri0tWqiKBpdN7b/91+XbsghsjacucSOf8R69T3IGUVogpOjwFZpayWLzAdyGGUHLsfWCzdCm52Znfs8=
- References: <4dd15d180608150809y2e6244e5qbbf951379768e5fd@mail.gmail.com> <20060820162301.GS29570@lunn.ch>
Hi,
Sorry for the delay, I have been trying to get httpd running over LWIP
on eCos, now that I have resolved all the issues, I can attend this
your questions.
Please could you explain what goes wrong with loopif and how your
change fixes this.
The current code is:
#if LWIP_HAVE_LOOPIF
IP4_ADDR(&gw, 127,0,0,1);
IP4_ADDR(&ipaddr, 127,0,0,1);
IP4_ADDR(&netmask, 255,0,0,0);
netif_add(&ecos_loopif, &ipaddr, &netmask, &gw, NULL, loopif_init,
tcpip_input);
#endif
Reading netif_add, it will call loopif_init, so it is not obvious to
me why you need to call it before.
I actually hadn't test this. I just noticed that when I enabled debug
the message never printed out the loopif interface name properly, I
thought this one liner would fix it.
> #if LWIP_SLIP
> - lwip_set_addr(&mynetif);
> slipif_init(&mynetif);
> - netif_set_default(&mynetif);
> + lwip_set_addr(&mynetif);
> #elif PPP_SUPPORT
> pppInit();
> #if PAP_SUPPORT || CHAP_SUPPORT
Here you no longer call netif_set_default(). Did you test this change
with routing to packets via a default gateway?
If you simply look further down the file, where lwip_set_addr is
defined, the function calls netif_set_default. Essentially
netif_set_default was called twice in the original code.
Note that I have to move the call to lwip_set_addr after slipif_init
resets the netif->flags. Inside lwip_set_addr, it attempts to bring
the interface up by setting a bit in netif->flags, which slipif_init
clears.
> diff --git a/packages/net/lwip_tcpip/current/src/ecos/sio.c
> b/packages/net/lwip_tcpip/current/src/ecos/sio.c
> index 60004c4..87a4eb7 100644
> --- a/packages/net/lwip_tcpip/current/src/ecos/sio.c
> +++ b/packages/net/lwip_tcpip/current/src/ecos/sio.c
> @@ -82,7 +82,7 @@ void *
> sio_open(int devnum)
> {
> int res;
> - cyg_uint32 nb = 0, len = 4;
> + cyg_uint32 nb = 1, len = 4;
>
> #if LWIP_SLIP
> #define SIODEV SLIP_DEV
> @@ -95,9 +95,11 @@ #endif
>
> res = cyg_io_set_config(ser, CYG_IO_SET_CONFIG_READ_BLOCKING,
> &nb, &len);
> res = cyg_io_set_config(ser, CYG_IO_SET_CONFIG_WRITE_BLOCKING,
> &nb, &len);
> +#if 0
> len = 4;
> nb = 0xFFFFFFFF;
> res = cyg_io_set_config(ser,
> CYG_IO_SET_CONFIG_SERIAL_FLOW_CONTROL_METHOD, &nb, &len);
> +#endif
> if (res != ENOERR)
> diag_printf("set_config flow_control returned
> an error\n");
> return &ser;
Again, please could you explain this change. It is not obvious what is
wrong.
If I don't set up the serial port driver to blocking read, I would be
continously receiving garbage that is returned from a non-blocking
read, which is not what I want. So I enabled blocking on both reads
and writes and that made things behave a lot better.
There is no FLOW_CONTROL_METHOD option implemented in the at91 serial
driver, trying to do that on the driver will stop the LWIP
initialization process.
Hope this helps,
David