Dependents:   TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more

Committer:
segundo
Date:
Tue Nov 09 20:54:15 2010 +0000
Revision:
0:ac1725ba162c

        

Who changed what in which revision?

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