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