added LWIP_TIMERS_CUSTOM to override the default implementation of timeouts

This commit is contained in:
sg 2016-07-27 21:46:16 +02:00
parent a326b057b3
commit 53dc94d570
5 changed files with 32 additions and 20 deletions

View File

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

View File

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

View File

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

View File

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

View File

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