bdk: uart: add uart va print

This commit is contained in:
CTCaer 2022-01-20 12:39:32 +02:00
parent 82f90fae28
commit 39d411dc68
2 changed files with 22 additions and 0 deletions

View file

@ -172,3 +172,22 @@ void uart_empty_fifo(u32 idx, u32 which)
} }
} }
} }
#ifdef DEBUG_UART_PORT
#include <stdarg.h>
#include <string.h>
#include <utils/sprintf.h>
void uart_print(const char *fmt, ...)
{
va_list ap;
char text[256];
va_start(ap, fmt);
s_vprintf(text, fmt, ap);
va_end(ap);
uart_send(DEBUG_UART_PORT, (u8 *)text, strlen(text));
}
#endif

View file

@ -94,5 +94,8 @@ void uart_invert(u32 idx, bool enable, u32 invert_mask);
u32 uart_get_IIR(u32 idx); u32 uart_get_IIR(u32 idx);
void uart_set_IIR(u32 idx); void uart_set_IIR(u32 idx);
void uart_empty_fifo(u32 idx, u32 which); void uart_empty_fifo(u32 idx, u32 which);
#ifdef DEBUG_UART_PORT
void uart_print(const char *fmt, ...);
#endif
#endif #endif