Dependents:   SNMPAgent HTTPServer think_speak_a cyassl-client ... more

Committer:
mamezu
Date:
Thu Dec 09 01:33:56 2010 +0000
Revision:
0:0f6c82fcde82

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mamezu 0:0f6c82fcde82 1 /*
mamezu 0:0f6c82fcde82 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mamezu 0:0f6c82fcde82 3 * All rights reserved.
mamezu 0:0f6c82fcde82 4 *
mamezu 0:0f6c82fcde82 5 * Redistribution and use in source and binary forms, with or without modification,
mamezu 0:0f6c82fcde82 6 * are permitted provided that the following conditions are met:
mamezu 0:0f6c82fcde82 7 *
mamezu 0:0f6c82fcde82 8 * 1. Redistributions of source code must retain the above copyright notice,
mamezu 0:0f6c82fcde82 9 * this list of conditions and the following disclaimer.
mamezu 0:0f6c82fcde82 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mamezu 0:0f6c82fcde82 11 * this list of conditions and the following disclaimer in the documentation
mamezu 0:0f6c82fcde82 12 * and/or other materials provided with the distribution.
mamezu 0:0f6c82fcde82 13 * 3. The name of the author may not be used to endorse or promote products
mamezu 0:0f6c82fcde82 14 * derived from this software without specific prior written permission.
mamezu 0:0f6c82fcde82 15 *
mamezu 0:0f6c82fcde82 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mamezu 0:0f6c82fcde82 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mamezu 0:0f6c82fcde82 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mamezu 0:0f6c82fcde82 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mamezu 0:0f6c82fcde82 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mamezu 0:0f6c82fcde82 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mamezu 0:0f6c82fcde82 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mamezu 0:0f6c82fcde82 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mamezu 0:0f6c82fcde82 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mamezu 0:0f6c82fcde82 25 * OF SUCH DAMAGE.
mamezu 0:0f6c82fcde82 26 *
mamezu 0:0f6c82fcde82 27 * This file is part of the lwIP TCP/IP stack.
mamezu 0:0f6c82fcde82 28 *
mamezu 0:0f6c82fcde82 29 * Author: Adam Dunkels <adam@sics.se>
mamezu 0:0f6c82fcde82 30 *
mamezu 0:0f6c82fcde82 31 */
mamezu 0:0f6c82fcde82 32 #ifndef __LWIP_DEBUG_H__
mamezu 0:0f6c82fcde82 33 #define __LWIP_DEBUG_H__
mamezu 0:0f6c82fcde82 34
mamezu 0:0f6c82fcde82 35 #include "lwip/arch.h"
mamezu 0:0f6c82fcde82 36
mamezu 0:0f6c82fcde82 37 /** lower two bits indicate debug level
mamezu 0:0f6c82fcde82 38 * - 0 all
mamezu 0:0f6c82fcde82 39 * - 1 warning
mamezu 0:0f6c82fcde82 40 * - 2 serious
mamezu 0:0f6c82fcde82 41 * - 3 severe
mamezu 0:0f6c82fcde82 42 */
mamezu 0:0f6c82fcde82 43 #define LWIP_DBG_LEVEL_ALL 0x00
mamezu 0:0f6c82fcde82 44 #define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL /* compatibility define only */
mamezu 0:0f6c82fcde82 45 #define LWIP_DBG_LEVEL_WARNING 0x01 /* bad checksums, dropped packets, ... */
mamezu 0:0f6c82fcde82 46 #define LWIP_DBG_LEVEL_SERIOUS 0x02 /* memory allocation failures, ... */
mamezu 0:0f6c82fcde82 47 #define LWIP_DBG_LEVEL_SEVERE 0x03
mamezu 0:0f6c82fcde82 48 #define LWIP_DBG_MASK_LEVEL 0x03
mamezu 0:0f6c82fcde82 49
mamezu 0:0f6c82fcde82 50 /** flag for LWIP_DEBUGF to enable that debug message */
mamezu 0:0f6c82fcde82 51 #define LWIP_DBG_ON 0x80U
mamezu 0:0f6c82fcde82 52 /** flag for LWIP_DEBUGF to disable that debug message */
mamezu 0:0f6c82fcde82 53 #define LWIP_DBG_OFF 0x00U
mamezu 0:0f6c82fcde82 54
mamezu 0:0f6c82fcde82 55 /** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */
mamezu 0:0f6c82fcde82 56 #define LWIP_DBG_TRACE 0x40U
mamezu 0:0f6c82fcde82 57 /** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */
mamezu 0:0f6c82fcde82 58 #define LWIP_DBG_STATE 0x20U
mamezu 0:0f6c82fcde82 59 /** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */
mamezu 0:0f6c82fcde82 60 #define LWIP_DBG_FRESH 0x10U
mamezu 0:0f6c82fcde82 61 /** flag for LWIP_DEBUGF to halt after printing this debug message */
mamezu 0:0f6c82fcde82 62 #define LWIP_DBG_HALT 0x08U
mamezu 0:0f6c82fcde82 63
mamezu 0:0f6c82fcde82 64 #ifndef LWIP_NOASSERT
mamezu 0:0f6c82fcde82 65 #define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \
mamezu 0:0f6c82fcde82 66 LWIP_PLATFORM_ASSERT(message); } while(0)
mamezu 0:0f6c82fcde82 67 #else /* LWIP_NOASSERT */
mamezu 0:0f6c82fcde82 68 #define LWIP_ASSERT(message, assertion)
mamezu 0:0f6c82fcde82 69 #endif /* LWIP_NOASSERT */
mamezu 0:0f6c82fcde82 70
mamezu 0:0f6c82fcde82 71 /** if "expression" isn't true, then print "message" and execute "handler" expression */
mamezu 0:0f6c82fcde82 72 #ifndef LWIP_ERROR
mamezu 0:0f6c82fcde82 73 #define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
mamezu 0:0f6c82fcde82 74 LWIP_PLATFORM_ASSERT(message); handler;}} while(0)
mamezu 0:0f6c82fcde82 75 #endif /* LWIP_ERROR */
mamezu 0:0f6c82fcde82 76
mamezu 0:0f6c82fcde82 77 #ifdef LWIP_DEBUG
mamezu 0:0f6c82fcde82 78 /** print debug message only if debug message type is enabled...
mamezu 0:0f6c82fcde82 79 * AND is of correct type AND is at least LWIP_DBG_LEVEL
mamezu 0:0f6c82fcde82 80 */
mamezu 0:0f6c82fcde82 81 #define LWIP_DEBUGF(debug, message) do { \
mamezu 0:0f6c82fcde82 82 if ( \
mamezu 0:0f6c82fcde82 83 ((debug) & LWIP_DBG_ON) && \
mamezu 0:0f6c82fcde82 84 ((debug) & LWIP_DBG_TYPES_ON) && \
mamezu 0:0f6c82fcde82 85 ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
mamezu 0:0f6c82fcde82 86 LWIP_PLATFORM_DIAG(message); \
mamezu 0:0f6c82fcde82 87 if ((debug) & LWIP_DBG_HALT) { \
mamezu 0:0f6c82fcde82 88 while(1); \
mamezu 0:0f6c82fcde82 89 } \
mamezu 0:0f6c82fcde82 90 } \
mamezu 0:0f6c82fcde82 91 } while(0)
mamezu 0:0f6c82fcde82 92
mamezu 0:0f6c82fcde82 93 #else /* LWIP_DEBUG */
mamezu 0:0f6c82fcde82 94 #define LWIP_DEBUGF(debug, message)
mamezu 0:0f6c82fcde82 95 #endif /* LWIP_DEBUG */
mamezu 0:0f6c82fcde82 96
mamezu 0:0f6c82fcde82 97 #endif /* __LWIP_DEBUG_H__ */
mamezu 0:0f6c82fcde82 98