summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-15 13:52:39 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-15 13:52:39 -0600
commit3e32e050072dcda6790295188d3bf7ba11e477f6 (patch)
tree0850aa6f9df6b95493be9e67bde721f3c856ea2f /apps
parent24a33a43436bcc8430c5c1e6707dedc8c2531171 (diff)
downloadnuttx-3e32e050072dcda6790295188d3bf7ba11e477f6.tar.gz
nuttx-3e32e050072dcda6790295188d3bf7ba11e477f6.tar.bz2
nuttx-3e32e050072dcda6790295188d3bf7ba11e477f6.zip
Network: Various fixes for clean compile with both Ethernet and SLIP
Diffstat (limited to 'apps')
-rw-r--r--apps/examples/thttpd/thttpd_main.c25
-rw-r--r--apps/netutils/netlib/Makefile2
-rw-r--r--apps/nshlib/nsh_netcmds.c6
-rw-r--r--apps/nshlib/nsh_netinit.c19
4 files changed, 36 insertions, 16 deletions
diff --git a/apps/examples/thttpd/thttpd_main.c b/apps/examples/thttpd/thttpd_main.c
index e2778093a..89677f855 100644
--- a/apps/examples/thttpd/thttpd_main.c
+++ b/apps/examples/thttpd/thttpd_main.c
@@ -95,13 +95,24 @@
# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file"
#endif
-/* SLIP-specific configuration */
+/* Ethernet specific configuration */
-#ifdef CONFIG_NET_SLIP
+#ifdef CONFIG_NET_ETHERNET
+
+ /* Otherwise, use the standard Ethernet device name */
+
+# define NET_DEVNAME "eth0"
+
+#else
- /* No MAC address operations */
+ /* No Ethernet -> No MAC address operations */
# undef CONFIG_EXAMPLES_THTTPD_NOMAC
+#endif
+
+/* SLIP-specific configuration */
+
+#ifdef CONFIG_NET_SLIP
/* TTY device to use */
@@ -110,12 +121,10 @@
# endif
# define SLIP_DEVNO 0
-# define NET_DEVNAME "sl0"
-#else
-
- /* Otherwise, use the standard ethernet device name */
-# define NET_DEVNAME "eth0"
+# ifndef NET_DEVNAME
+# define NET_DEVNAME "sl0"
+# endif
#endif
/* Describe the ROMFS file system */
diff --git a/apps/netutils/netlib/Makefile b/apps/netutils/netlib/Makefile
index 8de89a857..9710702ba 100644
--- a/apps/netutils/netlib/Makefile
+++ b/apps/netutils/netlib/Makefile
@@ -52,7 +52,7 @@ endif
# No MAC address support for SLIP (Ethernet only)
-ifneq ($(CONFIG_NET_SLIP),y)
+ifeq ($(CONFIG_NET_ETHERNET),y)
CSRCS += netlib_setmacaddr.c netlib_getmacaddr.c
endif
diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c
index f70d88e3e..f7cd9dc90 100644
--- a/apps/nshlib/nsh_netcmds.c
+++ b/apps/nshlib/nsh_netcmds.c
@@ -589,7 +589,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
FAR char *gwip = NULL;
FAR char *mask = NULL;
FAR char *tmp = NULL;
-#ifndef CONFIG_NET_SLIP
+#ifdef CONFIG_NET_ETHERNET
FAR char *hw = NULL;
#endif
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
@@ -661,7 +661,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
}
}
-#ifndef CONFIG_NET_SLIP
+#ifdef CONFIG_NET_ETHERNET
/* REVISIT: How will we handle Ethernet and SLIP networks together? */
else if (!strcmp(tmp, "hw"))
@@ -703,7 +703,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR;
}
-#ifndef CONFIG_NET_SLIP
+#ifdef CONFIG_NET_ETHERNET
/* Set Hardware Ethernet MAC address */
/* REVISIT: How will we handle Ethernet and SLIP networks together? */
diff --git a/apps/nshlib/nsh_netinit.c b/apps/nshlib/nsh_netinit.c
index 1b8a82bf9..16fc78eb6 100644
--- a/apps/nshlib/nsh_netinit.c
+++ b/apps/nshlib/nsh_netinit.c
@@ -92,13 +92,23 @@
* mixed transports.
*/
-#ifdef CONFIG_NET_SLIP
+#ifdef CONFIG_NET_MULILINK
+# warning REVISIT: CONFIG_NET_MULILINK multilink support incomplete
+#endif
+
+/* If both SLIP and Ethernet interfaces are present, only the Ethernet
+ * interface will be initialized.
+ */
+
+#if defined(CONFIG_NET_ETHERNET)
+# define NET_DEVNAME "eth0"
+#elif defined(CONFIG_NET_SLIP)
# define NET_DEVNAME "sl0"
# ifndef CONFIG_NSH_NOMAC
# error "CONFIG_NSH_NOMAC must be defined for SLIP"
# endif
#else
-# define NET_DEVNAME "eth0"
+# error ERROR: No link layer protocol defined
#endif
/* While the network is up, the network monitor really does nothing. It
@@ -143,7 +153,8 @@ static void nsh_netinit_configure(void)
#if defined(CONFIG_NSH_DHCPC)
FAR void *handle;
#endif
-#if (defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_NOMAC)) && !defined(CONFIG_NET_SLIP)
+#if (defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_NOMAC)) && \
+ defined(CONFIG_NET_ETHERNET)
uint8_t mac[IFHWADDRLEN];
#endif
@@ -151,7 +162,7 @@ static void nsh_netinit_configure(void)
/* Many embedded network interfaces must have a software assigned MAC */
-#if defined(CONFIG_NSH_NOMAC) && !defined(CONFIG_NET_SLIP)
+#if defined(CONFIG_NSH_NOMAC) && defined(CONFIG_NET_ETHERNET)
#ifdef CONFIG_NSH_ARCHMAC
/* Let platform-specific logic assign the MAC address. */