Lines Matching refs:msg

70 #define TCPIP_MBOX_FETCH(mbox, msg) sys_timeouts_mbox_fetch(mbox, msg)  argument
73 #define TCPIP_MBOX_FETCH(mbox, msg) sys_mbox_fetch(mbox, msg) argument
89 struct tcpip_msg *msg; in tcpip_thread() local
101 TCPIP_MBOX_FETCH(&mbox, (void **)&msg); in tcpip_thread()
103 if (msg == NULL) { in tcpip_thread()
108 switch (msg->type) { in tcpip_thread()
111 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg)); in tcpip_thread()
112 msg->msg.api_msg.function(msg->msg.api_msg.msg); in tcpip_thread()
115 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API CALL message %p\n", (void *)msg)); in tcpip_thread()
116 msg->msg.api_call.arg->err = msg->msg.api_call.function(msg->msg.api_call.arg); in tcpip_thread()
117 sys_sem_signal(msg->msg.api_call.sem); in tcpip_thread()
123 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg)); in tcpip_thread()
124 msg->msg.inp.input_fn(msg->msg.inp.p, msg->msg.inp.netif); in tcpip_thread()
125 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_thread()
131 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); in tcpip_thread()
132 sys_timeout(msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg); in tcpip_thread()
133 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread()
136 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: UNTIMEOUT %p\n", (void *)msg)); in tcpip_thread()
137 sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg); in tcpip_thread()
138 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread()
143 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg)); in tcpip_thread()
144 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread()
145 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread()
149 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK_STATIC %p\n", (void *)msg)); in tcpip_thread()
150 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread()
154 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type)); in tcpip_thread()
179 struct tcpip_msg *msg; in tcpip_inpkt()
183 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT); in tcpip_inpkt()
184 if (msg == NULL) { in tcpip_inpkt()
188 msg->type = TCPIP_MSG_INPKT; in tcpip_inpkt()
189 msg->msg.inp.p = p; in tcpip_inpkt()
190 msg->msg.inp.netif = inp; in tcpip_inpkt()
191 msg->msg.inp.input_fn = input_fn; in tcpip_inpkt()
192 if (sys_mbox_trypost(&mbox, msg) != ERR_OK) { in tcpip_inpkt()
193 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_inpkt()
236 struct tcpip_msg *msg; in tcpip_callback_with_block() local
240 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callback_with_block()
241 if (msg == NULL) { in tcpip_callback_with_block()
245 msg->type = TCPIP_MSG_CALLBACK; in tcpip_callback_with_block()
246 msg->msg.cb.function = function; in tcpip_callback_with_block()
247 msg->msg.cb.ctx = ctx; in tcpip_callback_with_block()
249 sys_mbox_post(&mbox, msg); in tcpip_callback_with_block()
251 if (sys_mbox_trypost(&mbox, msg) != ERR_OK) { in tcpip_callback_with_block()
252 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_callback_with_block()
271 struct tcpip_msg *msg; in tcpip_timeout() local
275 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_timeout()
276 if (msg == NULL) { in tcpip_timeout()
280 msg->type = TCPIP_MSG_TIMEOUT; in tcpip_timeout()
281 msg->msg.tmo.msecs = msecs; in tcpip_timeout()
282 msg->msg.tmo.h = h; in tcpip_timeout()
283 msg->msg.tmo.arg = arg; in tcpip_timeout()
284 sys_mbox_post(&mbox, msg); in tcpip_timeout()
298 struct tcpip_msg *msg; in tcpip_untimeout() local
302 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_untimeout()
303 if (msg == NULL) { in tcpip_untimeout()
307 msg->type = TCPIP_MSG_UNTIMEOUT; in tcpip_untimeout()
308 msg->msg.tmo.h = h; in tcpip_untimeout()
309 msg->msg.tmo.arg = arg; in tcpip_untimeout()
310 sys_mbox_post(&mbox, msg); in tcpip_untimeout()
338 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_send_msg_wait_sem()
343 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_send_msg_wait_sem()
344 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API; in tcpip_send_msg_wait_sem()
345 TCPIP_MSG_VAR_REF(msg).msg.api_msg.function = fn; in tcpip_send_msg_wait_sem()
346 TCPIP_MSG_VAR_REF(msg).msg.api_msg.msg = apimsg; in tcpip_send_msg_wait_sem()
347 sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_send_msg_wait_sem()
349 TCPIP_MSG_VAR_FREE(msg); in tcpip_send_msg_wait_sem()
374 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_api_call()
385 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_api_call()
386 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API_CALL; in tcpip_api_call()
387 TCPIP_MSG_VAR_REF(msg).msg.api_call.arg = call; in tcpip_api_call()
388 TCPIP_MSG_VAR_REF(msg).msg.api_call.function = fn; in tcpip_api_call()
390 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = LWIP_NETCONN_THREAD_SEM_GET(); in tcpip_api_call()
392 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = &call->sem; in tcpip_api_call()
394 sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_api_call()
395 sys_arch_sem_wait(TCPIP_MSG_VAR_REF(msg).msg.api_call.sem, 0); in tcpip_api_call()
396 TCPIP_MSG_VAR_FREE(msg); in tcpip_api_call()
417 struct tcpip_msg *msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callbackmsg_new() local
418 if (msg == NULL) { in tcpip_callbackmsg_new()
421 msg->type = TCPIP_MSG_CALLBACK_STATIC; in tcpip_callbackmsg_new()
422 msg->msg.cb.function = function; in tcpip_callbackmsg_new()
423 msg->msg.cb.ctx = ctx; in tcpip_callbackmsg_new()
424 return (struct tcpip_callback_msg*)msg; in tcpip_callbackmsg_new()
433 tcpip_callbackmsg_delete(struct tcpip_callback_msg* msg) in tcpip_callbackmsg_delete() argument
435 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_callbackmsg_delete()
446 tcpip_trycallback(struct tcpip_callback_msg* msg) in tcpip_trycallback() argument
449 return sys_mbox_trypost(&mbox, msg); in tcpip_trycallback()