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