1 /* 2 * Copyright (c) 2010 Broadcom Corporation 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef _wl_dbg_h_ 18 #define _wl_dbg_h_ 19 20 /* wl_msg_level is a bit vector with defs in wlioctl.h */ 21 extern u32 wl_msg_level; 22 23 #define WL_NONE(fmt, args...) no_printk(fmt, ##args) 24 25 #define WL_PRINT(level, fmt, args...) \ 26 do { \ 27 if (wl_msg_level & level) \ 28 printk(fmt, ##args); \ 29 } while (0) 30 31 #ifdef BCMDBG 32 33 #define WL_ERROR(fmt, args...) WL_PRINT(WL_ERROR_VAL, fmt, ##args) 34 #define WL_TRACE(fmt, args...) WL_PRINT(WL_TRACE_VAL, fmt, ##args) 35 #define WL_AMPDU(fmt, args...) WL_PRINT(WL_AMPDU_VAL, fmt, ##args) 36 #define WL_FFPLD(fmt, args...) WL_PRINT(WL_FFPLD_VAL, fmt, ##args) 37 38 #define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL) 39 40 /* Extra message control for AMPDU debugging */ 41 #define WL_AMPDU_UPDN_VAL 0x00000001 /* Config up/down related */ 42 #define WL_AMPDU_ERR_VAL 0x00000002 /* Calls to beaocn update */ 43 #define WL_AMPDU_TX_VAL 0x00000004 /* Transmit data path */ 44 #define WL_AMPDU_RX_VAL 0x00000008 /* Receive data path */ 45 #define WL_AMPDU_CTL_VAL 0x00000010 /* TSF-related items */ 46 #define WL_AMPDU_HW_VAL 0x00000020 /* AMPDU_HW */ 47 #define WL_AMPDU_HWTXS_VAL 0x00000040 /* AMPDU_HWTXS */ 48 #define WL_AMPDU_HWDBG_VAL 0x00000080 /* AMPDU_DBG */ 49 50 extern u32 wl_ampdu_dbg; 51 52 #define WL_AMPDU_PRINT(level, fmt, args...) \ 53 do { \ 54 if (wl_ampdu_dbg & level) { \ 55 WL_AMPDU(fmt, ##args); \ 56 } \ 57 } while (0) 58 59 #define WL_AMPDU_UPDN(fmt, args...) \ 60 WL_AMPDU_PRINT(WL_AMPDU_UPDN_VAL, fmt, ##args) 61 #define WL_AMPDU_RX(fmt, args...) \ 62 WL_AMPDU_PRINT(WL_AMPDU_RX_VAL, fmt, ##args) 63 #define WL_AMPDU_ERR(fmt, args...) \ 64 WL_AMPDU_PRINT(WL_AMPDU_ERR_VAL, fmt, ##args) 65 #define WL_AMPDU_TX(fmt, args...) \ 66 WL_AMPDU_PRINT(WL_AMPDU_TX_VAL, fmt, ##args) 67 #define WL_AMPDU_CTL(fmt, args...) \ 68 WL_AMPDU_PRINT(WL_AMPDU_CTL_VAL, fmt, ##args) 69 #define WL_AMPDU_HW(fmt, args...) \ 70 WL_AMPDU_PRINT(WL_AMPDU_HW_VAL, fmt, ##args) 71 #define WL_AMPDU_HWTXS(fmt, args...) \ 72 WL_AMPDU_PRINT(WL_AMPDU_HWTXS_VAL, fmt, ##args) 73 #define WL_AMPDU_HWDBG(fmt, args...) \ 74 WL_AMPDU_PRINT(WL_AMPDU_HWDBG_VAL, fmt, ##args) 75 #define WL_AMPDU_ERR_ON() (wl_ampdu_dbg & WL_AMPDU_ERR_VAL) 76 #define WL_AMPDU_HW_ON() (wl_ampdu_dbg & WL_AMPDU_HW_VAL) 77 #define WL_AMPDU_HWTXS_ON() (wl_ampdu_dbg & WL_AMPDU_HWTXS_VAL) 78 79 #else /* BCMDBG */ 80 81 #define WL_ERROR(fmt, args...) no_printk(fmt, ##args) 82 #define WL_TRACE(fmt, args...) no_printk(fmt, ##args) 83 #define WL_AMPDU(fmt, args...) no_printk(fmt, ##args) 84 #define WL_FFPLD(fmt, args...) no_printk(fmt, ##args) 85 86 #define WL_ERROR_ON() 0 87 88 #define WL_AMPDU_UPDN(fmt, args...) no_printk(fmt, ##args) 89 #define WL_AMPDU_RX(fmt, args...) no_printk(fmt, ##args) 90 #define WL_AMPDU_ERR(fmt, args...) no_printk(fmt, ##args) 91 #define WL_AMPDU_TX(fmt, args...) no_printk(fmt, ##args) 92 #define WL_AMPDU_CTL(fmt, args...) no_printk(fmt, ##args) 93 #define WL_AMPDU_HW(fmt, args...) no_printk(fmt, ##args) 94 #define WL_AMPDU_HWTXS(fmt, args...) no_printk(fmt, ##args) 95 #define WL_AMPDU_HWDBG(fmt, args...) no_printk(fmt, ##args) 96 #define WL_AMPDU_ERR_ON() 0 97 #define WL_AMPDU_HW_ON() 0 98 #define WL_AMPDU_HWTXS_ON() 0 99 100 #endif /* BCMDBG */ 101 102 #endif /* _wl_dbg_h_ */ 103