diff --git a/configs/olimex-lpc1766stk/README.txt b/configs/olimex-lpc1766stk/README.txt index 72340ffff8..5a30ab9f17 100755 --- a/configs/olimex-lpc1766stk/README.txt +++ b/configs/olimex-lpc1766stk/README.txt @@ -811,11 +811,15 @@ Where is one of the following: 3. Reset on the target side and attach SLIP on the Linux side: $ modprobe slip - $ slattach -p slip -s 57600 /dev/ttyS0 & + $ slattach -L -p slip -s 57600 /dev/ttyS0 & This should create an interface with a name like sl0, or sl1, etc. Add -d to get debug output. This will show the interface name. + NOTE: The -L option is included to suppress use of hardware flow + control. This is necessary because I haven't figure out how to + use the UART1 hardwar flow control yet. + NOTE: The Linux slip module hard-codes its MTU size to 296. So you might as well set CONFIG_NET_BUFSIZE to 296 as well. diff --git a/configs/olimex-lpc1766stk/slip-httpd/defconfig b/configs/olimex-lpc1766stk/slip-httpd/defconfig index c4fd1a6d01..324207e8a2 100755 --- a/configs/olimex-lpc1766stk/slip-httpd/defconfig +++ b/configs/olimex-lpc1766stk/slip-httpd/defconfig @@ -152,7 +152,7 @@ CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART2_SERIAL_CONSOLE=n CONFIG_UART3_SERIAL_CONSOLE=n -CONFIG_UART1_FLOWCONTROL=y +CONFIG_UART1_FLOWCONTROL=n CONFIG_UART0_TXBUFSIZE=256 CONFIG_UART1_TXBUFSIZE=256 diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index 16aab6d871..5956f72c62 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -663,8 +663,8 @@ int skel_initialize(int intf) /* Initialize the driver structure */ memset(priv, 0, sizeof(struct skel_driver_s)); - priv->sk_dev.d_ifup = skel_ifup; /* I/F down callback */ - priv->sk_dev.d_ifdown = skel_ifdown; /* I/F up (new IP address) callback */ + priv->sk_dev.d_ifup = skel_ifup; /* I/F up (new IP address) callback */ + priv->sk_dev.d_ifdown = skel_ifdown; /* I/F down callback */ priv->sk_dev.d_txavail = skel_txavail; /* New TX data callback */ #ifdef CONFIG_NET_IGMP priv->sk_dev.d_addmac = skel_addmac; /* Add multicast MAC address */ diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 6fedb829a3..fd38c5f329 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -83,15 +83,17 @@ #endif #ifndef CONFIG_SLIP_STACKSIZE -# define CONFIG_SLIP_STACKSIZE 1024 +# define CONFIG_SLIP_STACKSIZE 2048 #endif #ifndef CONFIG_SLIP_DEFPRIO # define CONFIG_SLIP_DEFPRIO 128 #endif -/* The Linux slip module hard-codes its MTU size to 296. So you - might as well set CONFIG_NET_BUFSIZE to 296 as well. +/* The Linux slip module hard-codes its MTU size to 296. So you might as + * well set CONFIG_NET_BUFSIZE to 296 as well. + */ + #if CONFIG_NET_BUFSIZE < 296 # error "CONFIG_NET_BUFSIZE >= 296 is required" #elif CONFIG_NET_BUFSIZE > 296 @@ -278,7 +280,7 @@ static inline void slip_write(FAR struct slip_driver_s *priv, static inline void slip_putc(FAR struct slip_driver_s *priv, int ch) { -#if CONFIG_DEBUG +#if 0 // CONFIG_DEBUG int ret = putc(ch, priv->stream); DEBUGASSERT(ret == ch); #else @@ -385,7 +387,7 @@ static int slip_transmit(FAR struct slip_driver_s *priv) src++; } - /* We have looked at every charcter in the packet. Now flush any unsent + /* We have looked at every character in the packet. Now flush any unsent * data */ @@ -919,8 +921,8 @@ int slip_initialize(int intf, const char *devname) /* Initialize the driver structure */ memset(priv, 0, sizeof(struct slip_driver_s)); - priv->dev.d_ifup = slip_ifup; /* I/F down callback */ - priv->dev.d_ifdown = slip_ifdown; /* I/F up (new IP address) callback */ + priv->dev.d_ifup = slip_ifup; /* I/F up (new IP address) callback */ + priv->dev.d_ifdown = slip_ifdown; /* I/F down callback */ priv->dev.d_txavail = slip_txavail; /* New TX data callback */ #ifdef CONFIG_NET_IGMP priv->dev.d_addmac = slip_addmac; /* Add multicast MAC address */ @@ -976,9 +978,6 @@ int slip_initialize(int intf, const char *devname) /* Register the device with the OS so that socket IOCTLs can be performed */ -#if CONFIG_NSOCKET_DESCRIPTORS > 0 - snprintf(priv->dev.d_ifname, IFNAMSIZ, "slip%d", intf); -#endif (void)netdev_register(&priv->dev); return OK; } diff --git a/examples/thttpd/main.c b/examples/thttpd/main.c index b7c040cdb0..f9d0ee0558 100644 --- a/examples/thttpd/main.c +++ b/examples/thttpd/main.c @@ -107,7 +107,7 @@ # endif # define SLIP_DEVNO 0 -# define NET_DEVNAME "slip0" +# define NET_DEVNAME "sl0" #else /* Otherwise, use the standard ethernet device name */ @@ -190,6 +190,17 @@ int user_start(int argc, char *argv[]) char *thttpd_argv = "thttpd"; int ret; + /* Configure SLIP */ + +#ifdef CONFIG_NET_SLIP + ret = slip_initialize(SLIP_DEVNO, CONFIG_NET_SLIPTTY); + if (ret < 0) + { + message("ERROR: SLIP initialization failed: %d\n", ret); + exit(1); + } +#endif + /* Many embedded network interfaces must have a software assigned MAC */ #ifdef CONFIG_EXAMPLE_THTTPD_NOMAC @@ -204,17 +215,6 @@ int user_start(int argc, char *argv[]) uip_setmacaddr(NET_DEVNAME, mac); #endif - /* Configure SLIP */ - -#ifdef CONFIG_NET_SLIP - ret = slip_initialize(SLIP_DEVNO, CONFIG_NET_SLIPTTY); - if (ret < 0) - { - message("ERROR: SLIP initialization failed: %d\n", ret); - exit(1); - } -#endif - /* Set up our host address */ message("Setup network addresses\n"); diff --git a/net/netdev_register.c b/net/netdev_register.c index 7283574ddb..d9387c7964 100644 --- a/net/netdev_register.c +++ b/net/netdev_register.c @@ -58,6 +58,12 @@ * Definitions ****************************************************************************/ +#ifdef CONFIG_NET_SLIP +# define NETDEV_FORMAT "sl%d" +#else +# define NETDEV_FORMAT "eth%d" +#endif + /**************************************************************************** * Priviate Types ****************************************************************************/ @@ -134,7 +140,7 @@ int netdev_register(FAR struct uip_driver_s *dev) /* Assign a device name to the interface */ devnum = g_next_devnum++; - snprintf( dev->d_ifname, IFNAMSIZ, "eth%d", devnum ); + snprintf( dev->d_ifname, IFNAMSIZ, NETDEV_FORMAT, devnum ); /* Add the device to the list of known network devices */