NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Committer:
donatien
Date:
Tue Jul 27 15:59:42 2010 +0000
Revision:
5:dd63a1e02b1b
Parent:
4:fd826cad83c0
Child:
7:534fa46ad8c5

        

Who changed what in which revision?

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