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