diff --git a/include/nuttx/net/arp.h b/include/nuttx/net/arp.h index dab5e278760..4768c9fdffa 100644 --- a/include/nuttx/net/arp.h +++ b/include/nuttx/net/arp.h @@ -68,7 +68,8 @@ * in the first 6-bytes of the sockaddr sa_data array. */ -#define ARPHRD_ETHER 1 /* Only Ethernet is supported */ +#define ARPHRD_ETHER 1 /* Ethernet */ +#define ARPHRD_IEEE802154 804 /* IEEE 802-15-4 */ /**************************************************************************** * Public Types diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index 07f6cead774..86de2a18fab 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -79,6 +79,7 @@ enum net_lltype_e NET_LL_LOOPBACK, /* Local loopback */ NET_LL_SLIP, /* Serial Line Internet Protocol (SLIP) */ NET_LL_TUN, /* TUN Virtual Network Device */ + NET_LL_IEEE802154 /* IEEE 802.15-4 */ }; /* This defines a bitmap big enough for one bit for each socket option */ diff --git a/include/sys/socket.h b/include/sys/socket.h index 8f1df8818af..71710d308e0 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -64,7 +64,7 @@ #define PF_ATMPVC 8 /* Access to raw ATM PVCs */ #define PF_APPLETALK 9 /* Appletalk */ #define PF_PACKET 10 /* Low level packet interface */ -#define PF_IEEE802154 11 /* IEEE802154 sockets */ +#define PF_IEEE802154 11 /* IEEE802.15-4 sockets */ /* Address families */ diff --git a/net/Kconfig b/net/Kconfig index 52a425900a0..d2d7c1c0cdb 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -269,6 +269,7 @@ source "net/pkt/Kconfig" source "net/local/Kconfig" source "net/tcp/Kconfig" source "net/udp/Kconfig" +source "net/ieee802154/Kconfig" source "net/icmp/Kconfig" source "net/icmpv6/Kconfig" source "net/igmp/Kconfig" diff --git a/net/Makefile b/net/Makefile index 4d42b212b5e..a8628c4a9af 100644 --- a/net/Makefile +++ b/net/Makefile @@ -67,6 +67,7 @@ include pkt/Make.defs include local/Make.defs include tcp/Make.defs include udp/Make.defs +include ieee802154/Make.defs include devif/Make.defs include loopback/Make.defs include route/Make.defs diff --git a/net/devif/devif.h b/net/devif/devif.h index 58f7fffa9d9..2251ffcad0e 100644 --- a/net/devif/devif.h +++ b/net/devif/devif.h @@ -1,7 +1,7 @@ /**************************************************************************** * net/devif/devif.h * - * Copyright (C) 2007-2009, 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * This logic was leveraged from uIP which also has a BSD-style license: @@ -296,7 +296,7 @@ void devif_initialize(void); * Configure the pre-allocated callback structures into a free list. * * Assumptions: - * This function is called with interrupts disabled. + * This function must be called with the network locked. * ****************************************************************************/ @@ -314,7 +314,7 @@ void devif_callback_init(void); * callback. * * Assumptions: - * This function is called with the network locked. + * This function must be called with the network locked. * ****************************************************************************/ @@ -336,7 +336,7 @@ FAR struct devif_callback_s * * The callback structure will be freed in any event. * * Assumptions: - * This function is called with the network locked. + * This function must be called with the network locked. * ****************************************************************************/ @@ -360,7 +360,7 @@ void devif_conn_callback_free(FAR struct net_driver_s *dev, * The callback structure will be freed in any event. * * Assumptions: - * This function is called with the network locked. + * This function must be called with the network locked. * ****************************************************************************/ @@ -386,7 +386,7 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev, * The updated flags as modified by the callback functions. * * Assumptions: - * This function is called with the network locked. + * This function must be called with the network locked. * ****************************************************************************/ @@ -411,7 +411,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, FAR void *pvconn, * The updated flags as modified by the callback functions. * * Assumptions: - * This function is called with the network locked. + * This function must be called with the network locked. * ****************************************************************************/ @@ -455,8 +455,7 @@ void devif_send(FAR struct net_driver_s *dev, FAR const void *buf, int len); * in an I/O buffer chain, rather than a flat buffer. * * Assumptions: - * Called from the interrupt level or, at a minimum, with interrupts - * disabled. + * This function must be called with the network locked. * ****************************************************************************/ @@ -478,8 +477,7 @@ void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *buf, * no header on the data. * * Assumptions: - * Called from the interrupt level or, at a minimum, with interrupts - * disabled. + * This function must be called with the network locked. * ****************************************************************************/ diff --git a/net/ieee802154/Kconfig b/net/ieee802154/Kconfig new file mode 100644 index 00000000000..3a317616939 --- /dev/null +++ b/net/ieee802154/Kconfig @@ -0,0 +1,19 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +menu "IEEE802.15-4 Configuration" + +config NET_IEEE802154 + bool "IEEE802.15-4 support" + default n + depends on EXPERIMENTAL + ---help--- + Enable IEEE802.15-4 protocol socket support + +if NET_IEEE802154 + + +endif # NET_IEEE802154 +endmenu # IEEE802.15-4 Configuration diff --git a/net/ieee802154/Make.defs b/net/ieee802154/Make.defs new file mode 100644 index 00000000000..93d849eff71 --- /dev/null +++ b/net/ieee802154/Make.defs @@ -0,0 +1,49 @@ +############################################################################ +# net/ieee802154/Make.defs +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# IEEE802.15-4 support + +ifeq ($(CONFIG_NET_IEEE802154),y) + +# Include IEEE802.15-4 file in the build + +# NET_CSRCS += + +# Include the ieee802154 directory in the build + +DEPPATH += --dep-path ieee802154 +VPATH += :ieee802154 + +endif # CONFIG_NET_IEEE802154 diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index fd6ce96985f..b850dc109fc 100644 --- a/net/netdev/netdev_register.c +++ b/net/netdev/netdev_register.c @@ -194,7 +194,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) switch (lltype) { #ifdef CONFIG_NET_LOOPBACK - case NET_LL_LOOPBACK: /* Local loopback */ + case NET_LL_LOOPBACK: /* Local loopback */ dev->d_llhdrlen = 0; dev->d_mtu = NET_LO_MTU; #ifdef CONFIG_NET_TCP @@ -205,7 +205,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) #endif #ifdef CONFIG_NET_ETHERNET - case NET_LL_ETHERNET: /* Ethernet */ + case NET_LL_ETHERNET: /* Ethernet */ dev->d_llhdrlen = ETH_HDRLEN; dev->d_mtu = CONFIG_NET_ETH_MTU; #ifdef CONFIG_NET_TCP @@ -215,8 +215,14 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) break; #endif +#ifdef CONFIG_NET_IEEE802154 + case NET_LL_IEEE802154: /* IEEE802.15-4 */ + nlldbg("ERROR: IEEE 802.15-4 not yet supported\n"); + return -ENOSYS; +#endif + #ifdef CONFIG_NET_SLIP - case NET_LL_SLIP: /* Serial Line Internet Protocol (SLIP) */ + case NET_LL_SLIP: /* Serial Line Internet Protocol (SLIP) */ dev->d_llhdrlen = 0; dev->d_mtu = CONFIG_NET_SLIP_MTU; #ifdef CONFIG_NET_TCP @@ -227,7 +233,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) #endif #ifdef CONFIG_NET_TUN - case NET_LL_TUN: /* Virtual Network Device (TUN) */ + case NET_LL_TUN: /* Virtual Network Device (TUN) */ dev->d_llhdrlen = 0; dev->d_mtu = CONFIG_NET_TUN_MTU; #ifdef CONFIG_NET_TCP diff --git a/net/pkt/pkt.h b/net/pkt/pkt.h index dc5c3812c4a..295c40b07ed 100644 --- a/net/pkt/pkt.h +++ b/net/pkt/pkt.h @@ -61,7 +61,7 @@ * Public Type Definitions ****************************************************************************/ -/* Representation of a uIP packet socket connection */ +/* Representation of a packet socket connection */ struct devif_callback_s; /* Forward reference */