xref: /haiku/src/add-ons/kernel/drivers/audio/echo/debug.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * EchoGals/Echo24 BeOS Driver for Echo audio cards
3  *
4  * Copyright (c) 2003, Jerome Duval (jerome.duval@free.fr)
5  *
6  * Original code : BeOS Driver for Intel ICH AC'97 Link interface
7  * Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
8  *
9  * All rights reserved.
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * - Redistributions of source code must retain the above copyright notice,
14  *   this list of conditions and the following disclaimer.
15  * - Redistributions in binary form must reproduce the above copyright notice,
16  *   this list of conditions and the following disclaimer in the documentation
17  *   and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  */
31 #ifndef _DEBUG_H_
32 #define _DEBUG_H_
33 
34 #ifdef ECHO24_FAMILY
35 #define DRIVER_NAME "echo24"
36 #endif
37 #ifdef ECHOGALS_FAMILY
38 #define DRIVER_NAME "echogals"
39 #endif
40 #ifdef INDIGO_FAMILY
41 #define DRIVER_NAME "echoindigo"
42 #endif
43 #ifdef ECHO3G_FAMILY
44 #define DRIVER_NAME "echo3g"
45 #endif
46 #define ECHO_VERSION		"0.0"
47 
48 /*
49  * PRINT() executes dprintf if DEBUG = 0 (disabled), or expands to LOG() when DEBUG > 0
50  * TRACE() executes dprintf if DEBUG > 0
51  * LOG()   executes dprintf and writes to the logfile if DEBUG > 0
52  */
53 
54 /* DEBUG == 0, no debugging, PRINT writes to syslog
55  * DEBUG == 1, TRACE & LOG, PRINT
56  * DEBUG == 2, TRACE & LOG, PRINT with snooze()
57  */
58 #ifndef DEBUG
59 	#define DEBUG 0
60 #endif
61 
62 #undef PRINT
63 #undef TRACE
64 #undef ASSERT
65 
66 #if DEBUG > 0
67 	#define PRINT(a)		log_printf a
68 	#define TRACE(a) 		debug_printf a
69 	#define LOG(a)			log_printf a
70 	#define LOG_CREATE()	log_create()
71 	#define ASSERT(a)		if (a) {} else LOG(("ASSERT failed! file = %s, line = %d\n",__FILE__,__LINE__))
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75 
76 	void log_create(void);
77 	void log_printf(const char *text,...);
78 	void debug_printf(const char *text,...);
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #else
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87 	void log_create(void);
88 	void debug_printf(const char *text,...);
89 #ifdef __cplusplus
90 }
91 #endif
92 	#define PRINT(a)	debug_printf a
93 	#define TRACE(a)	((void)(0))
94 	#define ASSERT(a)	((void)(0))
95 	#define LOG(a)		((void)(0))
96 	#define LOG_CREATE()
97 #endif
98 
99 #endif
100