goldfish: R.I.P.
[openwrt.git] / target / linux / s3c24xx / files-2.6.30 / drivers / ar6000 / htc / htc_debug.h
1 #ifndef HTC_DEBUG_H_
2 #define HTC_DEBUG_H_
3 /*
4  *
5  * Copyright (c) 2004-2007 Atheros Communications Inc.
6  * All rights reserved.
7  *
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License version 2 as
11  *  published by the Free Software Foundation;
12  *
13  *  Software distributed under the License is distributed on an "AS
14  *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
15  *  implied. See the License for the specific language governing
16  *  rights and limitations under the License.
17  *
18  *
19  *
20  */
21
22 /* ------- Debug related stuff ------- */
23 enum {
24     ATH_DEBUG_SEND = 0x0001,
25     ATH_DEBUG_RECV = 0x0002,
26     ATH_DEBUG_SYNC = 0x0004,
27     ATH_DEBUG_DUMP = 0x0008,
28     ATH_DEBUG_IRQ  = 0x0010,
29     ATH_DEBUG_TRC  = 0x0020,
30     ATH_DEBUG_WARN = 0x0040,
31     ATH_DEBUG_ERR  = 0x0080,
32     ATH_DEBUG_ANY  = 0xFFFF,
33 };
34
35 #ifdef DEBUG
36
37 // TODO FIX usage of A_PRINTF!
38 #define AR_DEBUG_LVL_CHECK(lvl) (debughtc & (lvl))
39 #define AR_DEBUG_PRINTBUF(buffer, length, desc) do {   \
40     if (debughtc & ATH_DEBUG_DUMP) {             \
41         DebugDumpBytes(buffer, length,desc);               \
42     }                                            \
43 } while(0)
44 #define PRINTX_ARG(arg...) arg
45 #define AR_DEBUG_PRINTF(flags, args) do {        \
46     if (debughtc & (flags)) {                    \
47         A_PRINTF(KERN_ALERT PRINTX_ARG args);    \
48     }                                            \
49 } while (0)
50 #define AR_DEBUG_ASSERT(test) do {               \
51     if (!(test)) {                               \
52         AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Debug Assert Caught, File %s, Line: %d, Test:%s \n",__FILE__, __LINE__,#test));         \
53     }                                            \
54 } while(0)
55 extern int debughtc;
56 #else
57 #define AR_DEBUG_PRINTF(flags, args)
58 #define AR_DEBUG_PRINTBUF(buffer, length, desc)
59 #define AR_DEBUG_ASSERT(test)
60 #define AR_DEBUG_LVL_CHECK(lvl) 0
61 #endif
62
63 void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription);
64
65 #endif /*HTC_DEBUG_H_*/