Ethernet test for tinydtls-0.5.0

Dependencies:   EthernetInterface mbed-rtos mbed tinydtls

Fork of tinydtls_test_ethernet by Ashley Mills

Committer:
ashleymills
Date:
Fri Oct 18 14:29:21 2013 +0000
Revision:
4:4d466a913c11
Parent:
1:391ec57807fa
Updated to tinydtls v0.5.0;

Who changed what in which revision?

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