1 #ifndef _WRAPPER_H 2 #define _WRAPPER_H 3 4 5 #include <KernelExport.h> 6 #include <lock.h> 7 8 9 // debug output 10 11 #ifdef DEBUG_WAIT_ON_MSG 12 # define DEBUG_WAIT snooze( DEBUG_WAIT_ON_MSG ); 13 #else 14 # define DEBUG_WAIT 15 #endif 16 17 #ifdef DEBUG_WAIT_ON_ERROR 18 # define DEBUG_WAIT_ERROR snooze( DEBUG_WAIT_ON_ERROR ); 19 #else 20 # define DEBUG_WAIT_ERROR 21 #endif 22 23 #ifndef DEBUG_MAX_LEVEL_FLOW 24 # define DEBUG_MAX_LEVEL_FLOW 4 25 #endif 26 27 #ifndef DEBUG_MAX_LEVEL_INFO 28 # define DEBUG_MAX_LEVEL_INFO 4 29 #endif 30 31 #ifndef DEBUG_MAX_LEVEL_ERROR 32 # define DEBUG_MAX_LEVEL_ERROR 4 33 #endif 34 35 #ifndef DEBUG_MSG_PREFIX 36 # define DEBUG_MSG_PREFIX "" 37 #endif 38 39 #ifndef debug_level_flow 40 # define debug_level_flow 0 41 #endif 42 43 #ifndef debug_level_info 44 # define debug_level_info 1 45 #endif 46 47 #ifndef debug_level_error 48 # define debug_level_error 2 49 #endif 50 51 #define FUNC_NAME DEBUG_MSG_PREFIX, __FUNCTION__ 52 53 #define SHOW_FLOW(seriousness, format, param...) \ 54 do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \ 55 dprintf("%s%s: " format "\n", FUNC_NAME, param ); DEBUG_WAIT \ 56 }} while( 0 ) 57 58 #define SHOW_FLOW0(seriousness, format) \ 59 do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \ 60 dprintf("%s%s: " format "\n", FUNC_NAME); DEBUG_WAIT \ 61 }} while( 0 ) 62 63 #define SHOW_INFO(seriousness, format, param...) \ 64 do { if( seriousness <= debug_level_info && seriousness <= DEBUG_MAX_LEVEL_INFO ) { \ 65 dprintf("%s%s: " format "\n", FUNC_NAME, param ); DEBUG_WAIT \ 66 }} while( 0 ) 67 68 #define SHOW_INFO0(seriousness, format) \ 69 do { if( seriousness <= debug_level_info && seriousness <= DEBUG_MAX_LEVEL_INFO ) { \ 70 dprintf("%s%s: " format "\n", FUNC_NAME); DEBUG_WAIT \ 71 }} while( 0 ) 72 73 #define SHOW_ERROR(seriousness, format, param...) \ 74 do { if( seriousness <= debug_level_error && seriousness <= DEBUG_MAX_LEVEL_ERROR ) { \ 75 dprintf("%s%s: " format "\n", FUNC_NAME, param ); DEBUG_WAIT_ERROR \ 76 }} while( 0 ) 77 78 #define SHOW_ERROR0(seriousness, format) \ 79 do { if( seriousness <= debug_level_error && seriousness <= DEBUG_MAX_LEVEL_ERROR ) { \ 80 dprintf("%s%s: " format "\n", FUNC_NAME); DEBUG_WAIT_ERROR \ 81 }} while( 0 ) 82 83 84 #endif /* _WRAPPER_H */ 85