sim/posix/uart: add host_printf() to debug some critical issue

Sometimes we need to bypass the system to debug some issue in critical sections

Signed-off-by: chao an <anchao.archer@bytedance.com>
This commit is contained in:
chao an 2025-01-23 15:09:28 +08:00 committed by Xiang Xiao
parent 49460518a9
commit 801cd455ef
2 changed files with 16 additions and 0 deletions

View file

@ -32,6 +32,8 @@
#include <termios.h>
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include "sim_internal.h"
@ -242,3 +244,16 @@ bool host_uart_checkout(int fd)
pfd.events = POLLOUT;
return poll(&pfd, 1, 0) == 1;
}
/****************************************************************************
* Name: host_printf
****************************************************************************/
void host_printf(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}

View file

@ -287,6 +287,7 @@ bool host_uart_checkin(int fd);
bool host_uart_checkout(int fd);
int host_uart_setcflag(int fd, unsigned int cflag);
int host_uart_getcflag(int fd, unsigned int *cflag);
void host_printf(const char *fmt, ...);
/* sim_deviceimage.c ********************************************************/