Skip to content

Commit 801cd45

Browse files
anchaoxiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent 4946051 commit 801cd45

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

arch/sim/src/sim/posix/sim_hostuart.c

+15
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include <termios.h>
3333
#include <poll.h>
3434
#include <errno.h>
35+
#include <stdarg.h>
36+
#include <stdio.h>
3537

3638
#include "sim_internal.h"
3739

@@ -242,3 +244,16 @@ bool host_uart_checkout(int fd)
242244
pfd.events = POLLOUT;
243245
return poll(&pfd, 1, 0) == 1;
244246
}
247+
248+
/****************************************************************************
249+
* Name: host_printf
250+
****************************************************************************/
251+
252+
void host_printf(const char *fmt, ...)
253+
{
254+
va_list ap;
255+
256+
va_start(ap, fmt);
257+
vprintf(fmt, ap);
258+
va_end(ap);
259+
}

arch/sim/src/sim/sim_internal.h

+1
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ bool host_uart_checkin(int fd);
287287
bool host_uart_checkout(int fd);
288288
int host_uart_setcflag(int fd, unsigned int cflag);
289289
int host_uart_getcflag(int fd, unsigned int *cflag);
290+
void host_printf(const char *fmt, ...);
290291

291292
/* sim_deviceimage.c ********************************************************/
292293

0 commit comments

Comments
 (0)