Lines Matching refs:msg
73 #define TCPIP_MBOX_FETCH(mbox, msg) sys_timeouts_mbox_fetch(mbox, msg) argument
76 #define TCPIP_MBOX_FETCH(mbox, msg) sys_mbox_fetch(mbox, msg) argument
92 struct tcpip_msg *msg; in tcpip_thread() local
104 TCPIP_MBOX_FETCH(&mbox, (void **)&msg); in tcpip_thread()
106 if (msg == NULL) { in tcpip_thread()
111 switch (msg->type) { in tcpip_thread()
114 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg)); in tcpip_thread()
115 msg->msg.api_msg.function(msg->msg.api_msg.msg); in tcpip_thread()
118 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API CALL message %p\n", (void *)msg)); in tcpip_thread()
119 msg->msg.api_call.arg->err = msg->msg.api_call.function(msg->msg.api_call.arg); in tcpip_thread()
120 sys_sem_signal(msg->msg.api_call.sem); in tcpip_thread()
126 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg)); in tcpip_thread()
127 msg->msg.inp.input_fn(msg->msg.inp.p, msg->msg.inp.netif); in tcpip_thread()
128 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_thread()
134 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); in tcpip_thread()
135 sys_timeout(msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg); in tcpip_thread()
136 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread()
139 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: UNTIMEOUT %p\n", (void *)msg)); in tcpip_thread()
140 sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg); in tcpip_thread()
141 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread()
146 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg)); in tcpip_thread()
147 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread()
148 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread()
152 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK_STATIC %p\n", (void *)msg)); in tcpip_thread()
153 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread()
157 LWIP_DEBUGF(NETIF_DEBUG, ("tcpip_thread: DRV %p\n", (void *)msg)); in tcpip_thread()
158 msg->msg.drv.drv_fn(msg->msg.drv.netif, msg->msg.drv.event); in tcpip_thread()
159 memp_free(MEMP_NETIF_DRV_MSG, msg); in tcpip_thread()
163 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type)); in tcpip_thread()
181 struct tcpip_msg *msg; in tcpip_signal_netif_event() local
185 msg = (struct tcpip_msg *)memp_malloc(MEMP_NETIF_DRV_MSG); in tcpip_signal_netif_event()
186 if (msg == NULL) { in tcpip_signal_netif_event()
190 msg->type = TCPIP_MSG_DRV; in tcpip_signal_netif_event()
192 msg->msg.drv.netif = inp; in tcpip_signal_netif_event()
193 msg->msg.drv.event = event; in tcpip_signal_netif_event()
194 msg->msg.drv.drv_fn = drv_fn; in tcpip_signal_netif_event()
195 if (sys_mbox_trypost(&mbox, msg) != ERR_OK) { in tcpip_signal_netif_event()
196 memp_free(MEMP_NETIF_DRV_MSG, msg); in tcpip_signal_netif_event()
221 struct tcpip_msg *msg; in tcpip_inpkt()
225 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT); in tcpip_inpkt()
226 if (msg == NULL) { in tcpip_inpkt()
230 msg->type = TCPIP_MSG_INPKT; in tcpip_inpkt()
231 msg->msg.inp.p = p; in tcpip_inpkt()
232 msg->msg.inp.netif = inp; in tcpip_inpkt()
233 msg->msg.inp.input_fn = input_fn; in tcpip_inpkt()
234 if (sys_mbox_trypost(&mbox, msg) != ERR_OK) { in tcpip_inpkt()
235 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_inpkt()
287 struct tcpip_msg *msg; in tcpip_callback_with_block() local
291 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callback_with_block()
292 if (msg == NULL) { in tcpip_callback_with_block()
296 msg->type = TCPIP_MSG_CALLBACK; in tcpip_callback_with_block()
297 msg->msg.cb.function = function; in tcpip_callback_with_block()
298 msg->msg.cb.ctx = ctx; in tcpip_callback_with_block()
300 sys_mbox_post(&mbox, msg); in tcpip_callback_with_block()
302 if (sys_mbox_trypost(&mbox, msg) != ERR_OK) { in tcpip_callback_with_block()
303 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_callback_with_block()
322 struct tcpip_msg *msg; in tcpip_timeout() local
326 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_timeout()
327 if (msg == NULL) { in tcpip_timeout()
331 msg->type = TCPIP_MSG_TIMEOUT; in tcpip_timeout()
332 msg->msg.tmo.msecs = msecs; in tcpip_timeout()
333 msg->msg.tmo.h = h; in tcpip_timeout()
334 msg->msg.tmo.arg = arg; in tcpip_timeout()
335 sys_mbox_post(&mbox, msg); in tcpip_timeout()
349 struct tcpip_msg *msg; in tcpip_untimeout() local
353 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_untimeout()
354 if (msg == NULL) { in tcpip_untimeout()
358 msg->type = TCPIP_MSG_UNTIMEOUT; in tcpip_untimeout()
359 msg->msg.tmo.h = h; in tcpip_untimeout()
360 msg->msg.tmo.arg = arg; in tcpip_untimeout()
361 sys_mbox_post(&mbox, msg); in tcpip_untimeout()
389 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_send_msg_wait_sem()
394 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_send_msg_wait_sem()
395 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API; in tcpip_send_msg_wait_sem()
396 TCPIP_MSG_VAR_REF(msg).msg.api_msg.function = fn; in tcpip_send_msg_wait_sem()
397 TCPIP_MSG_VAR_REF(msg).msg.api_msg.msg = apimsg; in tcpip_send_msg_wait_sem()
398 sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_send_msg_wait_sem()
400 TCPIP_MSG_VAR_FREE(msg); in tcpip_send_msg_wait_sem()
425 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_api_call()
436 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_api_call()
437 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API_CALL; in tcpip_api_call()
438 TCPIP_MSG_VAR_REF(msg).msg.api_call.arg = call; in tcpip_api_call()
439 TCPIP_MSG_VAR_REF(msg).msg.api_call.function = fn; in tcpip_api_call()
441 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = LWIP_NETCONN_THREAD_SEM_GET(); in tcpip_api_call()
443 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = &call->sem; in tcpip_api_call()
445 sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_api_call()
446 sys_arch_sem_wait(TCPIP_MSG_VAR_REF(msg).msg.api_call.sem, 0); in tcpip_api_call()
447 TCPIP_MSG_VAR_FREE(msg); in tcpip_api_call()
468 struct tcpip_msg *msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callbackmsg_new() local
469 if (msg == NULL) { in tcpip_callbackmsg_new()
472 msg->type = TCPIP_MSG_CALLBACK_STATIC; in tcpip_callbackmsg_new()
473 msg->msg.cb.function = function; in tcpip_callbackmsg_new()
474 msg->msg.cb.ctx = ctx; in tcpip_callbackmsg_new()
475 return (struct tcpip_callback_msg*)msg; in tcpip_callbackmsg_new()
484 tcpip_callbackmsg_delete(struct tcpip_callback_msg* msg) in tcpip_callbackmsg_delete() argument
486 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_callbackmsg_delete()
497 tcpip_trycallback(struct tcpip_callback_msg* msg) in tcpip_trycallback() argument
500 return sys_mbox_trypost(&mbox, msg); in tcpip_trycallback()