lpc1768

Committer:
jh1cdv00
Date:
Tue Jan 27 01:38:19 2015 +0000
Revision:
0:f35dada1dac1
lpc1768

Who changed what in which revision?

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