Added an option to disable tcpip_(un)timeout code since the linker cannot do this automatically to save space.

This commit is contained in:
goldsimon 2010-03-20 11:55:41 +00:00
parent 5fd410db4b
commit f70014b8ea
4 changed files with 22 additions and 1 deletions

View File

@ -13,6 +13,10 @@ HISTORY
++ New features: ++ 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 2010-03-20: Simon Goldschmidt
* opt.h, etharp.c/.h: Added support for static ARP table entries * opt.h, etharp.c/.h: Added support for static ARP table entries

View File

@ -122,6 +122,7 @@ tcpip_thread(void *arg)
memp_free(MEMP_TCPIP_MSG_API, msg); memp_free(MEMP_TCPIP_MSG_API, msg);
break; break;
#if LWIP_TCPIP_TIMEOUT
case TCPIP_MSG_TIMEOUT: case TCPIP_MSG_TIMEOUT:
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); 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); 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); sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg);
memp_free(MEMP_TCPIP_MSG_API, msg); memp_free(MEMP_TCPIP_MSG_API, msg);
break; break;
#endif /* LWIP_TCPIP_TIMEOUT */
default: default:
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type)); 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; return ERR_VAL;
} }
#if LWIP_TCPIP_TIMEOUT
/** /**
* call sys_timeout in tcpip_thread * call sys_timeout in tcpip_thread
* *
@ -282,6 +285,7 @@ tcpip_untimeout(sys_timeout_handler h, void *arg)
} }
return ERR_VAL; return ERR_VAL;
} }
#endif /* LWIP_TCPIP_TIMEOUT */
#if LWIP_NETCONN #if LWIP_NETCONN
/** /**

View File

@ -1321,6 +1321,13 @@
#define LWIP_NETCONN 1 #define LWIP_NETCONN 1
#endif #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 ---------- ---------- Socket options ----------

View File

@ -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 pbuf_free_callback(struct pbuf *p);
err_t mem_free_callback(void *m); 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_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
err_t tcpip_untimeout(sys_timeout_handler h, void *arg); err_t tcpip_untimeout(sys_timeout_handler h, void *arg);
#endif /* LWIP_TCPIP_TIMEOUT */
enum tcpip_msg_type { enum tcpip_msg_type {
#if LWIP_NETCONN #if LWIP_NETCONN
@ -108,8 +110,10 @@ enum tcpip_msg_type {
TCPIP_MSG_NETIFAPI, TCPIP_MSG_NETIFAPI,
#endif /* LWIP_NETIF_API */ #endif /* LWIP_NETIF_API */
TCPIP_MSG_CALLBACK, TCPIP_MSG_CALLBACK,
#if LWIP_TCPIP_TIMEOUT
TCPIP_MSG_TIMEOUT, TCPIP_MSG_TIMEOUT,
TCPIP_MSG_UNTIMEOUT TCPIP_MSG_UNTIMEOUT,
#endif /* LWIP_TCPIP_TIMEOUT */
}; };
struct tcpip_msg { struct tcpip_msg {
@ -130,11 +134,13 @@ struct tcpip_msg {
tcpip_callback_fn function; tcpip_callback_fn function;
void *ctx; void *ctx;
} cb; } cb;
#if LWIP_TCPIP_TIMEOUT
struct { struct {
u32_t msecs; u32_t msecs;
sys_timeout_handler h; sys_timeout_handler h;
void *arg; void *arg;
} tmo; } tmo;
#endif /* LWIP_TCPIP_TIMEOUT */
} msg; } msg;
}; };