Dependents:   RTnoV3 RTnoV3_LED RTnoV3_Template RTnoV3_ADC ... more

Committer:
sherckuith
Date:
Sat Dec 31 11:25:27 2011 +0000
Revision:
0:479ce5546098
Ethernet

Who changed what in which revision?

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