独立函数实现调试输出,方便RTL8710整体链接,而不需要putchar

This commit is contained in:
大石头 2016-12-14 20:35:32 +08:00
parent 6ac8e7f4d2
commit 38db41c6ba
3 changed files with 17 additions and 2 deletions

View File

@ -6,7 +6,8 @@
extern "C"
{
#if defined(DEBUG)
#define debug_printf printf
#define debug_printf SmartOS_printf
extern int SmartOS_printf(const char *format, ...);
#else
#define debug_printf(format, ...)
#endif

View File

@ -26,7 +26,8 @@
extern "C"
{
#if defined(DEBUG)
#define debug_printf printf
#define debug_printf SmartOS_printf
extern int SmartOS_printf(const char *format, ...);
#else
#define debug_printf(format, ...)
#endif

View File

@ -371,3 +371,16 @@ void ExitCritical() { __enable_irq(); }
uint _REV(uint value) { return __REV(value); }
ushort _REV16(ushort value) { return __REV16(value); }
/******************************** 调试日志 ********************************/
int SmartOS_printf(const char* format, ...)
{
va_list ap;
va_start(ap, format);
int rs = printf(format, ap);
va_end(ap);
return rs;
}