Project import
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..aeac9e8 --- /dev/null +++ b/Makefile
@@ -0,0 +1,183 @@ +# +# Copyright (c) 2012 Nest Labs, Inc. +# All rights reserved. +# +# This document is the property of Nest. It is considered +# confidential and proprietary information. +# +# This document may not be reproduced or transmitted in any form, +# in whole or in part, without the express written permission of +# Nest. +# +# Description: +# This file is the make file for LwIP, a Lightweight IPv4- +# and IPv6 TCP/IP stack. +# + +BuildConfigSpecialized := Yes +BuildProductSpecialized := Yes + +include pre.mak + +PackageRoot := . + +PackageName := lwip + +PackageSourceDir := $(LwipSrcPath)/$(PackageName) + +GeneratePackagePaths = $(addprefix $(call Slashify,$(PackageSourceDir)),$(1)) + +LicenseSourceFile := $(PackageSourceDir)/COPYING + +all: $(PackageDefaultGoal) + +# Generate the package license contents. + +$(LicenseSourceFile): source + +$(PackageLicenseFile): $(LicenseSourceFile) + $(copy-result) + +# We are building this package from version-controlled source, so +# there is nothing to do for this target goal. + +$(PackageSourceDir): + +# Prepare the sources. + +.PHONY: source +source: | $(PackageSourceDir) + +# Patch the sources, if necessary. + +.PHONY: patch +patch: source + +# Configure the source for building. + +.PHONY: configure +configure: source + +# Build the source. + +.PHONY: build +build: configure + +.PHONY: stage +stage: build | $(ResultDirectory) + +lwip_API_PATHS = src/api/api_lib.c \ + src/api/api_msg.c \ + src/api/err.c \ + src/api/netbuf.c \ + src/api/netdb.c \ + src/api/netifapi.c \ + src/api/sockets.c \ + src/api/tcpip.c + +lwip_CORE_PATHS = src/core/def.c \ + src/core/dhcp.c \ + src/core/dns.c \ + src/core/inet_chksum.c \ + src/core/init.c \ + src/core/ipv4/autoip.c \ + src/core/ipv4/icmp.c \ + src/core/ipv4/igmp.c \ + src/core/ipv4/ip4.c \ + src/core/ipv4/ip4_addr.c \ + src/core/ipv4/ip_frag.c \ + src/core/ipv6/dhcp6.c \ + src/core/ipv6/ethip6.c \ + src/core/ipv6/icmp6.c \ + src/core/ipv6/inet6.c \ + src/core/ipv6/ip6.c \ + src/core/ipv6/ip6_addr.c \ + src/core/ipv6/ip6_frag.c \ + src/core/ipv6/mld6.c \ + src/core/ipv6/nd6.c \ + src/core/mem.c \ + src/core/memp.c \ + src/core/netif.c \ + src/core/pbuf.c \ + src/core/raw.c \ + src/core/stats.c \ + src/core/sys.c \ + src/core/tcp.c \ + src/core/tcp_in.c \ + src/core/tcp_out.c \ + src/core/timers.c \ + src/core/udp.c + +lwip_NETIF_PATHS = src/netif/etharp.c + +ifeq ($(BuildConfig),unittest) +lwip_TEST_PATHS = test/nlunittest/src/test_pbuf.cpp +endif + +lwip_SOURCE_PATHS = $(lwip_API_PATHS) \ + $(lwip_CORE_PATHS) \ + $(lwip_NETIF_PATHS) \ + $(lwip_TEST_PATHS) + +lwip_INCLUDE = src/include +lwip_IPV4_INCLUDE = src/include/ipv4 +lwip_IPV6_INCLUDE = src/include/ipv6 + +ifeq ($(BuildConfig),unittest) +lwip_TEST_INCLUDE_DIRS = test/nlunittest/include +endif + +lwip_PACKAGE_SOURCE_PATHS = $(call GeneratePackagePaths,$(lwip_SOURCE_PATHS)) + +# Tell make where to search for the sources, cleaning up the leading +# ./ strictly for cosmetic display purposes in the process. + +VPATH = $(subst ./,,$(dir $(lwip_PACKAGE_SOURCE_PATHS))) + +ifneq ($(BUILD_PRODUCT),pinnasim) # Only copy headers for pinnasim, don't build lwip library +ARCHIVES = lwip +endif + +lwip_SOURCES = $(notdir $(lwip_PACKAGE_SOURCE_PATHS)) + +lwip_INCLUDES = $(LwIPIncludePaths) \ + os/$(TargetOS) \ + $(FreeRTOSIncludePaths) \ + $(NlPlatformIncludePaths) \ + $(TestFrameworkIncludePaths) \ + $(NLERIncludePaths) + +# While LwIP uses the nlbuild build system because it has no build system of +# its own, it is still third-party software and we do not want to enforce +# style semantics on it. Consequently, set PrettyPaths to empty. + +PrettyPaths := $(NULL) + +# Use header_source:header_dest format to move header files to their appropriate locations +LwIPIncludeSourcePaths = $(wildcard $(addsuffix /*/*.h,$(call GeneratePackagePaths, $(lwip_INCLUDE)))) +LwIPIncludeTranslationPaths = $(foreach headerfile,$(LwIPIncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/src/include,,$(headerfile))) + +LwIPIPV4IncludeSourcePaths = $(wildcard $(addsuffix /*/*.h,$(call GeneratePackagePaths, $(lwip_IPV4_INCLUDE)))) +LwIPIPV4IncludeTranslationPaths = $(foreach headerfile,$(LwIPIPV4IncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/src/include,,$(headerfile))) + +LwIPIPV6IncludeSourcePaths = $(wildcard $(addsuffix /*/*.h,$(call GeneratePackagePaths, $(lwip_IPV6_INCLUDE)))) +LwIPIPV6IncludeTranslationPaths = $(foreach headerfile,$(LwIPIPV6IncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/src/include,,$(headerfile))) + +LwIPTestIncludeSourcePaths = $(wildcard $(addsuffix /*.h,$(call GeneratePackagePaths, $(lwip_TEST_INCLUDE_DIRS)))) +LwIPTestIncludeTranslationPaths = $(foreach headerfile,$(LwIPTestIncludeSourcePaths),$(headerfile):$(subst $(PackageSourceDir)/test/nlunittest/include,,$(headerfile))) + +LwIPOptionHeaderNames = common_lwipopts.h lwipopts.h lwippools.h + +LwIPArchHeaderNames = cc.h perf.h sys_arch.h +LwIPArchHeaderSourcePaths = $(addprefix os/$(TargetOS)/arch/,$(LwIPArchHeaderNames)) +LwIPArchTranslationPaths = $(foreach headerfile,$(LwIPArchHeaderSourcePaths),$(headerfile):$(subst os/$(TargetOS)/,,$(headerfile))) + +lwip_HEADERS = $(LwIPIncludeTranslationPaths) \ + $(LwIPIPV4IncludeTranslationPaths) \ + $(LwIPIPV6IncludeTranslationPaths) \ + $(LwIPOptionHeaderNames) \ + $(LwIPArchTranslationPaths) \ + $(LwIPTestIncludeTranslationPaths) + +include post.mak +
diff --git a/common_lwipopts.h b/common_lwipopts.h new file mode 100644 index 0000000..4f4d42e --- /dev/null +++ b/common_lwipopts.h
@@ -0,0 +1,353 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * Description: + * This file describes common compile-time constants used for + * configuring LwIP, shared across all products and platforms. + * + */ + +#ifndef __COMMON_LWIPOPTS_H__ +#define __COMMON_LWIPOPTS_H__ + +/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided + * by your system, set this to 0 and include <sys/time.h> in cc.h + */ +#define LWIP_TIMEVAL_PRIVATE (0) + +/** + * LwIP has three memory models it can work with for general memory + * allocation: + * + * 1) Standard C Library APIs and default platform heap. + * + * - Enabled by asserting MEM_LIBC_MALLOC + * + * 2) LwIP APIs and LwIP-internal heap (from BSS data). + * + * - Enabled by deasserting MEM_LIBC_MALLOC + * + * 3) Pre-allocated binned memory and object pools (from BSS data). + * + * - Enabled by deasserting MEM_LIBC_MALLOC and asserting + * MEM_USE_POOLS. + * + */ + +/** + * Do use the Standard C Library heap and associated APIs. + */ +#define MEM_LIBC_MALLOC (0) + +/** + * Do not use memory pools to create fixed, statically allocated pools of + * memory in lieu of the Standard C Library heap and APIs. + */ +#define MEM_USE_POOLS (0) + +/** + * Do not use custom memory pools for specific, named LwIP objects, sourced + * from lwippools.h. + */ +#define MEM_USE_CUSTOM_POOLS (MEM_USE_POOLS) + +/** + * MEM_SIZE: The size of the built-in LwIP heap memory. + * + * We size this for: + * + * 2 @ 120 bytes for outstanding transport header + * 5 @ 9 bytes for LwIP heap structure + * + * 288 bytes after 16 byte alignment + */ +#define MEM_SIZE 288 + +/** Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores + * should be used instead + */ +#define LWIP_COMPAT_MUTEX (0) + +/** + * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain + * critical regions during buffer allocation, deallocation and memory + * allocation and deallocation. + */ +#define SYS_LIGHTWEIGHT_PROT (1) + +/** + * Enable automatic IPv4 link-local address assignment. + */ +#define LWIP_AUTOIP (0) + +/** + * Allow DHCP and automatic IPv4 link-local address assignment to + * work cooperatively. + */ +#define LWIP_DHCP_AUTOIP_COOP (0) + +/** + * LWIP_PROVIDE_ERRNO: errno definitions from the Standard C Library. + */ +#undef LWIP_PROVIDE_ERRNO + +/** + * ERRNO: no errno + */ +#undef ERRNO + +/** + * MEMP_NUM_RAW_PCB: Number of raw connection PCBs + * (requires the LWIP_RAW option) + */ +#ifndef MEMP_NUM_RAW_PCB +#define MEMP_NUM_RAW_PCB (5) +#endif + +/** + * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One + * per active UDP "connection". + * (requires the LWIP_UDP option) + */ +#ifndef MEMP_NUM_UDP_PCB +#define MEMP_NUM_UDP_PCB (7 + (LWIP_DHCP) + (LWIP_DNS)) +#endif + +/* ARP before DHCP causes multi-second delay - turn it off */ +#define DHCP_DOES_ARP_CHECK (0) + +/** + * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c + */ +#define LWIP_HAVE_LOOPIF (0) + +/** + * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP + * address equal to the netif IP address, looping them back up the stack. + */ +#define LWIP_NETIF_LOOPBACK (0) + +/** + * MEMP_NUM_NETCONN: the number of struct netconns. + * (only needed if you use the sequential API, like api_lib.c) + */ +#define MEMP_NUM_NETCONN (1) + +/** + * LWIP_SO_RCVTIMEO==1: Enable SO_RCVTIMEO processing. + */ +#define LWIP_SO_RCVTIMEO (1) + + +/** + * LWIP_IGMP==0: Turn off IGMP module. + */ +#ifndef LWIP_IGMP +#define LWIP_IGMP (0) +#endif + +/** + * LWIP_ARP==0: Disable ARP functionality. + */ + +#ifndef LWIP_ARP +#define LWIP_ARP (0) +#endif + + +/** + * SO_REUSE==1: Enable SO_REUSEADDR option. + * Required by IGMP for reuse of multicast address and port by other sockets + */ +#define SO_REUSE (1) + +/** + * When using IGMP, LWIP_RAND() needs to be defined to a random-function returning an u32_t random value + */ +#define LWIP_RAND() (u32_t)lrand48() + +/** + * LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS==1: Randomize the local port + * for the first local TCP/UDP PCB. This can prevent creating + * predictable port numbers after booting a system (see RFC-6065). + */ +#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS (1) + +/** + * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS + * transport. + */ +#ifndef LWIP_DNS +#define LWIP_DNS (0) +#endif + +/** + * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names. + * Disable this option if you use a POSIX operating system that uses the same + * names (read, write & close). (only used if you use sockets.c) + * + * We disable this because this otherwise collides with the Standard C + * Library where both LWIP and its headers are included. + */ +#define LWIP_POSIX_SOCKETS_IO_NAMES (0) + +#ifdef LWIP_SO_RCVBUF +#if ( LWIP_SO_RCVBUF == 1 ) +#include <limits.h> /* Needed because RECV_BUFSIZE_DEFAULT is defined as INT_MAX */ +#endif /* if ( LWIP_SO_RCVBUF == 1 ) */ +#endif /* ifdef LWIP_SO_RCVBUF */ + +/** + * LWIP_STATS : Turn off statistics gathering + */ +#define LWIP_STATS (0) + +/** + * LWIP_IPV6==1: Enable IPv6 + */ +#define LWIP_IPV6 1 + +/** + * LWIP_IPV6_AUTOCONFIG==0: Disable stateless address + * autoconfiguration (SLAAC). + */ +#define LWIP_IPV6_AUTOCONFIG (0) + +/** + * LWIP_IPV6_REASS -- disable reassembly, already performed by 6lowpan layer. + */ +#define LWIP_IPV6_REASS (0) + +/** + * LWIP_IPV6_MLD==1: enable multicast listener discovery protocol. + */ +#define LWIP_IPV6_MLD (1) + +/** + * + */ + +/** + * LWIP_IPV6_DHCP6==0: Disable DHCPv6 stateful address autoconfiguration. + */ +#ifndef LWIP_IPV6_DHCP6 +#define LWIP_IPV6_DHCP6 1 +#endif + +/** + * Enable locking in the lwip (tcpip) thread. + */ +#ifndef LWIP_TCPIP_CORE_LOCKING +#define LWIP_TCPIP_CORE_LOCKING 1 +#endif + +/** + * Controls if TCP should queue segments that arrive out of + * order. Define to 0 if your device is low on memory. + * See DOLO-738 as to why buffering of out of order + * segments has been disabled (in short, device runs out of + * pbufs during prolonged download, slowing down a lot.) + */ +#define TCP_QUEUE_OOSEQ 0 + +/** + * ARP_QUEUEING==1: Multiple outgoing packets are queued during + * hardware address resolution. By default, only the most recent + * packet is queued per IP address. This is sufficient for most + * protocols and mainly reduces TCP connection startup time. Set this + * to 1 if you know your application sends more than one packet in a + * row to an IP address that is not in the ARP cache. + */ +#define ARP_QUEUEING (0) + +/** + * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing + * packets (pbufs) that are waiting for an ARP request (to resolve + * their destination address) to finish. (requires the ARP_QUEUEING + * option) + */ +#define MEMP_NUM_ARP_QUEUE (PBUF_POOL_SIZE) + +/** + * LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address + * is being resolved. + */ +#define LWIP_ND6_QUEUEING (LWIP_IPV6) + +/** + * MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC + * resolution. + */ +#define MEMP_NUM_ND6_QUEUE (PBUF_POOL_SIZE) + +/** + * LWIP_MULTICAST_PING: respond to multicast pings (default is unicast only) + */ +#define LWIP_MULTICAST_PING (1) + +/** + * Debug printing + * By default enable debug printing for debug build, but set level to off + * This allows user to change any desired debug level to on. + */ +#define LWIP_DEBUG +#define MEMP_OVERFLOW_CHECK ( 0 ) +#define MEMP_SANITY_CHECK ( 0 ) +#define MEM_DEBUG (LWIP_DBG_OFF) +#define MEMP_DEBUG (LWIP_DBG_ON) +#define PBUF_DEBUG (LWIP_DBG_OFF) +#define API_LIB_DEBUG (LWIP_DBG_OFF) +#define API_MSG_DEBUG (LWIP_DBG_OFF) +#define TCPIP_DEBUG (LWIP_DBG_OFF) +#define NETIF_DEBUG (LWIP_DBG_OFF) +#define SOCKETS_DEBUG (LWIP_DBG_OFF) +#define DEMO_DEBUG (LWIP_DBG_OFF) +#define DHCP_DEBUG (LWIP_DBG_OFF) +#define AUTOIP_DEBUG (LWIP_DBG_OFF) +#define ETHARP_DEBUG (LWIP_DBG_OFF) +#define IP_DEBUG (LWIP_DBG_OFF) +#define IP_REASS_DEBUG (LWIP_DBG_OFF) +#define IP6_DEBUG (LWIP_DBG_OFF) +#define RAW_DEBUG (LWIP_DBG_OFF) +#define ICMP_DEBUG (LWIP_DBG_OFF) +#define UDP_DEBUG (LWIP_DBG_OFF) +#define TCP_DEBUG (LWIP_DBG_OFF) +#define TCP_INPUT_DEBUG (LWIP_DBG_OFF) +#define TCP_OUTPUT_DEBUG (LWIP_DBG_OFF) +#define TCP_RTO_DEBUG (LWIP_DBG_OFF) +#define TCP_CWND_DEBUG (LWIP_DBG_OFF) +#define TCP_WND_DEBUG (LWIP_DBG_OFF) +#define TCP_FR_DEBUG (LWIP_DBG_OFF) +#define TCP_QLEN_DEBUG (LWIP_DBG_OFF) +#define TCP_RST_DEBUG (LWIP_DBG_OFF) +#define PPP_DEBUG (LWIP_DBG_OFF) + +#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */ + +/** + * LwIP defaults the size of most mailboxes (i.e. message queues) to + * zero (0). That generally makes RTOSes such as FreeRTOS very + * unhappy. Specify reasonable defaults instead. + */ +#define TCPIP_MBOX_SIZE 6 + +#define DEFAULT_RAW_RECVMBOX_SIZE 6 + +#define DEFAULT_UDP_RECVMBOX_SIZE 6 + +#define DEFAULT_TCP_RECVMBOX_SIZE 6 + +/** + * Disable processing of incoming Router Advertisements. + */ +#define LWIP_ND6_LISTEN_RA 0 + +/** + * Disable IPV6 router discovery. + */ +#define LWIP_IPV6_ROUTER_SUPPORT 0 + + +#endif /* __COMMON_LWIPOPTS_H__ */
diff --git a/lwipopts.h b/lwipopts.h new file mode 100644 index 0000000..167321a --- /dev/null +++ b/lwipopts.h
@@ -0,0 +1,323 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * Description: + * This file describes compile-time constants used for + * configuring LwIP. + * + */ + +/* + * Copyright 2012, Broadcom Corporation + * All Rights Reserved. + * + * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; + * the contents of this file may not be disclosed to third parties, copied + * or duplicated in any form, in whole or in part, without the prior + * written permission of Broadcom Corporation. + */ + +/* + * Copyright (c) 2001-2003 Swedish Institute of Computer Science. + * All rights reserved. + * + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels <adam@sics.se> + * + */ +#ifndef __LWIPOPTS_H__ +#define __LWIPOPTS_H__ + +#include <stdlib.h> + +/** + * Override values in common/lwipopts.h. + */ +#define LWIP_DNS (0) +#define LWIP_ICMP (0) +#define LWIP_IGMP (0) + +#define LWIP_ND6_NUM_NEIGHBORS (0) +#define LWIP_ND6_NUM_DESTINATIONS (0) +#define LWIP_ND6_NUM_PREFIXES (0) +#define LWIP_ND6_NUM_ROUTERS (0) +#define LWIP_ND6_MAX_MULTICAST_SOLICIT (0) +#define LWIP_ND6_MAX_UNICAST_SOLICIT (0) +#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT (0) +#define LWIP_ND6_TCP_REACHABILITY_HINTS (0) +/** + * LWIP_DHCP==0: Disable DHCP module. + */ +#ifdef BUILD_FEATURE_NETWORK_MANAGER_DHCP_V4_CLIENT +#define LWIP_DHCP (1) +#else +#define LWIP_DHCP (0) +#endif + + +#include "common_lwipopts.h" + +#ifdef CUSTOM_LWIPOPTS +#include "custom_lwipopts.h" +#else /* ifdef CUSTOM_LWIPOPTS */ + +/** + * MEM_ALIGNMENT: should be set to the alignment of the CPU + * 4 byte alignment -> #define MEM_ALIGNMENT 4 + * 2 byte alignment -> #define MEM_ALIGNMENT 2 + */ +#define MEM_ALIGNMENT (4) + +/** + * MEMP_NUM_NETBUF: the number of struct netbufs. + * (only needed if you use the sequential API, like api_lib.c) + */ +#define MEMP_NUM_NETBUF (PBUF_POOL_SIZE_LARGE) + +/** + * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. + * (requires the LWIP_TCP option) + */ +#define MEMP_NUM_TCP_SEG (TCP_SND_QUEUELEN+1) + +/** + * MEMP_SEPARATE_POOLS: if defined to 1, each pool is placed in its own array. + * This can be used to individually change the location of each pool. + * Default is one big array for all pools + * + * Nest has enabled this flag to support pbuf allocation tracking. + */ +#define MEMP_SEPARATE_POOLS (1) + +/** + * LWIP_PBUF_FROM_CUSTOM_POOLS: Declare a set of custom mempools immediately following + * MEMP_PBUF_POOL. When allocating a pbuf, scan the custom pbuf pools and find the + * smallest free pbuf that will hold the requested payload and allocate from that pool. + * When using, set PBUF_POOL_SIZE and PBUF_POOL_BUFSIZE to 0 - they are not used. + */ +#define LWIP_PBUF_FROM_CUSTOM_POOLS (1) + +/** + * Include custom mempools from lwippools.h. Required for use with + * LWIP_PBUF_FROM_CUSTOM_POOLS + */ +#define MEMP_USE_CUSTOM_POOLS (1) + +/** + * PBUF_POOL_SIZE: the number of buffers in the default pbuf pool. + * Set to 0 here because we are using LWIP_PBUF_FROM_CUSTOM_POOLS. + */ +#ifndef PBUF_POOL_SIZE +#define PBUF_POOL_SIZE (0) +#endif + +/** + * PBUF_POOL_SIZE_LARGE: the number of buffers in the pool for large sized pbufs + */ +#define PBUF_POOL_SIZE_LARGE (3) + +/** + * PBUF_POOL_SIZE_MEDIUM: the number of buffers in the pool for medium sized pbufs + */ +#define PBUF_POOL_SIZE_MEDIUM (4) + +/** + * PBUF_POOL_SIZE_SMALL: the number of buffers in the pool for small sized pbufs + */ +#define PBUF_POOL_SIZE_SMALL (5) + + +/* + * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. + * Since the received pbufs are enqueued, be sure to configure + * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive + * packets even if the maximum amount of fragments is enqueued for reassembly! + * + */ +#define IP_REASS_MAX_PBUFS 0 +#define IP_REASSEMBLY 0 + +/** + * MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for + * reassembly (whole packets, not fragments!) + */ +#if IP_REASS_MAX_PBUFS > 1 +#ifndef MEMP_NUM_REASSDATA +#define MEMP_NUM_REASSDATA (IP_REASS_MAX_PBUFS - 1) +#endif +#else +#define MEMP_NUM_REASSDATA 0 +#endif + +/** + * PBUF_POOL_BUFSIZE_LARGE: the size of each pbuf in the pool for large pbufs + */ +#define PBUF_POOL_BUFSIZE_LARGE (1280) + +/** + * PBUF_POOL_BUFSIZE_MEDIUM: the size of each pbuf in the pool for medium pbufs + */ +#define PBUF_POOL_BUFSIZE_MEDIUM (640) + +/** + * PBUF_POOL_BUFSIZE_MEDIUM: the size of each pbuf in the pool for small pbufs + */ +#define PBUF_POOL_BUFSIZE_SMALL (256) + + +/** + * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is + * designed to accomodate single full size TCP frame in one pbuf, including + * TCP_MSS, IP header, and link header. + */ +#define PBUF_POOL_BUFSIZE (PBUF_POOL_BUFSIZE_LARGE) + +/** + * PBUF_CUSTOM_POOL_IDX_START: the pbuf pool index at which we start scanning when + * searching variable sized pbuf pools for one we can use. Scanning begins at + * PBUF_CUSTOM_POOL_IDX_START and stops when we reach PBUF_VARIABLE_POOL_END. Pools should be + * placed in descending order by size, immediately following the MEMP_PBUF_POOL. + * + * ie, + * MEMP_PBUF_POOL <---- default pool of pbufs, defined to be zero size + * CUSTOM_PBUF_POOL_0 <---- pool containing largest pbufs + * CUSTOM_PBUF_POOL_1 <---- pool containing second largest pbufs + * ... + * CUSTOM_PBUF_POOL_N-1 <---- pool containing second smallest pbufs + * CUSTOM_PBUF_POOL_N <---- pool containing smallest pbufs. + * + * PBUF_CUSTOM_POOL_IDX_START would be defined to CUSTOM_PBUF_POOL_N + * PBUF_CUSTOM_POOL_IDX_END would be defined to CUSTOM_PBUF_POOL_0 + */ +#define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) +#define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) + + +/** + * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default, + * you might want to increase this.) + * For the receive side, this MSS is advertised to the remote side + * when opening a connection. For the transmit size, this MSS sets + * an upper limit on the MSS advertised by the remote host. + */ +/* *** IMPORTANT *** + * + * DO NOT increase this beyond the point at which a TCP segement will fit within a single PBUF, otherwise + * the code in the WICED netif output function (host_hardware_output() in wiced-network.cpp) will fail. + * + * The limit is effectively WICED_LINK_MTU - (WICED_LINK_OVERHEAD_BELOW_ETHERNET_FRAME + WICED_ETHERNET_SIZE + 60) + */ +#define TCP_MSS (1152) + + +/** + * TCP_SND_BUF: TCP sender buffer space (bytes). + * must be at least as much as (2 * TCP_MSS) for things to work smoothly + */ +#define TCP_SND_BUF (2 * TCP_MSS) + +/** + * ETH_PAD_SIZE: the header space required preceeding the of each pbuf in the pbuf pool. The default is + * designed to accomodate single full size TCP frame in one pbuf, including + * TCP_MSS, IP header, and link header. + * + * This is zero since the role has been taken over by SUB_ETHERNET_HEADER_SPACE as ETH_PAD_SIZE was not always obeyed + */ +#define ETH_PAD_SIZE (0) + +/* TODO */ +#define SUB_ETHERNET_HEADER_SPACE (0) + + +/** + * PBUF_LINK_HLEN: the number of bytes that should be allocated for a + * link level header. The default is 14, the standard value for + * Ethernet. + */ +/* TODO */ +#define PBUF_LINK_HLEN (0) + + +/** + * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. + * The stack size value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#define TCPIP_THREAD_STACKSIZE (1024) + +/** + * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. + * The priority value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#define TCPIP_THREAD_PRIO (2) + +#define TCP_LISTEN_BACKLOG (1) + + +/** + * The WICED definition of PBUF_POOL_BUFSIZE includes a number of + * sizeof() instantiations which causes the C preprocessor to + * fail. Disable TCP configuration constant sanity checks to work + * around this. + */ +#define LWIP_DISABLE_TCP_SANITY_CHECKS (1) + +/** + * The maximum of all used hardware address lengths across all types + * of interfaces in use: + * + * - 802.11 : 6 + * - 802.15.4 : 8 + */ +#define NETIF_MAX_HWADDR_LEN 8U + +/** + * LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif. + * Currently: + * Link-Local, Mesh-Local, Weave Legacy ULA, Weave Thread ULA + * + * TODO: If we ever need mesh local address added back, + * increase the number of IPV6 and unmap + * NL_WPAN_ADDR_THREAD_MESH to NL_WPAN_ADDR_INVALID + */ +#ifndef LWIP_IPV6_NUM_ADDRESSES +#define LWIP_IPV6_NUM_ADDRESSES 3 +#endif + +#define LWIP_NOASSERT 1 + +/** + * Disable 6LoWPAN/Thread debugging in LwIP + * TODO: move this into a more SiLabs centric location + */ +#define ZIP_DEBUG (LWIP_DBG_OFF) + +#endif /* ifdef CUSTOM_LWIPOPTS */ + +#endif /* __LWIPOPTS_H__ */
diff --git a/lwippools.h b/lwippools.h new file mode 100644 index 0000000..b9e9f3b --- /dev/null +++ b/lwippools.h
@@ -0,0 +1,14 @@ +/* Custom PBUF pools must be defined starting with the pool containing the largest PBUF, + * and must be allocated in descending order by PBUF size. + * + * pbuf_alloc will start at the smallest pool (PBUF_VARIABLE_POOL_START in lwipopts.h) + * and try to allocate from pbuf pools of progressively larger pbuf size until it + * successfully finds a pbuf from one of the pools or until it passes PBUF_VARIABLE_POOL_END*/ + +#if LWIP_PBUF_FROM_CUSTOM_POOLS +LWIP_PBUF_MEMPOOL(PBUF_POOL_LARGE, PBUF_POOL_SIZE_LARGE, PBUF_POOL_BUFSIZE_LARGE, "PBUF_POOL_LARGE") +LWIP_PBUF_MEMPOOL(PBUF_POOL_MEDIUM, PBUF_POOL_SIZE_MEDIUM, PBUF_POOL_BUFSIZE_MEDIUM, "PBUF_POOL_MEDIUM") +LWIP_PBUF_MEMPOOL(PBUF_POOL_SMALL, PBUF_POOL_SIZE_SMALL, PBUF_POOL_BUFSIZE_SMALL, "PBUF_POOL_SMALL") +#endif + +/* Place other custom LWIP mem pools below this line */
diff --git a/os/darwin/arch/cc.h b/os/darwin/arch/cc.h new file mode 100644 index 0000000..3a80e53 --- /dev/null +++ b/os/darwin/arch/cc.h
@@ -0,0 +1,85 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture- and toolchain- + * specific constants and types required for building + * LwIP against DARWIN. + * + */ + +#ifndef NL_LWIP_DARWIN_ARCH_CC_H +#define NL_LWIP_DARWIN_ARCH_CC_H + +#include <errno.h> +#include <stdlib.h> +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> + +#include <sys/time.h> +#include <sys/types.h> + +typedef int8_t s8_t; +typedef uint8_t u8_t; +typedef int16_t s16_t; +typedef uint16_t u16_t; +typedef int32_t s32_t; +typedef uint32_t u32_t; + +typedef ptrdiff_t mem_ptr_t; + +typedef u32_t sys_prot_t; + +#ifndef LWIP_NOASSERT +#define LWIP_PLATFORM_ASSERT(message) do { puts(message); } while (0) +#else +#define LWIP_PLATFORM_ASSERT(message) +#endif + +/* Darwin defines BYTE_ORDER to definitions that should be identical + * to those LwIP has defined for LITTLE_ENDIAN and BIG_ENDIAN. Ensure + * that's the case. + */ +#if !defined(BYTE_ORDER) +# if defined(__LITTLE_ENDIAN__) +# define BYTE_ORDER LITTLE_ENDIAN +# elif defined(__BIG_ENDIAN__) +# define BYTE_ORDER BIG_ENDIAN +# endif +#else +# if defined(__LITTLE_ENDIAN__) && (BYTE_ORDER != LITTLE_ENDIAN) +# error "Darwin's BYTE_ORDER is inconsistent with LwIP's LITTLE_ENDIAN." +# elif defined(__BIG_ENDIAN__) && (BYTE_ORDER != BIG_ENDIAN) +# error "Darwin's BYTE_ORDER is inconsistent with LwIP's BIG_ENDIAN." +# endif +#endif + +/* LwIP Debug Output Formatting and Function Calls */ + +#define U16_F "hu" +#define S16_F "hd" +#define X16_F "hx" +#define U32_F "u" +#define S32_F "d" +#define X32_F "x" +#define SZT_F "zu" + +#define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) +#define PACK_STRUCT_FIELD(x) x + +#define LWIP_PLATFORM_DIAG(x) \ + do { \ + printf x; \ + } while (0) + +#endif /* NL_LWIP_DARWIN_ARCH_CC_H */
diff --git a/os/darwin/arch/perf.h b/os/darwin/arch/perf.h new file mode 100644 index 0000000..7fe50ee --- /dev/null +++ b/os/darwin/arch/perf.h
@@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture-specific constants, + * interfaces and types required for LwIP performance + * measurement. + * + */ + +#ifndef NL_LWIP_DARWIN_ARCH_PERF_H +#define NL_LWIP_DARWIN_ARCH_PERF_H + +#define PERF_START +#define PERF_STOP(s) + +#define sys_profile_interval_set_pbuf_highwatermark(x,y) +#define sys_profile_pbuf_allocate(pbuf) +#define sys_profile_pbuf_free(pbuf) +#define sys_profile_pbuf_transfer(x, y) + +#endif /* NL_LWIP_DARWIN_ARCH_PERF_H */
diff --git a/os/darwin/arch/sys_arch.h b/os/darwin/arch/sys_arch.h new file mode 100644 index 0000000..3f6132e --- /dev/null +++ b/os/darwin/arch/sys_arch.h
@@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture- and operating + * system- specific constants and types required for building + * LwIP against DARWIN. + * + */ + +#ifndef NL_LWIP_DARWIN_ARCH_SYS_ARCH_H +#define NL_LWIP_DARWIN_ARCH_SYS_ARCH_H + +/* Preprocessor Macros */ + +#define SYS_MBOX_NULL NULL +#define SYS_SEM_NULL NULL + +/* Forward Declarations */ + +struct sys_mbox; +struct sys_sem; +struct sys_thread; + +/* Type Definitions */ + +typedef struct sys_mbox *sys_mbox_t; +typedef struct sys_sem *sys_sem_t; +#define sys_mutex_t sys_sem_t +typedef struct sys_thread *sys_thread_t; + + +#endif /* NL_LWIP_DARWIN_ARCH_SYS_ARCH_H */
diff --git a/os/freertos/arch/cc.h b/os/freertos/arch/cc.h new file mode 100644 index 0000000..e13d55a --- /dev/null +++ b/os/freertos/arch/cc.h
@@ -0,0 +1,80 @@ +/* + * + * Copyright (c) 2012 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture- and toolchain- + * specific constants and types required for building + * LwIP against FreeRTOS. + * + */ + +#ifndef NL_LWIP_FREERTOS_ARCH_CC_H +#define NL_LWIP_FREERTOS_ARCH_CC_H + +#include <errno.h> +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> + +#include <sys/time.h> + +// TODO: We really shouldn't be including a Nesty file in a product/platform agnostic file like this. +// What we really need is a lwipopts.h like file that allows us to shim away platform specific information. +#include <nlerlog.h> + +typedef int8_t s8_t; +typedef uint8_t u8_t; +typedef int16_t s16_t; +typedef uint16_t u16_t; +typedef int32_t s32_t; +typedef uint32_t u32_t; + +typedef ptrdiff_t mem_ptr_t; + +typedef int sys_prot_t; + +#ifndef LWIP_NOASSERT +#define LWIP_PLATFORM_ASSERT(message) do { puts(message); } while (0) +#else +#define LWIP_PLATFORM_ASSERT(message) +#endif + +#ifndef BYTE_ORDER +#if defined(__LITTLE_ENDIAN__) +#define BYTE_ORDER LITTLE_ENDIAN +#elif defined(__BIG_ENDIAN__) +#define BYTE_ORDER BIG_ENDIAN +#elif defined(__BYTE_ORDER__) +#define BYTE_ORDER __BYTE_ORDER__ +#endif +#endif +/* LwIP Debug Output Formatting and Function Calls */ + +#define U16_F "u" +#define S16_F "d" +#define X16_F "x" +#define U32_F "lu" +#define S32_F "ld" +#define X32_F "lx" +#define SZT_F "u" + +#define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) +#define PACK_STRUCT_FIELD(x) x + +#define _LWIP_PLATFORM_DIAG(...) NL_LOG_DEBUG(lrLWIP, __VA_ARGS__); + +#define LWIP_PLATFORM_DIAG(x) \ + do { \ + _LWIP_PLATFORM_DIAG x \ + } while (0); + +#endif /* NL_LWIP_FREERTOS_ARCH_CC_H */
diff --git a/os/freertos/arch/lwip-logregions.h b/os/freertos/arch/lwip-logregions.h new file mode 100644 index 0000000..8487509 --- /dev/null +++ b/os/freertos/arch/lwip-logregions.h
@@ -0,0 +1,13 @@ +/* guard against multiple inclusion is deliberately left out */ + +#ifdef NLER_SET_LOG_REGION_DEFAULTS + #ifndef NLER_LWIP_LOG_REGION_DEFAULT_SET + #define NLER_LWIP_LOG_REGION_DEFAULT_SET + nlLPDEBG, /* lrLWIP */ + #endif +#else + #ifndef NLER_LWIP_LOG_REGION_DEFINED + #define NLER_LWIP_LOG_REGION_DEFINED + lrLWIP, + #endif +#endif
diff --git a/os/freertos/arch/perf.h b/os/freertos/arch/perf.h new file mode 100644 index 0000000..83ef38d --- /dev/null +++ b/os/freertos/arch/perf.h
@@ -0,0 +1,48 @@ +/* + * + * Copyright (c) 2012 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture-specific constants, + * interfaces and types required for LwIP performance + * measurement. + * + */ + +#ifndef NL_LWIP_FREERTOS_ARCH_PERF_H +#define NL_LWIP_FREERTOS_ARCH_PERF_H + +#define PERF_START +#define PERF_STOP(s) + +#if defined(BUILD_FEATURE_NL_PROFILE) + +// Record the pbuf high watermark for this interval +void nl_profile_interval_set_pbuf_highwatermark(uint32_t pbuf_count, uint32_t pool_idx); +#define sys_profile_interval_set_pbuf_highwatermark(x,y) nl_profile_interval_set_pbuf_highwatermark(x,y) +struct pbuf; +void nl_profile_product_pbuf_allocate(const struct pbuf *pbuf); +void nl_profile_product_pbuf_free(const struct pbuf *pbuf); +#define sys_profile_pbuf_allocate(pbuf) nl_profile_product_pbuf_allocate(pbuf) +#define sys_profile_pbuf_free(pbuf) nl_profile_product_pbuf_free(pbuf) +void nl_profile_product_pbuf_transfer(const struct pbuf *new_pbuf, const struct pbuf *old_pbuf); +#define sys_profile_pbuf_transfer(x, y) nl_profile_product_pbuf_transfer(x, y) + +#else /* defined(BUILD_FEATURE_NL_PROFILE) */ + +#define sys_profile_interval_set_pbuf_highwatermark(x,y) +#define sys_profile_pbuf_allocate(pbuf) +#define sys_profile_pbuf_free(pbuf) +#define sys_profile_pbuf_transfer(x, y) + +#endif /* defined(BUILD_FEATURE_NL_PROFILE) */ + +#endif /* NL_LWIP_FREERTOS_ARCH_PERF_H */
diff --git a/os/freertos/arch/sys_arch.h b/os/freertos/arch/sys_arch.h new file mode 100644 index 0000000..8b5b3f8 --- /dev/null +++ b/os/freertos/arch/sys_arch.h
@@ -0,0 +1,33 @@ +/* + * + * Copyright (c) 2012 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture- and operating + * system- specific constants and types required for building + * LwIP against FreeRTOS. + * + */ + +#ifndef NL_LWIP_FREERTOS_ARCH_SYS_ARCH_H +#define NL_LWIP_FREERTOS_ARCH_SYS_ARCH_H + +#include "FreeRTOS.h" +#include "queue.h" +#include "semphr.h" +#include "task.h" + +typedef xQueueHandle sys_mbox_t; +typedef xSemaphoreHandle sys_mutex_t; +typedef xSemaphoreHandle sys_sem_t; +typedef xTaskHandle sys_thread_t; + +#endif /* NL_LWIP_FREERTOS_ARCH_SYS_ARCH_H */
diff --git a/os/linux/arch/cc.h b/os/linux/arch/cc.h new file mode 100644 index 0000000..5a8d16b --- /dev/null +++ b/os/linux/arch/cc.h
@@ -0,0 +1,74 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture- and toolchain- + * specific constants and types required for building + * LwIP against Linux. + * + */ + +#ifndef NL_LWIP_LINUX_ARCH_CC_H +#define NL_LWIP_LINUX_ARCH_CC_H + +#include <errno.h> +#include <malloc.h> +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> + +#include <sys/time.h> + +typedef int8_t s8_t; +typedef uint8_t u8_t; +typedef int16_t s16_t; +typedef uint16_t u16_t; +typedef int32_t s32_t; +typedef uint32_t u32_t; + +typedef ptrdiff_t mem_ptr_t; + +typedef u32_t sys_prot_t; + +#ifndef LWIP_NOASSERT +#define LWIP_PLATFORM_ASSERT(message) do { puts(message); } while (0) +#else +#define LWIP_PLATFORM_ASSERT(message) +#endif + +#ifndef BYTE_ORDER +#if defined(__LITTLE_ENDIAN__) +#define BYTE_ORDER LITTLE_ENDIAN +#elif defined(__BIG_ENDIAN__) +#define BYTE_ORDER BIG_ENDIAN +#endif +#endif + +/* LwIP Debug Output Formatting and Function Calls */ + +#define U16_F "hu" +#define S16_F "hd" +#define X16_F "hx" +#define U32_F "u" +#define S32_F "d" +#define X32_F "x" +#define SZT_F "zu" + +#define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) +#define PACK_STRUCT_FIELD(x) x + +#define LWIP_PLATFORM_DIAG(x) \ + do { \ + printf x; \ + } while (0) + +#endif /* NL_LWIP_LINUX_ARCH_CC_H */
diff --git a/os/linux/arch/perf.h b/os/linux/arch/perf.h new file mode 100644 index 0000000..d6bf440 --- /dev/null +++ b/os/linux/arch/perf.h
@@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture-specific constants, + * interfaces and types required for LwIP performance + * measurement. + * + */ + +#ifndef NL_LWIP_LINUX_ARCH_PERF_H +#define NL_LWIP_LINUX_ARCH_PERF_H + +#define PERF_START +#define PERF_STOP(s) + +#define sys_profile_interval_set_pbuf_highwatermark(x,y) +#define sys_profile_pbuf_allocate(pbuf) +#define sys_profile_pbuf_free(pbuf) +#define sys_profile_pbuf_transfer(x, y) + +#endif /* NL_LWIP_LINUX_ARCH_PERF_H */
diff --git a/os/linux/arch/sys_arch.h b/os/linux/arch/sys_arch.h new file mode 100644 index 0000000..43ac590 --- /dev/null +++ b/os/linux/arch/sys_arch.h
@@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2012-2013 Nest Labs, Inc. + * All rights reserved. + * + * This document is the property of Nest. It is considered + * confidential and proprietary information. + * + * This document may not be reproduced or transmitted in any form, + * in whole or in part, without the express written permission of + * Nest. + * + * Description: + * This file defines processor-architecture- and operating + * system- specific constants and types required for building + * LwIP against Linux. + * + */ + +#ifndef NL_LWIP_LINUX_ARCH_SYS_ARCH_H +#define NL_LWIP_LINUX_ARCH_SYS_ARCH_H + +/* Preprocessor Macros */ + +#define SYS_MBOX_NULL NULL +#define SYS_SEM_NULL NULL + +/* Forward Declarations */ + +struct sys_mbox; +struct sys_sem; +struct sys_thread; + +/* Type Definitions */ + +typedef struct sys_mbox *sys_mbox_t; +typedef struct sys_sem *sys_sem_t; +#define sys_mutex_t sys_sem_t +typedef struct sys_thread *sys_thread_t; + + +#endif /* NL_LWIP_LINUX_ARCH_SYS_ARCH_H */