MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _send_recv_timeout

Function _send_recv_timeout

components/lwp/lwp_ipc.c:476–512  ·  view source on GitHub ↗

* Send data through an IPC channel, wait for the reply or not. */

Source from the content-addressed store, hash-verified

474 * Send data through an IPC channel, wait for the reply or not.
475 */
476static rt_err_t _send_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, int need_reply, rt_channel_msg_t data_ret, rt_int32_t time)
477{
478 rt_ipc_msg_t msg;
479 rt_err_t rc = -RT_ERROR;
480
481 if (need_reply)
482 {
483 RT_DEBUG_NOT_IN_INTERRUPT;
484 }
485
486 if (ch == RT_NULL)
487 {
488 rc = -RT_EIO;
489 }
490 else
491 {
492 if (rt_object_get_type(&ch->parent.parent) != RT_Object_Class_Channel)
493 {
494 rc = -RT_EIO;
495 }
496 else if (need_reply && time == 0)
497 {
498 rc = -RT_ETIMEOUT;
499 }
500 else
501 {
502 /* allocate an IPC message */
503 msg = _ipc_msg_alloc();
504 if (!msg)
505 rc = -RT_ENOMEM;
506 else
507 rc = _do_send_recv_timeout(ch, data, need_reply, data_ret, time, msg);
508 }
509 }
510
511 return rc;
512}
513
514static rt_err_t _do_send_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, int need_reply, rt_channel_msg_t data_ret, rt_int32_t time, rt_ipc_msg_t msg)
515{

Callers 3

rt_raw_channel_sendFunction · 0.85
rt_raw_channel_send_recvFunction · 0.85

Calls 3

rt_object_get_typeFunction · 0.85
_ipc_msg_allocFunction · 0.85
_do_send_recv_timeoutFunction · 0.85

Tested by

no test coverage detected