rpmsg/rpmsg_port_uart: add poweroff support

Peer can send poweroff command and local will shutdown the uart
device and wait for the next connect

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang
2024-12-12 15:56:06 +08:00
committed by Xiang Xiao
parent 8ba084329d
commit b8ad562fcb
+9 -1
View File
@@ -50,7 +50,8 @@
#define RPMSG_PORT_UART_SUSPEND 0x7b
#define RPMSG_PORT_UART_RESUME 0x7a
#define RPMSG_PORT_UART_WAKEUP 0x79
#define RPMSG_PORT_UART_END 0x78
#define RPMSG_PORT_UART_POWEROFF 0x78
#define RPMSG_PORT_UART_END 0x77
#define RPMSG_PORT_UART_ESCAPE_MASK 0x20
#define RPMSG_PORT_UART_BUFLEN 256
@@ -383,6 +384,13 @@ static int rpmsg_port_uart_rx_thread(int argc, FAR char *argv[])
nxsem_post(&rpuart->wake);
continue;
}
else if (buf[i] == RPMSG_PORT_UART_POWEROFF)
{
rpmsgdbg("Received poweroff command\n");
rpmsg_port_unregister(&rpuart->port);
rpuart->connected = false;
continue;
}
if (rpuart->connected == false)
{