Skip to content

Commit

Permalink
sim/posix/uart: add host_printf() to debug some critical issue
Browse files Browse the repository at this point in the history
Sometimes we need to bypass the system to debug some issue in critical sections

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao authored and xiaoxiang781216 committed Jan 23, 2025
1 parent 4946051 commit 801cd45
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arch/sim/src/sim/posix/sim_hostuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include <termios.h>
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>

#include "sim_internal.h"

Expand Down Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions arch/sim/src/sim/sim_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ********************************************************/

Expand Down

0 comments on commit 801cd45

Please sign in to comment.