diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2011-03-12 15:36:28 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2011-03-12 15:36:28 +0000 |
commit | 208de7e00279e9bf43eb2fad167749804c9d36af (patch) | |
tree | 487b0ec566d911458a00e1803392b817e84b7809 /nuttx/net | |
parent | e3099adb4a4a7cdfff096c9870f9ee2b3ddf826b (diff) |
More support for SLIP data link protocol
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3370 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/net')
-rw-r--r-- | nuttx/net/Makefile | 9 | ||||
-rw-r--r-- | nuttx/net/net_arptimer.c | 6 | ||||
-rw-r--r-- | nuttx/net/net_internal.h | 6 | ||||
-rw-r--r-- | nuttx/net/netdev_ioctl.c | 6 | ||||
-rw-r--r-- | nuttx/net/netdev_register.c | 7 | ||||
-rw-r--r-- | nuttx/net/send.c | 4 | ||||
-rw-r--r-- | nuttx/net/uip/Make.defs | 14 | ||||
-rw-r--r-- | nuttx/net/uip/uip_arp.c | 8 | ||||
-rw-r--r-- | nuttx/net/uip/uip_arptab.c | 7 |
9 files changed, 53 insertions, 14 deletions
diff --git a/nuttx/net/Makefile b/nuttx/net/Makefile index 203aa0e539..40eb2af50d 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 f019fdb75b..fe835d0fe5 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 0ddb98b305..e3498cd440 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 d4be2b64a6..d32f6a24fd 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 15a71c2098..7283574ddb 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 b3f1373765..475344c03f 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 3c7e2ac23e..c544765ac3 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 413fcddc27..03a68ec2f4 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 b777727d4a..b93ea761aa 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 */ |