Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2007 Bruno Randolf <bruno@thinktube.com>
0003  *
0004  *  This file is free software: you may copy, redistribute and/or modify it
0005  *  under the terms of the GNU General Public License as published by the
0006  *  Free Software Foundation, either version 2 of the License, or (at your
0007  *  option) any later version.
0008  *
0009  *  This file is distributed in the hope that it will be useful, but
0010  *  WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  *  General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  *
0017  *
0018  * This file incorporates work covered by the following copyright and
0019  * permission notice:
0020  *
0021  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
0022  * Copyright (c) 2004-2005 Atheros Communications, Inc.
0023  * Copyright (c) 2006 Devicescape Software, Inc.
0024  * Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com>
0025  * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
0026  *
0027  * All rights reserved.
0028  *
0029  * Redistribution and use in source and binary forms, with or without
0030  * modification, are permitted provided that the following conditions
0031  * are met:
0032  * 1. Redistributions of source code must retain the above copyright
0033  *    notice, this list of conditions and the following disclaimer,
0034  *    without modification.
0035  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0036  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
0037  *    redistribution must be conditioned upon including a substantially
0038  *    similar Disclaimer requirement for further binary redistribution.
0039  * 3. Neither the names of the above-listed copyright holders nor the names
0040  *    of any contributors may be used to endorse or promote products derived
0041  *    from this software without specific prior written permission.
0042  *
0043  * Alternatively, this software may be distributed under the terms of the
0044  * GNU General Public License ("GPL") version 2 as published by the Free
0045  * Software Foundation.
0046  *
0047  * NO WARRANTY
0048  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0049  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0050  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
0051  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
0052  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
0053  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0054  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0055  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
0056  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0057  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
0058  * THE POSSIBILITY OF SUCH DAMAGES.
0059  */
0060 
0061 #ifndef _ATH5K_DEBUG_H
0062 #define _ATH5K_DEBUG_H
0063 
0064 struct ath5k_hw;
0065 struct sk_buff;
0066 struct ath5k_buf;
0067 
0068 struct ath5k_dbg_info {
0069     unsigned int        level;      /* debug level */
0070 };
0071 
0072 /**
0073  * enum ath5k_debug_level - ath5k debug level
0074  *
0075  * @ATH5K_DEBUG_RESET: reset processing
0076  * @ATH5K_DEBUG_INTR: interrupt handling
0077  * @ATH5K_DEBUG_MODE: mode init/setup
0078  * @ATH5K_DEBUG_XMIT: basic xmit operation
0079  * @ATH5K_DEBUG_BEACON: beacon handling
0080  * @ATH5K_DEBUG_CALIBRATE: periodic calibration
0081  * @ATH5K_DEBUG_TXPOWER: transmit power setting
0082  * @ATH5K_DEBUG_LED: led management
0083  * @ATH5K_DEBUG_DUMP_RX: print received skb content
0084  * @ATH5K_DEBUG_DUMP_TX: print transmit skb content
0085  * @ATH5K_DEBUG_DUMPBANDS: dump bands
0086  * @ATH5K_DEBUG_DMA: debug dma start/stop
0087  * @ATH5K_DEBUG_TRACE: trace function calls
0088  * @ATH5K_DEBUG_DESC: descriptor setup
0089  * @ATH5K_DEBUG_ANY: show at any debug level
0090  *
0091  * The debug level is used to control the amount and type of debugging output
0092  * we want to see. The debug level is given in calls to ATH5K_DBG to specify
0093  * where the message should appear, and the user can control the debugging
0094  * messages he wants to see, either by the module parameter 'debug' on module
0095  * load, or dynamically by using debugfs 'ath5k/phyX/debug'. these levels can
0096  * be combined together by bitwise OR.
0097  */
0098 enum ath5k_debug_level {
0099     ATH5K_DEBUG_RESET   = 0x00000001,
0100     ATH5K_DEBUG_INTR    = 0x00000002,
0101     ATH5K_DEBUG_MODE    = 0x00000004,
0102     ATH5K_DEBUG_XMIT    = 0x00000008,
0103     ATH5K_DEBUG_BEACON  = 0x00000010,
0104     ATH5K_DEBUG_CALIBRATE   = 0x00000020,
0105     ATH5K_DEBUG_TXPOWER = 0x00000040,
0106     ATH5K_DEBUG_LED     = 0x00000080,
0107     ATH5K_DEBUG_DUMPBANDS   = 0x00000400,
0108     ATH5K_DEBUG_DMA     = 0x00000800,
0109     ATH5K_DEBUG_ANI     = 0x00002000,
0110     ATH5K_DEBUG_DESC    = 0x00004000,
0111     ATH5K_DEBUG_ANY     = 0xffffffff
0112 };
0113 
0114 #ifdef CONFIG_ATH5K_DEBUG
0115 
0116 #define ATH5K_DBG(_sc, _m, _fmt, ...) do { \
0117     if (unlikely((_sc)->debug.level & (_m) && net_ratelimit())) \
0118         ATH5K_PRINTK(_sc, KERN_DEBUG, "(%s:%d): " _fmt, \
0119             __func__, __LINE__, ##__VA_ARGS__); \
0120     } while (0)
0121 
0122 #define ATH5K_DBG_UNLIMIT(_sc, _m, _fmt, ...) do { \
0123     if (unlikely((_sc)->debug.level & (_m))) \
0124         ATH5K_PRINTK(_sc, KERN_DEBUG, "(%s:%d): " _fmt, \
0125             __func__, __LINE__, ##__VA_ARGS__); \
0126     } while (0)
0127 
0128 void
0129 ath5k_debug_init_device(struct ath5k_hw *ah);
0130 
0131 void
0132 ath5k_debug_printrxbuffs(struct ath5k_hw *ah);
0133 
0134 void
0135 ath5k_debug_dump_bands(struct ath5k_hw *ah);
0136 
0137 void
0138 ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf);
0139 
0140 #else /* no debugging */
0141 
0142 #include <linux/compiler.h>
0143 
0144 static inline __printf(3, 4) void
0145 ATH5K_DBG(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) {}
0146 
0147 static inline __printf(3, 4) void
0148 ATH5K_DBG_UNLIMIT(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...)
0149 {}
0150 
0151 static inline void
0152 ath5k_debug_init_device(struct ath5k_hw *ah) {}
0153 
0154 static inline void
0155 ath5k_debug_printrxbuffs(struct ath5k_hw *ah) {}
0156 
0157 static inline void
0158 ath5k_debug_dump_bands(struct ath5k_hw *ah) {}
0159 
0160 static inline void
0161 ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf) {}
0162 
0163 #endif /* ifdef CONFIG_ATH5K_DEBUG */
0164 
0165 #endif /* ifndef _ATH5K_DEBUG_H */