2017-11-22 00:53:42 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|
2009-07-11 14:26:28 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <debug-uart.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <strformat.h>
|
2017-11-22 00:53:42 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|
2009-07-11 14:26:28 +00:00
|
|
|
static StrFormatResult
|
|
|
|
write_str(void *user_data, const char *data, unsigned int len)
|
|
|
|
{
|
2017-11-22 00:58:50 +00:00
|
|
|
if(len > 0) {
|
|
|
|
dbg_send_bytes((unsigned char *)data, len);
|
|
|
|
}
|
2009-07-11 14:26:28 +00:00
|
|
|
return STRFORMAT_OK;
|
|
|
|
}
|
2017-11-22 00:53:42 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|
2009-07-11 14:26:28 +00:00
|
|
|
static StrFormatContext ctxt =
|
2017-11-22 00:58:50 +00:00
|
|
|
{
|
|
|
|
write_str,
|
|
|
|
NULL
|
|
|
|
};
|
2017-11-22 00:53:42 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|
2009-07-11 14:26:28 +00:00
|
|
|
int
|
|
|
|
printf(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
int res;
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
res = format_str_v(&ctxt, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
return res;
|
|
|
|
}
|
2017-11-22 00:53:42 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|