diff options
Diffstat (limited to 'drivers/net/wireless/ath5k/debug.h')
| -rw-r--r-- | drivers/net/wireless/ath5k/debug.h | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath5k/debug.h b/drivers/net/wireless/ath5k/debug.h new file mode 100644 index 000000000000..2b491cbc8c80 --- /dev/null +++ b/drivers/net/wireless/ath5k/debug.h | |||
| @@ -0,0 +1,216 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2007 Bruno Randolf <bruno@thinktube.com> | ||
| 3 | * | ||
| 4 | * This file is free software: you may copy, redistribute and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation, either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | * | ||
| 9 | * This file is distributed in the hope that it will be useful, but | ||
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | * | ||
| 17 | * | ||
| 18 | * This file incorporates work covered by the following copyright and | ||
| 19 | * permission notice: | ||
| 20 | * | ||
| 21 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting | ||
| 22 | * Copyright (c) 2004-2005 Atheros Communications, Inc. | ||
| 23 | * Copyright (c) 2006 Devicescape Software, Inc. | ||
| 24 | * Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com> | ||
| 25 | * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> | ||
| 26 | * | ||
| 27 | * All rights reserved. | ||
| 28 | * | ||
| 29 | * Redistribution and use in source and binary forms, with or without | ||
| 30 | * modification, are permitted provided that the following conditions | ||
| 31 | * are met: | ||
| 32 | * 1. Redistributions of source code must retain the above copyright | ||
| 33 | * notice, this list of conditions and the following disclaimer, | ||
| 34 | * without modification. | ||
| 35 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
| 36 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any | ||
| 37 | * redistribution must be conditioned upon including a substantially | ||
| 38 | * similar Disclaimer requirement for further binary redistribution. | ||
| 39 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
| 40 | * of any contributors may be used to endorse or promote products derived | ||
| 41 | * from this software without specific prior written permission. | ||
| 42 | * | ||
| 43 | * Alternatively, this software may be distributed under the terms of the | ||
| 44 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
| 45 | * Software Foundation. | ||
| 46 | * | ||
| 47 | * NO WARRANTY | ||
| 48 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 49 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 50 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY | ||
| 51 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
| 52 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, | ||
| 53 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 54 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 55 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| 56 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 57 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
| 58 | * THE POSSIBILITY OF SUCH DAMAGES. | ||
| 59 | */ | ||
| 60 | |||
| 61 | #ifndef _ATH5K_DEBUG_H | ||
| 62 | #define _ATH5K_DEBUG_H | ||
| 63 | |||
| 64 | /* set this to 1 for debugging output */ | ||
| 65 | #ifndef ATH5K_DEBUG | ||
| 66 | #define ATH5K_DEBUG 0 | ||
| 67 | #endif | ||
| 68 | |||
| 69 | struct ath5k_softc; | ||
| 70 | struct ath5k_hw; | ||
| 71 | struct ieee80211_hw_mode; | ||
| 72 | struct sk_buff; | ||
| 73 | struct ath5k_buf; | ||
| 74 | |||
| 75 | struct ath5k_dbg_info { | ||
| 76 | unsigned int level; /* debug level */ | ||
| 77 | /* debugfs entries */ | ||
| 78 | struct dentry *debugfs_phydir; | ||
| 79 | struct dentry *debugfs_debug; | ||
| 80 | struct dentry *debugfs_registers; | ||
| 81 | struct dentry *debugfs_tsf; | ||
| 82 | struct dentry *debugfs_beacon; | ||
| 83 | struct dentry *debugfs_reset; | ||
| 84 | }; | ||
| 85 | |||
| 86 | /** | ||
| 87 | * enum ath5k_debug_level - ath5k debug level | ||
| 88 | * | ||
| 89 | * @ATH5K_DEBUG_RESET: reset processing | ||
| 90 | * @ATH5K_DEBUG_INTR: interrupt handling | ||
| 91 | * @ATH5K_DEBUG_MODE: mode init/setup | ||
| 92 | * @ATH5K_DEBUG_XMIT: basic xmit operation | ||
| 93 | * @ATH5K_DEBUG_BEACON: beacon handling | ||
| 94 | * @ATH5K_DEBUG_BEACON_PROC: beacon ISR proc | ||
| 95 | * @ATH5K_DEBUG_CALIBRATE: periodic calibration | ||
| 96 | * @ATH5K_DEBUG_TXPOWER: transmit power setting | ||
| 97 | * @ATH5K_DEBUG_LED: led management | ||
| 98 | * @ATH5K_DEBUG_DUMP_RX: print received skb content | ||
| 99 | * @ATH5K_DEBUG_DUMP_TX: print transmit skb content | ||
| 100 | * @ATH5K_DEBUG_DUMPMODES: dump modes | ||
| 101 | * @ATH5K_DEBUG_TRACE: trace function calls | ||
| 102 | * @ATH5K_DEBUG_FATAL: fatal errors | ||
| 103 | * @ATH5K_DEBUG_ANY: show at any debug level | ||
| 104 | * | ||
| 105 | * The debug level is used to control the amount and type of debugging output | ||
| 106 | * we want to see. The debug level is given in calls to ATH5K_DBG to specify | ||
| 107 | * where the message should appear, and the user can control the debugging | ||
| 108 | * messages he wants to see, either by the module parameter 'debug' on module | ||
| 109 | * load, or dynamically by using debugfs 'ath5k/phyX/debug'. these levels can | ||
| 110 | * be combined together by bitwise OR. | ||
| 111 | */ | ||
| 112 | enum ath5k_debug_level { | ||
| 113 | ATH5K_DEBUG_RESET = 0x00000001, | ||
| 114 | ATH5K_DEBUG_INTR = 0x00000002, | ||
| 115 | ATH5K_DEBUG_MODE = 0x00000004, | ||
| 116 | ATH5K_DEBUG_XMIT = 0x00000008, | ||
| 117 | ATH5K_DEBUG_BEACON = 0x00000010, | ||
| 118 | ATH5K_DEBUG_BEACON_PROC = 0x00000020, | ||
| 119 | ATH5K_DEBUG_CALIBRATE = 0x00000100, | ||
| 120 | ATH5K_DEBUG_TXPOWER = 0x00000200, | ||
| 121 | ATH5K_DEBUG_LED = 0x00000400, | ||
| 122 | ATH5K_DEBUG_DUMP_RX = 0x00001000, | ||
| 123 | ATH5K_DEBUG_DUMP_TX = 0x00002000, | ||
| 124 | ATH5K_DEBUG_DUMPMODES = 0x00004000, | ||
| 125 | ATH5K_DEBUG_TRACE = 0x00010000, | ||
| 126 | ATH5K_DEBUG_FATAL = 0x80000000, | ||
| 127 | ATH5K_DEBUG_ANY = 0xffffffff | ||
| 128 | }; | ||
| 129 | |||
| 130 | #if ATH5K_DEBUG | ||
| 131 | |||
| 132 | #define ATH5K_TRACE(_sc) do { \ | ||
| 133 | if (unlikely((_sc)->debug.level & ATH5K_DEBUG_TRACE)) \ | ||
| 134 | printk(KERN_DEBUG "ath5k trace %s:%d\n", __func__, __LINE__); \ | ||
| 135 | } while (0) | ||
| 136 | |||
| 137 | #define ATH5K_DBG(_sc, _m, _fmt, ...) do { \ | ||
| 138 | if (unlikely((_sc)->debug.level & (_m) && net_ratelimit())) \ | ||
| 139 | ATH5K_PRINTK(_sc, KERN_DEBUG, "(%s:%d): " _fmt, \ | ||
| 140 | __func__, __LINE__, ##__VA_ARGS__); \ | ||
| 141 | } while (0) | ||
| 142 | |||
| 143 | #define ATH5K_DBG_UNLIMIT(_sc, _m, _fmt, ...) do { \ | ||
| 144 | if (unlikely((_sc)->debug.level & (_m))) \ | ||
| 145 | ATH5K_PRINTK(_sc, KERN_DEBUG, "(%s:%d): " _fmt, \ | ||
| 146 | __func__, __LINE__, ##__VA_ARGS__); \ | ||
| 147 | } while (0) | ||
| 148 | |||
| 149 | void | ||
| 150 | ath5k_debug_init(void); | ||
| 151 | |||
| 152 | void | ||
| 153 | ath5k_debug_init_device(struct ath5k_softc *sc); | ||
| 154 | |||
| 155 | void | ||
| 156 | ath5k_debug_finish(void); | ||
| 157 | |||
| 158 | void | ||
| 159 | ath5k_debug_finish_device(struct ath5k_softc *sc); | ||
| 160 | |||
| 161 | void | ||
| 162 | ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah); | ||
| 163 | |||
| 164 | void | ||
| 165 | ath5k_debug_dump_modes(struct ath5k_softc *sc, | ||
| 166 | struct ieee80211_hw_mode *modes); | ||
| 167 | |||
| 168 | void | ||
| 169 | ath5k_debug_dump_skb(struct ath5k_softc *sc, | ||
| 170 | struct sk_buff *skb, const char *prefix, int tx); | ||
| 171 | |||
| 172 | void | ||
| 173 | ath5k_debug_printtxbuf(struct ath5k_softc *sc, | ||
| 174 | struct ath5k_buf *bf, int done); | ||
| 175 | |||
| 176 | #else /* no debugging */ | ||
| 177 | |||
| 178 | #define ATH5K_TRACE(_sc) /* empty */ | ||
| 179 | |||
| 180 | static inline void __attribute__ ((format (printf, 3, 4))) | ||
| 181 | ATH5K_DBG(struct ath5k_softc *sc, unsigned int m, const char *fmt, ...) {} | ||
| 182 | |||
| 183 | static inline void __attribute__ ((format (printf, 3, 4))) | ||
| 184 | ATH5K_DBG_UNLIMIT(struct ath5k_softc *sc, unsigned int m, const char *fmt, ...) | ||
| 185 | {} | ||
| 186 | |||
| 187 | static inline void | ||
| 188 | ath5k_debug_init(void) {} | ||
| 189 | |||
| 190 | static inline void | ||
| 191 | ath5k_debug_init_device(struct ath5k_softc *sc) {} | ||
| 192 | |||
| 193 | static inline void | ||
| 194 | ath5k_debug_finish(void) {} | ||
| 195 | |||
| 196 | static inline void | ||
| 197 | ath5k_debug_finish_device(struct ath5k_softc *sc) {} | ||
| 198 | |||
| 199 | static inline void | ||
| 200 | ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah) {} | ||
| 201 | |||
| 202 | static inline void | ||
| 203 | ath5k_debug_dump_modes(struct ath5k_softc *sc, | ||
| 204 | struct ieee80211_hw_mode *modes) {} | ||
| 205 | |||
| 206 | static inline void | ||
| 207 | ath5k_debug_dump_skb(struct ath5k_softc *sc, | ||
| 208 | struct sk_buff *skb, const char *prefix, int tx) {} | ||
| 209 | |||
| 210 | static inline void | ||
| 211 | ath5k_debug_printtxbuf(struct ath5k_softc *sc, | ||
| 212 | struct ath5k_buf *bf, int done) {} | ||
| 213 | |||
| 214 | #endif /* if ATH5K_DEBUG */ | ||
| 215 | |||
| 216 | #endif /* ifndef _ATH5K_DEBUG_H */ | ||
