summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-12-08 04:14:00 +0000
committer[email protected] <[email protected]>2012-12-08 04:14:00 +0000
commit6d78189f1b1baa7fc7db56947a726182040b5738 (patch)
tree7e1df05e9d3e58a9a00d2dd66ad4034d75993f96
parent451cb0281c1b570ed2d99c11cc318541e433d0c3 (diff)
Add RT_LWIP_ALIGN_SIZE setting for lwIP; Export BSD socket symbol to Application Module.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2470 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--components/net/lwip/src/arch/sys_arch.c65
-rw-r--r--components/net/lwip/src/lwipopts.h6
2 files changed, 70 insertions, 1 deletions
diff --git a/components/net/lwip/src/arch/sys_arch.c b/components/net/lwip/src/arch/sys_arch.c
index 98fe8588e1..bb7eb99e8d 100644
--- a/components/net/lwip/src/arch/sys_arch.c
+++ b/components/net/lwip/src/arch/sys_arch.c
@@ -1,3 +1,18 @@
+/*
+ * File : sys_arch.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2012, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2012-12-8 Bernard add file header
+ * export bsd socket symbol for RT-Thread Application Module
+ */
+
#include <rtthread.h>
#include "lwip/sys.h"
@@ -532,6 +547,7 @@ u32_t sys_jiffies(void)
return rt_tick_get();
}
+#ifdef RT_LWIP_PPP
u32_t sio_read(sio_fd_t fd, u8_t *buf, u32_t size)
{
u32_t len;
@@ -568,3 +584,52 @@ void ppp_trace(int level, const char *format, ...)
rt_device_write((rt_device_t)rt_console_get_device(), 0, rt_log_buf, length);
va_end(args);
}
+#endif
+
+/*
+ * export bsd socket symbol for RT-Thread Application Module
+ */
+#if LWIP_SOCKET
+#include <lwip/sockets.h>
+RTM_EXPORT(lwip_accept);
+RTM_EXPORT(lwip_bind);
+RTM_EXPORT(lwip_shutdown);
+RTM_EXPORT(lwip_getpeername);
+RTM_EXPORT(lwip_getsockname);
+RTM_EXPORT(lwip_getsockopt);
+RTM_EXPORT(lwip_setsockopt);
+RTM_EXPORT(lwip_close);
+RTM_EXPORT(lwip_connect);
+RTM_EXPORT(lwip_listen);
+RTM_EXPORT(lwip_recv);
+RTM_EXPORT(lwip_read);
+RTM_EXPORT(lwip_recvfrom);
+RTM_EXPORT(lwip_send);
+RTM_EXPORT(lwip_sendto);
+RTM_EXPORT(lwip_socket);
+RTM_EXPORT(lwip_write);
+RTM_EXPORT(lwip_select);
+RTM_EXPORT(lwip_ioctl);
+RTM_EXPORT(lwip_fcntl);
+
+#if LWIP_DNS
+#include <lwip/netdb.h>
+RTM_EXPORT(lwip_gethostbyname);
+RTM_EXPORT(lwip_gethostbyname_r);
+RTM_EXPORT(lwip_freeaddrinfo);
+RTM_EXPORT(lwip_getaddrinfo);
+#endif
+
+#endif
+
+#if LWIP_DHCP
+#include <lwip/dhcp.h>
+RTM_EXPORT(dhcp_start);
+RTM_EXPORT(dhcp_renew);
+RTM_EXPORT(dhcp_stop);
+#endif
+
+#if LWIP_NETIF_API
+#include <lwip/netifapi.h>
+RTM_EXPORT(netifapi_netif_set_addr);
+#endif
diff --git a/components/net/lwip/src/lwipopts.h b/components/net/lwip/src/lwipopts.h
index 96f6d37f5e..2ed7b78897 100644
--- a/components/net/lwip/src/lwipopts.h
+++ b/components/net/lwip/src/lwipopts.h
@@ -82,7 +82,11 @@
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
/* ---------- Memory options ---------- */
-#define MEM_ALIGNMENT RT_ALIGN_SIZE
+#ifdef RT_LWIP_ALIGN_SIZE
+#define MEM_ALIGNMENT RT_LWIP_ALIGN_SIZE
+#else
+#define MEM_ALIGNMENT 4
+#endif
#define MEM_LIBC_MALLOC 1
#define mem_malloc rt_malloc