diff --git a/CHANGELOG b/CHANGELOG index 3f0cbb63..9eb5dfa0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,10 @@ HISTORY ++ New features: + 2010-03-20: Simon Goldschmidt + * opt.h, tcpip.c/.h: Added an option to disable tcpip_(un)timeout code + since the linker cannot do this automatically to save space. + 2010-03-20: Simon Goldschmidt * opt.h, etharp.c/.h: Added support for static ARP table entries diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 4749b3d4..188eb506 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -122,6 +122,7 @@ tcpip_thread(void *arg) memp_free(MEMP_TCPIP_MSG_API, msg); break; +#if LWIP_TCPIP_TIMEOUT case TCPIP_MSG_TIMEOUT: LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); sys_timeout(msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg); @@ -132,6 +133,7 @@ tcpip_thread(void *arg) sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg); memp_free(MEMP_TCPIP_MSG_API, msg); break; +#endif /* LWIP_TCPIP_TIMEOUT */ default: LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type)); @@ -226,6 +228,7 @@ tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block) return ERR_VAL; } +#if LWIP_TCPIP_TIMEOUT /** * call sys_timeout in tcpip_thread * @@ -282,6 +285,7 @@ tcpip_untimeout(sys_timeout_handler h, void *arg) } return ERR_VAL; } +#endif /* LWIP_TCPIP_TIMEOUT */ #if LWIP_NETCONN /** diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 4f91f94a..81d98970 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1321,6 +1321,13 @@ #define LWIP_NETCONN 1 #endif +/** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout tod create + * timers running in tcpip_thread from another thread. + */ +#ifndef LWIP_TCPIP_TIMEOUT +#define LWIP_TCPIP_TIMEOUT 1 +#endif + /* ------------------------------------ ---------- Socket options ---------- diff --git a/src/include/lwip/tcpip.h b/src/include/lwip/tcpip.h index 48418746..ef13c167 100644 --- a/src/include/lwip/tcpip.h +++ b/src/include/lwip/tcpip.h @@ -96,8 +96,10 @@ err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t bloc err_t pbuf_free_callback(struct pbuf *p); err_t mem_free_callback(void *m); +#if LWIP_TCPIP_TIMEOUT err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); err_t tcpip_untimeout(sys_timeout_handler h, void *arg); +#endif /* LWIP_TCPIP_TIMEOUT */ enum tcpip_msg_type { #if LWIP_NETCONN @@ -108,8 +110,10 @@ enum tcpip_msg_type { TCPIP_MSG_NETIFAPI, #endif /* LWIP_NETIF_API */ TCPIP_MSG_CALLBACK, +#if LWIP_TCPIP_TIMEOUT TCPIP_MSG_TIMEOUT, - TCPIP_MSG_UNTIMEOUT + TCPIP_MSG_UNTIMEOUT, +#endif /* LWIP_TCPIP_TIMEOUT */ }; struct tcpip_msg { @@ -130,11 +134,13 @@ struct tcpip_msg { tcpip_callback_fn function; void *ctx; } cb; +#if LWIP_TCPIP_TIMEOUT struct { u32_t msecs; sys_timeout_handler h; void *arg; } tmo; +#endif /* LWIP_TCPIP_TIMEOUT */ } msg; };