lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Connection timeout and issue with LWIP_DEBUGF


From: Muhamad Ikhwan Ismail
Subject: [lwip-users] Connection timeout and issue with LWIP_DEBUGF
Date: Wed, 30 Jan 2008 07:01:36 +0000

Hi..

I ported lwIP 1.2.0 into MPC852T running on SMX real time OS. It works really great and I would have to say its a great product.
I have however 2 issues I could use some help with.

1. I would like to know what happens internally within the stack and to the socket state if e.g. the cable is plugged out ? Will the pcb and the socket and conn be
automatically closed after certain interval ? I was thinking of implementing on the tcpip thread a timeout with a handler, which monitors this by counting the carrier sense losses errors
during the interval of the timeout in transmitted frames. The handler will in case of a high volume of carrier sense loss error set a certain global flag, and all application
instead of using while(1) loop will use (while this flag not set). This would work if  the application is running, not waiting on read  or connect, which is why I wanna know
what happens to the listen pcb e.g. when the connection is plugged out.

2. I had a massive problem using LWIP_DEBUGF due to the way my compiler interpretes the macro invokation.

in debug.h #  define LWIP_DEBUGF(debug,x) do { if (((debug) & DBG_ON) && ((debug) & DBG_TYPES_ON) && ((s16_t)((debug) & DBG_MASK_LEVEL) >= DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if ((debug) & DBG_HALT) while(1); } } while(0)

and in any of the invokation the x is a string with the formats in a closed bracket e.g.  LWIP_DEBUGF1(UDP_DEBUG, ("udp_input: received datagram of length %"U16_F"\n", p->tot_len));
and my compiler interprets x as ("udp_input: received datagram of length %"U16_F"\n", p->tot_len) including the brackets. In my case I need to convert this to a string using sprintf
and this brings out compiler error since x is in brackets, meaning the whole string(everything in the bracket) has to be const char*.
I am using Diab Compiler 5.1.2.
My workaround is rather crude in which I have to define more macros such as and change all DEBUGF to e.g these :

#  define LWIP_DEBUGF3(debug,x,a,b,c) do { if (((debug) & DBG_ON) && ((debug) & DBG_TYPES_ON) && ((s16_t)((debug) & DBG_MASK_LEVEL) >= DBG_MIN_LEVEL)) { sprintf(mydebugstring,x,a,b,c);lwip_debug_to_uart(mydebugstring); if ((debug) & DBG_HALT) while(1); } } while(0)
#  define LWIP_DEBUGF4(debug,x,a,b,c,d) do { if (((debug) & DBG_ON) && ((debug) & DBG_TYPES_ON) && ((s16_t)((debug) & DBG_MASK_LEVEL) >= DBG_MIN_LEVEL)) { sprintf(mydebugstring,x,a,b,c,d); lwip_debug_to_uart(mydebugstring); if ((debug) & DBG_HALT) while(1); } } while(0)

Meaning dependent on how many formatters different macros are invoked. I propose a workaround so that the debugging interface is more universal for compilers.
Has anyone one with the same problem but have a better workaround ?

Thanks in advance
ikhwan


Climb to the top of the charts! Play the word scramble challenge with star power. Play now!

reply via email to

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