debug_uart: add a printdec() to print decimalism result
some value use decimalism to print is more readable for user, for example: frequency, capacity Change-Id: I9fa2a68d30c7694a582167d2d8767e18e28a9e83 Signed-off-by: CanYang He <hcy@rock-chips.com>
This commit is contained in:
parent
cc527546d3
commit
ab83a6fe58
|
|
@ -105,6 +105,13 @@ void printhex4(uint value);
|
|||
*/
|
||||
void printhex8(uint value);
|
||||
|
||||
/**
|
||||
* printdec() - Output a decimalism value
|
||||
*
|
||||
* @value: Value to output
|
||||
*/
|
||||
void printdec(uint value);
|
||||
|
||||
#ifdef CONFIG_DEBUG_UART_ANNOUNCE
|
||||
#define _DEBUG_UART_ANNOUNCE printascii("<debug_uart> ");
|
||||
#else
|
||||
|
|
@ -171,6 +178,18 @@ void printhex8(uint value);
|
|||
{ \
|
||||
printhex(value, 8); \
|
||||
} \
|
||||
\
|
||||
void printdec(uint value) \
|
||||
{ \
|
||||
if (value > 10) { \
|
||||
printdec(value / 10); \
|
||||
value %= 10; \
|
||||
} else if (value == 10) { \
|
||||
_debug_uart_putc('1'); \
|
||||
value = 0; \
|
||||
} \
|
||||
_debug_uart_putc('0' + value); \
|
||||
} \
|
||||
\
|
||||
void debug_uart_init(void) \
|
||||
{ \
|
||||
|
|
|
|||
Loading…
Reference in New Issue