diff options
Diffstat (limited to 'drivers/net/wireless/ti/wl12xx/debug.h')
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/debug.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/debug.h b/drivers/net/wireless/ti/wl12xx/debug.h new file mode 100644 index 000000000000..ec0fdc25b280 --- /dev/null +++ b/drivers/net/wireless/ti/wl12xx/debug.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * This file is part of wl12xx | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments. All rights reserved. | ||
5 | * Copyright (C) 2008-2009 Nokia Corporation | ||
6 | * | ||
7 | * Contact: Luciano Coelho <coelho@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * version 2 as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
21 | * 02110-1301 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #ifndef __DEBUG_H__ | ||
26 | #define __DEBUG_H__ | ||
27 | |||
28 | #include <linux/bitops.h> | ||
29 | #include <linux/printk.h> | ||
30 | |||
31 | #define DRIVER_NAME "wl12xx" | ||
32 | #define DRIVER_PREFIX DRIVER_NAME ": " | ||
33 | |||
34 | enum { | ||
35 | DEBUG_NONE = 0, | ||
36 | DEBUG_IRQ = BIT(0), | ||
37 | DEBUG_SPI = BIT(1), | ||
38 | DEBUG_BOOT = BIT(2), | ||
39 | DEBUG_MAILBOX = BIT(3), | ||
40 | DEBUG_TESTMODE = BIT(4), | ||
41 | DEBUG_EVENT = BIT(5), | ||
42 | DEBUG_TX = BIT(6), | ||
43 | DEBUG_RX = BIT(7), | ||
44 | DEBUG_SCAN = BIT(8), | ||
45 | DEBUG_CRYPT = BIT(9), | ||
46 | DEBUG_PSM = BIT(10), | ||
47 | DEBUG_MAC80211 = BIT(11), | ||
48 | DEBUG_CMD = BIT(12), | ||
49 | DEBUG_ACX = BIT(13), | ||
50 | DEBUG_SDIO = BIT(14), | ||
51 | DEBUG_FILTERS = BIT(15), | ||
52 | DEBUG_ADHOC = BIT(16), | ||
53 | DEBUG_AP = BIT(17), | ||
54 | DEBUG_PROBE = BIT(18), | ||
55 | DEBUG_MASTER = (DEBUG_ADHOC | DEBUG_AP), | ||
56 | DEBUG_ALL = ~0, | ||
57 | }; | ||
58 | |||
59 | extern u32 wl12xx_debug_level; | ||
60 | |||
61 | #define DEBUG_DUMP_LIMIT 1024 | ||
62 | |||
63 | #define wl1271_error(fmt, arg...) \ | ||
64 | pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg) | ||
65 | |||
66 | #define wl1271_warning(fmt, arg...) \ | ||
67 | pr_warning(DRIVER_PREFIX "WARNING " fmt "\n", ##arg) | ||
68 | |||
69 | #define wl1271_notice(fmt, arg...) \ | ||
70 | pr_info(DRIVER_PREFIX fmt "\n", ##arg) | ||
71 | |||
72 | #define wl1271_info(fmt, arg...) \ | ||
73 | pr_info(DRIVER_PREFIX fmt "\n", ##arg) | ||
74 | |||
75 | #define wl1271_debug(level, fmt, arg...) \ | ||
76 | do { \ | ||
77 | if (level & wl12xx_debug_level) \ | ||
78 | pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \ | ||
79 | } while (0) | ||
80 | |||
81 | /* TODO: use pr_debug_hex_dump when it becomes available */ | ||
82 | #define wl1271_dump(level, prefix, buf, len) \ | ||
83 | do { \ | ||
84 | if (level & wl12xx_debug_level) \ | ||
85 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ | ||
86 | DUMP_PREFIX_OFFSET, 16, 1, \ | ||
87 | buf, \ | ||
88 | min_t(size_t, len, DEBUG_DUMP_LIMIT), \ | ||
89 | 0); \ | ||
90 | } while (0) | ||
91 | |||
92 | #define wl1271_dump_ascii(level, prefix, buf, len) \ | ||
93 | do { \ | ||
94 | if (level & wl12xx_debug_level) \ | ||
95 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ | ||
96 | DUMP_PREFIX_OFFSET, 16, 1, \ | ||
97 | buf, \ | ||
98 | min_t(size_t, len, DEBUG_DUMP_LIMIT), \ | ||
99 | true); \ | ||
100 | } while (0) | ||
101 | |||
102 | #endif /* __DEBUG_H__ */ | ||