12 #include "common/uart_stdout.h"
14 #define PRINT_BUFF_SIZE 32
15 #define NUM_BUFF_SIZE 12
23 '8',
'9',
'a',
'b',
'c',
'd',
'e',
'f'};
25 '8',
'9',
'A',
'B',
'C',
'D',
'E',
'F'};
44 _tfm_flush_formatted_buffer(pb, *str++);
52 int32_t num, uint8_t sign)
56 uint32_t number = (uint32_t)num;
59 if (sign ==
'd' && num < 0) {
60 _tfm_flush_formatted_buffer(pb,
'-');
66 num_buff[k++] =
'0' + number % 10;
71 _tfm_flush_formatted_buffer(pb, num_buff[--k]);
79 const char *hex_digits)
86 num_buff[k++] = hex_digits[num & 0x0f];
91 _tfm_flush_formatted_buffer(pb, num_buff[--k]);
98 static int _tfm_log_vprintf(
const char *fmt, va_list ap)
110 count += _tfm_dec_num_output(&outputbuf,
111 va_arg(ap, int32_t),
'd');
114 count += _tfm_dec_num_output(&outputbuf,
115 va_arg(ap, int32_t),
'u');
118 count += _tfm_hex_num_output(&outputbuf, va_arg(ap, uint32_t),
122 count += _tfm_hex_num_output(&outputbuf, va_arg(ap, uint32_t),
126 count += _tfm_string_output(&outputbuf,
"0x");
127 count += _tfm_hex_num_output(&outputbuf, va_arg(ap, uint32_t),
131 count += _tfm_string_output(&outputbuf, va_arg(ap,
char*));
134 _tfm_flush_formatted_buffer(&outputbuf,
135 (uint8_t)va_arg(ap, int32_t));
139 _tfm_flush_formatted_buffer(&outputbuf,
'%');
143 count += _tfm_string_output(&outputbuf,
"[Unsupported Tag]");
148 _tfm_flush_formatted_buffer(&outputbuf, *fmt++);
155 count += stdio_output_string(outputbuf.buf, outputbuf.pos);
167 count = _tfm_log_vprintf(fmt, ap);
int tfm_log_printf(const char *fmt,...)
Prints log messages.
const char hex_digits_up[]
const char hex_digits_lo[]