The beta version of the Vodafone K3770 dongle driver
This library is deprecated. Please use the newest production branch of the library from https://mbed.org/users/mbed_official/code/VodafoneUSBModem/
NetworkingCoreLib/DebugLib/dbg.h@0:0ac66acdfdc0, 2012-05-31 (annotated)
- Committer:
- donatien
- Date:
- Thu May 31 15:32:49 2012 +0000
- Revision:
- 0:0ac66acdfdc0
Initial Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:0ac66acdfdc0 | 1 | /* dbg.h */ |
donatien | 0:0ac66acdfdc0 | 2 | /* |
donatien | 0:0ac66acdfdc0 | 3 | Copyright (C) 2012 ARM Limited. |
donatien | 0:0ac66acdfdc0 | 4 | |
donatien | 0:0ac66acdfdc0 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
donatien | 0:0ac66acdfdc0 | 6 | this software and associated documentation files (the "Software"), to deal in |
donatien | 0:0ac66acdfdc0 | 7 | the Software without restriction, including without limitation the rights to |
donatien | 0:0ac66acdfdc0 | 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
donatien | 0:0ac66acdfdc0 | 9 | of the Software, and to permit persons to whom the Software is furnished to do |
donatien | 0:0ac66acdfdc0 | 10 | so, subject to the following conditions: |
donatien | 0:0ac66acdfdc0 | 11 | |
donatien | 0:0ac66acdfdc0 | 12 | The above copyright notice and this permission notice shall be included in all |
donatien | 0:0ac66acdfdc0 | 13 | copies or substantial portions of the Software. |
donatien | 0:0ac66acdfdc0 | 14 | |
donatien | 0:0ac66acdfdc0 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 0:0ac66acdfdc0 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 0:0ac66acdfdc0 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 0:0ac66acdfdc0 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 0:0ac66acdfdc0 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:0ac66acdfdc0 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
donatien | 0:0ac66acdfdc0 | 21 | SOFTWARE. |
donatien | 0:0ac66acdfdc0 | 22 | */ |
donatien | 0:0ac66acdfdc0 | 23 | |
donatien | 0:0ac66acdfdc0 | 24 | #ifndef DBG_H_ |
donatien | 0:0ac66acdfdc0 | 25 | #define DBG_H_ |
donatien | 0:0ac66acdfdc0 | 26 | |
donatien | 0:0ac66acdfdc0 | 27 | #ifdef __cplusplus |
donatien | 0:0ac66acdfdc0 | 28 | extern "C" { |
donatien | 0:0ac66acdfdc0 | 29 | #endif |
donatien | 0:0ac66acdfdc0 | 30 | |
donatien | 0:0ac66acdfdc0 | 31 | |
donatien | 0:0ac66acdfdc0 | 32 | void debug_init(void); |
donatien | 0:0ac66acdfdc0 | 33 | void debug(int level, const char* module, int line, const char* fmt, ...); |
donatien | 0:0ac66acdfdc0 | 34 | void debug_set_newline(const char* newline); |
donatien | 0:0ac66acdfdc0 | 35 | void debug_error(const char* module, int line, int ret); |
donatien | 0:0ac66acdfdc0 | 36 | void debug_exact(const char* fmt, ...); |
donatien | 0:0ac66acdfdc0 | 37 | |
donatien | 0:0ac66acdfdc0 | 38 | #define DBG_INIT() do{ debug_init(); }while(0) |
donatien | 0:0ac66acdfdc0 | 39 | |
donatien | 0:0ac66acdfdc0 | 40 | #define DBG_SET_NEWLINE( x ) do{ debug_set_newline(x); }while(0) |
donatien | 0:0ac66acdfdc0 | 41 | |
donatien | 0:0ac66acdfdc0 | 42 | #if __DEBUG__ > 0 |
donatien | 0:0ac66acdfdc0 | 43 | #ifndef __MODULE__ |
donatien | 0:0ac66acdfdc0 | 44 | #error "__MODULE__ must be defined" |
donatien | 0:0ac66acdfdc0 | 45 | #endif |
donatien | 0:0ac66acdfdc0 | 46 | #endif |
donatien | 0:0ac66acdfdc0 | 47 | |
donatien | 0:0ac66acdfdc0 | 48 | #if __DEBUG__ >= 1 |
donatien | 0:0ac66acdfdc0 | 49 | #define ERR(...) do{ debug(1, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
donatien | 0:0ac66acdfdc0 | 50 | #else |
donatien | 0:0ac66acdfdc0 | 51 | #define ERR(...) do{ }while(0) |
donatien | 0:0ac66acdfdc0 | 52 | #endif |
donatien | 0:0ac66acdfdc0 | 53 | |
donatien | 0:0ac66acdfdc0 | 54 | #if __DEBUG__ >= 2 |
donatien | 0:0ac66acdfdc0 | 55 | #define WARN(...) do{ debug(2, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
donatien | 0:0ac66acdfdc0 | 56 | #else |
donatien | 0:0ac66acdfdc0 | 57 | #define WARN(...) do{ }while(0) |
donatien | 0:0ac66acdfdc0 | 58 | #endif |
donatien | 0:0ac66acdfdc0 | 59 | |
donatien | 0:0ac66acdfdc0 | 60 | #if __DEBUG__ >= 3 |
donatien | 0:0ac66acdfdc0 | 61 | #define INFO(...) do{ debug(3, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
donatien | 0:0ac66acdfdc0 | 62 | #define CHECK(ret) do{ if(ret){ debug_error(__MODULE__, __LINE__, ret); } }while(0) |
donatien | 0:0ac66acdfdc0 | 63 | #else |
donatien | 0:0ac66acdfdc0 | 64 | #define INFO(...) do{ }while(0) |
donatien | 0:0ac66acdfdc0 | 65 | #define CHECK(ret) do{ }while(0) |
donatien | 0:0ac66acdfdc0 | 66 | #endif |
donatien | 0:0ac66acdfdc0 | 67 | |
donatien | 0:0ac66acdfdc0 | 68 | #if __DEBUG__ >= 4 |
donatien | 0:0ac66acdfdc0 | 69 | #define DBG(...) do{ debug(4, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
donatien | 0:0ac66acdfdc0 | 70 | #define DBGX(...) do{ debug_exact(__VA_ARGS__); }while(0) |
donatien | 0:0ac66acdfdc0 | 71 | #else |
donatien | 0:0ac66acdfdc0 | 72 | #define DBG(...) do{ }while(0) |
donatien | 0:0ac66acdfdc0 | 73 | #define DBGX(...) do{ }while(0) |
donatien | 0:0ac66acdfdc0 | 74 | #endif |
donatien | 0:0ac66acdfdc0 | 75 | |
donatien | 0:0ac66acdfdc0 | 76 | #ifdef __cplusplus |
donatien | 0:0ac66acdfdc0 | 77 | } |
donatien | 0:0ac66acdfdc0 | 78 | #endif |
donatien | 0:0ac66acdfdc0 | 79 | |
donatien | 0:0ac66acdfdc0 | 80 | #endif /* DBG_H_ */ |