Merge remote-tracking branch 'origin/master' into ieee802154
This commit is contained in:
commit
b0204909b2
@ -197,6 +197,9 @@ Ubuntu Bash under Windows 10
|
||||
|
||||
C:\Users\Username\AppData\Local\lxss\rootfs
|
||||
|
||||
However, I am unable to see my files under the rootfs/home directory
|
||||
so this is not very useful.
|
||||
|
||||
Install Linux Software.
|
||||
-----------------------
|
||||
Use "sudo apt-get install <package name>". As examples, this is how
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/lcd/pcf8574_lcd_backpack.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: dev@ziggurat29.com
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <poll.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
@ -91,6 +91,7 @@ namespace std
|
||||
using ::vfwprintf;
|
||||
using ::vwprintf;
|
||||
using ::vswprintf;
|
||||
using ::wcstold;
|
||||
using ::wcrtomb;
|
||||
using ::wcscat;
|
||||
using ::wcschr;
|
||||
|
@ -418,6 +418,10 @@ int ipv4_input(FAR struct net_driver_s *dev);
|
||||
int ipv6_input(FAR struct net_driver_s *dev);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
int sixlowpan_input(FAR struct net_driver_s *dev);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Polling of connections
|
||||
*
|
||||
|
358
include/nuttx/net/sixlowpan.h
Normal file
358
include/nuttx/net/sixlowpan.h
Normal file
@ -0,0 +1,358 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/net/sixlowpan.h
|
||||
* Header file for the 6lowpan implementation (RFC4944 and draft-hui-6lowpan-hc-01)
|
||||
*
|
||||
* Copyright (C) 2017, Gregory Nutt, all rights reserved
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Derives from Contiki:
|
||||
*
|
||||
* Copyright (c) 2008, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
* Authors: Adam Dunkels <adam@sics.se>
|
||||
* Nicolas Tsiftes <nvt@sics.se>
|
||||
* Niclas Finne <nfi@sics.se>
|
||||
* Mathilde Durvy <mdurvy@cisco.com>
|
||||
* Julien Abeille <jabeille@cisco.com>
|
||||
*
|
||||
* 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 of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_NET_SIXLOWOAN_H
|
||||
#define __INCLUDE_NUTTX_NET_SIXLOWOAN_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Min and Max compressible UDP ports - HC06 */
|
||||
|
||||
#define SIXLOWPAN_UDP_4_BIT_PORT_MIN 0xf0b0
|
||||
#define SIXLOWPAN_UDP_4_BIT_PORT_MAX 0xf0bf /* F0B0 + 15 */
|
||||
#define SIXLOWPAN_UDP_8_BIT_PORT_MIN 0xF000
|
||||
#define SIXLOWPAN_UDP_8_BIT_PORT_MAX 0xf0ff /* F000 + 255 */
|
||||
|
||||
/* 6lowpan compressions */
|
||||
|
||||
#define SIXLOWPAN_COMPRESSION_IPV6 0
|
||||
#define SIXLOWPAN_COMPRESSION_HC1 1
|
||||
#define SIXLOWPAN_COMPRESSION_HC06 2
|
||||
|
||||
/* 6lowpan dispatches */
|
||||
|
||||
#define SIXLOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */
|
||||
#define SIXLOWPAN_DISPATCH_HC1 0x42 /* 01000010 = 66 */
|
||||
#define SIXLOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */
|
||||
#define SIXLOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx */
|
||||
#define SIXLOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx */
|
||||
|
||||
/* HC1 encoding */
|
||||
|
||||
#define SIXLOWPAN_HC1_NH_UDP 0x02
|
||||
#define SIXLOWPAN_HC1_NH_TCP 0x06
|
||||
#define SIXLOWPAN_HC1_NH_ICMP6 0x04
|
||||
|
||||
/* HC_UDP encoding (works together with HC1) */
|
||||
|
||||
#define SIXLOWPAN_HC_UDP_ALL_C 0xe0
|
||||
|
||||
/* IPHC encoding
|
||||
*
|
||||
* Values of fields within the IPHC encoding first byte (C stands for
|
||||
* compressed and I for inline)
|
||||
*/
|
||||
|
||||
#define SIXLOWPAN_IPHC_FL_C 0x10
|
||||
#define SIXLOWPAN_IPHC_TC_C 0x08
|
||||
#define SIXLOWPAN_IPHC_NH_C 0x04
|
||||
#define SIXLOWPAN_IPHC_TTL_1 0x01
|
||||
#define SIXLOWPAN_IPHC_TTL_64 0x02
|
||||
#define SIXLOWPAN_IPHC_TTL_255 0x03
|
||||
#define SIXLOWPAN_IPHC_TTL_I 0x00
|
||||
|
||||
|
||||
/* Values of fields within the IPHC encoding second byte */
|
||||
|
||||
#define SIXLOWPAN_IPHC_CID 0x80
|
||||
|
||||
#define SIXLOWPAN_IPHC_SAC 0x40
|
||||
#define SIXLOWPAN_IPHC_SAM_00 0x00
|
||||
#define SIXLOWPAN_IPHC_SAM_01 0x10
|
||||
#define SIXLOWPAN_IPHC_SAM_10 0x20
|
||||
#define SIXLOWPAN_IPHC_SAM_11 0x30
|
||||
|
||||
#define SIXLOWPAN_IPHC_SAM_BIT 4
|
||||
|
||||
#define SIXLOWPAN_IPHC_M 0x08
|
||||
#define SIXLOWPAN_IPHC_DAC 0x04
|
||||
#define SIXLOWPAN_IPHC_DAM_00 0x00
|
||||
#define SIXLOWPAN_IPHC_DAM_01 0x01
|
||||
#define SIXLOWPAN_IPHC_DAM_10 0x02
|
||||
#define SIXLOWPAN_IPHC_DAM_11 0x03
|
||||
|
||||
#define SIXLOWPAN_IPHC_DAM_BIT 0
|
||||
|
||||
/* Link local context number */
|
||||
|
||||
#define SIXLOWPAN_IPHC_ADDR_CONTEXT_LL 0
|
||||
|
||||
/* 16-bit multicast addresses compression */
|
||||
|
||||
#define SIXLOWPAN_IPHC_MCAST_RANGE 0xa0
|
||||
|
||||
/* NHC_EXT_HDR */
|
||||
|
||||
#define SIXLOWPAN_NHC_MASK 0xf0
|
||||
#define SIXLOWPAN_NHC_EXT_HDR 0xe0
|
||||
|
||||
/* LOWPAN_UDP encoding (works together with IPHC) */
|
||||
|
||||
#define SIXLOWPAN_NHC_UDP_MASK 0xf8
|
||||
#define SIXLOWPAN_NHC_UDP_ID 0xf0
|
||||
#define SIXLOWPAN_NHC_UDP_CHECKSUMC 0x04
|
||||
#define SIXLOWPAN_NHC_UDP_CHECKSUMI 0x00
|
||||
|
||||
/* Values for port compression, _with checksum_ ie bit 5 set to 0 */
|
||||
|
||||
#define SIXLOWPAN_NHC_UDP_CS_P_00 0xf0 /* All inline */
|
||||
#define SIXLOWPAN_NHC_UDP_CS_P_01 0xf1 /* Source 16bit inline, dest = 0xf0 + 8 bit inline */
|
||||
#define SIXLOWPAN_NHC_UDP_CS_P_10 0xf2 /* Source = 0xf0 + 8bit inline, dest = 16 bit inline */
|
||||
#define SIXLOWPAN_NHC_UDP_CS_P_11 0xf3 /* Source & dest = 0xf0b + 4bit inline */
|
||||
|
||||
/* The 6lowpan "headers" length */
|
||||
|
||||
#define SIXLOWPAN_IPV6_HDR_LEN 1 /* One byte */
|
||||
#define SIXLOWPAN_HC1_HDR_LEN 3
|
||||
#define SIXLOWPAN_HC1_HC_UDP_HDR_LEN 7
|
||||
#define SIXLOWPAN_FRAG1_HDR_LEN 4
|
||||
#define SIXLOWPAN_FRAGN_HDR_LEN 5
|
||||
|
||||
/* Address compressibility test macros */
|
||||
|
||||
/* Check whether we can compress the IID in address 'a' to 16 bits. This is
|
||||
* used for unicast addresses only, and is true if the address is on the
|
||||
* format <PREFIX>::0000:00ff:fe00:XXXX
|
||||
*
|
||||
* NOTE: we currently assume 64-bits prefixes
|
||||
*/
|
||||
|
||||
#define SIXLOWPAN_IS_IID_16BIT_COMPRESSABLE(a) \
|
||||
((((a)->u16[4]) == 0) && \
|
||||
// (((a)->u8[10]) == 0)&& \
|
||||
(((a)->u8[11]) == 0xff)&& \
|
||||
(((a)->u8[12]) == 0xfe)&& \
|
||||
(((a)->u8[13]) == 0))
|
||||
|
||||
/* Check whether the 9-bit group-id of the compressed multicast address is
|
||||
* known. It is true if the 9-bit group is the all nodes or all routers
|
||||
* group. Parameter 'a' is typed uint8_t *
|
||||
*/
|
||||
|
||||
#define SIXLOWPAN_IS_MCASTADDR_DECOMPRESSABLE(a) \
|
||||
(((*a & 0x01) == 0) && \
|
||||
((*(a + 1) == 0x01) || (*(a + 1) == 0x02)))
|
||||
|
||||
/* Check whether the 112-bit group-id of the multicast address is mappable
|
||||
* to a 9-bit group-id. It is true if the group is the all nodes or all
|
||||
* routers group.
|
||||
*/
|
||||
|
||||
#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE(a) \
|
||||
((((a)->u16[1]) == 0) && \
|
||||
(((a)->u16[2]) == 0) && \
|
||||
(((a)->u16[3]) == 0) && \
|
||||
(((a)->u16[4]) == 0) && \
|
||||
(((a)->u16[5]) == 0) && \
|
||||
(((a)->u16[6]) == 0) && \
|
||||
(((a)->u8[14]) == 0) && \
|
||||
((((a)->u8[15]) == 1) || (((a)->u8[15]) == 2)))
|
||||
|
||||
/* FFXX::00XX:XXXX:XXXX */
|
||||
|
||||
#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE48(a) \
|
||||
((((a)->u16[1]) == 0) && \
|
||||
(((a)->u16[2]) == 0) && \
|
||||
(((a)->u16[3]) == 0) && \
|
||||
(((a)->u16[4]) == 0) && \
|
||||
(((a)->u8[10]) == 0))
|
||||
|
||||
/* FFXX::00XX:XXXX */
|
||||
|
||||
#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE32(a) \
|
||||
((((a)->u16[1]) == 0) && \
|
||||
(((a)->u16[2]) == 0) && \
|
||||
(((a)->u16[3]) == 0) && \
|
||||
(((a)->u16[4]) == 0) && \
|
||||
(((a)->u16[5]) == 0) && \
|
||||
(((a)->u8[12]) == 0))
|
||||
|
||||
/* FF02::00XX */
|
||||
|
||||
#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE8(a) \
|
||||
((((a)->u8[1]) == 2) && \
|
||||
(((a)->u16[1]) == 0) && \
|
||||
(((a)->u16[2]) == 0) && \
|
||||
(((a)->u16[3]) == 0) && \
|
||||
(((a)->u16[4]) == 0) && \
|
||||
(((a)->u16[5]) == 0) && \
|
||||
(((a)->u16[6]) == 0) && \
|
||||
(((a)->u8[14]) == 0))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* The header for fragments
|
||||
*
|
||||
* NOTE: We do not define different structures for FRAG1 and FRAGN headers,
|
||||
* which are different. For FRAG1, the offset field is just not used
|
||||
*/
|
||||
|
||||
struct sixlowpan_frag_hdr
|
||||
{
|
||||
uint16_t dispatch_size;
|
||||
uint16_t tag;
|
||||
uint8_t offset;
|
||||
};
|
||||
|
||||
/* The HC1 header when HC_UDP is not used
|
||||
*
|
||||
* When all fields are compressed and HC_UDP is not used, we use this
|
||||
* structure. If HC_UDP is used, the ttl is in another spot, and we use the
|
||||
* sixlowpan_hc1_hc_udp structure
|
||||
*/
|
||||
|
||||
struct sixlowpan_hc1_hdr
|
||||
{
|
||||
uint8_t dispatch;
|
||||
uint8_t encoding;
|
||||
uint8_t ttl;
|
||||
};
|
||||
|
||||
/* HC1 followed by HC_UDP */
|
||||
|
||||
struct sixlowpan_hc1_hc_udp_hdr
|
||||
{
|
||||
uint8_t dispatch;
|
||||
uint8_t hc1_encoding;
|
||||
uint8_t hc_udp_encoding;
|
||||
uint8_t ttl;
|
||||
uint8_t ports;
|
||||
uint16_t udpchksum;
|
||||
};
|
||||
|
||||
/* An address context for IPHC address compression each context can have up
|
||||
* to 8 bytes
|
||||
*/
|
||||
|
||||
struct sixlowpan_addr_context
|
||||
{
|
||||
uint8_t used; /* Possibly use as prefix-length */
|
||||
uint8_t number;
|
||||
uint8_t prefix[8];
|
||||
};
|
||||
|
||||
|
||||
/* The structure of a next header compressor. This compressor is provided
|
||||
* by architecture-specific logic outside of the network stack.
|
||||
*
|
||||
* TODO: needs more parameters when compressing extension headers, etc.
|
||||
*/
|
||||
|
||||
struct sixlowpan_nhcompressor_s
|
||||
{
|
||||
CODE int (*is_compressable)(uint8_t next_header);
|
||||
|
||||
/* Compress next header (TCP/UDP, etc) - ptr points to next header to
|
||||
* compress.
|
||||
*/
|
||||
|
||||
CODE int (*compress)(FAR uint8_t *compressed, FAR uint8_t *uncompressed_len);
|
||||
|
||||
/* Uncompress next header (TCP/UDP, etc) - ptr points to next header to
|
||||
* uncompress.
|
||||
*/
|
||||
|
||||
CODE int (*uncompress)(FAR uint8_t *compressed, FAR uint8_t *lowpanbuf,
|
||||
FAR uint8_t *uncompressed_len);
|
||||
};
|
||||
|
||||
/* RIME sniffer callbacks */
|
||||
|
||||
struct sixlowpan_rime_sniffer_s
|
||||
{
|
||||
CODE void (*input)(void);
|
||||
CODE void (*output)(int mac_status);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: sixlowpan_set_compressor
|
||||
*
|
||||
* Description:
|
||||
* Configure to use the architecture-specific compressor.
|
||||
*
|
||||
* Input parameters:
|
||||
* compressor - A reference to the new compressor to be used. This may
|
||||
* be a NULL value to disable the compressor.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sixlowpan_set_compressor(FAR struct sixlowpan_nhcompressor_s *compressor);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: sixlowpan_set_sniffer
|
||||
*
|
||||
* Description:
|
||||
* Configure to use an architecture-specific sniffer to enable tracing of
|
||||
* IP.
|
||||
*
|
||||
* Input parameters:
|
||||
* sniffer - A reference to the new sniffer to be used. This may
|
||||
* be a NULL value to disable the sniffer.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sixlowpan_set_sniffer(FAR struct sixlowpan_rime_sniffer_s *sniffer);
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_NET_SIXLOWOAN_H */
|
@ -418,12 +418,20 @@
|
||||
# define SYS_pthread_mutex_lock (__SYS_pthread+19)
|
||||
# define SYS_pthread_mutex_trylock (__SYS_pthread+20)
|
||||
# define SYS_pthread_mutex_unlock (__SYS_pthread+21)
|
||||
# define SYS_pthread_once (__SYS_pthread+22)
|
||||
# define SYS_pthread_setschedparam (__SYS_pthread+23)
|
||||
# define SYS_pthread_setschedprio (__SYS_pthread+24)
|
||||
# define SYS_pthread_setspecific (__SYS_pthread+25)
|
||||
# define SYS_pthread_yield (__SYS_pthread+26)
|
||||
# define __SYS_pthread_smp (__SYS_pthread+27)
|
||||
|
||||
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
|
||||
# define SYS_pthread_mutex_consistent (__SYS_pthread+22)
|
||||
# define __SYS_pthread_once (__SYS_pthread+23)
|
||||
#else
|
||||
# define __SYS_pthread_once (__SYS_pthread+22)
|
||||
#endif
|
||||
|
||||
# define SYS_pthread_once (__SYS_pthread_once+0)
|
||||
# define SYS_pthread_setschedparam (__SYS_pthread_once+1)
|
||||
# define SYS_pthread_setschedprio (__SYS_pthread_once+2)
|
||||
# define SYS_pthread_setspecific (__SYS_pthread_once+3)
|
||||
# define SYS_pthread_yield (__SYS_pthread_once+4)
|
||||
# define __SYS_pthread_smp (__SYS_pthread_once+5)
|
||||
|
||||
# ifdef CONFIG_SMP
|
||||
# define SYS_pthread_setaffinity_np (__SYS_pthread_smp+0)
|
||||
|
@ -77,13 +77,13 @@
|
||||
#define timersub(tvp, uvp, vvp) \
|
||||
do \
|
||||
{ \
|
||||
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
|
||||
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
|
||||
if ((vvp)->tv_usec < 0) \
|
||||
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
|
||||
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
|
||||
if ((vvp)->tv_usec < 0) \
|
||||
{ \
|
||||
(vvp)->tv_sec--; \
|
||||
(vvp)->tv_usec += 1000000; \
|
||||
} \
|
||||
(vvp)->tv_sec--; \
|
||||
(vvp)->tv_usec += 1000000; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
@ -255,7 +255,7 @@ menuconfig NET_IPv6
|
||||
Build in support for IPv6.
|
||||
|
||||
source "net/neighbor/Kconfig"
|
||||
source "net/6lowpan/Kconfig"
|
||||
source "net/sixlowpan/Kconfig"
|
||||
|
||||
endmenu # Internet Protocol Selection
|
||||
|
||||
|
@ -67,7 +67,7 @@ include pkt/Make.defs
|
||||
include local/Make.defs
|
||||
include tcp/Make.defs
|
||||
include udp/Make.defs
|
||||
include 6lowpan/Make.defs
|
||||
include sixlowpan/Make.defs
|
||||
include devif/Make.defs
|
||||
include loopback/Make.defs
|
||||
include route/Make.defs
|
||||
|
@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# net/6lowpan/Make.defs
|
||||
# net/sixlowpan/Make.defs
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -39,11 +39,11 @@ ifeq ($(CONFIG_NET_6LOWPAN),y)
|
||||
|
||||
# Include IEEE 802.15.4 file in the build
|
||||
|
||||
# NET_CSRCS +=
|
||||
NET_CSRCS += sixlowpan_compressor.c sixlowpan_sniffer.c
|
||||
|
||||
# Include the 6lowpan directory in the build
|
||||
# Include the sixlowpan directory in the build
|
||||
|
||||
DEPPATH += --dep-path 6lowpan
|
||||
VPATH += :6lowpan
|
||||
DEPPATH += --dep-path sixlowpan
|
||||
VPATH += :sixlowpan
|
||||
|
||||
endif # CONFIG_NET_6LOWPAN
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* net/6lowpan/6lowpan.h
|
||||
* net/sixlowpan/sixlowpan.h
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __NET_6LOWPAN_6LOWPAN_H
|
||||
#define __NET_6LOWPAN_6LOWPAN_H
|
||||
#ifndef _NET_SIXLOWPAN_SIXLOWPAN_H
|
||||
#define _NET_SIXLOWPAN_SIXLOWPAN_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@ -44,6 +44,19 @@
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* A pointer to the optional, architecture-specific compressor */
|
||||
|
||||
struct sixlowpan_nhcompressor_s; /* Foward reference */
|
||||
extern FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor;
|
||||
|
||||
/* Rime Sniffer support for one single listener to enable trace of IP */
|
||||
|
||||
extern struct sixlowpan_rime_sniffer_s *g_sixlopan_sniffer;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@ -53,4 +66,4 @@
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* CONFIG_NET_6LOWPAN */
|
||||
#endif /* __NET_6LOWPAN_6LOWPAN_H */
|
||||
#endif /* _NET_SIXLOWPAN_SIXLOWPAN_H */
|
88
net/sixlowpan/sixlowpan_compressor.c
Normal file
88
net/sixlowpan/sixlowpan_compressor.c
Normal file
@ -0,0 +1,88 @@
|
||||
/****************************************************************************
|
||||
* net/sixlowpan/sixlowpan_compressor.c
|
||||
*
|
||||
* Copyright (C) 2017 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "nuttx/net/net.h"
|
||||
#include "nuttx/net/sixlowpan.h"
|
||||
|
||||
#include "sixlowpan/sixlopan.h"
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* A pointer to the optional, architecture-specific compressor */
|
||||
|
||||
FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: sixlowpan_set_compressor
|
||||
*
|
||||
* Description:
|
||||
* Configure to use the architecture-specific compressor.
|
||||
*
|
||||
* Input parameters:
|
||||
* compressor - A reference to the new compressor to be used. This may
|
||||
* be a NULL value to disable the compressor.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sixlowpan_set_compressor(FAR struct sixlowpan_nhcompressor_s *compressor)
|
||||
{
|
||||
/* Make sure that the compressor is not in use */
|
||||
|
||||
net_lock();
|
||||
|
||||
/* Then instantiate the new compressor */
|
||||
|
||||
g_sixlowpan_compressor = compressor;
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET_6LOWPAN */
|
89
net/sixlowpan/sixlowpan_sniffer.c
Normal file
89
net/sixlowpan/sixlowpan_sniffer.c
Normal file
@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
* net/sixlowpan/sixlowpan_sniffer.c
|
||||
*
|
||||
* Copyright (C) 2017 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "nuttx/net/net.h"
|
||||
#include "nuttx/net/sixlowpan.h"
|
||||
|
||||
#include "sixlowpan/sixlopan.h"
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* A pointer to the optional, architecture-specific sniffer */
|
||||
|
||||
FAR struct sixlowpan_rime_sniffer_s *g_sixlowpan_sniffer;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: sixlowpan_set_sniffer
|
||||
*
|
||||
* Description:
|
||||
* Configure to use an architecture-specific sniffer to enable tracing of
|
||||
* IP.
|
||||
*
|
||||
* Input parameters:
|
||||
* sniffer - A reference to the new sniffer to be used. This may
|
||||
* be a NULL value to disable the sniffer.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sixlowpan_set_sniffer(FAR struct sixlowpan_rime_sniffer_s *sniffer)
|
||||
{
|
||||
/* Make sure that the sniffer is not in use */
|
||||
|
||||
net_lock();
|
||||
|
||||
/* Then instantiate the new sniffer */
|
||||
|
||||
g_sixlowpan_sniffer = sniffer;
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET_6LOWPAN */
|
@ -536,12 +536,12 @@ choice
|
||||
default PTHREAD_MUTEX_ROBUST if !DEFAULT_SMALL
|
||||
default PTHREAD_UNSAFE if DEFAULT_SMALL
|
||||
|
||||
config PTHREAD_MUTEX_ROBUST
|
||||
config PTHREAD_MUTEX_ROBUST
|
||||
bool "Robust mutexes"
|
||||
---help---
|
||||
Support only the robust form of the NORMAL mutex.
|
||||
|
||||
config PTHREAD_MUTEX_UNSAFE
|
||||
config PTHREAD_MUTEX_UNSAFE
|
||||
bool "Traditional unsafe mutexes"
|
||||
---help---
|
||||
Support only the traditional non-robust form of the NORMAL mutex.
|
||||
@ -549,7 +549,7 @@ choice
|
||||
software you may be porting or, perhaps, if you are trying to minimize
|
||||
footprint.
|
||||
|
||||
config PTHREAD_MUTEX_BOTH
|
||||
config PTHREAD_MUTEX_BOTH
|
||||
bool "Both robust and unsafe mutexes"
|
||||
---help---
|
||||
Support both forms of NORMAL mutexes.
|
||||
@ -561,12 +561,12 @@ choice
|
||||
default PTHREAD_MUTEX_DEFAULT_ROBUST
|
||||
depends on PTHREAD_MUTEX_BOTH
|
||||
|
||||
config PTHREAD_MUTEX_DEFAULT_ROBUST
|
||||
config PTHREAD_MUTEX_DEFAULT_ROBUST
|
||||
bool "Robust default"
|
||||
---help---
|
||||
The default is robust NORMAL mutexes (non-standard)
|
||||
|
||||
config PTHREAD_MUTEX_DEFAULT_UNSAFE
|
||||
config PTHREAD_MUTEX_DEFAULT_UNSAFE
|
||||
bool "Unsafe default"
|
||||
---help---
|
||||
The default is traditional unsafe NORMAL mutexes (standard)
|
||||
|
@ -91,6 +91,7 @@
|
||||
"pthread_mutex_lock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
|
||||
"pthread_mutex_trylock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
|
||||
"pthread_mutex_unlock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
|
||||
"pthread_mutex_consistent","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_PTHREAD_MUTEX_UNSAFE)","int","FAR pthread_mutex_t*"
|
||||
"pthread_once","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_once_t*","CODE void (*)(void)"
|
||||
"pthread_setaffinity_np","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SMP)","int","pthread_t","size_t","FAR const cpu_set_t*"
|
||||
"pthread_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int","FAR const struct sched_param*"
|
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
@ -303,6 +303,9 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
|
||||
SYSCALL_LOOKUP(pthread_mutex_lock, 1, STUB_pthread_mutex_lock)
|
||||
SYSCALL_LOOKUP(pthread_mutex_trylock, 1, STUB_pthread_mutex_trylock)
|
||||
SYSCALL_LOOKUP(pthread_mutex_unlock, 1, STUB_pthread_mutex_unlock)
|
||||
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
|
||||
SYSCALL_LOOKUP(pthread_mutex_consistent, 1, STUB_pthread_mutex_consistent)
|
||||
#endif
|
||||
SYSCALL_LOOKUP(pthread_once, 2, STUB_pthread_once)
|
||||
SYSCALL_LOOKUP(pthread_setschedparam, 3, STUB_pthread_setschedparam)
|
||||
SYSCALL_LOOKUP(pthread_setschedprio, 2, STUB_pthread_setschedprio)
|
||||
|
@ -302,6 +302,7 @@ uintptr_t STUB_pthread_mutex_init(int nbr, uintptr_t parm1,
|
||||
uintptr_t STUB_pthread_mutex_lock(int nbr, uintptr_t parm1);
|
||||
uintptr_t STUB_pthread_mutex_trylock(int nbr, uintptr_t parm1);
|
||||
uintptr_t STUB_pthread_mutex_unlock(int nbr, uintptr_t parm1);
|
||||
uintptr_t STUB_pthread_mutex_consistent(int nbr, uintptr_t parm1);
|
||||
uintptr_t STUB_pthread_once(int nbr, uintptr_t parm1, uintptr_t parm2);
|
||||
uintptr_t STUB_pthread_setschedparam(int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user