This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: [PATCH] LWIP over SLIP
On Tue, Aug 15, 2006 at 11:09:27AM -0400, David Ho wrote:
> Hi,
>
> These are the minimal changes needed to get LWIP running over SLIP.
> Plus a loopif cleanup.
>
> David
> ---
>
> diff --git a/packages/net/lwip_tcpip/current/src/ecos/init.c
> b/packages/net/lwip_tcpip/current/src/ecos/init.c
> index 3f55942..6aa098a 100644
> --- a/packages/net/lwip_tcpip/current/src/ecos/init.c
> +++ b/packages/net/lwip_tcpip/current/src/ecos/init.c
> @@ -185,6 +185,8 @@ #endif
> sys_sem_free(sem);
>
> #if LWIP_HAVE_LOOPIF
> + loopif_init(&ecos_loopif);
> +
> IP4_ADDR(&gw, 127,0,0,1);
> IP4_ADDR(&ipaddr, 127,0,0,1);
> IP4_ADDR(&netmask, 255,0,0,0);
> @@ -194,9 +196,8 @@ #if LWIP_HAVE_LOOPIF
> #endif
Hi David.
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.
> #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?
> 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.
Thanks
Andrew