diff --git a/components/net/lwip/src/arch/sys_arch.c b/components/net/lwip/src/arch/sys_arch.c index 98fe8588e1fd2c152a72ea8ced4c427cc63216f0..bb7eb99e8df9e1b6ab444e03ad0e8a7e66b14ec0 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 #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 +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 +RTM_EXPORT(lwip_gethostbyname); +RTM_EXPORT(lwip_gethostbyname_r); +RTM_EXPORT(lwip_freeaddrinfo); +RTM_EXPORT(lwip_getaddrinfo); +#endif + +#endif + +#if LWIP_DHCP +#include +RTM_EXPORT(dhcp_start); +RTM_EXPORT(dhcp_renew); +RTM_EXPORT(dhcp_stop); +#endif + +#if LWIP_NETIF_API +#include +RTM_EXPORT(netifapi_netif_set_addr); +#endif diff --git a/components/net/lwip/src/lwipopts.h b/components/net/lwip/src/lwipopts.h index 96f6d37f5ef9189816371741bbb05ff1b391cc97..2ed7b788978bf1b9fd2c4d1f05fdc319996299a4 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