Replies: 1 comment
-
Converted into a discussion, as it does not seem to be an issue but a request for advice |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been troubled by this problem for several days, please help to give some guidance:
I run Linux on A72 as the HOST(master/driver) and FreeRTOS on R5 as a remote(slave/device), A72 send data to R5 is ok, but R5 send data to A72, the data is incorrect.
A72 and R5 source codes come from GitHub, R5 use the rpmsg_echo.c and A72 use the rpmsg_ping.c
If possible, could you please help to explain how buffer is used when R5 send data to A72.
I send data from A72 to R5,it works ok. But I send data from R5 to A72, it doesn’t work.
for example:
I send "ABC" from A72 to R5 and R5 receive "ABC", it's ok. I call rpmsg_send function on R5 side and send "EFG" to A72, but A72 receive data is still "ABC".
create vdev:
On A72: rpdev = platform_create_rpmsg_vdev(platform, 0,VIRTIO_DEV_DRIVER, NULL, rpmsg_name_service_bind_cb);
On R5: rpdev = platform_create_rpmsg_vdev(platform, 0,VIRTIO_DEV_SLAVE,NULL, NULL);
create and init tx and rx virtqueue(master tx equals slave rx, master rx equals slave tx):
host/A72:
rvdev->rvq = vdev->vrings_info[0].vq;
rvdev->svq = vdev->vrings_info[1].vq;
slave/R5:
rvdev->rvq = vdev->vrings_info[1].vq;
rvdev->svq = vdev->vrings_info[0].vq;
In the rpmsg source code(lib/rpmsg/rpmsg_virtio.c):
R5 as slave/remote role, the buffer is not added to the queue, as shown in the following:
128 static int rpmsg_virtio_enqueue_buffer(struct rpmsg_virtio_device rvdev,
129 void buffer, uint32_t len,
130 uint16_t idx)
131 {
132 unsigned int role = rpmsg_virtio_get_role(rvdev);
133
134 #ifdef VIRTIO_CACHED_BUFFERS
135 metal_cache_flush(buffer, len);
136 #endif / VIRTIO_CACHED_BUFFERS /
137
138 #ifndef VIRTIO_DEVICE_ONLY
139 if (role == RPMSG_HOST) {
140 struct virtqueue_buf vqbuf;
141 (void)idx;
142
143 / Initialize buffer node /
144 vqbuf.buf = buffer;
145 vqbuf.len = len;
146 return virtqueue_add_buffer(rvdev->svq, &vqbuf, 1, 0, buffer);
147 }
148 #endif /!VIRTIO_DEVICE_ONLY/
149
150 #ifndef VIRTIO_DRIVER_ONLY
151 if (role == RPMSG_REMOTE) {
152 (void)buffer;
153 return virtqueue_add_consumed_buffer(rvdev->svq, idx, len);
154 }
155 #endif /!VIRTIO_DRIVER_ONLY/
156 return 0;
157 }
Beta Was this translation helpful? Give feedback.
All reactions