This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b8ad562fcbb7025be6e11e093b119af636911706 Author: Bowen Wang <[email protected]> AuthorDate: Thu Dec 12 15:56:06 2024 +0800 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 <[email protected]> --- drivers/rpmsg/rpmsg_port_uart.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/rpmsg/rpmsg_port_uart.c b/drivers/rpmsg/rpmsg_port_uart.c index 1556ab71a58..50c0fb9d247 100644 --- a/drivers/rpmsg/rpmsg_port_uart.c +++ b/drivers/rpmsg/rpmsg_port_uart.c @@ -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) {
