lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SV: [lwip-users] Re: LWIP_PLATFORM_DIAG


From: Jan Wester
Subject: SV: [lwip-users] Re: LWIP_PLATFORM_DIAG
Date: Thu, 10 Jan 2008 09:40:16 +0100

Hi
I'm not calling by myself, trying to enable standard debug output 
In debug.h it is declared as:
#define LWIP_DEBUGF(debug,x) do { \
                               if ( \
                                   ((debug) & LWIP_DBG_ON) && \
                                   ((debug) & LWIP_DBG_TYPES_ON) && \
                                   ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL)
>= LWIP_DBG_MIN_LEVEL)) { \
                                 LWIP_PLATFORM_DIAG(x); \
                                 if ((debug) & LWIP_DBG_HALT) { \
                                   while(1); \
                                 } \
                               } \
                             } while(0)

And in lwipopts.h I try to declare:
#define LWIP_PLATFORM_DIAG(m) {sprintf(buffer, m); \
                               SioWriteString(2, buffer); \
                              }

SioWriteString() is my function to write to my serialport.
LWIP_DEBUGF(debug,(("foo\n"))); This works (only format string)
LWIP_DEBUGF(debug,(("foo=%d\n", foo))); This don't works

I can't use printf becuse of library use system calls for _write()


Med vänlig hälsning/Best Regards
Jan Wester

_________________________________ 
WHI Konsult AB
Scheelegatan 11, 112 28 Stockholm, Sweden
www.whi.se
address@hidden
+46 8 449 05 30

-----Ursprungligt meddelande-----
Från: address@hidden
[mailto:address@hidden För Jonathan Larmour
Skickat: den 9 januari 2008 15:23
Till: Mailing list for lwIP users
Ämne: [lwip-users] Re: LWIP_PLATFORM_DIAG

[ I changed the Subject - please remember to make a new message ]

Jan Wester wrote:
> Is where any example availble for defined of macros for 
> lwip_platform_diag printout

Yes, lots in the "contrib" part of lwIP. The usual definition is:

#define LWIP_PLATFORM_DIAG(x)       do {printf x;} while(0)

> I have try def for lwip_platform_diag but it is problem to get it work 
> and I found out it is problem with variable no of arguments, it works 
> for one argument (only print format string) if the arguments consists 
> of format string and a integer, the input parameter for the function 
> is a value of the integer, should be a pointer ?

Are you calling it yourself? All the instances that lwIP itself makes use
double brackets. Perhaps these have been forgotten.

So you can do something like:
LWIP_PLATFORM_DIAG(("foo=%d\n", foo));
which will expand to:

do {printf (foo=%d\n", foo);} while(0)
and it all works.

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users






reply via email to

[Prev in Thread] Current Thread [Next in Thread]