This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

dst parameter for pru_rpmsg_send()

What is the correct way to determine the dst parameter for pru_rpmsg_send()?  The echo example uses the value in the message it receives from the host.  My app is only sending messages.  For src, I use CHAN_PORT (31).  As a hack I used the value 0x400 for dst, found here, and it works:

cat /sys/bus/virtio/drivers/virtio_rpmsg_bus/virtio0/rpmsg16/src

But there must be a programmatic way for the PRU application to determine this.  I expected it to be returned from pru_rpmsg_channel(), but it is not.  If necessary, my host app can send a dummy message to the PRU, where I'll capture the src parameter.  Is it guaranteed that address will remain constant for the lifetime of the PRU app?  

[ 2730.844514] virtio_rpmsg_bus virtio0: creating channel rpmsg-pru addr 0x1f

[ 2730.911727] rpmsg_pru rpmsg0: new rpmsg_pru device: /dev/rpmsg_pru31

Thanks,

Brian

  • I will forward this to the PRU experts. Feedback will be posted directly here.
  • Brian,

    Short answer: Your host app will need to send a dummy message to the PRU before the PRU will know the destination address to use.

    Explanation: The pru_rpmsg_channel() function creates a message in a specific format (see the pru_rpmsg_ns_msg struct in the pru_rpmsg.c file found in lib/src/rpmsg_lib/ directory of the pru-software-support-package) and then sends it to the known/static destination address (53) of the name server on the Linux side. The name server is responsible for creating the channel and assigning a dynamic address to the Linux side of the channel. Currently, the PRU does not receive any feedback from the Linux side that the the channel was created or the address of the other side of the channel. So, a message will need to be sent to the PRU before the PRU will know the destination address.

    The channel address will remain constant through the lifetime of the rpmsg channel that is created.

    Jason Reeder