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