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