Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Socket USBHostWANDongle lwip-sys lwip
Fork of VodafoneUSBModem by
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 void debug_init(void); 00028 void debug(int level, const char* module, int line, const char* fmt, ...); 00029 void debug_set_newline(const char* newline); 00030 void debug_set_speed(int speed); 00031 void debug_error(const char* module, int line, int ret); 00032 void debug_exact(const char* fmt, ...); 00033 00034 #define DBG_INIT() do{ debug_init(); }while(0) 00035 00036 #define DBG_SET_NEWLINE( x ) do{ debug_set_newline(x); }while(0) 00037 00038 #define DBG_SET_SPEED( x ) do{ debug_set_speed(x); }while(0) 00039 00040 #if __DEBUG__ > 0 00041 #ifndef __MODULE__ 00042 #error "__MODULE__ must be defined" 00043 #endif 00044 #endif 00045 00046 #if __DEBUG__ >= 1 00047 #define ERR(...) do{ debug(1, __MODULE__, __LINE__, __VA_ARGS__); }while(0) 00048 #else 00049 #define ERR(...) do{ }while(0) 00050 #endif 00051 00052 #if __DEBUG__ >= 2 00053 #define WARN(...) do{ debug(2, __MODULE__, __LINE__, __VA_ARGS__); }while(0) 00054 #else 00055 #define WARN(...) do{ }while(0) 00056 #endif 00057 00058 #if __DEBUG__ >= 3 00059 #define INFO(...) do{ debug(3, __MODULE__, __LINE__, __VA_ARGS__); }while(0) 00060 #define CHECK(ret) do{ if(ret){ debug_error(__MODULE__, __LINE__, ret); } }while(0) 00061 #else 00062 #define INFO(...) do{ }while(0) 00063 #define CHECK(ret) do{ }while(0) 00064 #endif 00065 00066 #if __DEBUG__ >= 4 00067 #define DBG(...) do{ debug(4, __MODULE__, __LINE__, __VA_ARGS__); }while(0) 00068 #define DBGX(...) do{ debug_exact(__VA_ARGS__); }while(0) 00069 #else 00070 #define DBG(...) do{ }while(0) 00071 #define DBGX(...) do{ }while(0) 00072 #endif 00073 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif /* DBG_H_ */
Generated on Sun Jul 17 2022 00:54:41 by
1.7.2
