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

Function rpmsgmtd_bread_handler

drivers/mtd/rpmsgmtd.c:823–849  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

821 ****************************************************************************/
822
823static int rpmsgmtd_bread_handler(FAR struct rpmsg_endpoint *ept,
824 FAR void *data, size_t len,
825 uint32_t src, FAR void *priv)
826{
827 FAR struct rpmsgmtd_header_s *header = data;
828 FAR struct rpmsgmtd_cookie_s *cookie =
829 (FAR struct rpmsgmtd_cookie_s *)(uintptr_t)header->cookie;
830 FAR struct rpmsgmtd_bread_s *rsp = data;
831 FAR struct iovec *iov = cookie->data;
832 size_t read;
833
834 cookie->result = header->result;
835 if (cookie->result > 0)
836 {
837 read = cookie->result * rsp->blocksize;
838 memcpy(iov->iov_base, rsp->buf, read);
839 iov->iov_base += read;
840 iov->iov_len += cookie->result;
841 }
842
843 if (cookie->result <= 0 || iov->iov_len >= rsp->nblocks)
844 {
845 rpmsg_post(ept, &cookie->sem);
846 }
847
848 return 0;
849}
850
851/****************************************************************************
852 * Name: rpmsgmtd_read_handler

Callers

nothing calls this directly

Calls 2

rpmsg_postFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected