Merged nuttx/nuttx into master

This commit is contained in:
Masayuki Ishikawa
2017-04-20 16:09:09 +09:00
17 changed files with 393 additions and 99 deletions
+1 -1
View File
@@ -1481,7 +1481,7 @@ struct abc_s
</p> </p>
</font> </font>
<p> <p>
<b>Correct</b> <b>Preferred</b>
</p> </p>
<pre> <pre>
struct abc_s struct abc_s
+95 -2
View File
@@ -86,6 +86,7 @@
#include "cache.h" #include "cache.h"
#include "chip/sam_pinmap.h" #include "chip/sam_pinmap.h"
#include "chip/sam_chipid.h"
#include "sam_gpio.h" #include "sam_gpio.h"
#include "sam_periphclks.h" #include "sam_periphclks.h"
#include "sam_ethernet.h" #include "sam_ethernet.h"
@@ -331,7 +332,19 @@
#define EMAC_QUEUE_0 0 #define EMAC_QUEUE_0 0
#define EMAC_QUEUE_1 1 #define EMAC_QUEUE_1 1
#define EMAC_QUEUE_2 2 #define EMAC_QUEUE_2 2
#define EMAC_NQUEUES 3
#if defined(CONFIG_ARCH_CHIP_SAMV71)
/* After chip version 1, the SAMV71 increased from 3 to 6 queue */
# define EMAC_QUEUE_3 3
# define EMAC_QUEUE_4 4
# define EMAC_QUEUE_5 5
# define EMAC_NQUEUES (g_emac_nqueues)
# define EMAC_MAX_NQUEUES 6
#else
# define EMAC_NQUEUES 3
# define EMAC_MAX_NQUEUES 3
#endif
/* Interrupt settings */ /* Interrupt settings */
@@ -537,7 +550,7 @@ struct sam_emac_s
/* Transfer queues */ /* Transfer queues */
struct sam_queue_s xfrq[EMAC_NQUEUES]; struct sam_queue_s xfrq[EMAC_MAX_NQUEUES];
/* Debug stuff */ /* Debug stuff */
@@ -924,6 +937,16 @@ static uint8_t g_pktbuf1[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
/* EMAC1 peripheral state */ /* EMAC1 peripheral state */
static struct sam_emac_s g_emac1; static struct sam_emac_s g_emac1;
#endif /* CONFIG_SAMV7_EMAC1 */
/* The SAMV71 may support from 3 to 6 queue, depending upon the chip
* revision. NOTE that this is a global setting and applies to both
* EMAC peripherals.
*/
#if defined(CONFIG_ARCH_CHIP_SAMV71)
static uint8_t g_emac_nqueues = 3;
#endif #endif
/**************************************************************************** /****************************************************************************
@@ -2677,6 +2700,16 @@ static int sam_ifup(struct net_driver_s *dev)
sam_emac_configure(priv); sam_emac_configure(priv);
sam_queue_configure(priv, EMAC_QUEUE_1); sam_queue_configure(priv, EMAC_QUEUE_1);
sam_queue_configure(priv, EMAC_QUEUE_2); sam_queue_configure(priv, EMAC_QUEUE_2);
#if defined(CONFIG_ARCH_CHIP_SAMV71)
if (g_emac_nqueues > 3)
{
sam_queue_configure(priv, EMAC_QUEUE_3);
sam_queue_configure(priv, EMAC_QUEUE_4);
sam_queue_configure(priv, EMAC_QUEUE_5);
}
#endif
sam_queue0_configure(priv); sam_queue0_configure(priv);
/* Set the MAC address (should have been configured while we were down) */ /* Set the MAC address (should have been configured while we were down) */
@@ -4540,10 +4573,28 @@ static void sam_emac_reset(struct sam_emac_s *priv)
sam_rxreset(priv, EMAC_QUEUE_1); sam_rxreset(priv, EMAC_QUEUE_1);
sam_rxreset(priv, EMAC_QUEUE_2); sam_rxreset(priv, EMAC_QUEUE_2);
#if defined(CONFIG_ARCH_CHIP_SAMV71)
if (g_emac_nqueues > 3)
{
sam_rxreset(priv, EMAC_QUEUE_3);
sam_rxreset(priv, EMAC_QUEUE_4);
sam_rxreset(priv, EMAC_QUEUE_5);
}
#endif
sam_txreset(priv, EMAC_QUEUE_0); sam_txreset(priv, EMAC_QUEUE_0);
sam_txreset(priv, EMAC_QUEUE_1); sam_txreset(priv, EMAC_QUEUE_1);
sam_txreset(priv, EMAC_QUEUE_2); sam_txreset(priv, EMAC_QUEUE_2);
#if defined(CONFIG_ARCH_CHIP_SAMV71)
if (g_emac_nqueues > 3)
{
sam_txreset(priv, EMAC_QUEUE_3);
sam_txreset(priv, EMAC_QUEUE_4);
sam_txreset(priv, EMAC_QUEUE_5);
}
#endif
/* Disable Rx and Tx, plus the statistics registers. */ /* Disable Rx and Tx, plus the statistics registers. */
regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET); regval = sam_getreg(priv, SAM_EMAC_NCR_OFFSET);
@@ -4561,10 +4612,28 @@ static void sam_emac_reset(struct sam_emac_s *priv)
sam_rxreset(priv, EMAC_QUEUE_1); sam_rxreset(priv, EMAC_QUEUE_1);
sam_rxreset(priv, EMAC_QUEUE_2); sam_rxreset(priv, EMAC_QUEUE_2);
#if defined(CONFIG_ARCH_CHIP_SAMV71)
if (g_emac_nqueues > 3)
{
sam_rxreset(priv, EMAC_QUEUE_3);
sam_rxreset(priv, EMAC_QUEUE_4);
sam_rxreset(priv, EMAC_QUEUE_5);
}
#endif
sam_txreset(priv, EMAC_QUEUE_0); sam_txreset(priv, EMAC_QUEUE_0);
sam_txreset(priv, EMAC_QUEUE_1); sam_txreset(priv, EMAC_QUEUE_1);
sam_txreset(priv, EMAC_QUEUE_2); sam_txreset(priv, EMAC_QUEUE_2);
#if defined(CONFIG_ARCH_CHIP_SAMV71)
if (g_emac_nqueues > 3)
{
sam_txreset(priv, EMAC_QUEUE_3);
sam_txreset(priv, EMAC_QUEUE_4);
sam_txreset(priv, EMAC_QUEUE_5);
}
#endif
/* Make sure that RX and TX are disabled; clear statistics registers */ /* Make sure that RX and TX are disabled; clear statistics registers */
sam_putreg(priv, SAM_EMAC_NCR_OFFSET, EMAC_NCR_CLRSTAT); sam_putreg(priv, SAM_EMAC_NCR_OFFSET, EMAC_NCR_CLRSTAT);
@@ -4875,12 +4944,36 @@ int sam_emac_initialize(int intf)
{ {
struct sam_emac_s *priv; struct sam_emac_s *priv;
const struct sam_emacattr_s *attr; const struct sam_emacattr_s *attr;
#if defined(CONFIG_ARCH_CHIP_SAMV71)
uint32_t regval;
#endif
uint8_t *pktbuf; uint8_t *pktbuf;
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT) #if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
uint8_t phytype; uint8_t phytype;
#endif #endif
int ret; int ret;
#if defined(CONFIG_ARCH_CHIP_SAMV71)
/* Determine if the chip has 3 or 6 queues. This logic is for the
* V71 only -- if you are using a different chip in the family,
* the version number at which to switch from 3 to 6 queues may
* be different. For the V71, versions 1 and higher have 6 queues.
*
* If both emacs are enabled, this code will be run twice, which
* should not be a problem as the result will be the same each time
* it is run.
*/
regval = getreg32(SAM_CHIPID_CIDR);
if ((regval & CHIPID_CIDR_ARCH_MASK) == CHIPID_CIDR_ARCH_SAMV71)
{
if (((regval & CHIPID_CIDR_VERSION_MASK) >> CHIPID_CIDR_VERSION_SHIFT) > 0)
{
g_emac_nqueues = 6;
}
}
#endif
#if defined(CONFIG_SAMV7_EMAC0) #if defined(CONFIG_SAMV7_EMAC0)
if (intf == EMAC0_INTF) if (intf == EMAC0_INTF)
{ {
+47 -10
View File
@@ -267,18 +267,55 @@ Configurations
NOTES: NOTES:
1. Support for NSH built-in applications is provided: 1. This initial release of this configuration was very minimal, but
also very small:
Binary Formats: $ size nuttx
CONFIG_BUILTIN=y : Enable support for built-in programs text data bss dec hex filename
32000 92 1172 33264 81f0 nuttx
Application Configuration: The current version, additional features have been enabled: board
CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line bring-up initialization, button support, the procfs file system,
and NSH built-in application support. The size increased as follows:
No built applications are enabled in the base configuration, however. $ size nuttx
text data bss dec hex filename
40231 92 1208 41531 a23b nuttx
2. C++ support for applications is enabled: Those additional features cost about 8KiB FLASH. I believe that is a
good use of the STM32F072RB's FLASH, but if you interested in the
more minimal configuration, here is what was changed:
CONFIG_HAVE_CXX=y Removed
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y CONFIG_BINFMT_DISABLE=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_NSH_DISABLE_CD=y
Added:
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_BUILTIN=y
CONFIG_BUILTIN_PROXY_STACKSIZE=1024
CONFIG_FS_PROCFS=y
CONFIG_NSH_PROC_MOUNTPOINT="/proc"
CONFIG_LIB_BOARDCTL=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
Support for NSH built-in applications is enabled for future use.
However, no built applications are enabled in this base configuration.
2. C++ support for applications is NOT enabled. That could be enabled
with the following configuration changes:
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
And also support fo C++ constructors under
apps/platform/nucleo-stm32f072rb.
+47 -8
View File
@@ -407,14 +407,20 @@ CONFIG_ARCH_BOARD="nucleo-f072rb"
CONFIG_ARCH_HAVE_LEDS=y CONFIG_ARCH_HAVE_LEDS=y
CONFIG_ARCH_LEDS=y CONFIG_ARCH_LEDS=y
CONFIG_ARCH_HAVE_BUTTONS=y CONFIG_ARCH_HAVE_BUTTONS=y
# CONFIG_ARCH_BUTTONS is not set CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_HAVE_IRQBUTTONS=y CONFIG_ARCH_HAVE_IRQBUTTONS=y
CONFIG_ARCH_IRQBUTTONS=y
# #
# Board-Specific Options # Board-Specific Options
# #
# CONFIG_BOARD_CRASHDUMP is not set # CONFIG_BOARD_CRASHDUMP is not set
# CONFIG_LIB_BOARDCTL is not set CONFIG_LIB_BOARDCTL=y
# CONFIG_BOARDCTL_RESET is not set
# CONFIG_BOARDCTL_UNIQUEID is not set
# CONFIG_BOARDCTL_TSCTEST is not set
# CONFIG_BOARDCTL_GRAPHICS is not set
# CONFIG_BOARDCTL_IOCTL is not set
# #
# RTOS Features # RTOS Features
@@ -448,6 +454,7 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_SPINLOCK is not set # CONFIG_SPINLOCK is not set
# CONFIG_INIT_NONE is not set # CONFIG_INIT_NONE is not set
CONFIG_INIT_ENTRYPOINT=y CONFIG_INIT_ENTRYPOINT=y
# CONFIG_INIT_FILEPATH is not set
CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_RR_INTERVAL=200 CONFIG_RR_INTERVAL=200
# CONFIG_SCHED_SPORADIC is not set # CONFIG_SCHED_SPORADIC is not set
@@ -675,13 +682,28 @@ CONFIG_SYSLOG_CONSOLE=y
# #
# File system configuration # File system configuration
# #
CONFIG_DISABLE_MOUNTPOINT=y # CONFIG_DISABLE_MOUNTPOINT is not set
# CONFIG_FS_AUTOMOUNTER is not set
CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
# CONFIG_FS_READABLE is not set CONFIG_FS_READABLE=y
# CONFIG_FS_WRITABLE is not set # CONFIG_FS_WRITABLE is not set
# CONFIG_FS_NAMED_SEMAPHORES is not set # CONFIG_FS_NAMED_SEMAPHORES is not set
# CONFIG_FS_RAMMAP is not set # CONFIG_FS_RAMMAP is not set
# CONFIG_FS_PROCFS is not set # CONFIG_FS_FAT is not set
# CONFIG_FS_NXFFS is not set
# CONFIG_FS_ROMFS is not set
# CONFIG_FS_TMPFS is not set
# CONFIG_FS_SMARTFS is not set
# CONFIG_FS_BINFS is not set
CONFIG_FS_PROCFS=y
# CONFIG_FS_PROCFS_REGISTER is not set
#
# Exclude individual procfs entries
#
# CONFIG_FS_PROCFS_EXCLUDE_PROCESS is not set
# CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set
# CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set
# CONFIG_FS_UNIONFS is not set # CONFIG_FS_UNIONFS is not set
# #
@@ -709,7 +731,10 @@ CONFIG_MM_REGIONS=1
# #
# Binary Loader # Binary Loader
# #
CONFIG_BINFMT_DISABLE=y # CONFIG_BINFMT_DISABLE is not set
# CONFIG_NXFLAT is not set
# CONFIG_ELF is not set
CONFIG_BUILTIN=y
# CONFIG_PIC is not set # CONFIG_PIC is not set
# CONFIG_SYMTAB_ORDEREDBYNAME is not set # CONFIG_SYMTAB_ORDEREDBYNAME is not set
@@ -762,6 +787,7 @@ CONFIG_LIB_RAND_ORDER=1
# #
# Program Execution Options # Program Execution Options
# #
# CONFIG_LIBC_EXECFUNCS is not set
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536 CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536
@@ -801,6 +827,7 @@ CONFIG_ARCH_HAVE_TLS=y
# #
# NETDB Support # NETDB Support
# #
# CONFIG_NETDB_HOSTFILE is not set
# CONFIG_LIBC_IOCTL_VARIADIC is not set # CONFIG_LIBC_IOCTL_VARIADIC is not set
CONFIG_LIB_SENDFILE_BUFSIZE=512 CONFIG_LIB_SENDFILE_BUFSIZE=512
@@ -822,6 +849,11 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
# Application Configuration # Application Configuration
# #
#
# Built-In Applications
#
CONFIG_BUILTIN_PROXY_STACKSIZE=1024
# #
# CAN Utilities # CAN Utilities
# #
@@ -867,12 +899,14 @@ CONFIG_EXAMPLES_NSH=y
# CONFIG_EXAMPLES_SERLOOP is not set # CONFIG_EXAMPLES_SERLOOP is not set
# CONFIG_EXAMPLES_SLCD is not set # CONFIG_EXAMPLES_SLCD is not set
# CONFIG_EXAMPLES_SMART is not set # CONFIG_EXAMPLES_SMART is not set
# CONFIG_EXAMPLES_SMART_TEST is not set
# CONFIG_EXAMPLES_SMP is not set # CONFIG_EXAMPLES_SMP is not set
# CONFIG_EXAMPLES_STAT is not set # CONFIG_EXAMPLES_STAT is not set
# CONFIG_EXAMPLES_TCPECHO is not set # CONFIG_EXAMPLES_TCPECHO is not set
# CONFIG_EXAMPLES_TELNETD is not set # CONFIG_EXAMPLES_TELNETD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
# CONFIG_EXAMPLES_TOUCHSCREEN is not set # CONFIG_EXAMPLES_TOUCHSCREEN is not set
# CONFIG_EXAMPLES_USBSERIAL is not set
# CONFIG_EXAMPLES_WATCHDOG is not set # CONFIG_EXAMPLES_WATCHDOG is not set
# CONFIG_EXAMPLES_WEBSERVER is not set # CONFIG_EXAMPLES_WEBSERVER is not set
# CONFIG_EXAMPLES_XBC_TEST is not set # CONFIG_EXAMPLES_XBC_TEST is not set
@@ -881,6 +915,7 @@ CONFIG_EXAMPLES_NSH=y
# File System Utilities # File System Utilities
# #
# CONFIG_FSUTILS_INIFILE is not set # CONFIG_FSUTILS_INIFILE is not set
# CONFIG_FSUTILS_PASSWD is not set
# #
# GPS Utilities # GPS Utilities
@@ -896,6 +931,7 @@ CONFIG_EXAMPLES_NSH=y
# #
# Interpreters # Interpreters
# #
# CONFIG_INTERPRETERS_BAS is not set
# CONFIG_INTERPRETERS_FICL is not set # CONFIG_INTERPRETERS_FICL is not set
# CONFIG_INTERPRETERS_MICROPYTHON is not set # CONFIG_INTERPRETERS_MICROPYTHON is not set
# CONFIG_INTERPRETERS_MINIBASIC is not set # CONFIG_INTERPRETERS_MINIBASIC is not set
@@ -928,10 +964,12 @@ CONFIG_NSH_READLINE=y
# CONFIG_NSH_CLE is not set # CONFIG_NSH_CLE is not set
CONFIG_NSH_LINELEN=64 CONFIG_NSH_LINELEN=64
CONFIG_NSH_DISABLE_SEMICOLON=y CONFIG_NSH_DISABLE_SEMICOLON=y
# CONFIG_NSH_CMDPARMS is not set
CONFIG_NSH_MAXARGUMENTS=6 CONFIG_NSH_MAXARGUMENTS=6
# CONFIG_NSH_ARGCAT is not set # CONFIG_NSH_ARGCAT is not set
CONFIG_NSH_NESTDEPTH=3 CONFIG_NSH_NESTDEPTH=3
# CONFIG_NSH_DISABLEBG is not set # CONFIG_NSH_DISABLEBG is not set
CONFIG_NSH_BUILTIN_APPS=y
# #
# Disable Individual commands # Disable Individual commands
@@ -939,7 +977,7 @@ CONFIG_NSH_NESTDEPTH=3
CONFIG_NSH_DISABLE_ADDROUTE=y CONFIG_NSH_DISABLE_ADDROUTE=y
CONFIG_NSH_DISABLE_BASENAME=y CONFIG_NSH_DISABLE_BASENAME=y
# CONFIG_NSH_DISABLE_CAT is not set # CONFIG_NSH_DISABLE_CAT is not set
CONFIG_NSH_DISABLE_CD=y # CONFIG_NSH_DISABLE_CD is not set
CONFIG_NSH_DISABLE_CP=y CONFIG_NSH_DISABLE_CP=y
CONFIG_NSH_DISABLE_CMP=y CONFIG_NSH_DISABLE_CMP=y
CONFIG_NSH_DISABLE_DATE=y CONFIG_NSH_DISABLE_DATE=y
@@ -991,6 +1029,7 @@ CONFIG_NSH_MMCSDMINOR=0
# #
CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_CODECS_BUFSIZE=128
# CONFIG_NSH_CMDOPT_HEXDUMP is not set # CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_NSH_PROC_MOUNTPOINT="/proc"
CONFIG_NSH_FILEIOSIZE=64 CONFIG_NSH_FILEIOSIZE=64
# #
@@ -1003,7 +1042,7 @@ CONFIG_NSH_DISABLESCRIPT=y
# #
CONFIG_NSH_CONSOLE=y CONFIG_NSH_CONSOLE=y
# CONFIG_NSH_ALTCONDEV is not set # CONFIG_NSH_ALTCONDEV is not set
# CONFIG_NSH_ARCHINIT is not set CONFIG_NSH_ARCHINIT=y
# CONFIG_NSH_LOGIN is not set # CONFIG_NSH_LOGIN is not set
# CONFIG_NSH_CONSOLE_LOGIN is not set # CONFIG_NSH_CONSOLE_LOGIN is not set
+2 -1
View File
@@ -41,6 +41,7 @@
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/types.h> #include <sys/types.h>
#include <debug.h>
#include "nucleo-f072rb.h" #include "nucleo-f072rb.h"
@@ -72,7 +73,7 @@ int stm32_bringup(void)
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret);
} }
#endif #endif
+5 -3
View File
@@ -40,12 +40,14 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
#include <errno.h> #include <errno.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "stm32f0_gpio.h"
#include "nucleo-f072rb.h" #include "nucleo-f072rb.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -71,7 +73,7 @@ void board_button_initialize(void)
* also configured for the pin. * also configured for the pin.
*/ */
stm32_configgpio(GPIO_BTN_USER); stm32f0_configgpio(GPIO_BTN_USER);
} }
/**************************************************************************** /****************************************************************************
@@ -84,7 +86,7 @@ uint32_t board_buttons(void)
* pressed. * pressed.
*/ */
bool released = stm32_gpioread(GPIO_BTN_USER); bool released = stm32f0_gpioread(GPIO_BTN_USER);
return !released; return !released;
} }
@@ -117,7 +119,7 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
if (id == BUTTON_USER) if (id == BUTTON_USER)
{ {
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg); ret = stm32f0_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
} }
return ret; return ret;
+6
View File
@@ -233,6 +233,12 @@
#define _MTDIOCVALID(c) (_IOC_TYPE(c)==_MTDIOCBASE) #define _MTDIOCVALID(c) (_IOC_TYPE(c)==_MTDIOCBASE)
#define _MTDIOC(nr) _IOC(_MTDIOCBASE,nr) #define _MTDIOC(nr) _IOC(_MTDIOCBASE,nr)
/* Socket IOCTLs ************************************************************/
/* See include/nuttx/net/ioctl.h */
#define _SIOCVALID(c) (_IOC_TYPE(c)==_SIOCBASE)
#define _SIOC(nr) _IOC(_SIOCBASE,nr)
/* NuttX ARP driver ioctl definitions (see netinet/arp.h) *******************/ /* NuttX ARP driver ioctl definitions (see netinet/arp.h) *******************/
#define _ARPIOCVALID(c) (_IOC_TYPE(c)==_ARPIOCBASE) #define _ARPIOCVALID(c) (_IOC_TYPE(c)==_ARPIOCBASE)
+1 -4
View File
@@ -51,9 +51,6 @@
* masks, and hardware address, and a few others * masks, and hardware address, and a few others
*/ */
#define _SIOCVALID(c) (_IOC_TYPE(c)==_SIOCBASE)
#define _SIOC(nr) _IOC(_SIOCBASE,nr)
/* IPv4 interface control operations */ /* IPv4 interface control operations */
#define SIOCGIFADDR _SIOC(0x0001) /* Get IP address */ #define SIOCGIFADDR _SIOC(0x0001) /* Get IP address */
@@ -128,7 +125,7 @@
* See include/nuttx/net/telnet.h */ * See include/nuttx/net/telnet.h */
/**************************************************************************** /****************************************************************************
* Pulbic Type Definitions * Public Type Definitions
****************************************************************************/ ****************************************************************************/
/* See include/net/if.h, include/net/route.h, and include/net/arp.h */ /* See include/net/if.h, include/net/route.h, and include/net/arp.h */
+2 -2
View File
@@ -309,7 +309,7 @@
#endif #endif
#ifdef CONFIG_NET_6LOWPAN #ifdef CONFIG_NET_6LOWPAN
# define IEEE802154_UDP_MSS(h) (CONFIG_NET_6LOWPAN_MAXPAYLOAD - UDP_HDRLEN - (h)) # define IEEE802154_UDP_MSS(h) (CONFIG_NET_6LOWPAN_MTU - UDP_HDRLEN - (h))
# ifndef CONFIG_NET_MULTILINK # ifndef CONFIG_NET_MULTILINK
# define __MIN_UDP_MSS(h) IEEE802154_UDP_MSS(h) # define __MIN_UDP_MSS(h) IEEE802154_UDP_MSS(h)
# define __MAX_UDP_MSS(h) IEEE802154_UDP_MSS(h) # define __MAX_UDP_MSS(h) IEEE802154_UDP_MSS(h)
@@ -484,7 +484,7 @@
#endif #endif
#ifdef CONFIG_NET_6LOWPAN #ifdef CONFIG_NET_6LOWPAN
# define IEEE802154_TCP_MSS(h) (CONFIG_NET_6LOWPAN_MAXPAYLOAD - TCP_HDRLEN - (h)) # define IEEE802154_TCP_MSS(h) (CONFIG_NET_6LOWPAN_MTU - TCP_HDRLEN - (h))
# ifndef CONFIG_NET_MULTILINK # ifndef CONFIG_NET_MULTILINK
# define __MIN_TCP_MSS(h) IEEE802154_TCP_MSS(h) # define __MIN_TCP_MSS(h) IEEE802154_TCP_MSS(h)
# define __MAX_TCP_MSS(h) IEEE802154_TCP_MSS(h) # define __MAX_TCP_MSS(h) IEEE802154_TCP_MSS(h)
+59 -12
View File
@@ -37,8 +37,8 @@
* (when applicable). * (when applicable).
*/ */
#ifndef __INCLUDE_NUTTX_WIRELESS_H #ifndef __INCLUDE_NUTTX_WIRELESS_WIRELESS_H
#define __INCLUDE_NUTTX_WIRELESS_H #define __INCLUDE_NUTTX_WIRELESS_WIRELESS_H
/************************************************************************************ /************************************************************************************
* Included Files * Included Files
@@ -63,6 +63,7 @@
* interface. * interface.
*/ */
/* IEEE802.11 */
/* Wireless identification */ /* Wireless identification */
#define SIOCSIWCOMMIT _WLIOC(0x0001) /* Commit pending changes to driver */ #define SIOCSIWCOMMIT _WLIOC(0x0001) /* Commit pending changes to driver */
@@ -153,8 +154,24 @@
#define SIOCSIWPMKSA _WLIOC(0x0032) /* PMKSA cache operation */ #define SIOCSIWPMKSA _WLIOC(0x0032) /* PMKSA cache operation */
#define WL_FIRSTCHAR 0x0033 /* IEEE802.15.4 6loWPAN
#define WL_NNETCMDS 0x0032 *
* IEEE802.15.4 IOCTLs may be directed at one of three layers:
*
* 1. To the 6loWPAN network layer, as documented here,
* 2. To the IEEE802.15.4 MAC layer, as documented in,
* include/nuttx/wireless/ieee802154/ioeee802154_mac.h, or to
* 3. To the IEEE802.15.4 radio device layer, as documented in,
* include/nuttx/wireless/ieee802154/ioeee802154_radio.h.
*
* SIOCSWPANID - Join the specified PAN ID
*/
#define SIOCSWPANID _WLIOC(0x0033) /* Join PAN ID */
#define SIOCGWPANID _WLIOC(0x0034) /* Return PAN ID */
#define WL_FIRSTCHAR 0x0035
#define WL_NNETCMDS 0x0034
/* Character Driver IOCTL commands *************************************************/ /* Character Driver IOCTL commands *************************************************/
/* Non-compatible, NuttX only IOCTL definitions for use with low-level wireless /* Non-compatible, NuttX only IOCTL definitions for use with low-level wireless
@@ -162,23 +179,23 @@
* requires a file descriptor created by the open() interface. * requires a file descriptor created by the open() interface.
*/ */
#define WLIOC_SETRADIOFREQ _WLIOC(0x0033) /* arg: Pointer to uint32_t, frequency #define WLIOC_SETRADIOFREQ _WLIOC(0x0035) /* arg: Pointer to uint32_t, frequency
* value (in Mhz) */ * value (in Mhz) */
#define WLIOC_GETRADIOFREQ _WLIOC(0x0034) /* arg: Pointer to uint32_t, frequency #define WLIOC_GETRADIOFREQ _WLIOC(0x0036) /* arg: Pointer to uint32_t, frequency
* value (in Mhz) */ * value (in Mhz) */
#define WLIOC_SETADDR _WLIOC(0x0035) /* arg: Pointer to address value, format #define WLIOC_SETADDR _WLIOC(0x0037) /* arg: Pointer to address value, format
* of the address is driver specific */ * of the address is driver specific */
#define WLIOC_GETADDR _WLIOC(0x0036) /* arg: Pointer to address value, format #define WLIOC_GETADDR _WLIOC(0x0038) /* arg: Pointer to address value, format
* of the address is driver specific */ * of the address is driver specific */
#define WLIOC_SETTXPOWER _WLIOC(0x0037) /* arg: Pointer to int32_t, output power #define WLIOC_SETTXPOWER _WLIOC(0x0039) /* arg: Pointer to int32_t, output power
* (in dBm) */ * (in dBm) */
#define WLIOC_GETTXPOWER _WLIOC(0x0038) /* arg: Pointer to int32_t, output power #define WLIOC_GETTXPOWER _WLIOC(0x003a) /* arg: Pointer to int32_t, output power
* (in dBm) */ * (in dBm) */
/* Device-specific IOCTL commands **************************************************/ /* Device-specific IOCTL commands **************************************************/
#define WL_FIRST 0x0001 /* First common command */ #define WL_FIRST 0x0001 /* First common command */
#define WL_NCMDS 0x0038 /* Number of common commands */ #define WL_NCMDS 0x003a /* Number of common commands */
/* User defined ioctl commands are also supported. These will be forwarded /* User defined ioctl commands are also supported. These will be forwarded
* by the upper-half QE driver to the lower-half QE driver via the ioctl() * by the upper-half QE driver to the lower-half QE driver via the ioctl()
@@ -355,5 +372,35 @@ struct iw_event
union iwreq_data u; /* Fixed IOCTL payload */ union iwreq_data u; /* Fixed IOCTL payload */
}; };
/* 6loWPAN */
/* This structure is used with the SIOCSWPANID IOCTL command to select the
* PAN ID to join.
*/
struct sixlowpan_panid_s
{
uint16_t panid; /* The PAN ID to join */
};
/* This union defines the data payload of an 6loWPAN or SIOCGWPANID ioctl
* command and is used in struct sixlowpan_req_s below.
*/
union sixlowpan_data
{
struct sixlowpan_panid_s panid; /* PAN ID to join */
};
/* This is the structure used to exchange data in wireless IOCTLs. This
* structure is the same as 'struct ifreq', but defined for use with
* 6loWPAN IOCTLs.
*/
struct sixlowpan_req_s
{
char ifr_name[IFNAMSIZ]; /* Interface name, e.g. "wpan0" */
union sixlowpan_data u; /* Data payload */
};
#endif /* CONFIG_DRIVERS_WIRELESS */ #endif /* CONFIG_DRIVERS_WIRELESS */
#endif /* __INCLUDE_NUTTX_WIRELESS_H */ #endif /* __INCLUDE_NUTTX_WIRELESS_WIRELESS_H */
+79 -19
View File
@@ -61,6 +61,7 @@
#ifdef CONFIG_NET_6LOWPAN #ifdef CONFIG_NET_6LOWPAN
# include <nuttx/net/sixlowpan.h> # include <nuttx/net/sixlowpan.h>
# include <nuttx/wireless/wireless.h>
#endif #endif
#ifdef CONFIG_NET_IGMP #ifdef CONFIG_NET_IGMP
@@ -321,32 +322,73 @@ static void ioctl_set_ipv6addr(FAR net_ipv6addr_t outaddr,
#endif #endif
/**************************************************************************** /****************************************************************************
* Name: netdev_wifr_dev * Name: netdev_sixlowpan_ioctl
* *
* Description: * Description:
* Verify the struct iwreq and get the Wireless device. * Perform 6loWPAN network device specific operations.
* *
* Parameters: * Parameters:
* req - The argument of the ioctl cmd * psock Socket structure
* dev Ethernet driver device structure
* cmd The ioctl command
* req The argument of the ioctl cmd
* *
* Return: * Return:
* A pointer to the driver structure on success; NULL on failure. * >=0 on success (positive non-zero values are cmd-specific)
* Negated errno returned on failure.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL) #if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_6LOWPAN)
static FAR struct net_driver_s *netdev_wifr_dev(FAR struct iwreq *req) static int netdev_sixlowpan_ioctl(FAR struct socket *psock, int cmd,
FAR struct sixlowpan_req_s *req)
{ {
if (req != NULL) FAR struct ieee802154_driver_s *ieee;
{ int ret = -ENOTTY;
/* Find the network device associated with the device name
* in the request data.
*/
return netdev_findbyname(req->ifrn_name); /* Verify that this is a valid wireless network IOCTL command */
if (_WLIOCVALID(cmd) && (unsigned)_IOC_NR(cmd) <= WL_NNETCMDS)
{
switch (cmd)
{
case SIOCSWPANID: /* Join PAN ID */
{
ieee = (FAR struct ieee802154_driver_s *)netdev_findbyname(req->ifr_name);
if (ieee == NULL)
{
ret = -ENODEV;
}
else
{
ieee->i_panid = req->u.panid.panid;
ret = OK;
}
}
break;
case SIOCGWPANID: /* Return PAN ID */
{
ieee = (FAR struct ieee802154_driver_s *)netdev_findbyname(req->ifr_name);
if (ieee == NULL)
{
ret = -ENODEV;
}
else
{
req->u.panid.panid = ieee->i_panid;
ret = OK;
}
}
break;
default:
return -ENOTTY;
}
} }
return NULL; return ret;
} }
#endif #endif
@@ -381,8 +423,8 @@ static int netdev_wifr_ioctl(FAR struct socket *psock, int cmd,
{ {
/* Get the wireless device associated with the IOCTL command */ /* Get the wireless device associated with the IOCTL command */
dev = netdev_wifr_dev(req); dev = netdev_findbyname(req->ifrn_name);
if (dev) if (dev != NULL)
{ {
/* Just forward the IOCTL to the wireless driver */ /* Just forward the IOCTL to the wireless driver */
@@ -1209,7 +1251,11 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg)
* non-NULL. * non-NULL.
*/ */
#ifdef CONFIG_DRIVERS_WIRELESS
if (!_SIOCVALID(cmd) && !_WLIOCVALID(cmd))
#else
if (!_SIOCVALID(cmd)) if (!_SIOCVALID(cmd))
#endif
{ {
ret = -ENOTTY; ret = -ENOTTY;
goto errout; goto errout;
@@ -1227,13 +1273,27 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg)
ret = netdev_ifr_ioctl(psock, cmd, (FAR struct ifreq *)((uintptr_t)arg)); ret = netdev_ifr_ioctl(psock, cmd, (FAR struct ifreq *)((uintptr_t)arg));
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL) #if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_6LOWPAN)
/* Check a wireless network command */ /* Check for a 6loWPAN network command */
if (ret == -ENOTTY) if (ret == -ENOTTY)
{ {
ret = netdev_wifr_ioctl(psock, cmd, FAR struct sixlowpan_req_s *slpreq;
(FAR struct iwreq *)((uintptr_t)arg));
slpreq = (FAR struct sixlowpan_req_s *)((uintptr_t)arg);
ret = netdev_sixlowpan_ioctl(psock, cmd, slpreq);
}
#endif
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL)
/* Check for a wireless network command */
if (ret == -ENOTTY)
{
FAR struct iwreq *wifrreq;
wifrreq = (FAR struct sixlowpan_req_s *)((uintptr_t)arg);
ret = netdev_wifr_ioctl(psock, cmd, wifrreq);
} }
#endif #endif
-9
View File
@@ -156,15 +156,6 @@ config NET_6LOWPAN_MAX_MACTRANSMITS
layer should resend packets if no link-layer ACK wasreceived. This layer should resend packets if no link-layer ACK wasreceived. This
only makes sense with the csma_driver. only makes sense with the csma_driver.
config NET_6LOWPAN_MAXPAYLOAD
int "Max packet size"
default 102
---help---
NET_6LOWPAN_MAXPAYLOAD specifies the maximum size of packets
before they get fragmented. The default is 127 bytes (the maximum size
of a 802.15.4 frame) - 25 bytes (for the 802.15.4 MAClayer header). This
can be increased for systems with larger packet sizes.
config NET_6LOWPAN_MTU config NET_6LOWPAN_MTU
int "6LoWPAN packet buffer size" int "6LoWPAN packet buffer size"
default 1294 default 1294
+11 -10
View File
@@ -33,7 +33,7 @@ Optimal 6loWPAN Configuration
Fragmentation Headers Fragmentation Headers
--------------------- ---------------------
A fragment header is placed at the beginning of the outgoing packet just A fragment header is placed at the beginning of the outgoing packet just
after the FCF when the payload is too large to fit in a single IEEE 802.15.4 after the MAC when the payload is too large to fit in a single IEEE 802.15.4
frame. The fragment header contains three fields: Datagram size, datagram tag frame. The fragment header contains three fields: Datagram size, datagram tag
and datagram offset. and datagram offset.
@@ -47,7 +47,7 @@ The length of the fragment header length is four bytes for the first header
(FRAG1) and five bytes for all subsequent headers (FRAGN). For example, (FRAG1) and five bytes for all subsequent headers (FRAGN). For example,
this is a HC1 compressed first frame of a packet this is a HC1 compressed first frame of a packet
01 08 01 0000 3412 ### 7-byte FCF header 41 88 01 cefa 3412 cdab ### 9-byte MAC header
c50e 000b ### 4-byte FRAG1 header c50e 000b ### 4-byte FRAG1 header
42 ### SIXLOWPAN_DISPATCH_HC1 42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING fb ### RIME_HC1_HC_UDP_HC1_ENCODING
@@ -56,14 +56,15 @@ this is a HC1 compressed first frame of a packet
10 ### RIME_HC1_HC_UDP_PORTS 10 ### RIME_HC1_HC_UDP_PORTS
0000 ### RIME_HC1_HC_UDP_CHKSUM 0000 ### RIME_HC1_HC_UDP_CHKSUM
80 byte Payload follows: 104 byte Payload follows:
4f4e452064617920 48656e6e792d7065 6e6e792077617320 7069636b696e6720 4f4e452064617920 48656e6e792d7065 6e6e792077617320 7069636b696e6720
757020636f726e20 696e207468652063 6f726e7961726420 7768656e2d2d7768 757020636f726e20 696e207468652063 6f726e7961726420 7768656e2d2d7768
61636b212d2d736f 6d657468696e6720 g 61636b212d2d736f 6d657468696e6720 6869742068657220 75706f6e20746865
20686561642e2027
This is the second frame of the same transfer: This is the second frame of the same transfer:
01 08 01 0000 3412 ### 7-byte FCF header 41 88 01 cefa 3412 cdab ### 9-byte MAC header
e50e 000b 0a ### 5 byte FRAGN header e50e 000b 0a ### 5 byte FRAGN header
42 ### SIXLOWPAN_DISPATCH_HC1 42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING fb ### RIME_HC1_HC_UDP_HC1_ENCODING
@@ -72,11 +73,11 @@ This is the second frame of the same transfer:
10 ### RIME_HC1_HC_UDP_PORTS 10 ### RIME_HC1_HC_UDP_PORTS
0000 ### RIME_HC1_HC_UDP_CHKSUM 0000 ### RIME_HC1_HC_UDP_CHKSUM
80 byte Payload follows: 104 byte Payload follows:
6869742068657220 75706f6e20746865 20686561642e2027 476f6f646e657373 476f6f646e657373 2067726163696f75 73206d6521272073 6169642048656e6e
2067726163696f75 73206d6521272073 6169642048656e6e 792d70656e6e793b 792d70656e6e793b 202774686520736b 79277320612d676f 696e6720746f2066
202774686520736b 79277320612d676f 616c6c3b2049206d 75737420676f2061 6e642074656c6c20 746865206b696e67
2e270a0a536f2073
The payload length is encoded in the LS 11-bits of the first 16-bit value: The payload length is encoded in the LS 11-bits of the first 16-bit value:
In this example the payload size is 0x050e or 1,294. The tag is 0x000b. In In this example the payload size is 0x050e or 1,294. The tag is 0x000b. In
+8 -5
View File
@@ -281,6 +281,11 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
ninfo("Sending packet length %d\n", buflen); ninfo("Sending packet length %d\n", buflen);
/* Set the source and destinatino address */
rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_SENDER], &ieee->i_nodeaddr);
rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER], destmac);
/* Pre-calculate frame header length. */ /* Pre-calculate frame header length. */
framer_hdrlen = sixlowpan_send_hdrlen(ieee, ieee->i_panid); framer_hdrlen = sixlowpan_send_hdrlen(ieee, ieee->i_panid);
@@ -317,11 +322,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
ninfo("Header of length %d\n", g_frame_hdrlen); ninfo("Header of length %d\n", g_frame_hdrlen);
rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER], destmac);
/* Check if we need to fragment the packet into several frames */ /* Check if we need to fragment the packet into several frames */
if (buflen > (CONFIG_NET_6LOWPAN_MAXPAYLOAD - g_frame_hdrlen)) if (buflen > (CONFIG_NET_6LOWPAN_FRAMELEN - g_frame_hdrlen))
{ {
#ifdef CONFIG_NET_6LOWPAN_FRAG #ifdef CONFIG_NET_6LOWPAN_FRAG
/* ieee->i_framelist will hold the generated frames; frames will be /* ieee->i_framelist will hold the generated frames; frames will be
@@ -384,7 +387,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
* bytes. * bytes.
*/ */
paysize = (CONFIG_NET_6LOWPAN_MAXPAYLOAD - g_frame_hdrlen) & ~7; paysize = (CONFIG_NET_6LOWPAN_FRAMELEN - g_frame_hdrlen) & ~7;
memcpy(fptr + g_frame_hdrlen, buf, paysize); memcpy(fptr + g_frame_hdrlen, buf, paysize);
/* Set outlen to what we already sent from the IP payload */ /* Set outlen to what we already sent from the IP payload */
@@ -457,7 +460,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
/* Copy payload and enqueue */ /* Copy payload and enqueue */
/* Check for the last fragment */ /* Check for the last fragment */
paysize = (CONFIG_NET_6LOWPAN_MAXPAYLOAD - fragn_hdrlen) & paysize = (CONFIG_NET_6LOWPAN_FRAMELEN - fragn_hdrlen) &
SIXLOWPAN_DISPATCH_FRAG_MASK; SIXLOWPAN_DISPATCH_FRAG_MASK;
if (buflen - outlen < paysize) if (buflen - outlen < paysize)
{ {
+24 -9
View File
@@ -70,11 +70,11 @@
struct field_length_s struct field_length_s
{ {
uint8_t dest_pid_len; /**< Length (in bytes) of destination PAN ID field */ uint8_t dest_pid_len; /* Length (in bytes) of destination PAN ID field */
uint8_t dest_addr_len; /**< Length (in bytes) of destination address field */ uint8_t dest_addr_len; /* Length (in bytes) of destination address field */
uint8_t src_pid_len; /**< Length (in bytes) of source PAN ID field */ uint8_t src_pid_len; /* Length (in bytes) of source PAN ID field */
uint8_t src_addr_len; /**< Length (in bytes) of source address field */ uint8_t src_addr_len; /* Length (in bytes) of source address field */
uint8_t aux_sec_len; /**< Length (in bytes) of aux security header field */ uint8_t aux_sec_len; /* Length (in bytes) of aux security header field */
}; };
/**************************************************************************** /****************************************************************************
@@ -179,10 +179,17 @@ static void sixlowpan_fieldlengths(FAR struct frame802154_s *finfo,
(finfo->fcf.src_addr_mode & 3) != 0 && (finfo->fcf.src_addr_mode & 3) != 0 &&
finfo->src_pid == finfo->dest_pid) finfo->src_pid == finfo->dest_pid)
{ {
/* Indicate source PANID compression */
finfo->fcf.panid_compression = 1; finfo->fcf.panid_compression = 1;
/* Compressed header, only do dest pid */ /* Compressed header, only do dest pid.
/* flen->src_pid_len = 0; */ *
* REVISIT: This was commented out in corresponding Contiki logic, but
* is needed to match sixlowpan_recv_hdrlen().
*/
flen->src_pid_len = 0;
} }
/* Determine address lengths */ /* Determine address lengths */
@@ -348,7 +355,7 @@ static void sixlowpan_setup_params(FAR struct ieee802154_driver_s *ieee,
rimeaddr_copy((struct rimeaddr_s *)&params->dest_addr, rimeaddr_copy((struct rimeaddr_s *)&params->dest_addr,
g_pktaddrs[PACKETBUF_ADDR_RECEIVER].u8); g_pktaddrs[PACKETBUF_ADDR_RECEIVER].u8);
/* Use short address mode if so configured */ /* Use short destination address mode if so configured */
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED #ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
params->fcf.dest_addr_mode = FRAME802154_LONGADDRMODE; params->fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
@@ -359,7 +366,15 @@ static void sixlowpan_setup_params(FAR struct ieee802154_driver_s *ieee,
/* Set the source address to the node address assigned to the device */ /* Set the source address to the node address assigned to the device */
rimeaddr_copy((struct rimeaddr_s *)&params->src_addr, &ieee->i_nodeaddr.u8); rimeaddr_copy((struct rimeaddr_s *)&params->src_addr, &ieee->i_nodeaddr);
/* Use short soruce address mode if so configured */
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
params->fcf.src_addr_mode = FRAME802154_LONGADDRMODE;
#else
params->fcf.src_addr_mode = FRAME802154_SHORTADDRMODE;
#endif
} }
/**************************************************************************** /****************************************************************************
+3 -1
View File
@@ -167,7 +167,7 @@ int sixlowpan_recv_hdrlen(FAR const uint8_t *fptr)
} }
else if (addrmode == FRAME802154_LONGADDRMODE) else if (addrmode == FRAME802154_LONGADDRMODE)
{ {
/* 2 byte dest PAN + 6 byte dest long address */ /* 2 byte dest PAN + 8 byte dest long address */
hdrlen += 10; hdrlen += 10;
} }
@@ -193,6 +193,8 @@ int sixlowpan_recv_hdrlen(FAR const uint8_t *fptr)
} }
else else
{ {
/* Add source PANID if PANIDs are not compressed */
if ((fptr[0] & (1 << FRAME802154_PANIDCOMP_SHIFT)) == 0) if ((fptr[0] & (1 << FRAME802154_PANIDCOMP_SHIFT)) == 0)
{ {
hdrlen += 2; hdrlen += 2;
+3 -3
View File
@@ -221,9 +221,9 @@ struct frame802154_fcf_s
struct frame802154_scf_s struct frame802154_scf_s
{ {
uint8_t security_level; /* 3 bit. security level */ uint8_t security_level; /* 3 bit. security level */
uint8_t key_id_mode; /* 2 bit. Key identifier mode */ uint8_t key_id_mode; /* 2 bit. Key identifier mode */
uint8_t reserved; /* 3 bit. Reserved bits */ uint8_t reserved; /* 3 bit. Reserved bits */
}; };
/* 802.15.4 Aux security header */ /* 802.15.4 Aux security header */