Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2011 Atheros Communications Inc.
0003  * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
0004  *
0005  * Permission to use, copy, modify, and/or distribute this software for any
0006  * purpose with or without fee is hereby granted, provided that the above
0007  * copyright notice and this permission notice appear in all copies.
0008  *
0009  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0010  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0011  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0012  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0013  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0014  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0015  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0016  */
0017 
0018 #ifndef DEBUG_H
0019 #define DEBUG_H
0020 
0021 #include "hif.h"
0022 #include "trace.h"
0023 
0024 enum ATH6K_DEBUG_MASK {
0025     ATH6KL_DBG_CREDIT   = BIT(0),
0026     /* hole */
0027     ATH6KL_DBG_WLAN_TX      = BIT(2),     /* wlan tx */
0028     ATH6KL_DBG_WLAN_RX      = BIT(3),     /* wlan rx */
0029     ATH6KL_DBG_BMI      = BIT(4),     /* bmi tracing */
0030     ATH6KL_DBG_HTC      = BIT(5),
0031     ATH6KL_DBG_HIF      = BIT(6),
0032     ATH6KL_DBG_IRQ      = BIT(7),     /* interrupt processing */
0033     /* hole */
0034     /* hole */
0035     ATH6KL_DBG_WMI          = BIT(10),    /* wmi tracing */
0036     ATH6KL_DBG_TRC          = BIT(11),    /* generic func tracing */
0037     ATH6KL_DBG_SCATTER  = BIT(12),    /* hif scatter tracing */
0038     ATH6KL_DBG_WLAN_CFG     = BIT(13),    /* cfg80211 i/f file tracing */
0039     ATH6KL_DBG_RAW_BYTES    = BIT(14),    /* dump tx/rx frames */
0040     ATH6KL_DBG_AGGR     = BIT(15),    /* aggregation */
0041     ATH6KL_DBG_SDIO     = BIT(16),
0042     ATH6KL_DBG_SDIO_DUMP    = BIT(17),
0043     ATH6KL_DBG_BOOT     = BIT(18),    /* driver init and fw boot */
0044     ATH6KL_DBG_WMI_DUMP = BIT(19),
0045     ATH6KL_DBG_SUSPEND  = BIT(20),
0046     ATH6KL_DBG_USB      = BIT(21),
0047     ATH6KL_DBG_USB_BULK = BIT(22),
0048     ATH6KL_DBG_RECOVERY = BIT(23),
0049     ATH6KL_DBG_ANY          = 0xffffffff  /* enable all logs */
0050 };
0051 
0052 extern unsigned int debug_mask;
0053 __printf(2, 3) void ath6kl_printk(const char *level, const char *fmt, ...);
0054 __printf(1, 2) void ath6kl_info(const char *fmt, ...);
0055 __printf(1, 2) void ath6kl_err(const char *fmt, ...);
0056 __printf(1, 2) void ath6kl_warn(const char *fmt, ...);
0057 
0058 enum ath6kl_war {
0059     ATH6KL_WAR_INVALID_RATE,
0060 };
0061 
0062 int ath6kl_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif);
0063 
0064 #ifdef CONFIG_ATH6KL_DEBUG
0065 
0066 __printf(2, 3)
0067 void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...);
0068 void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
0069              const char *msg, const char *prefix,
0070              const void *buf, size_t len);
0071 
0072 void ath6kl_dump_registers(struct ath6kl_device *dev,
0073                struct ath6kl_irq_proc_registers *irq_proc_reg,
0074                struct ath6kl_irq_enable_reg *irq_en_reg);
0075 void dump_cred_dist_stats(struct htc_target *target);
0076 void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len);
0077 void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war);
0078 int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf,
0079                 size_t len);
0080 void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive);
0081 void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout);
0082 void ath6kl_debug_init(struct ath6kl *ar);
0083 int ath6kl_debug_init_fs(struct ath6kl *ar);
0084 void ath6kl_debug_cleanup(struct ath6kl *ar);
0085 
0086 #else
0087 __printf(2, 3)
0088 static inline void ath6kl_dbg(enum ATH6K_DEBUG_MASK dbg_mask,
0089                   const char *fmt, ...)
0090 {
0091 }
0092 
0093 static inline void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
0094                    const char *msg, const char *prefix,
0095                    const void *buf, size_t len)
0096 {
0097 }
0098 
0099 static inline void ath6kl_dump_registers(struct ath6kl_device *dev,
0100         struct ath6kl_irq_proc_registers *irq_proc_reg,
0101         struct ath6kl_irq_enable_reg *irq_en_reg)
0102 {
0103 }
0104 
0105 static inline void dump_cred_dist_stats(struct htc_target *target)
0106 {
0107 }
0108 
0109 static inline void ath6kl_debug_fwlog_event(struct ath6kl *ar,
0110                         const void *buf, size_t len)
0111 {
0112 }
0113 
0114 static inline void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war)
0115 {
0116 }
0117 
0118 static inline int ath6kl_debug_roam_tbl_event(struct ath6kl *ar,
0119                           const void *buf, size_t len)
0120 {
0121     return 0;
0122 }
0123 
0124 static inline void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
0125 {
0126 }
0127 
0128 static inline void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar,
0129                                u8 timeout)
0130 {
0131 }
0132 
0133 static inline void ath6kl_debug_init(struct ath6kl *ar)
0134 {
0135 }
0136 
0137 static inline int ath6kl_debug_init_fs(struct ath6kl *ar)
0138 {
0139     return 0;
0140 }
0141 
0142 static inline void ath6kl_debug_cleanup(struct ath6kl *ar)
0143 {
0144 }
0145 
0146 #endif
0147 #endif