Lines Matching refs:msg
68 static void tcpip_thread_handle_msg(struct tcpip_msg *msg);
72 #define TCPIP_MBOX_FETCH(mbox, msg) sys_mbox_fetch(mbox, msg) argument
75 #define TCPIP_MBOX_FETCH(mbox, msg) tcpip_timeouts_mbox_fetch(mbox, msg) argument
84 tcpip_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg) in tcpip_timeouts_mbox_fetch() argument
94 sys_arch_mbox_fetch(mbox, msg, 0); in tcpip_timeouts_mbox_fetch()
104 res = sys_arch_mbox_fetch(mbox, msg, sleeptime); in tcpip_timeouts_mbox_fetch()
129 struct tcpip_msg *msg; in tcpip_thread() local
142 TCPIP_MBOX_FETCH(&tcpip_mbox, (void **)&msg); in tcpip_thread()
143 if (msg == NULL) { in tcpip_thread()
148 tcpip_thread_handle_msg(msg); in tcpip_thread()
156 tcpip_thread_handle_msg(struct tcpip_msg *msg) in tcpip_thread_handle_msg() argument
158 switch (msg->type) { in tcpip_thread_handle_msg()
161 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg)); in tcpip_thread_handle_msg()
162 msg->msg.api_msg.function(msg->msg.api_msg.msg); in tcpip_thread_handle_msg()
165 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API CALL message %p\n", (void *)msg)); in tcpip_thread_handle_msg()
166 msg->msg.api_call.arg->err = msg->msg.api_call.function(msg->msg.api_call.arg); in tcpip_thread_handle_msg()
167 sys_sem_signal(msg->msg.api_call.sem); in tcpip_thread_handle_msg()
173 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg)); in tcpip_thread_handle_msg()
174 if (msg->msg.inp.input_fn(msg->msg.inp.p, msg->msg.inp.netif) != ERR_OK) { in tcpip_thread_handle_msg()
175 pbuf_free(msg->msg.inp.p); in tcpip_thread_handle_msg()
177 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_thread_handle_msg()
183 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); in tcpip_thread_handle_msg()
184 sys_timeout(msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg); in tcpip_thread_handle_msg()
185 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread_handle_msg()
188 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: UNTIMEOUT %p\n", (void *)msg)); in tcpip_thread_handle_msg()
189 sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg); in tcpip_thread_handle_msg()
190 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread_handle_msg()
195 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg)); in tcpip_thread_handle_msg()
196 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread_handle_msg()
197 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread_handle_msg()
201 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK_STATIC %p\n", (void *)msg)); in tcpip_thread_handle_msg()
202 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread_handle_msg()
206 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type)); in tcpip_thread_handle_msg()
218 struct tcpip_msg *msg; in tcpip_thread_poll_one() local
220 if (sys_arch_mbox_tryfetch(&tcpip_mbox, (void **)&msg) != SYS_ARCH_TIMEOUT) { in tcpip_thread_poll_one()
222 if (msg != NULL) { in tcpip_thread_poll_one()
223 tcpip_thread_handle_msg(msg); in tcpip_thread_poll_one()
250 struct tcpip_msg *msg; in tcpip_inpkt()
254 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT); in tcpip_inpkt()
255 if (msg == NULL) { in tcpip_inpkt()
259 msg->type = TCPIP_MSG_INPKT; in tcpip_inpkt()
260 msg->msg.inp.p = p; in tcpip_inpkt()
261 msg->msg.inp.netif = inp; in tcpip_inpkt()
262 msg->msg.inp.input_fn = input_fn; in tcpip_inpkt()
263 if (sys_mbox_trypost(&tcpip_mbox, msg) != ERR_OK) { in tcpip_inpkt()
264 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_inpkt()
311 struct tcpip_msg *msg; in tcpip_callback() local
315 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callback()
316 if (msg == NULL) { in tcpip_callback()
320 msg->type = TCPIP_MSG_CALLBACK; in tcpip_callback()
321 msg->msg.cb.function = function; in tcpip_callback()
322 msg->msg.cb.ctx = ctx; in tcpip_callback()
324 sys_mbox_post(&tcpip_mbox, msg); in tcpip_callback()
347 struct tcpip_msg *msg; in tcpip_try_callback() local
351 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_try_callback()
352 if (msg == NULL) { in tcpip_try_callback()
356 msg->type = TCPIP_MSG_CALLBACK; in tcpip_try_callback()
357 msg->msg.cb.function = function; in tcpip_try_callback()
358 msg->msg.cb.ctx = ctx; in tcpip_try_callback()
360 if (sys_mbox_trypost(&tcpip_mbox, msg) != ERR_OK) { in tcpip_try_callback()
361 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_try_callback()
379 struct tcpip_msg *msg; in tcpip_timeout() local
383 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_timeout()
384 if (msg == NULL) { in tcpip_timeout()
388 msg->type = TCPIP_MSG_TIMEOUT; in tcpip_timeout()
389 msg->msg.tmo.msecs = msecs; in tcpip_timeout()
390 msg->msg.tmo.h = h; in tcpip_timeout()
391 msg->msg.tmo.arg = arg; in tcpip_timeout()
392 sys_mbox_post(&tcpip_mbox, msg); in tcpip_timeout()
406 struct tcpip_msg *msg; in tcpip_untimeout() local
410 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_untimeout()
411 if (msg == NULL) { in tcpip_untimeout()
415 msg->type = TCPIP_MSG_UNTIMEOUT; in tcpip_untimeout()
416 msg->msg.tmo.h = h; in tcpip_untimeout()
417 msg->msg.tmo.arg = arg; in tcpip_untimeout()
418 sys_mbox_post(&tcpip_mbox, msg); in tcpip_untimeout()
446 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_send_msg_wait_sem()
451 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_send_msg_wait_sem()
452 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API; in tcpip_send_msg_wait_sem()
453 TCPIP_MSG_VAR_REF(msg).msg.api_msg.function = fn; in tcpip_send_msg_wait_sem()
454 TCPIP_MSG_VAR_REF(msg).msg.api_msg.msg = apimsg; in tcpip_send_msg_wait_sem()
455 sys_mbox_post(&tcpip_mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_send_msg_wait_sem()
457 TCPIP_MSG_VAR_FREE(msg); in tcpip_send_msg_wait_sem()
482 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_api_call()
493 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_api_call()
494 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API_CALL; in tcpip_api_call()
495 TCPIP_MSG_VAR_REF(msg).msg.api_call.arg = call; in tcpip_api_call()
496 TCPIP_MSG_VAR_REF(msg).msg.api_call.function = fn; in tcpip_api_call()
498 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = LWIP_NETCONN_THREAD_SEM_GET(); in tcpip_api_call()
500 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = &call->sem; in tcpip_api_call()
502 sys_mbox_post(&tcpip_mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_api_call()
503 sys_arch_sem_wait(TCPIP_MSG_VAR_REF(msg).msg.api_call.sem, 0); in tcpip_api_call()
504 TCPIP_MSG_VAR_FREE(msg); in tcpip_api_call()
533 struct tcpip_msg *msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callbackmsg_new() local
534 if (msg == NULL) { in tcpip_callbackmsg_new()
537 msg->type = TCPIP_MSG_CALLBACK_STATIC; in tcpip_callbackmsg_new()
538 msg->msg.cb.function = function; in tcpip_callbackmsg_new()
539 msg->msg.cb.ctx = ctx; in tcpip_callbackmsg_new()
540 return (struct tcpip_callback_msg *)msg; in tcpip_callbackmsg_new()
552 tcpip_callbackmsg_delete(struct tcpip_callback_msg *msg) in tcpip_callbackmsg_delete() argument
554 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_callbackmsg_delete()
567 tcpip_callbackmsg_trycallback(struct tcpip_callback_msg *msg) in tcpip_callbackmsg_trycallback() argument
570 return sys_mbox_trypost(&tcpip_mbox, msg); in tcpip_callbackmsg_trycallback()
586 tcpip_callbackmsg_trycallback_fromisr(struct tcpip_callback_msg *msg) in tcpip_callbackmsg_trycallback_fromisr() argument
589 return sys_mbox_trypost_fromisr(&tcpip_mbox, msg); in tcpip_callbackmsg_trycallback_fromisr()