12Oct2012MbedLab

Dependents:   Lab3_VoiceMeter

Fork of EthernetNetIf by Donatien Garnier

Committer:
psawant9
Date:
Fri Oct 12 16:02:00 2012 +0000
Revision:
6:22ce63eddd2b
Parent:
5:bc7df6da7589
Done

Who changed what in which revision?

UserRevisionLine numberNew contents of line
psawant9 6:22ce63eddd2b 1
psawant9 6:22ce63eddd2b 2 /*
psawant9 6:22ce63eddd2b 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
psawant9 6:22ce63eddd2b 4
psawant9 6:22ce63eddd2b 5 Permission is hereby granted, free of charge, to any person obtaining a copy
psawant9 6:22ce63eddd2b 6 of this software and associated documentation files (the "Software"), to deal
psawant9 6:22ce63eddd2b 7 in the Software without restriction, including without limitation the rights
psawant9 6:22ce63eddd2b 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
psawant9 6:22ce63eddd2b 9 copies of the Software, and to permit persons to whom the Software is
psawant9 6:22ce63eddd2b 10 furnished to do so, subject to the following conditions:
psawant9 6:22ce63eddd2b 11
psawant9 6:22ce63eddd2b 12 The above copyright notice and this permission notice shall be included in
psawant9 6:22ce63eddd2b 13 all copies or substantial portions of the Software.
psawant9 6:22ce63eddd2b 14
psawant9 6:22ce63eddd2b 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
psawant9 6:22ce63eddd2b 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
psawant9 6:22ce63eddd2b 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
psawant9 6:22ce63eddd2b 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
psawant9 6:22ce63eddd2b 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
psawant9 6:22ce63eddd2b 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
psawant9 6:22ce63eddd2b 21 THE SOFTWARE.
psawant9 6:22ce63eddd2b 22 */
psawant9 6:22ce63eddd2b 23
psawant9 6:22ce63eddd2b 24 /** \file
psawant9 6:22ce63eddd2b 25 Debugging helpers header file
psawant9 6:22ce63eddd2b 26 */
psawant9 6:22ce63eddd2b 27
psawant9 6:22ce63eddd2b 28 //#ifdef DBG_H
psawant9 6:22ce63eddd2b 29 //#define DBG_H
psawant9 6:22ce63eddd2b 30
psawant9 6:22ce63eddd2b 31 #ifdef __LWIP_DEBUG
psawant9 6:22ce63eddd2b 32 #define __DEBUG
psawant9 6:22ce63eddd2b 33 #endif
psawant9 6:22ce63eddd2b 34
psawant9 6:22ce63eddd2b 35 /*!
psawant9 6:22ce63eddd2b 36 \def __DEBUG
psawant9 6:22ce63eddd2b 37 To define to enable debugging in one file
psawant9 6:22ce63eddd2b 38 */
psawant9 6:22ce63eddd2b 39
psawant9 6:22ce63eddd2b 40 #ifdef __DEBUG
psawant9 6:22ce63eddd2b 41
psawant9 6:22ce63eddd2b 42 #ifndef __DEBUGSTREAM
psawant9 6:22ce63eddd2b 43 #define __DEBUGSTREAM
psawant9 6:22ce63eddd2b 44
psawant9 6:22ce63eddd2b 45
psawant9 6:22ce63eddd2b 46 class DebugStream
psawant9 6:22ce63eddd2b 47 {
psawant9 6:22ce63eddd2b 48 public:
psawant9 6:22ce63eddd2b 49 static void debug(const char* format, ...);
psawant9 6:22ce63eddd2b 50 static void release();
psawant9 6:22ce63eddd2b 51 static void breakPoint(const char* file, int line);
psawant9 6:22ce63eddd2b 52 private:
psawant9 6:22ce63eddd2b 53
psawant9 6:22ce63eddd2b 54 };
psawant9 6:22ce63eddd2b 55
psawant9 6:22ce63eddd2b 56 #undef DBG
psawant9 6:22ce63eddd2b 57 #undef DBG_END
psawant9 6:22ce63eddd2b 58 #undef BREAK
psawant9 6:22ce63eddd2b 59
psawant9 6:22ce63eddd2b 60 ///Debug output (if enabled), same syntax as printf, with heading info
psawant9 6:22ce63eddd2b 61 #define DBG(...) do{ DebugStream::debug("[%s:%s@%d] ", __FILE__, __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0);
psawant9 6:22ce63eddd2b 62
psawant9 6:22ce63eddd2b 63 ///Debug output (if enabled), same syntax as printf, no heading info
psawant9 6:22ce63eddd2b 64 #define DBGL(...) do{ DebugStream::debug(__VA_ARGS__); } while(0);
psawant9 6:22ce63eddd2b 65 #define DBG_END DebugStream::release
psawant9 6:22ce63eddd2b 66
psawant9 6:22ce63eddd2b 67 ///Break point usin serial debug interface (if debug enbaled)
psawant9 6:22ce63eddd2b 68 #define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
psawant9 6:22ce63eddd2b 69 #endif
psawant9 6:22ce63eddd2b 70
psawant9 6:22ce63eddd2b 71 #else
psawant9 6:22ce63eddd2b 72 #undef DBG
psawant9 6:22ce63eddd2b 73 #undef DBG_END
psawant9 6:22ce63eddd2b 74 #undef BREAK
psawant9 6:22ce63eddd2b 75 #define DBG(...)
psawant9 6:22ce63eddd2b 76 #define DBG_END()
psawant9 6:22ce63eddd2b 77 #define BREAK()
psawant9 6:22ce63eddd2b 78 #endif
psawant9 6:22ce63eddd2b 79
psawant9 6:22ce63eddd2b 80 #ifdef __LWIP_DEBUG
psawant9 6:22ce63eddd2b 81 #ifndef __SNPRINTF
psawant9 6:22ce63eddd2b 82 #define __SNPRINTF
psawant9 6:22ce63eddd2b 83 #include "mbed.h"
psawant9 6:22ce63eddd2b 84
psawant9 6:22ce63eddd2b 85 //int snprintf(char *str, int size, const char *format, ...);
psawant9 6:22ce63eddd2b 86 #endif
psawant9 6:22ce63eddd2b 87 #endif
psawant9 6:22ce63eddd2b 88
psawant9 6:22ce63eddd2b 89 #ifdef __LWIP_DEBUG
psawant9 6:22ce63eddd2b 90 #undef __DEBUG
psawant9 6:22ce63eddd2b 91 #endif
psawant9 6:22ce63eddd2b 92
psawant9 6:22ce63eddd2b 93 //#endif
psawant9 6:22ce63eddd2b 94