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

Function rpmsgmtd_read_handler

drivers/mtd/rpmsgmtd.c:870–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868 ****************************************************************************/
869
870static int rpmsgmtd_read_handler(FAR struct rpmsg_endpoint *ept,
871 FAR void *data, size_t len,
872 uint32_t src, FAR void *priv)
873{
874 FAR struct rpmsgmtd_header_s *header = data;
875 FAR struct rpmsgmtd_cookie_s *cookie =
876 (FAR struct rpmsgmtd_cookie_s *)(uintptr_t)header->cookie;
877 FAR struct rpmsgmtd_read_s *rsp = data;
878 FAR struct iovec *iov = cookie->data;
879
880 cookie->result = header->result;
881 if (cookie->result > 0)
882 {
883 memcpy(iov->iov_base + iov->iov_len, rsp->buf, cookie->result);
884 iov->iov_len += cookie->result;
885 }
886
887 if (cookie->result <= 0 || iov->iov_len >= rsp->nbytes)
888 {
889 rpmsg_post(ept, &cookie->sem);
890 }
891
892 return 0;
893}
894
895/****************************************************************************
896 * Name: rpmsgmtd_geometry_handler

Callers

nothing calls this directly

Calls 2

rpmsg_postFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected