summaryrefslogtreecommitdiff
path: root/nuttx/net
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-12 15:36:28 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-12 15:36:28 +0000
commite6f93f774080d42c3f954a862709d047df2d7e7a (patch)
tree487b0ec566d911458a00e1803392b817e84b7809 /nuttx/net
parent95317af605c883b464a4c5b524632193614bfd24 (diff)
downloadpx4-nuttx-e6f93f774080d42c3f954a862709d047df2d7e7a.tar.gz
px4-nuttx-e6f93f774080d42c3f954a862709d047df2d7e7a.tar.bz2
px4-nuttx-e6f93f774080d42c3f954a862709d047df2d7e7a.zip
More support for SLIP data link protocol
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3370 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net')
-rw-r--r--nuttx/net/Makefile9
-rw-r--r--nuttx/net/net_arptimer.c6
-rw-r--r--nuttx/net/net_internal.h6
-rw-r--r--nuttx/net/netdev_ioctl.c6
-rw-r--r--nuttx/net/netdev_register.c7
-rw-r--r--nuttx/net/send.c4
-rw-r--r--nuttx/net/uip/Make.defs14
-rw-r--r--nuttx/net/uip/uip_arp.c8
-rw-r--r--nuttx/net/uip/uip_arptab.c7
9 files changed, 53 insertions, 14 deletions
diff --git a/nuttx/net/Makefile b/nuttx/net/Makefile
index 203aa0e53..40eb2af50 100644
--- a/nuttx/net/Makefile
+++ b/nuttx/net/Makefile
@@ -1,7 +1,7 @@
############################################################################
# net/Makefile
#
-# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@@ -46,9 +46,12 @@ SOCK_CSRCS += send.c listen.c accept.c
endif
ifeq ($(CONFIG_NET_SOCKOPTS),y)
-SOCK_CSRCS += setsockopt.c getsockopt.c
+SOCK_CSRCS += setsockopt.c getsockopt.c
ifneq ($(CONFIG_DISABLE_CLOCK),y)
-SOCK_CSRCS += net_timeo.c net_dsec2timeval.c net_timeval2dsec.c net_arptimer.c
+SOCK_CSRCS += net_timeo.c net_dsec2timeval.c net_timeval2dsec.c
+ifneq ($(CONFIG_NET_SLIP),y)
+SOCK_CSRCS += net_arptimer.c
+endif
endif
endif
diff --git a/nuttx/net/net_arptimer.c b/nuttx/net/net_arptimer.c
index f019fdb75..fe835d0fe 100644
--- a/nuttx/net/net_arptimer.c
+++ b/nuttx/net/net_arptimer.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/net_arptimer.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -45,10 +45,13 @@
#include <wdog.h>
#include <debug.h>
+#include <net/uip/uipopt.h>
#include <net/uip/uip-arp.h>
#include "net_internal.h"
+#ifdef CONFIG_NET_ARP
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -127,4 +130,5 @@ void arptimer_init(void)
(void)wd_start(g_arptimer, ARPTIMER_WDINTERVAL, arptimer_poll, 0);
}
+#endif /* CONFIG_NET_ARP */
#endif /* CONFIG_NET */
diff --git a/nuttx/net/net_internal.h b/nuttx/net/net_internal.h
index 0ddb98b30..e3498cd44 100644
--- a/nuttx/net/net_internal.h
+++ b/nuttx/net/net_internal.h
@@ -1,7 +1,7 @@
/****************************************************************************
* net/net_internal.h
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -200,7 +200,11 @@ EXTERN int netdev_count(void);
/* net_arptimer.c ************************************************************/
+#ifdef CONFIG_NET_ARP
EXTERN void arptimer_init(void);
+#else
+# define arptimer_init()
+#endif
#undef EXTERN
#if defined(__cplusplus)
diff --git a/nuttx/net/netdev_ioctl.c b/nuttx/net/netdev_ioctl.c
index d4be2b64a..d32f6a24f 100644
--- a/nuttx/net/netdev_ioctl.c
+++ b/nuttx/net/netdev_ioctl.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/netdev_ioctl.c
*
- * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -205,6 +205,9 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd, struct ifreq *req)
req->ifr_mtu = CONFIG_NET_BUFSIZE;
break;
+ /* MAC address operations only make sense if Ethernet is supported */
+
+#ifdef CONFIG_NET_ETHERNET
case SIOCGIFHWADDR: /* Get hardware address */
req->ifr_hwaddr.sa_family = AF_INETX;
memcpy(req->ifr_hwaddr.sa_data, dev->d_mac.ether_addr_octet, IFHWADDRLEN);
@@ -214,6 +217,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd, struct ifreq *req)
req->ifr_hwaddr.sa_family = AF_INETX;
memcpy(dev->d_mac.ether_addr_octet, req->ifr_hwaddr.sa_data, IFHWADDRLEN);
break;
+#endif
case SIOCDIFADDR: /* Delete IP address */
ioctl_ifdown(dev);
diff --git a/nuttx/net/netdev_register.c b/nuttx/net/netdev_register.c
index 15a71c209..7283574dd 100644
--- a/nuttx/net/netdev_register.c
+++ b/nuttx/net/netdev_register.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/netdev_register.c
*
- * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -148,12 +148,15 @@ int netdev_register(FAR struct uip_driver_s *dev)
#endif
netdev_semgive();
+#ifdef CONFIG_NET_ETHERNET
nlldbg("Registered MAC: %02x:%02x:%02x:%02x:%02x:%02x as dev: %s\n",
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5],
dev->d_ifname);
-
+#else
+ nlldbg("Registered dev: %s\n", dev->d_ifname);
+#endif
return OK;
}
return -EINVAL;
diff --git a/nuttx/net/send.c b/nuttx/net/send.c
index b3f137376..475344c03 100644
--- a/nuttx/net/send.c
+++ b/nuttx/net/send.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/send.c
*
- * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -277,6 +277,7 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn,
* should already be in the ARP table.
*/
+#ifdef CONFIG_NET_ETHERNET
#ifndef CONFIG_NET_ARP_IPIN
if (pstate->snd_sent != 0 || uip_arp_find(conn->ripaddr) != NULL)
#endif
@@ -293,6 +294,7 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn,
pstate->snd_time = g_system_timer;
#endif
}
+#endif /* CONFIG_NET_ETHERNET */
}
/* All data has been send and we are just waiting for ACK or re-transmit
diff --git a/nuttx/net/uip/Make.defs b/nuttx/net/uip/Make.defs
index 3c7e2ac23..c544765ac 100644
--- a/nuttx/net/uip/Make.defs
+++ b/nuttx/net/uip/Make.defs
@@ -40,14 +40,22 @@ ifeq ($(CONFIG_NET),y)
# Common IP source files
-UIP_CSRCS += uip_initialize.c uip_setipid.c uip_arp.c uip_arptab.c uip_input.c \
- uip_send.c uip_poll.c uip_chksum.c uip_callback.c
+UIP_CSRCS += uip_initialize.c uip_setipid.c uip_input.c uip_send.c \
+ uip_poll.c uip_chksum.c uip_callback.c
+
+# ARP supported is not provided for SLIP (Ethernet only)
+
+ifneq ($(CONFIG_NET_SLIP),y)
+UIP_CSRCS += uip_arp.c uip_arptab.c
+endif
+
+# IPv6-specific logic
ifeq ($(CONFIG_NET_IPv6),y)
UIP_CSRCS += uip_neighbor.c
endif
-# TCP source files
+# TCP/IP source files
ifeq ($(CONFIG_NET_TCP),y)
diff --git a/nuttx/net/uip/uip_arp.c b/nuttx/net/uip/uip_arp.c
index 413fcddc2..03a68ec2f 100644
--- a/nuttx/net/uip/uip_arp.c
+++ b/nuttx/net/uip/uip_arp.c
@@ -2,7 +2,7 @@
* net/uip/uip_arp.c
* Implementation of the ARP Address Resolution Protocol.
*
- * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Based on uIP which also has a BSD style license:
@@ -61,10 +61,14 @@
#include <debug.h>
#include <netinet/in.h>
+
#include <net/ethernet.h>
+#include <net/uip/uipopt.h>
#include <net/uip/uip-arch.h>
#include <net/uip/uip-arp.h>
+#ifdef CONFIG_NET_ARP
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -422,4 +426,6 @@ void uip_arp_out(struct uip_driver_s *dev)
peth->type = HTONS(UIP_ETHTYPE_IP);
dev->d_len += UIP_LLH_LEN;
}
+
+#endif /* CONFIG_NET_ARP */
#endif /* CONFIG_NET */
diff --git a/nuttx/net/uip/uip_arptab.c b/nuttx/net/uip/uip_arptab.c
index b777727d4..b93ea761a 100644
--- a/nuttx/net/uip/uip_arptab.c
+++ b/nuttx/net/uip/uip_arptab.c
@@ -2,7 +2,7 @@
* net/uip/uip_arptab.c
* Implementation of the ARP Address Resolution Protocol.
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Based originally on uIP which also has a BSD style license:
@@ -51,10 +51,14 @@
#include <debug.h>
#include <netinet/in.h>
+
#include <net/ethernet.h>
+#include <net/uip/uipopt.h>
#include <net/uip/uip-arch.h>
#include <net/uip/uip-arp.h>
+#ifdef CONFIG_NET_ARP
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -249,4 +253,5 @@ struct arp_entry *uip_arp_find(in_addr_t ipaddr)
return NULL;
}
+#endif /* CONFIG_NET_ARP */
#endif /* CONFIG_NET */