Basic SLIP functionality -- but there are issues
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3382 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
77e3f14232
commit
53c68bf74e
@ -811,11 +811,15 @@ Where <subdir> 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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user