diff --git a/CHANGELOG b/CHANGELOG index bd71cc17..39177b8f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,10 +6,14 @@ HISTORY ++ New features: - 2016-07-xx: Dirk Ziegelmeier: + 2016-07-27: Simon Goldschmidt + * opt.h, timeouts.h/.c: added LWIP_TIMERS_CUSTOM to override the default + implementation of timeouts + + 2016-07-xx: Dirk Ziegelmeier * Large overhaul of doxygen documentation - 2016-04-05: Simon Goldschmidt: + 2016-04-05: Simon Goldschmidt * timers.h/.c: prepare for overriding current timeout implementation: all stack-internal caclic timers are avaliable in the lwip_cyclic_timers array diff --git a/src/core/timeouts.c b/src/core/timeouts.c index 9411800e..6c692ccc 100644 --- a/src/core/timeouts.c +++ b/src/core/timeouts.c @@ -106,7 +106,7 @@ const struct lwip_cyclic_timer lwip_cyclic_timers[] = { #endif /* LWIP_IPV6 */ }; -#if LWIP_TIMERS +#if LWIP_TIMERS && LWIP_TIMERS_CUSTOM /** The one and only timeout list */ static struct sys_timeo *next_timeout; @@ -426,10 +426,10 @@ again: #endif /* NO_SYS */ -#else /* LWIP_TIMERS */ +#else /* LWIP_TIMERS && LWIP_TIMERS_CUSTOM */ /* Satisfy the TCP code which calls this function */ void tcp_timer_needed(void) { } -#endif /* LWIP_TIMERS */ +#endif /* LWIP_TIMERS && LWIP_TIMERS_CUSTOM */ diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 5134185d..98567ca4 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -73,11 +73,28 @@ #endif /** - * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1 - * Mainly for compatibility to old versions. + * LWIP_TIMERS==0: Drop support for sys_timeout and lwip-internal cyclic timers. + * (the array of lwip-internal cyclic timers is still provided) */ -#if !defined NO_SYS_NO_TIMERS || defined __DOXYGEN__ -#define NO_SYS_NO_TIMERS 0 +#ifndef LWIP_TIMERS +#define LWIP_TIMERS 1 +#endif + +/** + * LWIP_TIMERS_CUSTOM==1: Provide your own timer implementation. + * Function prototypes in timeouts.h and the array of lwip-internal cyclic timers + * are still included, but the implementation is not. The following functions + * will be required: sys_timeouts_init(), sys_timeout(), sys_untimeout(), + * sys_timeouts_mbox_fetch() + * (check NO_SYS_NO_TIMERS for compatibility to old versions) + */ +#if !defined LWIP_TIMERS_CUSTOM || defined __DOXYGEN__ +#ifdef NO_SYS_NO_TIMERS +#define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) +#else +#define LWIP_TIMERS 1 +#endif +#define LWIP_TIMERS_CUSTOM 0 #endif /** * @} diff --git a/src/include/lwip/priv/memp_std.h b/src/include/lwip/priv/memp_std.h index 59f436df..ee3e2537 100644 --- a/src/include/lwip/priv/memp_std.h +++ b/src/include/lwip/priv/memp_std.h @@ -91,9 +91,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 (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */ +#if LWIP_TIMERS && !LWIP_TIMERS_CUSTOM LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT") -#endif /* LWIP_TIMERS */ +#endif /* LWIP_TIMERS && !LWIP_TIMERS_CUSTOM */ #if LWIP_DNS && LWIP_SOCKET LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB") diff --git a/src/include/lwip/timeouts.h b/src/include/lwip/timeouts.h index 253c0fe6..4988b151 100644 --- a/src/include/lwip/timeouts.h +++ b/src/include/lwip/timeouts.h @@ -39,15 +39,6 @@ #define LWIP_HDR_TIMEOUTS_H #include "lwip/opt.h" - -/** Timers are not supported when NO_SYS==1 and NO_SYS_NO_TIMERS==1. - * Timer support can be disabled when cyclic timers are implemented - * differently (use lwip_cyclic_timers array) - */ -#ifndef LWIP_TIMERS -#define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) -#endif - #include "lwip/err.h" #if !NO_SYS #include "lwip/sys.h"