Vodafone K3770/K3772-Z modems driver & networking library

Dependencies:   Socket USBHostWANDongle lwip-sys lwip

Dependents:   VodafoneUSBModemHTTPClientTest VodafoneUSBModemNTPClientTest VodafoneUSBModemSMSTest VodafoneUSBModemUSSDTest ... more

Fork of VodafoneUSBModem_bleedingedge by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dbg.h Source File

dbg.h

00001 /* dbg.h */
00002 /* Copyright (C) 2012 mbed.org, MIT License
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00005  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00006  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00007  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00008  * furnished to do so, subject to the following conditions:
00009  *
00010  * The above copyright notice and this permission notice shall be included in all copies or
00011  * substantial portions of the Software.
00012  *
00013  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00014  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00015  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00016  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00017  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00018  */
00019 
00020 #ifndef DBG_H_
00021 #define DBG_H_
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 
00028 void debug_init(void);
00029 void debug(int level, const char* module, int line, const char* fmt, ...);
00030 void debug_set_newline(const char* newline);
00031 void debug_set_speed(int speed);
00032 void debug_error(const char* module, int line, int ret);
00033 void debug_exact(const char* fmt, ...);
00034 
00035 #define DBG_INIT() do{ debug_init(); }while(0)
00036 
00037 #define DBG_SET_NEWLINE( x ) do{ debug_set_newline(x); }while(0)
00038 
00039 #define DBG_SET_SPEED( x ) do{ debug_set_speed(x); }while(0)
00040 
00041 #if __DEBUG__ > 0
00042 #ifndef __MODULE__
00043 #error "__MODULE__ must be defined"
00044 #endif
00045 #endif
00046 
00047 #if __DEBUG__ >= 1
00048 #define ERR(...) do{ debug(1, __MODULE__, __LINE__, __VA_ARGS__); }while(0)
00049 #else
00050 #define ERR(...) do{ }while(0)
00051 #endif
00052 
00053 #if __DEBUG__ >= 2
00054 #define WARN(...) do{ debug(2, __MODULE__, __LINE__, __VA_ARGS__); }while(0)
00055 #else
00056 #define WARN(...) do{ }while(0)
00057 #endif
00058 
00059 #if __DEBUG__ >= 3
00060 #define INFO(...) do{ debug(3, __MODULE__, __LINE__, __VA_ARGS__); }while(0)
00061 #define CHECK(ret) do{ if(ret){ debug_error(__MODULE__, __LINE__, ret); } }while(0)
00062 #else
00063 #define INFO(...) do{ }while(0)
00064 #define CHECK(ret) do{ }while(0)
00065 #endif
00066 
00067 #if __DEBUG__ >= 4
00068 #define DBG(...) do{ debug(4, __MODULE__, __LINE__, __VA_ARGS__); }while(0)
00069 #define DBGX(...) do{ debug_exact(__VA_ARGS__); }while(0)
00070 #else
00071 #define DBG(...) do{ }while(0)
00072 #define DBGX(...) do{ }while(0)
00073 #endif
00074 
00075 #ifdef __cplusplus
00076 }
00077 #endif
00078 
00079 #endif /* DBG_H_ */