Browse Source

[lwIP] Remove RT_LWIP_USING_RT_MEM

1. Remove RT_LWIP_USING_RT_MEM option;
2. Add waitqueue patch for lwIP 2.0.2;
bernard 7 years ago
parent
commit
a8e0711a6b

+ 1 - 5
components/net/lwip-1.3.2/src/lwipopts.h

@@ -95,11 +95,7 @@
 #define mem_free                    rt_free
 #define mem_calloc                  rt_calloc
 
-#ifdef RT_LWIP_USING_RT_MEM
-#define MEMP_MEM_MALLOC				1
-#else
-#define MEMP_MEM_MALLOC				0
-#endif
+#define MEMP_MEM_MALLOC             0
 
 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
    sends a lot of data out of ROM (or other static memory), this

+ 1 - 1
components/net/lwip-1.3.2/src/netif/skeleton.c

@@ -61,7 +61,7 @@ static rt_size_t rt_skeleton_write (rt_device_t dev, rt_off_t pos, const void* b
     return 0;
 }
 
-static rt_err_t rt_skeleton_control(rt_device_t dev, rt_uint8_t cmd, void *args)
+static rt_err_t rt_skeleton_control(rt_device_t dev, int cmd, void *args)
 {
 	struct rt_skeleton_eth *eth;
 

+ 0 - 4
components/net/lwip-1.4.1/src/lwipopts.h

@@ -86,11 +86,7 @@
 #define mem_free                    rt_free
 #define mem_calloc                  rt_calloc
 
-#ifdef RT_LWIP_USING_RT_MEM
-#define MEMP_MEM_MALLOC             1
-#else
 #define MEMP_MEM_MALLOC             0
-#endif
 
 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
    sends a lot of data out of ROM (or other static memory), this

+ 10 - 1
components/net/lwip-2.0.2/src/api/sockets.c

@@ -196,6 +196,11 @@ static void sockaddr_to_ipaddr_port(const struct sockaddr* sockaddr, ip_addr_t*
 #define SELWAIT_T u8_t
 #endif
 
+#include <rtthread.h>
+#ifdef RT_USING_DFS_NET
+#include <ipc/waitqueue.h>
+#endif
+
 /** Contains all internal pointers and states used for a socket */
 struct lwip_sock {
   /** sockets currently are built on netconns, each socket has one netconn */
@@ -216,6 +221,10 @@ struct lwip_sock {
   u8_t err;
   /** counter of how many threads are waiting for this socket using select */
   SELWAIT_T select_waiting;
+
+#ifdef RT_USING_DFS_NET
+  rt_wqueue_t wait_head;
+#endif
 };
 
 #if LWIP_NETCONN_SEM_PER_THREAD
@@ -521,7 +530,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
     return -1;
   }
   LWIP_ASSERT("invalid socket index", (newsock >= LWIP_SOCKET_OFFSET) && (newsock < NUM_SOCKETS + LWIP_SOCKET_OFFSET));
-  LWIP_ASSERT("newconn->callback == event_callback", newconn->callback == event_callback);
+  // LWIP_ASSERT("newconn->callback == event_callback", newconn->callback == event_callback);
   nsock = &sockets[newsock - LWIP_SOCKET_OFFSET];
 
   /* See event_callback: If data comes in right away after an accept, even

+ 0 - 4
components/net/lwip-2.0.2/src/lwipopts.h

@@ -93,11 +93,7 @@
 //#define MEMP_USE_CUSTOM_POOLS       1
 //#define MEM_SIZE                    (1024*64)
 
-#ifdef RT_LWIP_USING_RT_MEM
-#define MEMP_MEM_MALLOC             1
-#else
 #define MEMP_MEM_MALLOC             0
-#endif
 
 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
    sends a lot of data out of ROM (or other static memory), this

+ 1 - 1
components/net/netutils/telnet.c

@@ -232,7 +232,7 @@ static rt_size_t telnet_write (rt_device_t dev, rt_off_t pos, const void* buffer
     return (rt_uint32_t) ptr - (rt_uint32_t) buffer;
 }
 
-static rt_err_t telnet_control(rt_device_t dev, rt_uint8_t cmd, void *args)
+static rt_err_t telnet_control(rt_device_t dev, int cmd, void *args)
 {
     return RT_EOK;
 }