1/*
2 * Auvia BeOS Driver for Via VT82xx Southbridge audio
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/*
35 * PRINT() executes dprintf if DEBUG = 0 (disabled), or expands to LOG() when DEBUG > 0
36 * TRACE() executes dprintf if DEBUG > 0
37 * LOG()   executes dprintf and writes to the logfile if DEBUG > 0
38 */
39
40/* DEBUG == 0, no debugging, PRINT writes to syslog
41 * DEBUG == 1, TRACE & LOG, PRINT
42 * DEBUG == 2, TRACE & LOG, PRINT with snooze()
43 */
44#ifndef DEBUG
45	#define DEBUG 0
46#endif
47
48#undef PRINT
49#undef TRACE
50#undef ASSERT
51
52#if DEBUG > 0
53	#define PRINT(a)		log_printf a
54	#define TRACE(a) 		debug_printf a
55	#define LOG(a)			log_printf a
56	#define LOG_CREATE()	log_create()
57	#define ASSERT(a)		if (a) {} else LOG(("ASSERT failed! file = %s, line = %d\n",__FILE__,__LINE__))
58	void log_create();
59	void log_printf(const char *text,...);
60	void debug_printf(const char *text,...);
61#else
62	void debug_printf(const char *text,...);
63	#define PRINT(a)	debug_printf a
64	#define TRACE(a)	((void)(0))
65	#define ASSERT(a)	((void)(0))
66	#define LOG(a)		((void)(0))
67	#define LOG_CREATE()
68#endif
69
70#endif
71