xref: /haiku/src/add-ons/kernel/drivers/audio/ac97/es1370/debug.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * ES1370 Haiku Driver for ES1370 audio
3  *
4  * Copyright 2002-2007, Haiku, Inc.
5  * Distributed under the terms of the MIT License.
6  *
7  * Authors:
8  *		Marcus Overhagen, marcus@overhagen.de
9  *		Jerome Duval, jerome.duval@free.fr
10  */
11 
12 #ifndef _DEBUG_H_
13 #define _DEBUG_H_
14 
15 /*
16  * PRINT() executes dprintf if DEBUG = 0 (disabled), or expands to LOG() when DEBUG > 0
17  * TRACE() executes dprintf if DEBUG > 0
18  * LOG()   executes dprintf and writes to the logfile if DEBUG > 0
19  */
20 
21 /* DEBUG == 0, no debugging, PRINT writes to syslog
22  * DEBUG == 1, TRACE & LOG, PRINT
23  * DEBUG == 2, TRACE & LOG, PRINT with snooze()
24  */
25 #ifndef DEBUG
26 	#define DEBUG 1
27 #endif
28 
29 #undef PRINT
30 #undef TRACE
31 #undef ASSERT
32 
33 #if DEBUG > 0
34 	#define PRINT(a)		log_printf a
35 	#define TRACE(a) 		debug_printf a
36 	#define LOG(a)			log_printf a
37 	#define LOG_CREATE()	log_create()
38 	#define ASSERT(a)		if (a) {} else LOG(("ASSERT failed! file = %s, line = %d\n",__FILE__,__LINE__))
39 	void log_create();
40 	void log_printf(const char *text,...);
41 	void debug_printf(const char *text,...);
42 #else
43 	void debug_printf(const char *text,...);
44 	#define PRINT(a)	debug_printf a
45 	#define TRACE(a)	((void)(0))
46 	#define ASSERT(a)	((void)(0))
47 	#define LOG(a)		((void)(0))
48 	#define LOG_CREATE()
49 #endif
50 
51 #endif
52