Using priv field in struct rpmsg_endpoint for storing application data #546
Replies: 2 comments
-
I see a discussion here related to this and I am evaluating it. #296 but would appreciate what is the intended use of the priv field. |
Beta Was this translation helpful? Give feedback.
-
Hello @mkaricheri tty_ept.priv = &tty_msg;
ret = rpmsg_create_ept(&tty_ept, rpdev, "rpmsg-tty",
RPMSG_ADDR_ANY, RPMSG_ADDR_ANY,
rpmsg_recv_tty_callback, NULL); |
Beta Was this translation helpful? Give feedback.
-
We are using Open-AMP on Bare-metal (master) with Zephyr (slave). We use multi-endpoints, one per application to allow IPC between applications on the two cores. We have a CPP IPC interface / API to create endpoints. send/receive message. One thing we would like to have is to pass the index of the application endpoint to the RPMSG so that it gets passed to the received message handle to the endpoint. So bumped on to the priv structure field in struct rpmsg_endpoint. It works for us, but I am paranoid about the documentation in the header '@priv: private data for the driver's use'. I see that this is not used by RPMSG to store anything and is passed to the application as part of the message callback
rpmsg_virtio.c
status = ept->cb(ept, RPMSG_LOCATE_DATA(rp_hdr),
rp_hdr->len, rp_hdr->src, ept->priv);
I think this is a documentation mistake. Could someone clarify this please?
If not used, can we use it for application use?
We maintain a table of endpoints and save the index of the endpoint in priv so that when the core receives a response, we can use the index to identify the endpoint for this response. Otherwise we need to maintain some kind of map or loop through the endpoint names to find the correct endpoint for the response. We also use interrupt, so the loop and string comparison inside the ISR is not preferable.
Beta Was this translation helpful? Give feedback.
All reactions