drivers/uart_rpmsg: add recv lock when received the data from peer

The recv buffer is used both in user thread and rpmsg ept->callback
thread, so add recv lock to protect the recv buffer.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang 2024-09-07 18:51:04 +08:00 committed by GUIDINGLI
parent a1dc6dc7fc
commit 262ccbb068
1 changed files with 2 additions and 0 deletions

View File

@ -384,9 +384,11 @@ static int uart_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data,
{
/* Get write-cmd, there are some data, we need receive them */
nxmutex_lock(&dev->recv.lock);
priv->recv_data = data;
uart_recvchars_dma(dev);
priv->recv_data = NULL;
nxmutex_unlock(&dev->recv.lock);
header->response = 1;
rpmsg_send(ept, msg, sizeof(*msg));