net/: IEEE 802.15-4 basic build build structure.

This commit is contained in:
Gregory Nutt 2016-02-25 10:43:51 -06:00
parent 1ed1765e1a
commit e4e6181098
10 changed files with 94 additions and 18 deletions

View File

@ -68,7 +68,8 @@
* in the first 6-bytes of the sockaddr sa_data array. * 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 * Public Types

View File

@ -79,6 +79,7 @@ enum net_lltype_e
NET_LL_LOOPBACK, /* Local loopback */ NET_LL_LOOPBACK, /* Local loopback */
NET_LL_SLIP, /* Serial Line Internet Protocol (SLIP) */ NET_LL_SLIP, /* Serial Line Internet Protocol (SLIP) */
NET_LL_TUN, /* TUN Virtual Network Device */ 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 */ /* This defines a bitmap big enough for one bit for each socket option */

View File

@ -64,7 +64,7 @@
#define PF_ATMPVC 8 /* Access to raw ATM PVCs */ #define PF_ATMPVC 8 /* Access to raw ATM PVCs */
#define PF_APPLETALK 9 /* Appletalk */ #define PF_APPLETALK 9 /* Appletalk */
#define PF_PACKET 10 /* Low level packet interface */ #define PF_PACKET 10 /* Low level packet interface */
#define PF_IEEE802154 11 /* IEEE802154 sockets */ #define PF_IEEE802154 11 /* IEEE802.15-4 sockets */
/* Address families */ /* Address families */

View File

@ -269,6 +269,7 @@ source "net/pkt/Kconfig"
source "net/local/Kconfig" source "net/local/Kconfig"
source "net/tcp/Kconfig" source "net/tcp/Kconfig"
source "net/udp/Kconfig" source "net/udp/Kconfig"
source "net/ieee802154/Kconfig"
source "net/icmp/Kconfig" source "net/icmp/Kconfig"
source "net/icmpv6/Kconfig" source "net/icmpv6/Kconfig"
source "net/igmp/Kconfig" source "net/igmp/Kconfig"

View File

@ -67,6 +67,7 @@ include pkt/Make.defs
include local/Make.defs include local/Make.defs
include tcp/Make.defs include tcp/Make.defs
include udp/Make.defs include udp/Make.defs
include ieee802154/Make.defs
include devif/Make.defs include devif/Make.defs
include loopback/Make.defs include loopback/Make.defs
include route/Make.defs include route/Make.defs

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* net/devif/devif.h * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* This logic was leveraged from uIP which also has a BSD-style license: * 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. * Configure the pre-allocated callback structures into a free list.
* *
* Assumptions: * 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. * callback.
* *
* Assumptions: * 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. * The callback structure will be freed in any event.
* *
* Assumptions: * 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. * The callback structure will be freed in any event.
* *
* Assumptions: * 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. * The updated flags as modified by the callback functions.
* *
* Assumptions: * 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. * The updated flags as modified by the callback functions.
* *
* Assumptions: * 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. * in an I/O buffer chain, rather than a flat buffer.
* *
* Assumptions: * Assumptions:
* Called from the interrupt level or, at a minimum, with interrupts * This function must be called with the network locked.
* disabled.
* *
****************************************************************************/ ****************************************************************************/
@ -478,8 +477,7 @@ void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *buf,
* no header on the data. * no header on the data.
* *
* Assumptions: * Assumptions:
* Called from the interrupt level or, at a minimum, with interrupts * This function must be called with the network locked.
* disabled.
* *
****************************************************************************/ ****************************************************************************/

19
net/ieee802154/Kconfig Normal file
View File

@ -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

49
net/ieee802154/Make.defs Normal file
View File

@ -0,0 +1,49 @@
############################################################################
# net/ieee802154/Make.defs
#
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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

View File

@ -194,7 +194,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
switch (lltype) switch (lltype)
{ {
#ifdef CONFIG_NET_LOOPBACK #ifdef CONFIG_NET_LOOPBACK
case NET_LL_LOOPBACK: /* Local loopback */ case NET_LL_LOOPBACK: /* Local loopback */
dev->d_llhdrlen = 0; dev->d_llhdrlen = 0;
dev->d_mtu = NET_LO_MTU; dev->d_mtu = NET_LO_MTU;
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
@ -205,7 +205,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
#endif #endif
#ifdef CONFIG_NET_ETHERNET #ifdef CONFIG_NET_ETHERNET
case NET_LL_ETHERNET: /* Ethernet */ case NET_LL_ETHERNET: /* Ethernet */
dev->d_llhdrlen = ETH_HDRLEN; dev->d_llhdrlen = ETH_HDRLEN;
dev->d_mtu = CONFIG_NET_ETH_MTU; dev->d_mtu = CONFIG_NET_ETH_MTU;
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
@ -215,8 +215,14 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
break; break;
#endif #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 #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_llhdrlen = 0;
dev->d_mtu = CONFIG_NET_SLIP_MTU; dev->d_mtu = CONFIG_NET_SLIP_MTU;
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
@ -227,7 +233,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
#endif #endif
#ifdef CONFIG_NET_TUN #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_llhdrlen = 0;
dev->d_mtu = CONFIG_NET_TUN_MTU; dev->d_mtu = CONFIG_NET_TUN_MTU;
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP

View File

@ -61,7 +61,7 @@
* Public Type Definitions * Public Type Definitions
****************************************************************************/ ****************************************************************************/
/* Representation of a uIP packet socket connection */ /* Representation of a packet socket connection */
struct devif_callback_s; /* Forward reference */ struct devif_callback_s; /* Forward reference */