MCPcopy Create free account
hub / github.com/apache/nuttx / rpmsgdev_send_recv

Function rpmsgdev_send_recv

drivers/misc/rpmsgdev.c:800–852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

798 ****************************************************************************/
799
800static int rpmsgdev_send_recv(FAR struct rpmsgdev_s *priv,
801 uint32_t command, bool copy,
802 FAR struct rpmsgdev_header_s *msg,
803 int len, FAR void *data)
804{
805 struct rpmsgdev_cookie_s cookie;
806 int ret;
807
808 memset(&cookie, 0, sizeof(cookie));
809 nxsem_init(&cookie.sem, 0, 0);
810
811 if (data != NULL)
812 {
813 cookie.data = data;
814 }
815 else if (copy)
816 {
817 cookie.data = msg;
818 }
819
820 msg->command = command;
821 msg->result = -ENXIO;
822 msg->cookie = (uintptr_t)&cookie;
823
824 if (copy)
825 {
826 ret = rpmsg_send(&priv->ept, msg, len);
827 }
828 else
829 {
830 ret = rpmsg_send_nocopy(&priv->ept, msg, len);
831 }
832
833 if (ret < 0)
834 {
835 if (copy == false)
836 {
837 rpmsg_release_tx_buffer(&priv->ept, msg);
838 }
839
840 goto fail;
841 }
842
843 ret = rpmsg_wait(&priv->ept, &cookie.sem);
844 if (ret >= 0)
845 {
846 ret = cookie.result;
847 }
848
849fail:
850 nxsem_destroy(&cookie.sem);
851 return ret;
852}
853
854/****************************************************************************
855 * Name: rpmsgdev_default_handler

Callers 7

rpmsgdev_openFunction · 0.85
rpmsgdev_closeFunction · 0.85
rpmsgdev_readFunction · 0.85
rpmsgdev_writeFunction · 0.85
rpmsgdev_seekFunction · 0.85
rpmsgdev_ioctlFunction · 0.85
rpmsgdev_pollFunction · 0.85

Calls 4

nxsem_initFunction · 0.85
rpmsg_waitFunction · 0.85
nxsem_destroyFunction · 0.85
memsetFunction · 0.50

Tested by

no test coverage detected