]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Allow minimal unix target to build in cygwin (but not necessarily run).
authordavidhaas <davidhaas>
Tue, 18 Feb 2003 19:27:48 +0000 (19:27 +0000)
committerdavidhaas <davidhaas>
Tue, 18 Feb 2003 19:27:48 +0000 (19:27 +0000)
Applied a patch from Marc Boucher which has the following changes:

1) Fixed sys_arch.txt documentation to have new return type from
   sys_thread_new.

2) Removed unnecessary casts on calling sys_timeout() in certain files.

3) Removed some unnecessary break statements after return statements.

4) Changed sys_timeout_remove() to sys_untimeout().

5) Added some forgotten #ifndef SYS_LIGHTWEIGHT_PROT to memp.c

6) Changed LWIP_DIAG and LWIP_PLATFORM_ASSERT to have do while().

doc/sys_arch.txt
src/api/tcpip.c
src/core/ipv4/ip.c
src/core/ipv4/ip_frag.c
src/core/memp.c
src/core/sys.c
src/include/lwip/debug.h
src/include/lwip/event.h [deleted file]
src/include/lwip/sys.h
src/include/lwip/tcp.h
src/netif/ethernetif.c

index 752d18d425f98b5e8ce539b2b83b419662f103a9..6568a77571d50f9e4eb2efd955ae3a394ef3955c 100644 (file)
@@ -115,9 +115,9 @@ If threads are supported by the underlying operating system and if
 such functionality is needed in lwIP, the following function will have
 to be implemented as well:
 
-- void sys_thread_new(void (* thread)(void *arg), void *arg)
+- sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg)
 
   Starts a new thread that will begin its execution in the function
   "thread()". The "arg" argument will be passed as an argument to the
-  thread() function.
+  thread() function. The id of the new thread is returned.
 
index 37fb99dd6a9ac3538fd0c9d0b9fcdc558130e016..7666fd03da853b02b602261408fab589a7a56297 100644 (file)
@@ -60,7 +60,7 @@ tcpip_tcp_timer(void *arg)
 
   tcp_tmr();
   if(tcp_active_pcbs || tcp_tw_pcbs) {
-       sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, NULL);
+       sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
   } else {
        tcpip_tcp_timer_active = 0;
   }
@@ -71,7 +71,7 @@ tcp_timer_needed(void)
 {
   if(!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) {
        tcpip_tcp_timer_active = 1;
-       sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, NULL);
+       sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
   }
 }
 /*-----------------------------------------------------------------------------------*/
index 9d985a613351cb9af4a9aed191e8b8f109f3d61d..e7a324ef11ea091f61acdb8d7b5d53bf051e1de4 100644 (file)
@@ -108,7 +108,6 @@ ip_lookup(void *header, struct netif *inp)
 #if LWIP_UDP > 0
   case IP_PROTO_UDP:
     return udp_lookup(iphdr, inp);
-    break;
 #endif /* LWIP_UDP */
 #if LWIP_TCP > 0    
   case IP_PROTO_TCP:
@@ -116,7 +115,6 @@ ip_lookup(void *header, struct netif *inp)
 #endif /* LWIP_TCP */
   case IP_PROTO_ICMP:
     return 1;
-    break;
   default:
     return 0;
   }
index 4632a0519969092a1e17860d95a2e3744cc0fc24..dcf21e7d706ec194664f1e194c99bd53d883fbbb 100644 (file)
@@ -95,7 +95,7 @@ ip_reass_timer(void *arg)
 {
   if(ip_reasstmr > 1) {
     ip_reasstmr--;
-    sys_timeout(IP_REASS_TMO, (sys_timeout_handler) ip_reass_timer, NULL);
+    sys_timeout(IP_REASS_TMO, ip_reass_timer, NULL);
   } else if(ip_reasstmr == 1)
        ip_reasstmr = 0;
 }
@@ -121,7 +121,7 @@ ip_reass(struct pbuf *p)
     DEBUGF(IP_REASS_DEBUG, ("ip_reass: new packet\n"));
     memcpy(iphdr, fraghdr, IP_HLEN);
     ip_reasstmr = IP_REASS_MAXAGE;
-    sys_timeout(IP_REASS_TMO, (sys_timeout_handler) ip_reass_timer, NULL);
+    sys_timeout(IP_REASS_TMO, ip_reass_timer, NULL);
     ip_reassflags = 0;
     /* Clear the bitmap. */
     memset(ip_reassbitmap, 0, sizeof(ip_reassbitmap));
@@ -148,7 +148,7 @@ ip_reass(struct pbuf *p)
       DEBUGF(IP_REASS_DEBUG,
             ("ip_reass: fragment outside of buffer (%d:%d/%d).\n", offset,
              offset + len, IP_REASS_BUFSIZE));
-      sys_timeout_remove((sys_timeout_handler) ip_reass_timer, NULL);
+      sys_untimeout(ip_reass_timer, NULL);
       ip_reasstmr = 0;
       goto nullreturn;
     }
@@ -236,7 +236,7 @@ ip_reass(struct pbuf *p)
       /* If we have come this far, we have a full packet in the
          buffer, so we allocate a pbuf and copy the packet into it. We
          also reset the timer. */
-      sys_timeout_remove((sys_timeout_handler) ip_reass_timer, NULL);
+      sys_untimeout(ip_reass_timer, NULL);
       ip_reasstmr = 0;
       pbuf_free(p);
       p = pbuf_alloc(PBUF_LINK, ip_reasslen, PBUF_POOL);
index 2df9b140cf1b6272f32927b42f57c7abd033b058..a2948b00e366589b31babf0b6cd4299f01110fa5 100644 (file)
@@ -110,7 +110,9 @@ static u8_t memp_memory[(MEMP_NUM_PBUF *
                                        sizeof(struct memp)))];
 
 /*-----------------------------------------------------------------------------------*/
+#ifndef SYS_LIGHTWEIGHT_PROT
 static sys_sem_t mutex;
+#endif
 /*-----------------------------------------------------------------------------------*/
 #ifdef LWIP_DEBUG
 static int
@@ -168,7 +170,9 @@ memp_init(void)
     }
   }
 
+#ifndef SYS_LIGHTWEIGHT_PROT
   mutex = sys_sem_new(1);
+#endif
 
   
 }
index aa788e13f53acce9430b459b35070e7e10f0cc2e..79b866c52cc574b4b8a501f58b1113d8d59c792b 100644 (file)
@@ -206,7 +206,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
 */
 /*-----------------------------------------------------------------------------------*/
 void
-sys_timeout_remove(sys_timeout_handler h, void *arg)
+sys_untimeout(sys_timeout_handler h, void *arg)
 {
     struct sys_timeouts *timeouts;
     struct sys_timeout *prev_t, *t;
@@ -245,7 +245,7 @@ sswt_handler(void *arg)
 {
     struct sswt_cb *sswt_cb = (struct sswt_cb *) arg;
     
-    /* Timeout. Set flag to TRUE and signal semephore */
+    /* Timeout. Set flag to TRUE and signal semaphore */
     sswt_cb->timeflag = 1;
     sys_sem_signal(*(sswt_cb->psem));
 }
@@ -274,7 +274,7 @@ sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
         return 0;
     } else {
         /* Not a timeout. Remove timeout entry */
-        sys_timeout_remove(sswt_handler, &sswt_cb);
+        sys_untimeout(sswt_handler, &sswt_cb);
         return 1;
     }
     
index aadefc43196b8fef68d133b64381428c56d2a1fe..98567c03e9247f5f182a63c45c4d9da7785a6ec0 100644 (file)
@@ -36,9 +36,9 @@
 
 #ifdef LWIP_DEBUG
 
-#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x) } while(0)
-#define DEBUGF(debug, x) do { if(debug) LWIP_PLATFORM_DIAG(x) } while(0)
-#define LWIP_ERROR(x)   do { LWIP_PLATFORM_DIAG(x) } while(0)  
+#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
+#define DEBUGF(debug, x) do { if(debug) LWIP_PLATFORM_DIAG(x); } while(0)
+#define LWIP_ERROR(x)   do { LWIP_PLATFORM_DIAG(x); } while(0) 
 
 /* These defines control the amount of debugging output: */
 #define MEM_TRACKING
diff --git a/src/include/lwip/event.h b/src/include/lwip/event.h
deleted file mode 100644 (file)
index 677cafc..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __LWIP_EVENT_H__
-#define __LWIP_EVENT_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_EVENT_API
-
-#include "lwip/pbuf.h"
-
-enum lwip_event {
-  LWIP_EVENT_ACCEPT,
-  LWIP_EVENT_SENT,
-  LWIP_EVENT_RECV,
-  LWIP_EVENT_CONNECTED,
-  LWIP_EVENT_POLL,
-  LWIP_EVENT_ERR
-};
-
-struct tcp_pcb;
-
-err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb,
-                    enum lwip_event,
-                    struct pbuf *p,
-                    u16_t size,
-                    err_t err);
-
-#endif /* LWIP_EVENT_API */
-
-#endif /* __LWIP_EVENT_H__ */
index 47fa573dc873618223c2e62365cca6d242404291..0caceea90dc3ea3648c3526739c4683ca774b3a6 100644 (file)
@@ -91,7 +91,7 @@ void sys_init(void);
  *
  */
 void sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
-void sys_timeout_remove(sys_timeout_handler h, void *arg);
+void sys_untimeout(sys_timeout_handler h, void *arg);
 struct sys_timeouts *sys_arch_timeouts(void);
 
 /* Semaphore functions. */
index 26503731e2dcdbf71bae0c011c4bc4b281c141ed..e76729e9df54f23623dc8721d6f2d9e06be0a882 100644 (file)
@@ -44,8 +44,6 @@
 
 #include "lwip/err.h"
 
-#include "lwip/event.h"
-
 struct tcp_pcb;
 
 /* Functions for interfacing with TCP: */
@@ -307,6 +305,22 @@ struct tcp_pcb_listen {
 };
 
 #if LWIP_EVENT_API
+
+enum lwip_event {
+  LWIP_EVENT_ACCEPT,
+  LWIP_EVENT_SENT,
+  LWIP_EVENT_RECV,
+  LWIP_EVENT_CONNECTED,
+  LWIP_EVENT_POLL,
+  LWIP_EVENT_ERR
+};
+
+err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb,
+                    enum lwip_event,
+                    struct pbuf *p,
+                    u16_t size,
+                    err_t err);
+
 #define TCP_EVENT_ACCEPT(pcb,err,ret)    ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
                                                    LWIP_EVENT_ACCEPT, NULL, 0, err)
 #define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
index c10ae3b062f762a7c0d2f618ffaf671369074afa..8d9eb66840e2aa0b88c193d9021b78088641b7df 100644 (file)
@@ -312,7 +312,7 @@ static void
 arp_timer(void *arg)
 {
   arp_tmr();
-  sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL);
+  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
 }
 /*-----------------------------------------------------------------------------------*/
 /*
@@ -341,6 +341,6 @@ ethernetif_init(struct netif *netif)
   low_level_init(netif);
   arp_init();
 
-  sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL);
+  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
 }
 /*-----------------------------------------------------------------------------------*/