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