diff --git a/CHANGELOG b/CHANGELOG index 78a7fa89..f36a1b1b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -225,6 +225,10 @@ HISTORY ++ Bugfixes: + 2010-06-24: Simon Goldschmidt + * init.c, timers.c/.h, opt.h, memp_std.h: From patch #7221: added flag + NO_SYS_NO_TIMERS to drop timer support for NO_SYS==1 for easier upgrading + 2010-06-24: Simon Goldschmidt * api(_lib).c/.h, api_msg.c/.h, sockets.c/.h: Fixed bug #10088: Correctly implemented shutdown at socket level. diff --git a/src/core/init.c b/src/core/init.c index 5763f104..949934ae 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -145,7 +145,7 @@ #error "One and exactly one of LWIP_EVENT_API and LWIP_CALLBACK_API has to be enabled in your lwipopts.h" #endif /* There must be sufficient timeouts, taking into account requirements of the subsystems. */ -#if (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)) +#if LWIP_TIMERS && (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)) #error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required timeouts" #endif #if (IP_REASSEMBLY && (MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS)) @@ -261,7 +261,9 @@ lwip_init(void) /* Modules initialization */ stats_init(); +#if !NO_SYS sys_init(); +#endif /* !NO_SYS */ mem_init(); memp_init(); pbuf_init(); @@ -295,5 +297,7 @@ lwip_init(void) dns_init(); #endif /* LWIP_DNS */ +#if LWIP_TIMERS sys_timeouts_init(); +#endif /* LWIP_TIMERS */ } diff --git a/src/core/timers.c b/src/core/timers.c index 0dba9272..a377b668 100644 --- a/src/core/timers.c +++ b/src/core/timers.c @@ -42,6 +42,9 @@ #include "lwip/opt.h" #include "lwip/timers.h" + +#if LWIP_TIMERS + #include "lwip/def.h" #include "lwip/memp.h" #include "lwip/tcpip.h" @@ -485,3 +488,11 @@ sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg) } #endif /* NO_SYS */ + +#else /* LWIP_TIMERS */ +/* Satisfy the TCP code which calls this function */ +void +tcp_timer_needed(void) +{ +} +#endif /* LWIP_TIMERS */ diff --git a/src/include/lwip/memp_std.h b/src/include/lwip/memp_std.h index 15d27823..550809ae 100644 --- a/src/include/lwip/memp_std.h +++ b/src/include/lwip/memp_std.h @@ -71,7 +71,9 @@ LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_en LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP") #endif /* LWIP_IGMP */ +#if LWIP_TIMERS LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT") +#endif /* LWIP_TIMERS */ #if LWIP_SNMP LWIP_MEMPOOL(SNMP_ROOTNODE, MEMP_NUM_SNMP_ROOTNODE, sizeof(struct mib_list_rootnode), "SNMP_ROOTNODE") diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 968713e9..c5e3967e 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -68,6 +68,14 @@ #define NO_SYS 0 #endif +/** + * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1 + * Mainly for compatibility to old versions. + */ +#ifndef NO_SYS_NO_TIMERS +#define NO_SYS_NO_TIMERS 0 +#endif + /** * MEMCPY: override this if you have a faster implementation at hand than the * one included in your C library diff --git a/src/include/lwip/timers.h b/src/include/lwip/timers.h index c680b24c..b0195ded 100644 --- a/src/include/lwip/timers.h +++ b/src/include/lwip/timers.h @@ -35,6 +35,11 @@ #include "lwip/opt.h" +/* Timers are not supported when NO_SYS==1 and NO_SYS_NO_TIMERS==1 */ +#define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) + +#if LWIP_TIMERS + #include "lwip/err.h" #include "lwip/sys.h" @@ -89,4 +94,5 @@ void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg); } #endif +#endif /* LWIP_TIMERS */ #endif /* __LWIP_TIMERS_H__ */