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