This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

lwIP on SLIP interface


Hi

A few days ago I needed to run lwIP on sl0. I ran into two problems. It
seemed for me what a medice can be interesting. Please, look at the
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000717 for details.

Regards,

Sergei
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/lwip_tcpip/current/ChangeLog,v
retrieving revision 1.9
diff -U5 -r1.9 ChangeLog
--- ChangeLog	29 Jan 2009 17:49:58 -0000	1.9
+++ ChangeLog	14 Mar 2009 15:07:04 -0000
@@ -1,5 +1,12 @@
+2009-03-14  Sergei Gavrikov <sergei.gavrikov@gmail.com>
+
+	* src/netif/slipif.c: slipif_init() quite erased NETIF_FLAG_UP flag.
+	Fixed.
+	* src/ecos/sio.c: Fixed ecos sio I/O functions to work properly in
+	a non-blocking mode.
+
 2007-03-22  John Eigelaar  <jeigelaar@mweb.co.za>
                                                      
 	* include/lwip/netif.h, include/lwip/inet.h: Added externC macro
 	to public fucntions to make them C++ compliant.
 
Index: src/ecos/sio.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/lwip_tcpip/current/src/ecos/sio.c,v
retrieving revision 1.2
diff -U5 -r1.2 sio.c
--- src/ecos/sio.c	29 Jan 2009 17:49:58 -0000	1.2
+++ src/ecos/sio.c	14 Mar 2009 15:07:04 -0000
@@ -49,35 +49,39 @@
 
 void
 sio_send(char c,void * dev)
 {
 	len = 1;
-	cyg_io_write(*(cyg_io_handle_t*)dev, &c, &len);
+	while (cyg_io_write(*(cyg_io_handle_t*)dev, &c, &len) < 0)
+		sys_msleep(10);
 }
 
 char
 sio_recv(void * dev)
 {
 	char c;
 	len = 1;
-	cyg_io_read(*(cyg_io_handle_t *)dev, &c, &len);
+	while (cyg_io_read(*(cyg_io_handle_t *)dev, &c, &len) < 0)
+		sys_msleep(10);
 	return c;			
 }
 
 int
 sio_write(void *dev, char *b, int size)
 {
 	int len = size;
-	cyg_io_write(*(cyg_io_handle_t*)dev, b, &len);
+	while (cyg_io_write(*(cyg_io_handle_t*)dev, b, &len) < 0)
+		sys_msleep(10);
 	return len;
 }
 		
 int
 sio_read(void *dev, char *b, int size)
 {
 	int len = size;
-	cyg_io_read(*(cyg_io_handle_t*)dev, b, &len);
+	while(cyg_io_read(*(cyg_io_handle_t*)dev, b, &len) < 0)
+		sys_msleep(10);
 	
 	return len;
 }
 
 void * 
Index: src/netif/slipif.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/lwip_tcpip/current/src/netif/slipif.c,v
retrieving revision 1.2
diff -U5 -r1.2 slipif.c
--- src/netif/slipif.c	29 Mar 2006 10:33:28 -0000	1.2
+++ src/netif/slipif.c	14 Mar 2009 15:07:04 -0000
@@ -200,11 +200,11 @@
 
   netif->name[0] = 's';
   netif->name[1] = 'l';
   netif->output = slipif_output;
   netif->mtu = 1500;
-  netif->flags = NETIF_FLAG_POINTTOPOINT;
+  netif->flags |= NETIF_FLAG_POINTTOPOINT;
 
   netif->state = sio_open(netif->num);
   if (!netif->state)
     return ERR_IF;
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]