1/*
2 * Copyright (c) 1998-2011 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License").  You may not use this file except in compliance with the
9 * License.  Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef _IOAUDIODEBUG_H
24#define _IOAUDIODEBUG_H
25
26#ifdef DEBUG
27	#define DEBUG_LEVEL 3						//<rdar://problem/9725460>
28	//#define DEBUG_USE_FIRELOG 1
29	#define DEBUG_USE_FIREWIRE_KPRINTF 1
30
31	#ifdef DEBUG_USE_FIRELOG
32	#include <IOKit/firewire/FireLog.h>
33	#define audioDebugIOLog( level, message... ) \
34		do {FireLog(  message ); FireLog("\n");} while (0)
35	#endif
36
37	#ifdef DEBUG_USE_IOUSBLOG
38	#include <IOKit/usb/IOUSBLog.h>
39	#define audioDebugIOLog( level, message... ) \
40		do {USBLog( level, message );} while (0)
41	#endif
42
43	#ifdef DEBUG_USE_FIREWIRE_KPRINTF
44	#define audioDebugIOLog( level, message... ) \
45		do { if (level <= DEBUG_LEVEL) kprintf( message );} while (0)
46	#endif
47
48
49
50	#ifdef assert
51		#undef assert
52
53		#define AssertionMessage( cond, file, line ) \
54			"assert \"" #cond "\" failed in " #file " at line " #line
55
56		#define AssertionFailed( cond, file, line ) \
57			panic(AssertionMessage( cond, file, line ));
58
59		#define	assert( cond )								\
60			if( !(cond) ) {									\
61				AssertionFailed( cond, __FILE__, __LINE__ )	\
62			}
63	#endif
64#else
65	#define audioDebugIOLog( level, message... ) ;
66#endif
67
68#endif /* _IOAUDIODEBUG_H */
69