Browse Source

Allow minimal unix target to build in cygwin (but not necessarily run).

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().
STABLE-2_1_x
davidhaas 23 years ago
parent
commit
7f1becc682
  1. 4
      doc/sys_arch.txt
  2. 4
      src/api/tcpip.c
  3. 2
      src/core/ipv4/ip.c
  4. 8
      src/core/ipv4/ip_frag.c
  5. 4
      src/core/memp.c
  6. 6
      src/core/sys.c
  7. 6
      src/include/lwip/debug.h
  8. 29
      src/include/lwip/event.h
  9. 2
      src/include/lwip/sys.h
  10. 18
      src/include/lwip/tcp.h
  11. 4
      src/netif/ethernetif.c

4
doc/sys_arch.txt

@ -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.

4
src/api/tcpip.c

@ -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);
}
}
/*-----------------------------------------------------------------------------------*/

2
src/core/ipv4/ip.c

@ -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;
}

8
src/core/ipv4/ip_frag.c

@ -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);

4
src/core/memp.c

@ -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
}

6
src/core/sys.c

@ -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;
}

6
src/include/lwip/debug.h

@ -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

29
src/include/lwip/event.h

@ -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__ */

2
src/include/lwip/sys.h

@ -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. */

18
src/include/lwip/tcp.h

@ -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),\

4
src/netif/ethernetif.c

@ -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);
}
/*-----------------------------------------------------------------------------------*/

Loading…
Cancel
Save