diff --git a/src/include/lwip/debug.h b/src/include/lwip/debug.h index c6766120..8966d61f 100644 --- a/src/include/lwip/debug.h +++ b/src/include/lwip/debug.h @@ -40,18 +40,24 @@ #include "lwip/arch.h" #include "lwip/opt.h" -/** lower two bits indicate debug level - * - 0 all - * - 1 warning - * - 2 serious - * - 3 severe +/** + * @defgroup debugging Debugging + * @ingroup lwip + * @{ */ + +/** Debug level: ALL messages*/ #define LWIP_DBG_LEVEL_ALL 0x00 -#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL /* compatibility define only */ -#define LWIP_DBG_LEVEL_WARNING 0x01 /* bad checksums, dropped packets, ... */ -#define LWIP_DBG_LEVEL_SERIOUS 0x02 /* memory allocation failures, ... */ +/** Debug level: Warnings. bad checksums, dropped packets, ... */ +#define LWIP_DBG_LEVEL_WARNING 0x01 +/** Debug level: Serious. memory allocation failures, ... */ +#define LWIP_DBG_LEVEL_SERIOUS 0x02 +/** Debug level: Severe */ #define LWIP_DBG_LEVEL_SEVERE 0x03 + #define LWIP_DBG_MASK_LEVEL 0x03 +/* compatibility define only */ +#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL /** flag for LWIP_DEBUGF to enable that debug message */ #define LWIP_DBG_ON 0x80U @@ -68,9 +74,14 @@ #define LWIP_DBG_HALT 0x08U /** - * LWIP_NOASSERT: Disable LWIP_ASSERT checks. - * -- To disable assertions define LWIP_NOASSERT in arch/cc.h. + * LWIP_NOASSERT: Disable LWIP_ASSERT checks: + * To disable assertions define LWIP_NOASSERT in arch/cc.h. */ +#ifdef __DOXYGEN__ +#define LWIP_NOASSERT +#undef LWIP_NOASSERT +#endif + #ifndef LWIP_NOASSERT #define LWIP_ASSERT(message, assertion) do { if (!(assertion)) { \ LWIP_PLATFORM_ASSERT(message); }} while(0) @@ -81,7 +92,6 @@ #define LWIP_ASSERT(message, assertion) #endif /* LWIP_NOASSERT */ -/** if "expression" isn't true, then print "message" and execute "handler" expression */ #ifndef LWIP_ERROR #ifndef LWIP_NOASSERT #define LWIP_PLATFORM_ERROR(message) LWIP_PLATFORM_ASSERT(message) @@ -91,17 +101,24 @@ #define LWIP_PLATFORM_ERROR(message) #endif +/* if "expression" isn't true, then print "message" and execute "handler" expression */ #define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ LWIP_PLATFORM_ERROR(message); handler;}} while(0) #endif /* LWIP_ERROR */ +/** Enable debug message printing, but only if debug message type is enabled + * AND is of correct type AND is at least LWIP_DBG_LEVEL. + * e.g. \#define LWIP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_ALL | LWIP_DBG_TRACE) + */ +#ifdef __DOXYGEN__ +#define LWIP_DEBUG +#undef LWIP_DEBUG +#endif + #ifdef LWIP_DEBUG #ifndef LWIP_PLATFORM_DIAG #error "If you want to use LWIP_DEBUG, LWIP_PLATFORM_DIAG(message) needs to be defined in your arch/cc.h" #endif -/** print debug message only if debug message type is enabled... - * AND is of correct type AND is at least LWIP_DBG_LEVEL - */ #define LWIP_DEBUGF(debug, message) do { \ if ( \ ((debug) & LWIP_DBG_ON) && \ @@ -118,5 +135,8 @@ #define LWIP_DEBUGF(debug, message) #endif /* LWIP_DEBUG */ -#endif /* LWIP_HDR_DEBUG_H */ +/** + * @} + */ +#endif /* LWIP_HDR_DEBUG_H */