mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers/rpmsg_port_uart: Zero next when hit RPMSG_PORT_UART_RX_WAIT_START twice
align the behaviour with Linux driver Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
1196f0869e
commit
4bbccac6f0
1 changed files with 6 additions and 8 deletions
|
|
@ -63,8 +63,8 @@
|
|||
#define RPMSG_PORT_UART_WAKEUP_TIMEOUT MSEC2TICK(100)
|
||||
|
||||
#ifdef CONFIG_RPMSG_PORT_UART_CRC
|
||||
# define rpmsg_port_uart_crc16(hdr) \
|
||||
crc16ibm((FAR uint8_t *)&(hdr)->cmd, (hdr)->len - sizeof((hdr)->crc))
|
||||
# define rpmsg_port_uart_crc16(hdr) crc16ibm((FAR uint8_t *)&(hdr)->cmd, \
|
||||
(hdr)->len - sizeof((hdr)->crc))
|
||||
#else
|
||||
# define rpmsg_port_uart_crc16(hdr) 0
|
||||
#endif
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
# define rpmsgdbg rpmsgerr
|
||||
#else
|
||||
# define rpmsgdump(m,b,s)
|
||||
# define rpmsgdbg(fmt,...)
|
||||
# define rpmsgdbg(f,...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -427,18 +427,16 @@ static int rpmsg_port_uart_rx_thread(int argc, FAR char *argv[])
|
|||
{
|
||||
rpmsgerr("Recv dup start char, i=%zd\n", i);
|
||||
state = RPMSG_PORT_UART_RX_WAIT_START;
|
||||
next = 0;
|
||||
}
|
||||
else if (buf[i] == RPMSG_PORT_UART_END)
|
||||
{
|
||||
DEBUGASSERT(hdr->len == next);
|
||||
DEBUGASSERT(hdr->crc == 0 ||
|
||||
hdr->crc == rpmsg_port_uart_crc16(hdr));
|
||||
DEBUGASSERT(rpuart->rx_cb != NULL);
|
||||
|
||||
if (rpuart->rx_cb != NULL)
|
||||
{
|
||||
rpuart->rx_cb(&rpuart->port, hdr);
|
||||
}
|
||||
|
||||
rpuart->rx_cb(&rpuart->port, hdr);
|
||||
state = RPMSG_PORT_UART_RX_WAIT_START;
|
||||
hdr = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue