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.
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;
}
{
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);
}
}
/*-----------------------------------------------------------------------------------*/
#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:
#endif /* LWIP_TCP */
case IP_PROTO_ICMP:
return 1;
- break;
default:
return 0;
}
{
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;
}
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));
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;
}
/* 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);
sizeof(struct memp)))];
/*-----------------------------------------------------------------------------------*/
+#ifndef SYS_LIGHTWEIGHT_PROT
static sys_sem_t mutex;
+#endif
/*-----------------------------------------------------------------------------------*/
#ifdef LWIP_DEBUG
static int
}
}
+#ifndef SYS_LIGHTWEIGHT_PROT
mutex = sys_sem_new(1);
+#endif
}
*/
/*-----------------------------------------------------------------------------------*/
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;
{
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));
}
return 0;
} else {
/* Not a timeout. Remove timeout entry */
- sys_timeout_remove(sswt_handler, &sswt_cb);
+ sys_untimeout(sswt_handler, &sswt_cb);
return 1;
}
#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
+++ /dev/null
-#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__ */
*
*/
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. */
#include "lwip/err.h"
-#include "lwip/event.h"
-
struct tcp_pcb;
/* Functions for interfacing with TCP: */
};
#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),\
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);
}
/*-----------------------------------------------------------------------------------*/
/*
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);
}
/*-----------------------------------------------------------------------------------*/