[s3c24xx] bump to 2.6.30-rc6
[openwrt.git] / target / linux / s3c24xx / files-2.6.30 / drivers / ar6000 / ar6000 / debug_linux.h
1 /*
2  * Copyright (c) 2004-2006 Atheros Communications Inc.
3  * All rights reserved.
4  *
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License version 2 as
8  *  published by the Free Software Foundation;
9  *
10  *  Software distributed under the License is distributed on an "AS
11  *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
12  *  implied. See the License for the specific language governing
13  *  rights and limitations under the License.
14  *
15  *
16  *
17  */
18
19 #ifndef _DEBUG_LINUX_H_
20 #define _DEBUG_LINUX_H_
21
22 #define DBG_DEFAULTS    (DBG_ERROR|DBG_WARNING)
23
24 extern A_UINT32 g_dbg_flags;
25
26 #define DBGFMT  "%s() : "
27 #define DBGARG  __func__
28 #define DBGFN   A_PRINTF
29
30 /* ------- Debug related stuff ------- */
31 enum {
32     ATH_DEBUG_SEND = 0x0001,
33     ATH_DEBUG_RECV = 0x0002,
34     ATH_DEBUG_SYNC = 0x0004,
35     ATH_DEBUG_DUMP = 0x0008,
36     ATH_DEBUG_IRQ  = 0x0010,
37     ATH_DEBUG_TRC  = 0x0020,
38     ATH_DEBUG_WARN = 0x0040,
39     ATH_DEBUG_ERR  = 0x0080,
40     ATH_LOG_INF    = 0x0100,
41     ATH_DEBUG_BMI  = 0x0110,
42     ATH_DEBUG_WMI  = 0x0120,
43     ATH_DEBUG_HIF  = 0x0140,
44     ATH_DEBUG_HTC  = 0x0180,
45     ATH_DEBUG_WLAN = 0x1000,
46     ATH_LOG_ERR    = 0x1010,
47     ATH_DEBUG_ANY  = 0xFFFF,
48 };
49
50 #ifdef DEBUG
51
52 #define A_DPRINTF(f, a) \
53         if(g_dbg_flags & (f)) \
54         {       \
55                 DBGFN a ; \
56         }
57
58
59 // TODO FIX usage of A_PRINTF!
60 #define AR_DEBUG_LVL_CHECK(lvl) (debughtc & (lvl))
61 #define AR_DEBUG_PRINTBUF(buffer, length, desc) do {   \
62     if (debughtc & ATH_DEBUG_DUMP) {             \
63         DebugDumpBytes(buffer, length,desc);               \
64     }                                            \
65 } while(0)
66 #define PRINTX_ARG(arg...) arg
67 #define AR_DEBUG_PRINTF(flags, args) do {        \
68     if (debughtc & (flags)) {                    \
69         A_PRINTF(KERN_ALERT PRINTX_ARG args);    \
70     }                                            \
71 } while (0)
72 #define AR_DEBUG_ASSERT(test) do {               \
73     if (!(test)) {                               \
74         AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Debug Assert Caught, File %s, Line: %d, Test:%s \n",__FILE__, __LINE__,#test));         \
75     }                                            \
76 } while(0)
77 extern int debughtc;
78 #else
79 #define AR_DEBUG_PRINTF(flags, args)
80 #define AR_DEBUG_PRINTBUF(buffer, length, desc)
81 #define AR_DEBUG_ASSERT(test)
82 #define AR_DEBUG_LVL_CHECK(lvl) 0
83 #define A_DPRINTF(f, a)
84 #endif
85
86 #endif /* _DEBUG_LINUX_H_ */