• Home
  • Raw
  • Download

Lines Matching refs:msg

71 static void tcpip_thread_handle_msg(struct tcpip_msg *msg);
75 #define TCPIP_MBOX_FETCH(mbox, msg) sys_mbox_fetch(mbox, msg) argument
78 #define TCPIP_MBOX_FETCH(mbox, msg) tcpip_timeouts_mbox_fetch(mbox, msg) argument
88 tcpip_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg) in tcpip_timeouts_mbox_fetch() argument
98 sys_arch_mbox_fetch(mbox, msg, 0); in tcpip_timeouts_mbox_fetch()
108 res = sys_arch_mbox_fetch(mbox, msg, sleeptime); in tcpip_timeouts_mbox_fetch()
134 struct tcpip_msg *msg; in tcpip_thread() local
147 TCPIP_MBOX_FETCH(&tcpip_mbox, (void **)&msg); in tcpip_thread()
148 if (msg == NULL) { in tcpip_thread()
153 tcpip_thread_handle_msg(msg); in tcpip_thread()
161 tcpip_thread_handle_msg(struct tcpip_msg *msg) in tcpip_thread_handle_msg() argument
163 switch (msg->type) { in tcpip_thread_handle_msg()
166 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg)); in tcpip_thread_handle_msg()
167 msg->msg.api_msg.function(msg->msg.api_msg.msg); in tcpip_thread_handle_msg()
170 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API CALL message %p\n", (void *)msg)); in tcpip_thread_handle_msg()
171 msg->msg.api_call.arg->err = msg->msg.api_call.function(msg->msg.api_call.arg); in tcpip_thread_handle_msg()
172 sys_sem_signal(msg->msg.api_call.sem); in tcpip_thread_handle_msg()
178 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg)); in tcpip_thread_handle_msg()
179 if (msg->msg.inp.input_fn(msg->msg.inp.p, msg->msg.inp.netif) != ERR_OK) { in tcpip_thread_handle_msg()
180 pbuf_free(msg->msg.inp.p); in tcpip_thread_handle_msg()
182 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_thread_handle_msg()
188 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); in tcpip_thread_handle_msg()
189 sys_timeout(msg->msg.tmo.msecs, 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()
193 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: UNTIMEOUT %p\n", (void *)msg)); in tcpip_thread_handle_msg()
194 sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg); in tcpip_thread_handle_msg()
195 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread_handle_msg()
200 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg)); in tcpip_thread_handle_msg()
201 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread_handle_msg()
202 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_thread_handle_msg()
206 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK_STATIC %p\n", (void *)msg)); in tcpip_thread_handle_msg()
207 msg->msg.cb.function(msg->msg.cb.ctx); in tcpip_thread_handle_msg()
212 if (msg->msg.lowpower.type == LOW_BLOCK) { in tcpip_thread_handle_msg()
213 LOWPOWER_SIGNAL(msg->msg.lowpower.wait_up); in tcpip_thread_handle_msg()
215 memp_free(MEMP_TCPIP_MSG_LOWPOWER, msg); in tcpip_thread_handle_msg()
221 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type)); in tcpip_thread_handle_msg()
232 struct tcpip_msg *msg = NULL; in tcpip_send_msg_na() local
243 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_LOWPOWER); in tcpip_send_msg_na()
244 if (msg == NULL) { in tcpip_send_msg_na()
250 msg->type = TCPIP_MSG_NA; in tcpip_send_msg_na()
251 msg->msg.lowpower.type = type; in tcpip_send_msg_na()
254 LOWPOWER_SEM_NEW(msg->msg.lowpower.wait_up, val); in tcpip_send_msg_na()
257 memp_free(MEMP_TCPIP_MSG_LOWPOWER, msg); in tcpip_send_msg_na()
262 if (sys_mbox_trypost(&tcpip_mbox, msg) != ERR_OK) { in tcpip_send_msg_na()
264 LOWPOWER_SEM_FREE(msg->msg.lowpower.wait_up); in tcpip_send_msg_na()
266 memp_free(MEMP_TCPIP_MSG_LOWPOWER, msg); in tcpip_send_msg_na()
272 LOWPOWER_SEM_WAIT(msg->msg.lowpower.wait_up); in tcpip_send_msg_na()
273 LOWPOWER_SEM_FREE(msg->msg.lowpower.wait_up); in tcpip_send_msg_na()
274 memp_free(MEMP_TCPIP_MSG_LOWPOWER, msg); in tcpip_send_msg_na()
285 struct tcpip_msg *msg; in tcpip_thread_poll_one() local
287 if (sys_arch_mbox_tryfetch(&tcpip_mbox, (void **)&msg) != SYS_MBOX_EMPTY) { in tcpip_thread_poll_one()
289 if (msg != NULL) { in tcpip_thread_poll_one()
290 tcpip_thread_handle_msg(msg); in tcpip_thread_poll_one()
320 struct tcpip_msg *msg; in tcpip_inpkt()
324 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT); in tcpip_inpkt()
325 if (msg == NULL) { in tcpip_inpkt()
329 msg->type = TCPIP_MSG_INPKT; in tcpip_inpkt()
330 msg->msg.inp.p = p; in tcpip_inpkt()
331 msg->msg.inp.netif = inp; in tcpip_inpkt()
332 msg->msg.inp.input_fn = input_fn; in tcpip_inpkt()
333 if (sys_mbox_trypost(&tcpip_mbox, msg) != ERR_OK) { in tcpip_inpkt()
334 memp_free(MEMP_TCPIP_MSG_INPKT, msg); in tcpip_inpkt()
381 struct tcpip_msg *msg; in tcpip_callback() local
385 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callback()
386 if (msg == NULL) { in tcpip_callback()
390 msg->type = TCPIP_MSG_CALLBACK; in tcpip_callback()
391 msg->msg.cb.function = function; in tcpip_callback()
392 msg->msg.cb.ctx = ctx; in tcpip_callback()
394 sys_mbox_post(&tcpip_mbox, msg); in tcpip_callback()
417 struct tcpip_msg *msg; in tcpip_try_callback() local
421 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_try_callback()
422 if (msg == NULL) { in tcpip_try_callback()
426 msg->type = TCPIP_MSG_CALLBACK; in tcpip_try_callback()
427 msg->msg.cb.function = function; in tcpip_try_callback()
428 msg->msg.cb.ctx = ctx; in tcpip_try_callback()
430 if (sys_mbox_trypost(&tcpip_mbox, msg) != ERR_OK) { in tcpip_try_callback()
431 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_try_callback()
449 struct tcpip_msg *msg; in tcpip_timeout() local
453 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_timeout()
454 if (msg == NULL) { in tcpip_timeout()
458 msg->type = TCPIP_MSG_TIMEOUT; in tcpip_timeout()
459 msg->msg.tmo.msecs = msecs; in tcpip_timeout()
460 msg->msg.tmo.h = h; in tcpip_timeout()
461 msg->msg.tmo.arg = arg; in tcpip_timeout()
462 sys_mbox_post(&tcpip_mbox, msg); in tcpip_timeout()
476 struct tcpip_msg *msg; in tcpip_untimeout() local
480 msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_untimeout()
481 if (msg == NULL) { in tcpip_untimeout()
485 msg->type = TCPIP_MSG_UNTIMEOUT; in tcpip_untimeout()
486 msg->msg.tmo.h = h; in tcpip_untimeout()
487 msg->msg.tmo.arg = arg; in tcpip_untimeout()
488 sys_mbox_post(&tcpip_mbox, msg); in tcpip_untimeout()
519 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_send_msg_wait_sem()
524 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_send_msg_wait_sem()
525 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API; in tcpip_send_msg_wait_sem()
526 TCPIP_MSG_VAR_REF(msg).msg.api_msg.function = fn; in tcpip_send_msg_wait_sem()
527 TCPIP_MSG_VAR_REF(msg).msg.api_msg.msg = apimsg; in tcpip_send_msg_wait_sem()
528 sys_mbox_post(&tcpip_mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_send_msg_wait_sem()
530 TCPIP_MSG_VAR_FREE(msg); in tcpip_send_msg_wait_sem()
558 TCPIP_MSG_VAR_DECLARE(msg); in tcpip_api_call()
569 TCPIP_MSG_VAR_ALLOC(msg); in tcpip_api_call()
570 TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API_CALL; in tcpip_api_call()
571 TCPIP_MSG_VAR_REF(msg).msg.api_call.arg = call; in tcpip_api_call()
572 TCPIP_MSG_VAR_REF(msg).msg.api_call.function = fn; in tcpip_api_call()
574 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = LWIP_NETCONN_THREAD_SEM_GET(); in tcpip_api_call()
576 TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = &call->sem; in tcpip_api_call()
578 sys_mbox_post(&tcpip_mbox, &TCPIP_MSG_VAR_REF(msg)); in tcpip_api_call()
579 sys_arch_sem_wait(TCPIP_MSG_VAR_REF(msg).msg.api_call.sem, 0); in tcpip_api_call()
580 TCPIP_MSG_VAR_FREE(msg); in tcpip_api_call()
609 struct tcpip_msg *msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); in tcpip_callbackmsg_new() local
610 if (msg == NULL) { in tcpip_callbackmsg_new()
613 msg->type = TCPIP_MSG_CALLBACK_STATIC; in tcpip_callbackmsg_new()
614 msg->msg.cb.function = function; in tcpip_callbackmsg_new()
615 msg->msg.cb.ctx = ctx; in tcpip_callbackmsg_new()
616 return (struct tcpip_callback_msg *)msg; in tcpip_callbackmsg_new()
628 tcpip_callbackmsg_delete(struct tcpip_callback_msg *msg) in tcpip_callbackmsg_delete() argument
630 memp_free(MEMP_TCPIP_MSG_API, msg); in tcpip_callbackmsg_delete()
643 tcpip_callbackmsg_trycallback(struct tcpip_callback_msg *msg) in tcpip_callbackmsg_trycallback() argument
646 return sys_mbox_trypost(&tcpip_mbox, msg); in tcpip_callbackmsg_trycallback()
662 tcpip_callbackmsg_trycallback_fromisr(struct tcpip_callback_msg *msg) in tcpip_callbackmsg_trycallback_fromisr() argument
665 return sys_mbox_trypost_fromisr(&tcpip_mbox, msg); in tcpip_callbackmsg_trycallback_fromisr()