]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
arch dependent files for FreeRTOS
authorJan Dolezal <pm.jenik@gmail.com>
Mon, 29 Jul 2013 12:29:55 +0000 (14:29 +0200)
committerJan Dolezal <pm.jenik@gmail.com>
Mon, 29 Jul 2013 12:29:55 +0000 (14:29 +0200)
src/arch/perf.c [new file with mode: 0644]
src/arch/sys_arch.c [new file with mode: 0644]
src/include/arch/cc.h [new file with mode: 0644]
src/include/arch/lwipopts.h [new file with mode: 0644]
src/include/arch/perf.h [new file with mode: 0644]
src/include/arch/sys_arch.h [new file with mode: 0644]

diff --git a/src/arch/perf.c b/src/arch/perf.c
new file mode 100644 (file)
index 0000000..29ffb28
--- /dev/null
@@ -0,0 +1,38 @@
+/*\r
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.\r
+ * All rights reserved. \r
+ * \r
+ * Redistribution and use in source and binary forms, with or without modification, \r
+ * are permitted provided that the following conditions are met:\r
+ *\r
+ * 1. Redistributions of source code must retain the above copyright notice,\r
+ *    this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright notice,\r
+ *    this list of conditions and the following disclaimer in the documentation\r
+ *    and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote products\r
+ *    derived from this software without specific prior written permission. \r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED \r
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \r
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \r
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, \r
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT \r
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS \r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN \r
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \r
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY \r
+ * OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ * \r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+#include "arch/perf.h"\r
+\r
+void\r
+perf_init(char *fname)\r
+{\r
+}\r
diff --git a/src/arch/sys_arch.c b/src/arch/sys_arch.c
new file mode 100644 (file)
index 0000000..3724d0b
--- /dev/null
@@ -0,0 +1,245 @@
+/**
+ * @file - sys_arch.c
+ * System Architecture support routines for HDK devices.
+ *
+ */
+
+/*
+ * 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>
+ *
+ */
+
+/* Copyright (c) 2010 Texas Instruments Incorporated */
+
+/* lwIP includes. */
+#include "arch/sys_arch.h"
+#include "lwip/opt.h"
+#include "lwip/sys.h"
+
+#if !NO_SYS
+/* DETAILS: ./lwip/doc/sys_arch.txt
+ *          ./lwip/src/include/lwip/sys.h */
+
+/* For mutexes you can just set option in opt.h/lwipopts.h LWIP_COMPAT_MUTEX,
+ * which is using defined semaphores. This is basicaly doing the same thing. */
+/* Create a new mutex */
+err_t sys_mutex_new(sys_mutex_t *mutex)
+{
+       *mutex = xSemaphoreCreateMutex();
+       if(mutex != NULL)return ERR_OK;
+    return ERR_MEM;
+}
+/* locks a mutex */
+void inline sys_mutex_lock(sys_mutex_t *mutex)
+{
+       xSemaphoreTake(*mutex,0);
+}
+/* unlocks a mutex */
+void inline sys_mutex_unlock(sys_mutex_t *mutex)
+{
+       xSemaphoreGive(*mutex);
+}
+/* frees memory space formerly taken by mutex */
+void inline sys_mutex_free(sys_mutex_t *mutex)
+{
+       vSemaphoreDelete(*mutex);
+}
+
+/* creates a new semaphore */
+err_t sys_sem_new(sys_sem_t *sem, u8_t count)
+{
+    *sem = xSemaphoreCreateCounting( SEMPHR_MAX_CNT, count); /* it's supposedly possible to use vSemaphoreCreateBinary */
+    if(sem != NULL)return ERR_OK;
+    return ERR_MEM;
+}
+/* signals a semaphore */
+void inline sys_sem_signal(sys_sem_t *sem)
+{
+       xSemaphoreGive(*sem);
+}
+/* blocks thread while waiting for the semaphore */
+u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
+{
+       portTickType ticksBeforeSemphr = xTaskGetTickCount();
+    if(xSemaphoreTake( *sem, timeout / portTICK_RATE_MS ) == pdFALSE) /* note that it is important for the semaphores to return an accurate count of elapsed milliseconds, since they are used to schedule timers in lwIP */
+       return SYS_ARCH_TIMEOUT;
+    return ( (xTaskGetTickCount() - ticksBeforeSemphr) / portTICK_RATE_MS ); /* return time spent waiting for the semaphore - u can use xTaskGetTickCount() */
+}
+/* deletes a semaphore */
+void inline sys_sem_free(sys_sem_t *sem)
+{
+       vSemaphoreDelete(*sem);
+}
+
+/* creates an empty mailbox for maximum "size" elements */
+err_t sys_mbox_new(sys_mbox_t *mbox, int size)
+{
+       *mbox = xQueueCreate( size, sizeof( MBOX_PTR_TYPE ) );
+       if(mbox == 0)return ERR_MEM;
+       return ERR_OK;
+}
+/* posts the "msg" to the mailbox, blocks if mbox full */
+void inline sys_mbox_post(sys_mbox_t *mbox, void *msg)
+{
+       while(xQueueSendToBack(*mbox, msg, portMAX_DELAY) == errQUEUE_FULL);
+}
+/* returns ERR_MEM if mailbox is full, ERR_OK if "msg" is posted */
+err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
+{
+#if TRYPOST_ISR_SAFE
+       signed portBASE_TYPE *pxHigherPriorityTaskWoken;
+       if(xQueueSendToBackFromISR( *mbox, msg, pxHigherPriorityTaskWoken ) == errQUEUE_FULL)
+#else
+    if(xQueueSendToBack(*mbox, msg, 0) == errQUEUE_FULL)
+#endif
+               return ERR_MEM;
+       return ERR_OK;
+}
+/* TODO: message which arrives may be NULL */
+/* blocks the thread until a message arrives in the mailbox or timeout expires */
+u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
+{
+       portTickType ticksBeforeFetch = xTaskGetTickCount();
+       if(timeout == 0)
+       {
+               while(xQueueReceive( *mbox, msg, portMAX_DELAY ) == pdFALSE);
+       }
+       else
+       {
+               if(xQueueReceive( *mbox, msg, timeout / portTICK_RATE_MS ) == pdFALSE)
+                       return SYS_ARCH_TIMEOUT;
+       }
+       return ( (xTaskGetTickCount() - ticksBeforeFetch) / portTICK_RATE_MS ); /* return time spent waiting for the space in the mailbox */
+}
+/* if message is not present immediately returns SYS_MBOX_EMPTY, on success returns 0 */
+u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
+{
+#if TRYFETCH_ISR_SAFE
+       signed portBASE_TYPE *pxTaskWoken;
+       if(xQueueReceiveFromISR( *mbox, msg, pxTaskWoken ) == pdFALSE)
+#else
+    if(xQueueReceive(*mbox, msg, 0) == pdFALSE)
+#endif
+       return SYS_MBOX_EMPTY;
+       return 0; /* we waited 0ms */
+}
+/* deletes a mbox */
+void inline sys_mbox_free(sys_mbox_t *mbox)
+{
+       vQueueDelete(*mbox);
+}
+
+sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
+{
+       xTaskHandle *pvCreatedTask = NULL;
+       if(xTaskCreate(thread, (const signed char *) name, (unsigned short)stacksize, arg, prio, pvCreatedTask) != pdPASS)
+               return NULL; /* lwIP doesn't specify, how should be informed that thread creation failed */
+       return pvCreatedTask;
+}
+
+#endif /* NO_SYS */
+
+
+/* TODO: research on what put to sys_init() >>
+ * void sys_init(void). lwIP system initialization. This function is called before the any other
+ * sys_arch-function is called and is meant to be used to initialize anything that has to be up and
+ * running for the rest of the functions to work. for example to set up a pool of semaphores.
+ * This function is called from lwip_init() */
+void sys_init(void) /* initialize sys_arch layer */
+{
+}
+
+u32_t sys_jiffies(void)
+{
+    return (u32_t) xTaskGetTickCount();
+}
+
+/* TODO: consider overflowing */
+u32_t sys_now(void)
+{
+       return (u32_t) xTaskGetTickCount(); /* this works on condition that portTICK_RATE_MS is 1 */
+       /*
+       portTickType currentTicks = xTaskGetTickCount();
+       static portTickType previousTickCount;
+       if(previousTickCount>currentTicks){
+
+       }
+       */
+       /* for configTICK_RATE_Hz = 1000; when GetTickCount() fce returns 64-bit unsigned type it holds
+       about half billion years, for unsigned 32-bit type just about an hour ; ((((2³²)÷1000)÷configTICK_RATE_HZ)÷3600)÷24 */
+       /*return (xTaskGetTickCount()*1000 / configTICK_RATE_HZ) ;*/
+
+}
+
+
+#if SYS_LIGHTWEIGHT_PROT
+
+unsigned int IntMasterStatusGet        (void)
+{
+    return 0;//(unsigned int)(0xC0 & _get_CPSR());
+}
+/**
+ * This function is used to lock access to critical sections when lwipopt.h
+ * defines SYS_LIGHTWEIGHT_PROT. It disables interrupts and returns a value
+ * indicating the interrupt enable state when the function entered. This
+ * value must be passed back on the matching call to sys_arch_unprotect().
+ *
+ * @return the interrupt level when the function was entered.
+ */
+sys_prot_t sys_arch_protect(void)
+{
+    sys_prot_t status;
+    status = (IntMasterStatusGet() & 0xFF);
+
+    _disable_IRQ();
+    return status;
+}
+
+/**
+ * This function is used to unlock access to critical sections when lwipopt.h
+ * defines SYS_LIGHTWEIGHT_PROT. It enables interrupts if the value of the lev
+ * parameter indicates that they were enabled when the matching call to
+ * sys_arch_protect() was made.
+ *
+ * @param lev is the interrupt level when the matching protect function was
+ * called
+ */
+void sys_arch_unprotect(sys_prot_t lev)
+{
+    /* Only turn interrupts back on if they were originally on when the matching
+       sys_arch_protect() call was made. */
+    if((lev & 0x80) == 0) {
+        _enable_IRQ();
+    }
+}
+
+#endif /* SYS_LIGHTWEIGHT_PROT */
+
+
diff --git a/src/include/arch/cc.h b/src/include/arch/cc.h
new file mode 100644 (file)
index 0000000..e027ef4
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * 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>
+ *
+ */
+/*
+ * settings to adapt lwIP for compiler and machine architecture
+ * DETAILS: ./lwip/doc/sys_arch.txt
+ */
+#ifndef __CC_H__
+#define __CC_H__
+
+#include "types.h"
+
+/* This file must either include a system-local <errno.h> which defines
+   the standard *nix error codes, or it should #define LWIP_PROVIDE_ERRNO
+   to make lwip/arch.h define the codes which are used throughout. */
+#define LWIP_PROVIDE_ERRNO
+
+/* if the compiler does not provede memset() this file must include a
+   definition of it, or include a file which defines it. */
+
+/* type definitions */
+typedef uint8_t             u8_t;
+typedef int8_t              s8_t;
+typedef uint16_t            u16_t;
+typedef int16_t             s16_t;
+typedef uint32_t            u32_t;
+typedef int32_t             s32_t;
+typedef u32_t               mem_ptr_t;
+
+/*#ifdef __little_endian__
+#ifndef BYTE_ORDER
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+#else*/
+#define BYTE_ORDER BIG_ENDIAN
+/*#endif*/
+
+/* Define (sn)printf formatters for these lwIP types */
+/*#define U16_F "hu"
+#define S16_F "hd"
+#define X16_F "hx"
+#define U32_F "u"
+#define S32_F "d"
+#define X32_F "x"*/
+
+
+#if defined(__arm__) && defined(__ARMCC_VERSION)
+    //
+    // Setup PACKing macros for KEIL/RVMDK Tools
+    //
+    #define PACK_STRUCT_BEGIN __packed
+    #define PACK_STRUCT_STRUCT
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+#elif defined (__IAR_SYSTEMS_ICC__)
+    //
+    // Setup PACKing macros for IAR Tools
+    //
+    #define PACK_STRUCT_BEGIN
+    #define PACK_STRUCT_STRUCT
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+    #define PACK_STRUCT_USE_INCLUDES
+#elif defined (__TMS470__)
+    #define PACK_STRUCT_BEGIN
+    #define PACK_STRUCT_STRUCT
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+#else
+    //
+    // Setup PACKing macros for GCC Tools
+    //
+    #define PACK_STRUCT_BEGIN
+    #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+#endif
+
+/*
+ *     1 - load byte by byte, construct 16 bits word and add: not efficient for most platforms
+ *     2 - load first byte if odd address, loop processing 16 bits words, add last byte.
+ *     3 - load first byte and word if not 4 byte aligned, loop processing 32 bits words, add last word/byte.
+ *
+ *     see inet_chksum.c
+ */
+#ifndef LWIP_CHKSUM_ALGORITHM
+#define LWIP_CHKSUM_ALGORITHM 2
+#endif
+
+
+/* TODO: make the debug work */
+#ifdef DEBUG
+
+#define LWIP_PLATFORM_DIAG(expr)
+
+//extern void __error__(char *pcFilename, unsigned long ulLine);
+extern int32_t rpp_sci_printf(const char* format, ...);
+#define LWIP_PLATFORM_ASSERT(expr)      rpp_sci_printf((const char *) expr)
+/*
+{                                       \
+    if(!(expr))                         \
+    {                                   \
+        __error__(__FILE__, __LINE__);  \
+    }                                   \
+}
+*/
+#else
+#define LWIP_PLATFORM_ASSERT(expr)
+#endif /* DEBUG */
+
+/* "lightweight" synchronization mechanisms */
+/* #define SYS_ARCH_DECL_PROTECT(x) */ /* declare a protection state variable */
+/* #define SYS_ARCH_PROTECT(x) */ /* enter protection mode */
+/* #define SYS_ARCH_UNPROTECT(x) */ /* leave protection mode */
+
+#endif /* __CC_H__ */
diff --git a/src/include/arch/lwipopts.h b/src/include/arch/lwipopts.h
new file mode 100644 (file)
index 0000000..392369d
--- /dev/null
@@ -0,0 +1,139 @@
+/**
+ * \file lwipopts.h - Configuration options for lwIP
+ *
+ * Copyright (c) 2010 Texas Instruments Incorporated
+ */
+/*
+ * Copyright (c) 2001-2004 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>
+ *
+ */
+//#include "rpp/sci.h"
+
+#ifndef __LWIPOPTS_H__
+#define __LWIPOPTS_H__
+
+
+/*****************************************************************************
+**                           CONFIGURATIONS
+*****************************************************************************/
+/*
+** If Static IP address to be used, give it here. This value shall be 0 if
+** dynamic IP address is to be used.
+** For Example, for IP Address 192.168.247.1, use the corresponding hex
+** value 0xC0A8F701.
+*/
+#define STATIC_IP_ADDRESS               0
+
+/*****************************************************************************
+**            lwIP SPECIFIC DEFINITIONS - To be used by lwIP stack
+*****************************************************************************/
+#define HOST_TMR_INTERVAL               0
+#define DYNAMIC_HTTP_HEADERS
+
+/*****************************************************************************
+**                    Platform specific locking
+*****************************************************************************/
+#define SYS_LIGHTWEIGHT_PROT            1 /* critical sections */
+#define NO_SYS                          0
+
+/*****************************************************************************
+**                    TCPIP thread - used when NO_SYS defined to 0
+*****************************************************************************/
+#define TCPIP_THREAD_PRIO               0
+#define TCPIP_THREAD_STACKSIZE          500
+
+/*****************************************************************************
+**                          Memory Options
+*****************************************************************************/
+#define MEM_ALIGNMENT                   4
+#define MEM_SIZE                        (30 * 1024) /* 30K */
+#define MEMP_NUM_PBUF                   48
+#define MEMP_NUM_TCP_PCB                16
+#define PBUF_POOL_SIZE                  96
+
+/*****************************************************************************
+**                           IP Options
+*****************************************************************************/
+#define IP_REASSEMBLY                   0
+#define IP_FRAG                         0
+
+/*****************************************************************************
+**                           DHCP Options
+*****************************************************************************/
+#define LWIP_DHCP                       1
+#define DHCP_DOES_ARP_CHECK             0
+
+/*****************************************************************************
+**                           Auto IP  Options
+*****************************************************************************/
+#define LWIP_AUTOIP                     0           /* default is 0 */
+#define LWIP_DHCP_AUTOIP_COOP           ((LWIP_DHCP) && (LWIP_AUTOIP))
+                                                    /* default is 0 */
+#define LWIP_DHCP_AUTOIP_COOP_TRIES     5           /* default is 9 */
+
+/*****************************************************************************
+**                           TCP  Options
+*****************************************************************************/
+#define TCP_WND                         4096   /* default is 2048 */
+#define TCP_MSS                         1500        /* default is 128 */
+#define TCP_SND_BUF                     (4 * TCP_MSS)
+
+/*****************************************************************************
+**                           PBUF  Options
+*****************************************************************************/
+#define PBUF_LINK_HLEN                  14      /* default is 14 */
+#define PBUF_POOL_BUFSIZE               256
+                                           /* default is LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)*/
+#define ETH_PAD_SIZE                    0
+#define LWIP_NETCONN                    0          /*default is 1*/
+
+/*****************************************************************************
+**                           Socket  Options
+*****************************************************************************/
+#define LWIP_SOCKET                     0           /* default is 1 */
+
+/*****************************************************************************
+**                          Debugging options
+*****************************************************************************/
+#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_OFF
+#define LWIP_DBG_TYPES_ON               (LWIP_DBG_ON | LWIP_DBG_TRACE \
+                                         |LWIP_DBG_STATE | LWIP_DBG_FRESH)
+
+/*****************************************************************************
+**                          Mbox options
+*****************************************************************************/
+#define TCPIP_MBOX_SIZE                 20
+#define DEFAULT_RAW_RECVMBOX_SIZE       20
+#define DEFAULT_UDP_RECVMBOX_SIZE       20
+#define DEFAULT_TCP_RECVMBOX_SIZE       20
+#define DEFAULT_ACCEPTMBOX_SIZE         20
+
+
+#endif /* __LWIPOPTS_H__ */
diff --git a/src/include/arch/perf.h b/src/include/arch/perf.h
new file mode 100644 (file)
index 0000000..68afdb5
--- /dev/null
@@ -0,0 +1,38 @@
+/*\r
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.\r
+ * All rights reserved. \r
+ * \r
+ * Redistribution and use in source and binary forms, with or without modification, \r
+ * are permitted provided that the following conditions are met:\r
+ *\r
+ * 1. Redistributions of source code must retain the above copyright notice,\r
+ *    this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright notice,\r
+ *    this list of conditions and the following disclaimer in the documentation\r
+ *    and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote products\r
+ *    derived from this software without specific prior written permission. \r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED \r
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \r
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \r
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, \r
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT \r
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS \r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN \r
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \r
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY \r
+ * OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ * \r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+#ifndef __PERF_H__\r
+#define __PERF_H__\r
+\r
+#define PERF_START    /* null definition */\r
+#define PERF_STOP(x)  /* null definition */\r
+\r
+#endif /* __PERF_H__ */\r
diff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h
new file mode 100644 (file)
index 0000000..8615c20
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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>
+ *
+ */
+/*
+ * preset of semaphores, mailboxes, threads, timeouts, system,....
+ * see opt.h for reference definitions, put your definitions in lwipopts.h
+ */
+#ifndef __ARCH_SYS_ARCH_H__
+#define __ARCH_SYS_ARCH_H__
+
+#include "os/os.h"
+#include "types.h"
+#include "lwip/opt.h"
+#include "lwip/err.h"
+
+/* Find the size of the largest required mbox. */
+#define MAX1 ((TCPIP_MBOX_SIZE > DEFAULT_RAW_RECVMBOX_SIZE) ? \
+              TCPIP_MBOX_SIZE : DEFAULT_RAW_RECVMBOX_SIZE)
+#define MAX2 ((MAX1 > DEFAULT_UDP_RECVMBOX_SIZE) ? MAX1 : \
+              DEFAULT_UDP_RECVMBOX_SIZE)
+#define MAX3 ((MAX2 > DEFAULT_TCP_RECVMBOX_SIZE) ? MAX2 : \
+              DEFAULT_TCP_RECVMBOX_SIZE)
+#define MBOX_MAX ((MAX3 > DEFAULT_ACCEPTMBOX_SIZE) ? MAX3 : \
+                  DEFAULT_ACCEPTMBOX_SIZE)
+
+#define portQUEUE_OVERHEAD_BYTES 0
+
+typedef u8_t sys_prot_t;
+
+/* The values for an unallocated entities. */
+#define SYS_MBOX_NULL       NULL
+#define SYS_THREAD_NULL     NULL
+#define SYS_SEM_NULL        NULL
+
+
+/* Typedefs for the various port-specific types. */
+#if !NO_SYS
+typedef xQueueHandle sys_mbox_t;
+typedef xSemaphoreHandle sys_sem_t;
+typedef xTaskHandle sys_thread_t;
+#if !LWIP_COMPAT_MUTEX
+typedef xSemaphoreHandle sys_mutex_t;
+/* For mutexes you can just set option in opt.h/lwipopts.h LWIP_COMPAT_MUTEX,
+ * which is using defined semaphores. This is basicaly doing the same thing. */
+#define sys_mutex_valid(mutex)        sys_sem_valid(mutex)
+#define sys_mutex_set_invalid(mutex)  sys_sem_set_invalid(mutex)
+
+#define sys_sem_valid(sem)            (*sem != SYS_SEM_NULL)
+#define sys_sem_set_invalid(sem)      (*sem = SYS_SEM_NULL)
+
+#define sys_mbox_valid(mbox)          (*mbox != SYS_MBOX_NULL)
+#define sys_mbox_set_invalid(mbox)    (*mbox = SYS_MBOX_NULL)
+#endif
+
+#define SEMPHR_MAX_CNT             1
+#define MBOX_PTR_TYPE              void *
+#define TRYPOST_ISR_SAFE           0
+#define TRYFETCH_ISR_SAFE          0
+
+#endif /* !NO_SYS */
+
+/* TODO: try with SYS_ARCH_PROTECT defined and without it */
+/* DETAILS in sys.h */
+/* #define SYS_ARCH_PROTECT */
+#ifndef SYS_ARCH_PROTECT
+
+#if SYS_LIGHTWEIGHT_PROT
+
+#define SYS_ARCH_DECL_PROTECT(lev)
+
+#define SYS_ARCH_PROTECT(lev) portENTER_CRITICAL() /* consider putting here taskENTER_CRITICAL() ... freeRTOS */
+
+#define SYS_ARCH_UNPROTECT(lev) portEXIT_CRITICAL() /* consider putting here taskEXIT_CRITICAL() ... freeRTOS */
+sys_prot_t sys_arch_protect(void);
+void sys_arch_unprotect(sys_prot_t pval);
+
+#else
+
+#define SYS_ARCH_DECL_PROTECT(lev)
+#define SYS_ARCH_PROTECT(lev)
+#define SYS_ARCH_UNPROTECT(lev)
+
+#endif /* SYS_LIGHTWEIGHT_PROT */
+
+#endif /* SYS_ARCH_PROTECT */
+
+
+
+#endif /* __ARCH_SYS_ARCH_H__ */
+