mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
Squashed commit of the following:
commit 5b7b6e6e616c475c782e9883ada9f4a3b7cb4e2c Author: Gregory Nutt <gnutt@nuttx.org> Date: Sun Aug 20 11:13:17 2017 -0600 IEEE 802.15.4 network device: Make same changes as per loopback device so that it will build with PF_IEEE802154 but without 6LoWPAN. commit d656a98cf8eab2f20e884224b52cd47ec35df4cc Author: Gregory Nutt <gnutt@nuttx.org> Date: Sun Aug 20 10:31:28 2017 -0600 PF_IEEE802154: More fixes to device registration and to IEEE 802.15.4 loopback driver for PF_IEEE802154 without 6LoWPAN. commit 866bb9cbb0c5af79734bbd434c07fa2560b6608f Author: Gregory Nutt <gnutt@nuttx.org> Date: Sun Aug 20 09:58:13 2017 -0600 Network: Reorganize some Kconfig selections. commit 230b4cb48008cba5fccdafa22340df1d43584829 Author: Gregory Nutt <gnutt@nuttx.org> Date: Sun Aug 20 09:19:53 2017 -0600 Changes to conditional compilation so that PF_IEEE802154 can build without 6LoWPAN commit d96cbd6520d40590a740f695c4cd72208ce872da Author: Gregory Nutt <gnutt@nuttx.org> Date: Sun Aug 20 09:17:02 2017 -0600 configs/sim/pf_ieee802154: Disable 6LoWPAN, IPv6, TCP, and UDP. Now things do not build
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
# CONFIG_MMCSD_SPI is not set
|
# CONFIG_MMCSD_SPI is not set
|
||||||
# CONFIG_NET_ETHERNET is not set
|
# CONFIG_NET_ETHERNET is not set
|
||||||
# CONFIG_NET_IPv4 is not set
|
# CONFIG_NET_IPv4 is not set
|
||||||
# CONFIG_NET_UDP_CHECKSUMS is not set
|
|
||||||
# CONFIG_NSH_CMDOPT_DF_H is not set
|
# CONFIG_NSH_CMDOPT_DF_H is not set
|
||||||
# CONFIG_SIM_NETDEV is not set
|
# CONFIG_SIM_NETDEV is not set
|
||||||
CONFIG_ARCH_BOARD_SIM=y
|
CONFIG_ARCH_BOARD_SIM=y
|
||||||
@@ -23,29 +22,10 @@ CONFIG_DEBUG_FEATURES=y
|
|||||||
CONFIG_DEBUG_SYMBOLS=y
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
CONFIG_DISABLE_POLL=y
|
CONFIG_DISABLE_POLL=y
|
||||||
CONFIG_DRIVERS_WIRELESS=y
|
CONFIG_DRIVERS_WIRELESS=y
|
||||||
CONFIG_EXAMPLES_NETTEST_DAEMON_STACKSIZE=4096
|
|
||||||
CONFIG_EXAMPLES_NETTEST_LOOPBACK=y
|
|
||||||
CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO=61616
|
|
||||||
CONFIG_EXAMPLES_NETTEST_SERVERIPv6ADDR_1=0xfe80
|
|
||||||
CONFIG_EXAMPLES_NETTEST_SERVERIPv6ADDR_6=0x00ff
|
|
||||||
CONFIG_EXAMPLES_NETTEST_SERVERIPv6ADDR_7=0xfe00
|
|
||||||
CONFIG_EXAMPLES_NETTEST_SERVERIPv6ADDR_8=0xcda9
|
|
||||||
CONFIG_EXAMPLES_NETTEST_STACKSIZE1=4096
|
|
||||||
CONFIG_EXAMPLES_NETTEST=y
|
|
||||||
CONFIG_EXAMPLES_NSH=y
|
CONFIG_EXAMPLES_NSH=y
|
||||||
CONFIG_EXAMPLES_PFIEEE802154_STACKSIZE1=8192
|
CONFIG_EXAMPLES_PFIEEE802154_STACKSIZE1=8192
|
||||||
CONFIG_EXAMPLES_PFIEEE802154_STACKSIZE2=8192
|
CONFIG_EXAMPLES_PFIEEE802154_STACKSIZE2=8192
|
||||||
CONFIG_EXAMPLES_PFIEEE802154=y
|
CONFIG_EXAMPLES_PFIEEE802154=y
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_1=0xfe80
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_6=0x00ff
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_7=0xfe00
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_8=0x1034
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_STACKSIZE=8192
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_1=0xfe80
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_6=0x00ff
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_7=0xfe00
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_8=0xa9cd
|
|
||||||
CONFIG_EXAMPLES_UDPBLASTER=y
|
|
||||||
CONFIG_EXPERIMENTAL=y
|
CONFIG_EXPERIMENTAL=y
|
||||||
CONFIG_FAT_LCNAMES=y
|
CONFIG_FAT_LCNAMES=y
|
||||||
CONFIG_FAT_LFN=y
|
CONFIG_FAT_LFN=y
|
||||||
@@ -64,24 +44,13 @@ CONFIG_MTD_AT24XX=y
|
|||||||
CONFIG_MTD_AT25=y
|
CONFIG_MTD_AT25=y
|
||||||
CONFIG_MTD_CONFIG=y
|
CONFIG_MTD_CONFIG=y
|
||||||
CONFIG_MTD=y
|
CONFIG_MTD=y
|
||||||
CONFIG_NET_6LOWPAN_TCP_RECVWNDO=102
|
|
||||||
CONFIG_NET_6LOWPAN=y
|
|
||||||
CONFIG_NET_BROADCAST=y
|
|
||||||
CONFIG_NET_HOSTNAME="SAMV71-XULT"
|
CONFIG_NET_HOSTNAME="SAMV71-XULT"
|
||||||
CONFIG_NET_IEEE802154=y
|
CONFIG_NET_IEEE802154=y
|
||||||
CONFIG_NET_IEEE802154_NCONNS=4
|
|
||||||
CONFIG_NET_IPv6=y
|
|
||||||
CONFIG_NET_SOCKOPTS=y
|
CONFIG_NET_SOCKOPTS=y
|
||||||
CONFIG_NET_STATISTICS=y
|
CONFIG_NET_STATISTICS=y
|
||||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
|
||||||
CONFIG_NET_TCP=y
|
|
||||||
CONFIG_NET_TCPBACKLOG=y
|
|
||||||
CONFIG_NET_UDP=y
|
|
||||||
CONFIG_NET=y
|
CONFIG_NET=y
|
||||||
CONFIG_NETDB_DNSCLIENT=y
|
|
||||||
CONFIG_NETDEV_PHY_IOCTL=y
|
CONFIG_NETDEV_PHY_IOCTL=y
|
||||||
CONFIG_NETDEV_STATISTICS=y
|
CONFIG_NETDEV_STATISTICS=y
|
||||||
CONFIG_NETDEV_TELNET=y
|
|
||||||
CONFIG_NETDEVICES=y
|
CONFIG_NETDEVICES=y
|
||||||
CONFIG_NFILE_DESCRIPTORS=8
|
CONFIG_NFILE_DESCRIPTORS=8
|
||||||
CONFIG_NFILE_STREAMS=8
|
CONFIG_NFILE_STREAMS=8
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ struct netdev_statistics_s
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)
|
||||||
/* This structure is used to represent addresses of varying length. This
|
/* This structure is used to represent addresses of varying length. This
|
||||||
* structure is used to represent the address assigned to a radio.
|
* structure is used to represent the address assigned to a radio.
|
||||||
*/
|
*/
|
||||||
@@ -236,7 +236,9 @@ struct net_driver_s
|
|||||||
uint16_t d_recvwndo; /* TCP receive window size */
|
uint16_t d_recvwndo; /* TCP receive window size */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN)
|
#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN) || \
|
||||||
|
defined(CONFIG_NET_IEEE802154)
|
||||||
|
|
||||||
/* Link layer address */
|
/* Link layer address */
|
||||||
|
|
||||||
union
|
union
|
||||||
@@ -251,9 +253,9 @@ struct net_driver_s
|
|||||||
/* The address assigned to an IEEE 802.15.4 or generic packet radio. */
|
/* The address assigned to an IEEE 802.15.4 or generic packet radio. */
|
||||||
|
|
||||||
struct netdev_varaddr_s radio;
|
struct netdev_varaddr_s radio;
|
||||||
#endif /* CONFIG_NET_6LOWPAN */
|
#endif /* CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154 */
|
||||||
} d_mac;
|
} d_mac;
|
||||||
#endif /* CONFIG_NET_ETHERNET || CONFIG_NET_6LOWPAN */
|
#endif /* CONFIG_NET_ETHERNET || CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154 */
|
||||||
|
|
||||||
/* Network identity */
|
/* Network identity */
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)
|
||||||
# include <net/if.h>
|
# include <net/if.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1581,7 +1581,7 @@ union ieee802154_macarg_u
|
|||||||
/* To be determined */ /* MAC802154IOC_MLME_CALIBRATE_REQUEST */
|
/* To be determined */ /* MAC802154IOC_MLME_CALIBRATE_REQUEST */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)
|
||||||
/* For the case of network IOCTLs, the network IOCTL to the MAC network
|
/* For the case of network IOCTLs, the network IOCTL to the MAC network
|
||||||
* driver will include a device name like "wpan0" as the destination of
|
* driver will include a device name like "wpan0" as the destination of
|
||||||
* the IOCTL command.
|
* the IOCTL command.
|
||||||
|
|||||||
+19
-13
@@ -108,7 +108,7 @@ config NET_GUARDSIZE
|
|||||||
|
|
||||||
endmenu # Driver buffer configuration
|
endmenu # Driver buffer configuration
|
||||||
|
|
||||||
menu "Data link support"
|
menu "Link layer support"
|
||||||
|
|
||||||
config NET_USER_DEVFMT
|
config NET_USER_DEVFMT
|
||||||
bool "User provided devfmt"
|
bool "User provided devfmt"
|
||||||
@@ -125,15 +125,10 @@ config NET_ETHERNET
|
|||||||
no need to define anything special in the configuration file to use
|
no need to define anything special in the configuration file to use
|
||||||
Ethernet -- it is the default).
|
Ethernet -- it is the default).
|
||||||
|
|
||||||
config NET_6LOWPAN
|
#menu "IEEE 802.15.4"
|
||||||
bool "6LoWPAN support"
|
# depends on WIRELESS_IEEE802154
|
||||||
default n
|
#
|
||||||
select NETDEV_IOCTL
|
#endmenu # IEEE 802.15.4
|
||||||
select NET_HAVE_STAR
|
|
||||||
depends on NET_IPv6
|
|
||||||
---help---
|
|
||||||
Enable support for Low power Wireless Personal Area Networking (6LoWPAN)
|
|
||||||
for IEEE 802.15.4 or other packet radios.
|
|
||||||
|
|
||||||
config NET_LOOPBACK
|
config NET_LOOPBACK
|
||||||
bool "Local loopback"
|
bool "Local loopback"
|
||||||
@@ -141,7 +136,7 @@ config NET_LOOPBACK
|
|||||||
---help---
|
---help---
|
||||||
Add support for the local network loopback device, lo.
|
Add support for the local network loopback device, lo.
|
||||||
|
|
||||||
config NET_SLIP
|
menuconfig NET_SLIP
|
||||||
bool "SLIP support"
|
bool "SLIP support"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
@@ -186,7 +181,7 @@ config SLIP_DEFPRIO
|
|||||||
|
|
||||||
endif # NET_SLIP
|
endif # NET_SLIP
|
||||||
|
|
||||||
config NET_TUN
|
menuconfig NET_TUN
|
||||||
bool "TUN Virtual Network Device support"
|
bool "TUN Virtual Network Device support"
|
||||||
default n
|
default n
|
||||||
select ARCH_HAVE_NETDEV_STATISTICS
|
select ARCH_HAVE_NETDEV_STATISTICS
|
||||||
@@ -262,13 +257,24 @@ config NET_IPv4
|
|||||||
---help---
|
---help---
|
||||||
Build in support for IPv4.
|
Build in support for IPv4.
|
||||||
|
|
||||||
menuconfig NET_IPv6
|
config NET_IPv6
|
||||||
bool "IPv6"
|
bool "IPv6"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Build in support for IPv6.
|
Build in support for IPv6.
|
||||||
|
|
||||||
source "net/neighbor/Kconfig"
|
source "net/neighbor/Kconfig"
|
||||||
|
|
||||||
|
menuconfig NET_6LOWPAN
|
||||||
|
bool "6LoWPAN support"
|
||||||
|
default n
|
||||||
|
select NETDEV_IOCTL
|
||||||
|
select NET_HAVE_STAR
|
||||||
|
depends on NET_IPv6
|
||||||
|
---help---
|
||||||
|
Enable support for Low power Wireless Personal Area Networking (6LoWPAN)
|
||||||
|
for IEEE 802.15.4 or other packet radios.
|
||||||
|
|
||||||
source "net/sixlowpan/Kconfig"
|
source "net/sixlowpan/Kconfig"
|
||||||
source "net/ipforward/Kconfig"
|
source "net/ipforward/Kconfig"
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ menu "IEEE 802.15.4 socket support"
|
|||||||
config NET_IEEE802154
|
config NET_IEEE802154
|
||||||
bool "IEEE 802.15.4 socket support"
|
bool "IEEE 802.15.4 socket support"
|
||||||
default n
|
default n
|
||||||
depends on NET_IPv6 && WIRELESS_IEEE802154
|
depends on WIRELESS_IEEE802154
|
||||||
select NETDEV_IOCTL
|
select NETDEV_IOCTL
|
||||||
---help---
|
---help---
|
||||||
Enable support for raw, IEEE 802.15.4 sockets.
|
Enable support for raw, IEEE 802.15.4 sockets.
|
||||||
|
|||||||
@@ -76,9 +76,19 @@
|
|||||||
|
|
||||||
#define IEEE802154_MAC_FCSSIZE 2
|
#define IEEE802154_MAC_FCSSIZE 2
|
||||||
|
|
||||||
/* This, then, is the usable size of the frame */
|
/* This, then, is the usable size of the frame...
|
||||||
|
* REVISIT: Too many frame length definitions
|
||||||
|
*/
|
||||||
|
|
||||||
#define IEEE802154_FRAMELEN (CONFIG_NET_IEEE802154_FRAMELEN - IEEE802154_MAC_FCSSIZE)
|
#if defined(CONFIG_NET_6LOWPAN_FRAMELEN)
|
||||||
|
# define IEEE802_MAX_FRAMELEN CONFIG_NET_6LOWPAN_FRAMELEN
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||||
|
# define IEEE802_MAX_FRAMELEN CONFIG_NET_IEEE802154_FRAMELEN
|
||||||
|
#else
|
||||||
|
# define IEEE802_MAX_FRAMELEN IEEE802154_MAC_STDFRAME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define IEEE802154_FRAMELEN (IEEE802_MAX_FRAMELEN - IEEE802154_MAC_FCSSIZE)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Definitions
|
* Public Type Definitions
|
||||||
|
|||||||
@@ -214,13 +214,15 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)
|
||||||
case NET_LL_IEEE802154: /* IEEE 802.15.4 MAC */
|
case NET_LL_IEEE802154: /* IEEE 802.15.4 MAC */
|
||||||
case NET_LL_PKTRADIO: /* Non-IEEE 802.15.4 packet radio */
|
case NET_LL_PKTRADIO: /* Non-IEEE 802.15.4 packet radio */
|
||||||
dev->d_llhdrlen = 0;
|
dev->d_llhdrlen = 0;
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
dev->d_mtu = CONFIG_NET_6LOWPAN_MTU;
|
dev->d_mtu = CONFIG_NET_6LOWPAN_MTU;
|
||||||
#ifdef CONFIG_NET_TCP
|
#ifdef CONFIG_NET_TCP
|
||||||
dev->d_recvwndo = CONFIG_NET_6LOWPAN_TCP_RECVWNDO;
|
dev->d_recvwndo = CONFIG_NET_6LOWPAN_TCP_RECVWNDO;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
devfmt = NETDEV_WPAN_FORMAT;
|
devfmt = NETDEV_WPAN_FORMAT;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+2
-12
@@ -3,8 +3,7 @@
|
|||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
menu "6LoWPAN Configuration"
|
if NET_6LOWPAN
|
||||||
depends on NET_6LOWPAN
|
|
||||||
|
|
||||||
config NET_6LOWPAN_FRAG
|
config NET_6LOWPAN_FRAG
|
||||||
bool "6LoWPAN Fragmentation"
|
bool "6LoWPAN Fragmentation"
|
||||||
@@ -13,15 +12,6 @@ config NET_6LOWPAN_FRAG
|
|||||||
CONFIG_NET_6LOWPAN_FRAG specifies if 6lowpan fragmentation should be
|
CONFIG_NET_6LOWPAN_FRAG specifies if 6lowpan fragmentation should be
|
||||||
used or not. Fragmentation is on by default.
|
used or not. Fragmentation is on by default.
|
||||||
|
|
||||||
config NET_6LOWPAN_FRAMELEN
|
|
||||||
int "Max Radio Frame Size"
|
|
||||||
default 127
|
|
||||||
range 1 999999
|
|
||||||
---help---
|
|
||||||
Wireless devices use a variety of frame sizes. For IEEE 802.15.4
|
|
||||||
radios, this should be 127 bytes. However, some IEEE 802.15.4
|
|
||||||
radios may non-standard frame lengths.
|
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "6LoWPAN Compression"
|
prompt "6LoWPAN Compression"
|
||||||
default NET_6LOWPAN_COMPRESSION_HC06
|
default NET_6LOWPAN_COMPRESSION_HC06
|
||||||
@@ -200,4 +190,4 @@ config NET_6LOWPAN_DUMPBUFFER
|
|||||||
of the 6LoWPAN logic. This will generate a large volume of data if
|
of the 6LoWPAN logic. This will generate a large volume of data if
|
||||||
selected.
|
selected.
|
||||||
|
|
||||||
endmenu # 6LoWPAN Configuration
|
endif # NET_6LOWPAN
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ endif # IEEE802154_MACDEV
|
|||||||
config IEEE802154_NETDEV
|
config IEEE802154_NETDEV
|
||||||
bool "IEEE802154 6LoWPAN Network Device"
|
bool "IEEE802154 6LoWPAN Network Device"
|
||||||
default n
|
default n
|
||||||
depends on NET_6LOWPAN && NET_IPv6
|
depends on NET_6LOWPAN || NET_IEEE802154
|
||||||
select ARCH_HAVE_NETDEV_STATISTICS
|
select ARCH_HAVE_NETDEV_STATISTICS
|
||||||
---help---
|
---help---
|
||||||
Add support for the IEEE802.15.4 6LoWPAN network device built on
|
Add support for the IEEE802.15.4 6LoWPAN network device built on
|
||||||
@@ -224,7 +224,7 @@ endif # IEEE802154_NETDEV
|
|||||||
config IEEE802154_LOOPBACK
|
config IEEE802154_LOOPBACK
|
||||||
bool "IEEE802154 6LoWPAN Loopback"
|
bool "IEEE802154 6LoWPAN Loopback"
|
||||||
default n
|
default n
|
||||||
depends on NET_6LOWPAN && NET_IPv6
|
depends on NET_6LOWPAN || NET_IEEE802154
|
||||||
select ARCH_HAVE_NETDEV_STATISTICS
|
select ARCH_HAVE_NETDEV_STATISTICS
|
||||||
---help---
|
---help---
|
||||||
Add support for the IEEE802.15.4 6LoWPAN Loopback test device.
|
Add support for the IEEE802.15.4 6LoWPAN Loopback test device.
|
||||||
|
|||||||
@@ -80,6 +80,26 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Preferred address size */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||||
|
# define LO_ADDRSIZE IEEE802154_EADDRSIZE
|
||||||
|
#else
|
||||||
|
# define LO_ADDRSIZE IEEE802154_SADDRSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Frame size
|
||||||
|
* REVISIT: Too many frame length definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET_6LOWPAN_FRAMELEN)
|
||||||
|
# define LO_FRAMELEN CONFIG_NET_6LOWPAN_FRAMELEN
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||||
|
# define LO_FRAMELEN CONFIG_NET_IEEE802154_FRAMELEN
|
||||||
|
#else
|
||||||
|
# define LO_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
||||||
|
|
||||||
#define LO_WDDELAY (1*CLK_TCK)
|
#define LO_WDDELAY (1*CLK_TCK)
|
||||||
@@ -116,7 +136,9 @@ struct lo_driver_s
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static struct lo_driver_s g_loopback;
|
static struct lo_driver_s g_loopback;
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
static uint8_t g_iobuffer[CONFIG_NET_6LOWPAN_MTU + CONFIG_NET_GUARDSIZE];
|
static uint8_t g_iobuffer[CONFIG_NET_6LOWPAN_MTU + CONFIG_NET_GUARDSIZE];
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t g_eaddr[IEEE802154_EADDRSIZE] =
|
static uint8_t g_eaddr[IEEE802154_EADDRSIZE] =
|
||||||
{
|
{
|
||||||
@@ -193,9 +215,10 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
|
|||||||
{
|
{
|
||||||
/* Set the MAC address as the eaddr */
|
/* Set the MAC address as the eaddr */
|
||||||
|
|
||||||
dev->d_mac.radio.nv_addrlen = NET_6LOWPAN_EADDRSIZE;
|
dev->d_mac.radio.nv_addrlen = IEEE802154_EADDRSIZE;
|
||||||
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr, g_eaddr);
|
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr, g_eaddr);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
/* Set the IP address based on the eaddr */
|
/* Set the IP address based on the eaddr */
|
||||||
|
|
||||||
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
||||||
@@ -208,14 +231,16 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6addr[7] = (uint16_t)g_eaddr[6] << 8 | (uint16_t)g_eaddr[7];
|
dev->d_ipv6addr[7] = (uint16_t)g_eaddr[6] << 8 | (uint16_t)g_eaddr[7];
|
||||||
dev->d_ipv6addr[4] ^= 0x200;
|
dev->d_ipv6addr[4] ^= 0x200;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
static void lo_addr2ip(FAR struct net_driver_s *dev)
|
static void lo_addr2ip(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
/* Set the MAC address as the saddr */
|
/* Set the MAC address as the saddr */
|
||||||
|
|
||||||
dev->d_mac.radio.nv_addrlen = NET_6LOWPAN_SADDRSIZE;
|
dev->d_mac.radio.nv_addrlen = IEEE802154_SADDRSIZE;
|
||||||
IEEE802154_SADDRCOPY(dev->d_mac.radio.nv_addr, g_saddr);
|
IEEE802154_SADDRCOPY(dev->d_mac.radio.nv_addr, g_saddr);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
/* Set the IP address based on the saddr */
|
/* Set the IP address based on the saddr */
|
||||||
|
|
||||||
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
||||||
@@ -227,6 +252,7 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
||||||
dev->d_ipv6addr[7] = (uint16_t)g_saddr[0] << 8 | (uint16_t)g_saddr[1];
|
dev->d_ipv6addr[7] = (uint16_t)g_saddr[0] << 8 | (uint16_t)g_saddr[1];
|
||||||
dev->d_ipv6addr[7] ^= 0x200;
|
dev->d_ipv6addr[7] ^= 0x200;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -246,6 +272,7 @@ static void lo_addr2ip(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
static inline void lo_netmask(FAR struct net_driver_s *dev)
|
static inline void lo_netmask(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
dev->d_ipv6netmask[0] = 0xffff;
|
dev->d_ipv6netmask[0] = 0xffff;
|
||||||
dev->d_ipv6netmask[1] = 0xffff;
|
dev->d_ipv6netmask[1] = 0xffff;
|
||||||
dev->d_ipv6netmask[2] = 0xffff;
|
dev->d_ipv6netmask[2] = 0xffff;
|
||||||
@@ -261,6 +288,7 @@ static inline void lo_netmask(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6netmask[6] = 0xffff;
|
dev->d_ipv6netmask[6] = 0xffff;
|
||||||
dev->d_ipv6netmask[7] = 0;
|
dev->d_ipv6netmask[7] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -496,11 +524,11 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
|||||||
{
|
{
|
||||||
FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)dev->d_private;
|
FAR struct lo_driver_s *priv = (FAR struct lo_driver_s *)dev->d_private;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
ninfo("Bringing up: IPv6 %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
ninfo("Bringing up: IPv6 %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
||||||
dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
|
dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
|
||||||
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
||||||
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||||
ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
|
ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
|
||||||
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||||
@@ -513,6 +541,27 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
|||||||
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||||
priv->lo_panid[0], priv->lo_panid[1]);
|
priv->lo_panid[0], priv->lo_panid[1]);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
if (dev->d_mac.radio.nv_addrlen == 8)
|
||||||
|
{
|
||||||
|
ninfo("Bringing up: Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
|
||||||
|
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||||
|
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
|
||||||
|
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5],
|
||||||
|
dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7],
|
||||||
|
priv->lo_panid[0], priv->lo_panid[1]);
|
||||||
|
}
|
||||||
|
else if (dev->d_mac.radio.nv_addrlen == 2)
|
||||||
|
{
|
||||||
|
ninfo("Bringing up: Node: %02x:%02x PANID=%02x:%02x\n",
|
||||||
|
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||||
|
priv->lo_panid[0], priv->lo_panid[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nerr("ERROR: No address assigned\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set and activate a timer process */
|
/* Set and activate a timer process */
|
||||||
|
|
||||||
@@ -934,8 +983,8 @@ static int lo_properties(FAR struct radio_driver_s *netdev,
|
|||||||
|
|
||||||
/* General */
|
/* General */
|
||||||
|
|
||||||
properties->sp_addrlen = NET_6LOWPAN_ADDRSIZE; /* Length of an address */
|
properties->sp_addrlen = LO_ADDRSIZE; /* Length of an address */
|
||||||
properties->sp_pktlen = CONFIG_NET_6LOWPAN_FRAMELEN; /* Fixed frame length */
|
properties->sp_pktlen = LO_FRAMELEN; /* Fixed frame length */
|
||||||
|
|
||||||
/* Multicast address (uses broadcast address)
|
/* Multicast address (uses broadcast address)
|
||||||
*
|
*
|
||||||
@@ -952,12 +1001,12 @@ static int lo_properties(FAR struct radio_driver_s *netdev,
|
|||||||
* (qualified by the destination PANID).
|
* (qualified by the destination PANID).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
properties->sp_mcast.nv_addrlen = NET_6LOWPAN_SADDRSIZE;
|
properties->sp_mcast.nv_addrlen = IEEE802154_SADDRSIZE;
|
||||||
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
||||||
|
|
||||||
/* Broadcast address */
|
/* Broadcast address */
|
||||||
|
|
||||||
properties->sp_bcast.nv_addrlen = NET_6LOWPAN_SADDRSIZE;
|
properties->sp_bcast.nv_addrlen = IEEE802154_SADDRSIZE;
|
||||||
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STARPOINT
|
#ifdef CONFIG_NET_STARPOINT
|
||||||
@@ -1015,7 +1064,9 @@ int ieee8021514_loopback(void)
|
|||||||
#ifdef CONFIG_NETDEV_IOCTL
|
#ifdef CONFIG_NETDEV_IOCTL
|
||||||
dev->d_ioctl = lo_ioctl; /* Handle network IOCTL commands */
|
dev->d_ioctl = lo_ioctl; /* Handle network IOCTL commands */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
dev->d_buf = g_iobuffer; /* Attach the IO buffer */
|
dev->d_buf = g_iobuffer; /* Attach the IO buffer */
|
||||||
|
#endif
|
||||||
dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */
|
dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */
|
||||||
|
|
||||||
/* Set the network mask and advertise our MAC-based IP address */
|
/* Set the network mask and advertise our MAC-based IP address */
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
#include "mac802154.h"
|
#include "mac802154.h"
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -97,6 +97,26 @@
|
|||||||
# define CONFIG_IEEE802154_NETDEV_NINTERFACES 1
|
# define CONFIG_IEEE802154_NETDEV_NINTERFACES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Preferred address size */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||||
|
# define MACNET_ADDRSIZE IEEE802154_EADDRSIZE
|
||||||
|
#else
|
||||||
|
# define MACNET_ADDRSIZE IEEE802154_SADDRSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Frame size
|
||||||
|
* REVISIT: Too many frame length definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET_6LOWPAN_FRAMELEN)
|
||||||
|
# define MACNET_FRAMELEN CONFIG_NET_6LOWPAN_FRAMELEN
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||||
|
# define MACNET_FRAMELEN CONFIG_NET_IEEE802154_FRAMELEN
|
||||||
|
#else
|
||||||
|
# define MACNET_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
||||||
|
|
||||||
#define TXPOLL_WDDELAY (1*CLK_TCK)
|
#define TXPOLL_WDDELAY (1*CLK_TCK)
|
||||||
@@ -252,8 +272,9 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
eaddr = arg.getreq.attrval.mac.eaddr;
|
eaddr = arg.getreq.attrval.mac.eaddr;
|
||||||
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr, eaddr);
|
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr, eaddr);
|
||||||
dev->d_mac.radio.nv_addrlen = NET_6LOWPAN_EADDRSIZE;
|
dev->d_mac.radio.nv_addrlen = IEEE802154_EADDRSIZE;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
/* Set the IP address based on the eaddr */
|
/* Set the IP address based on the eaddr */
|
||||||
|
|
||||||
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
||||||
@@ -265,6 +286,7 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6addr[6] = (uint16_t)eaddr[4] << 8 | (uint16_t)eaddr[5];
|
dev->d_ipv6addr[6] = (uint16_t)eaddr[4] << 8 | (uint16_t)eaddr[5];
|
||||||
dev->d_ipv6addr[7] = (uint16_t)eaddr[6] << 8 | (uint16_t)eaddr[7];
|
dev->d_ipv6addr[7] = (uint16_t)eaddr[6] << 8 | (uint16_t)eaddr[7];
|
||||||
dev->d_ipv6addr[4] ^= 0x200;
|
dev->d_ipv6addr[4] ^= 0x200;
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,8 +312,9 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
saddr = arg.getreq.attrval.mac.saddr;
|
saddr = arg.getreq.attrval.mac.saddr;
|
||||||
IEEE802154_SADDRCOPY(dev->d_mac.radio.nv_addr, saddr);
|
IEEE802154_SADDRCOPY(dev->d_mac.radio.nv_addr, saddr);
|
||||||
dev->d_mac.radio.nv_addrlen = NET_6LOWPAN_SADDRSIZE;
|
dev->d_mac.radio.nv_addrlen = IEEE802154_SADDRSIZE;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
/* Set the IP address based on the saddr */
|
/* Set the IP address based on the saddr */
|
||||||
|
|
||||||
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
dev->d_ipv6addr[0] = HTONS(0xfe80);
|
||||||
@@ -303,6 +326,7 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
||||||
dev->d_ipv6addr[7] = (uint16_t)saddr[0] << 8 | (uint16_t)saddr[1];
|
dev->d_ipv6addr[7] = (uint16_t)saddr[0] << 8 | (uint16_t)saddr[1];
|
||||||
dev->d_ipv6addr[7] ^= 0x200;
|
dev->d_ipv6addr[7] ^= 0x200;
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -324,6 +348,7 @@ static int macnet_advertise(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
static inline void macnet_netmask(FAR struct net_driver_s *dev)
|
static inline void macnet_netmask(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
dev->d_ipv6netmask[0] = 0xffff;
|
dev->d_ipv6netmask[0] = 0xffff;
|
||||||
dev->d_ipv6netmask[1] = 0xffff;
|
dev->d_ipv6netmask[1] = 0xffff;
|
||||||
dev->d_ipv6netmask[2] = 0xffff;
|
dev->d_ipv6netmask[2] = 0xffff;
|
||||||
@@ -339,6 +364,7 @@ static inline void macnet_netmask(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6netmask[6] = 0xffff;
|
dev->d_ipv6netmask[6] = 0xffff;
|
||||||
dev->d_ipv6netmask[7] = 0;
|
dev->d_ipv6netmask[7] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -395,6 +421,7 @@ static int macnet_rxframe(FAR struct mac802154_maccb_s *maccb,
|
|||||||
(FAR struct macnet_callback_s *)maccb;
|
(FAR struct macnet_callback_s *)maccb;
|
||||||
FAR struct macnet_driver_s *priv;
|
FAR struct macnet_driver_s *priv;
|
||||||
FAR struct iob_s *iob;
|
FAR struct iob_s *iob;
|
||||||
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT(cb != NULL && cb->mc_priv != NULL);
|
DEBUGASSERT(cb != NULL && cb->mc_priv != NULL);
|
||||||
priv = cb->mc_priv;
|
priv = cb->mc_priv;
|
||||||
@@ -412,24 +439,6 @@ static int macnet_rxframe(FAR struct mac802154_maccb_s *maccb,
|
|||||||
DEBUGASSERT(priv != NULL && ind != NULL && ind->frame != NULL);
|
DEBUGASSERT(priv != NULL && ind != NULL && ind->frame != NULL);
|
||||||
iob = ind->frame;
|
iob = ind->frame;
|
||||||
|
|
||||||
/* If the frame is not a 6LoWPAN frame, then return an error. The first
|
|
||||||
* byte following the MAC head at the io_offset should be a valid IPHC
|
|
||||||
* header.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((iob->io_data[iob->io_offset] & SIXLOWPAN_DISPATCH_NALP_MASK) ==
|
|
||||||
SIXLOWPAN_DISPATCH_NALP)
|
|
||||||
{
|
|
||||||
wlwarn("WARNING: Dropped... Not a 6LoWPAN frame: %02x\n",
|
|
||||||
iob->io_data[iob->io_offset]);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Increment statistics */
|
|
||||||
|
|
||||||
NETDEV_RXPACKETS(&priv->md_dev.r_dev);
|
|
||||||
NETDEV_RXIPV6(&priv->md_dev.r_dev);
|
|
||||||
|
|
||||||
/* Remove the IOB containing the frame. */
|
/* Remove the IOB containing the frame. */
|
||||||
|
|
||||||
ind->frame = NULL;
|
ind->frame = NULL;
|
||||||
@@ -442,17 +451,40 @@ static int macnet_rxframe(FAR struct mac802154_maccb_s *maccb,
|
|||||||
* frame and return success.
|
* frame and return success.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_NET_6LOWPAN
|
ret = ieee802154_input(&priv->md_dev, iob, (FAR void *)ind);
|
||||||
(void)ieee802154_input(&priv->md_dev, iob, (FAR void *)ind);
|
if (ret < 0)
|
||||||
#else
|
|
||||||
if (ieee802154_input(&priv->md_dev, iob, (FAR void *)ind) < 0)
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
{
|
{
|
||||||
(void)sixlowpan_input(&priv->md_dev, iob, (FAR void *)ind);
|
/* If the frame is not a 6LoWPAN frame, then return an error. The
|
||||||
|
* first byte following the MAC head at the io_offset should be a
|
||||||
|
* valid IPHC header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((iob->io_data[iob->io_offset] & SIXLOWPAN_DISPATCH_NALP_MASK) ==
|
||||||
|
SIXLOWPAN_DISPATCH_NALP)
|
||||||
|
{
|
||||||
|
wlwarn("WARNING: Dropped... Not a 6LoWPAN frame: %02x\n",
|
||||||
|
iob->io_data[iob->io_offset]);
|
||||||
|
ret = -EINVAL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = sixlowpan_input(&priv->md_dev, iob, (FAR void *)ind);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
ind->frame = iob;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Increment statistics */
|
||||||
|
|
||||||
|
NETDEV_RXPACKETS(&priv->md_dev.r_dev);
|
||||||
|
NETDEV_RXIPV6(&priv->md_dev.r_dev);
|
||||||
|
|
||||||
/* sixlowpan_input() will free the IOB, but we must free the struct
|
/* sixlowpan_input() will free the IOB, but we must free the struct
|
||||||
* ieee802154_data_ind_s container here.
|
* ieee802154_data_ind_s container here.
|
||||||
@@ -676,6 +708,7 @@ static int macnet_ifup(FAR struct net_driver_s *dev)
|
|||||||
ret = macnet_advertise(dev);
|
ret = macnet_advertise(dev);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
wlinfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
wlinfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
||||||
dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
|
dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
|
||||||
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
||||||
@@ -691,6 +724,27 @@ static int macnet_ifup(FAR struct net_driver_s *dev)
|
|||||||
wlinfo(" Node: %02x:%02x\n",
|
wlinfo(" Node: %02x:%02x\n",
|
||||||
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1]);
|
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1]);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
if (dev->d_mac.radio.nv_addrlen == 8)
|
||||||
|
{
|
||||||
|
ninfo("Bringing up: Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
|
||||||
|
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||||
|
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
|
||||||
|
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5],
|
||||||
|
dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7],
|
||||||
|
priv->lo_panid[0], priv->lo_panid[1]);
|
||||||
|
}
|
||||||
|
else if (dev->d_mac.radio.nv_addrlen == 2)
|
||||||
|
{
|
||||||
|
ninfo("Bringing up: Node: %02x:%02x PANID=%02x:%02x\n",
|
||||||
|
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
|
||||||
|
priv->lo_panid[0], priv->lo_panid[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nerr("ERROR: No address assigned\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set and activate a timer process */
|
/* Set and activate a timer process */
|
||||||
|
|
||||||
@@ -1081,8 +1135,8 @@ static int macnet_properties(FAR struct radio_driver_s *netdev,
|
|||||||
|
|
||||||
/* General */
|
/* General */
|
||||||
|
|
||||||
properties->sp_addrlen = NET_6LOWPAN_ADDRSIZE; /* Length of an address */
|
properties->sp_addrlen = MACNET_ADDRSIZE; /* Length of an address */
|
||||||
properties->sp_pktlen = CONFIG_NET_6LOWPAN_FRAMELEN; /* Fixed frame length */
|
properties->sp_pktlen = MACNET_FRAMELEN; /* Fixed frame length */
|
||||||
|
|
||||||
/* Multicast address (uses broadcast address)
|
/* Multicast address (uses broadcast address)
|
||||||
*
|
*
|
||||||
@@ -1099,12 +1153,12 @@ static int macnet_properties(FAR struct radio_driver_s *netdev,
|
|||||||
* (qualified by the destination PANID).
|
* (qualified by the destination PANID).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
properties->sp_mcast.nv_addrlen = NET_6LOWPAN_SADDRSIZE;
|
properties->sp_mcast.nv_addrlen = IEEE802154_SADDRSIZE;
|
||||||
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
||||||
|
|
||||||
/* Broadcast address */
|
/* Broadcast address */
|
||||||
|
|
||||||
properties->sp_bcast.nv_addrlen = NET_6LOWPAN_SADDRSIZE;
|
properties->sp_bcast.nv_addrlen = IEEE802154_SADDRSIZE;
|
||||||
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
memset(properties->sp_mcast.nv_addr, 0xff, RADIO_MAX_ADDRLEN);
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STARPOINT
|
#ifdef CONFIG_NET_STARPOINT
|
||||||
@@ -1116,10 +1170,10 @@ static int macnet_properties(FAR struct radio_driver_s *netdev,
|
|||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||||
(void)macnet_coord_eaddr(netdev, properties->sp_hubnode.nv_addr);
|
(void)macnet_coord_eaddr(netdev, properties->sp_hubnode.nv_addr);
|
||||||
properties->sp_hubnode.nv_addrlen = NET_6LOWPAN_EADDRSIZE;
|
properties->sp_hubnode.nv_addrlen = IEEE802154_EADDRSIZE;
|
||||||
#else
|
#else
|
||||||
(void)macnet_coord_saddr(netdev, properties->sp_hubnode.nv_addr);
|
(void)macnet_coord_saddr(netdev, properties->sp_hubnode.nv_addr);
|
||||||
properties->sp_hubnode.nv_addrlen = NET_6LOWPAN_SADDRSIZE;
|
properties->sp_hubnode.nv_addrlen = IEEE802154_SADDRSIZE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1152,7 +1206,9 @@ int mac802154netdev_register(MACHANDLE mac)
|
|||||||
FAR struct radio_driver_s *radio;
|
FAR struct radio_driver_s *radio;
|
||||||
FAR struct net_driver_s *dev;
|
FAR struct net_driver_s *dev;
|
||||||
FAR struct mac802154_maccb_s *maccb;
|
FAR struct mac802154_maccb_s *maccb;
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
FAR uint8_t *pktbuf;
|
FAR uint8_t *pktbuf;
|
||||||
|
#endif
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT(mac != NULL);
|
DEBUGASSERT(mac != NULL);
|
||||||
@@ -1168,7 +1224,8 @@ int mac802154netdev_register(MACHANDLE mac)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a packet buffer (not used by this driver, but need by the
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
|
/* Allocate a packet buffer (not used by this driver, but needed by the
|
||||||
* upper networking layer)
|
* upper networking layer)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1179,12 +1236,15 @@ int mac802154netdev_register(MACHANDLE mac)
|
|||||||
kmm_free(priv);
|
kmm_free(priv);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize the driver structure */
|
/* Initialize the driver structure */
|
||||||
|
|
||||||
radio = &priv->md_dev;
|
radio = &priv->md_dev;
|
||||||
dev = &radio->r_dev;
|
dev = &radio->r_dev;
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
dev->d_buf = pktbuf; /* Single packet buffer */
|
dev->d_buf = pktbuf; /* Single packet buffer */
|
||||||
|
#endif
|
||||||
dev->d_ifup = macnet_ifup; /* I/F up (new IP address) callback */
|
dev->d_ifup = macnet_ifup; /* I/F up (new IP address) callback */
|
||||||
dev->d_ifdown = macnet_ifdown; /* I/F down callback */
|
dev->d_ifdown = macnet_ifdown; /* I/F down callback */
|
||||||
dev->d_txavail = macnet_txavail; /* New TX data callback */
|
dev->d_txavail = macnet_txavail; /* New TX data callback */
|
||||||
@@ -1237,7 +1297,9 @@ int mac802154netdev_register(MACHANDLE mac)
|
|||||||
|
|
||||||
/* Free memory and return the error */
|
/* Free memory and return the error */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
kmm_free(pktbuf);
|
kmm_free(pktbuf);
|
||||||
|
#endif
|
||||||
kmm_free(priv);
|
kmm_free(priv);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user