summaryrefslogtreecommitdiff
path: root/components/net
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2013-06-23 07:48:42 +0800
committerBernard Xiong <[email protected]>2013-06-23 07:48:42 +0800
commit98c8a23e9456b6a03f285245fbe9432b825e4f45 (patch)
treeacd0c83ac2d1015713a4fbc3ccb55955cdb8a868 /components/net
parentc5927f51b3dcba72aea4aca26fdb3bffb1d6f763 (diff)
Add component initialization.
Diffstat (limited to 'components/net')
-rw-r--r--components/net/lwip-1.4.1/src/arch/sys_arch.c7
-rw-r--r--components/net/lwip-1.4.1/src/lwipopts.h8
-rw-r--r--components/net/lwip-1.4.1/src/netif/ethernetif.c1
-rw-r--r--components/net/lwip/src/arch/sys_arch.c8
-rw-r--r--components/net/lwip/src/include/netif/ethernetif.h2
-rw-r--r--components/net/lwip/src/netif/ethernetif.c5
6 files changed, 21 insertions, 10 deletions
diff --git a/components/net/lwip-1.4.1/src/arch/sys_arch.c b/components/net/lwip-1.4.1/src/arch/sys_arch.c
index bb7eb99e8d..e18ed91345 100644
--- a/components/net/lwip-1.4.1/src/arch/sys_arch.c
+++ b/components/net/lwip-1.4.1/src/arch/sys_arch.c
@@ -25,6 +25,7 @@
#include "lwip/tcpip.h"
#include "netif/ethernetif.h"
#include "lwip/sio.h"
+#include <lwip/init.h>
#include <string.h>
@@ -124,7 +125,7 @@ static void tcpip_init_done_callback(void *arg)
/**
* LwIP system initialization
*/
-void lwip_system_init(void)
+int lwip_system_init(void)
{
rt_err_t rc;
struct rt_semaphore done_sem;
@@ -165,7 +166,11 @@ void lwip_system_init(void)
netifapi_netif_set_addr(netif_default, &ipaddr, &netmask, &gw);
}
#endif
+ rt_kprintf("lwIP-%d.%d.%d initialized!\n", LWIP_VERSION_MAJOR, LWIP_VERSION_MINOR, LWIP_VERSION_REVISION);
+
+ return 0;
}
+INIT_COMPONENT_EXPORT(lwip_system_init);
void sys_init(void)
{
diff --git a/components/net/lwip-1.4.1/src/lwipopts.h b/components/net/lwip-1.4.1/src/lwipopts.h
index 24cba48ea6..7dc8af0ae0 100644
--- a/components/net/lwip-1.4.1/src/lwipopts.h
+++ b/components/net/lwip-1.4.1/src/lwipopts.h
@@ -82,11 +82,7 @@
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
/* ---------- Memory options ---------- */
-#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
@@ -179,7 +175,11 @@
#define TCP_MSS 1460
/* TCP sender buffer space (bytes). */
+#ifdef RT_LWIP_TCP_SND_BUF
+#define TCP_SND_BUF RT_LWIP_TCP_SND_BUF
+#else
#define TCP_SND_BUF (TCP_MSS * 2)
+#endif
/* TCP sender buffer space (pbufs). This must be at least = 2 *
TCP_SND_BUF/TCP_MSS for things to work. */
diff --git a/components/net/lwip-1.4.1/src/netif/ethernetif.c b/components/net/lwip-1.4.1/src/netif/ethernetif.c
index 3f0fd21e59..4757981fa0 100644
--- a/components/net/lwip-1.4.1/src/netif/ethernetif.c
+++ b/components/net/lwip-1.4.1/src/netif/ethernetif.c
@@ -383,6 +383,7 @@ void eth_system_device_init()
result = rt_thread_startup(&eth_tx_thread);
RT_ASSERT(result == RT_EOK);
}
+INIT_DEVICE_EXPORT(eth_system_device_init);
#ifdef RT_USING_FINSH
#include <finsh.h>
diff --git a/components/net/lwip/src/arch/sys_arch.c b/components/net/lwip/src/arch/sys_arch.c
index bb7eb99e8d..6e488a31b5 100644
--- a/components/net/lwip/src/arch/sys_arch.c
+++ b/components/net/lwip/src/arch/sys_arch.c
@@ -124,7 +124,7 @@ static void tcpip_init_done_callback(void *arg)
/**
* LwIP system initialization
*/
-void lwip_system_init(void)
+int lwip_system_init(void)
{
rt_err_t rc;
struct rt_semaphore done_sem;
@@ -138,7 +138,7 @@ void lwip_system_init(void)
{
LWIP_ASSERT("Failed to create semaphore", 0);
- return;
+ return -1;
}
tcpip_init(tcpip_init_done_callback, (void *)&done_sem);
@@ -148,7 +148,7 @@ void lwip_system_init(void)
{
rt_sem_detach(&done_sem);
- return;
+ return -1;
}
rt_sem_detach(&done_sem);
@@ -165,7 +165,9 @@ void lwip_system_init(void)
netifapi_netif_set_addr(netif_default, &ipaddr, &netmask, &gw);
}
#endif
+ return 0;
}
+INIT_COMPONENT_EXPORT(lwip_system_init);
void sys_init(void)
{
diff --git a/components/net/lwip/src/include/netif/ethernetif.h b/components/net/lwip/src/include/netif/ethernetif.h
index 4aa4525ce2..53dacf2270 100644
--- a/components/net/lwip/src/include/netif/ethernetif.h
+++ b/components/net/lwip/src/include/netif/ethernetif.h
@@ -30,6 +30,6 @@ rt_err_t eth_device_init(struct eth_device * dev, char *name);
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint8_t flag);
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
-void eth_system_device_init(void);
+int eth_system_device_init(void);
#endif /* __NETIF_ETHERNETIF_H__ */
diff --git a/components/net/lwip/src/netif/ethernetif.c b/components/net/lwip/src/netif/ethernetif.c
index 3f0fd21e59..52a6831ebf 100644
--- a/components/net/lwip/src/netif/ethernetif.c
+++ b/components/net/lwip/src/netif/ethernetif.c
@@ -350,7 +350,7 @@ static void eth_rx_thread_entry(void* parameter)
}
}
-void eth_system_device_init()
+int eth_system_device_init(void)
{
rt_err_t result = RT_EOK;
@@ -382,7 +382,10 @@ void eth_system_device_init()
result = rt_thread_startup(&eth_tx_thread);
RT_ASSERT(result == RT_EOK);
+
+ return 0;
}
+INIT_DEVICE_EXPORT(eth_system_device_init);
#ifdef RT_USING_FINSH
#include <finsh.h>