linux/drivers/staging/rtl8723bs/include/rtw_debug.h
<<
>>
Prefs
   1/******************************************************************************
   2 *
   3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
   4 *
   5 * This program is free software; you can redistribute it and/or modify it
   6 * under the terms of version 2 of the GNU General Public License as
   7 * published by the Free Software Foundation.
   8 *
   9 * This program is distributed in the hope that it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12 * more details.
  13 *
  14 ******************************************************************************/
  15#ifndef __RTW_DEBUG_H__
  16#define __RTW_DEBUG_H__
  17
  18#include <linux/trace_seq.h>
  19
  20#define _drv_always_            1
  21#define _drv_emerg_                     2
  22#define _drv_alert_                     3
  23#define _drv_crit_                      4
  24#define _drv_err_                       5
  25#define _drv_warning_           6
  26#define _drv_notice_            7
  27#define _drv_info_                      8
  28#define _drv_dump_                      9
  29#define _drv_debug_                     10
  30
  31
  32#define _module_rtl871x_xmit_c_         BIT(0)
  33#define _module_xmit_osdep_c_           BIT(1)
  34#define _module_rtl871x_recv_c_         BIT(2)
  35#define _module_recv_osdep_c_           BIT(3)
  36#define _module_rtl871x_mlme_c_         BIT(4)
  37#define _module_mlme_osdep_c_           BIT(5)
  38#define _module_rtl871x_sta_mgt_c_              BIT(6)
  39#define _module_rtl871x_cmd_c_                  BIT(7)
  40#define _module_cmd_osdep_c_            BIT(8)
  41#define _module_rtl871x_io_c_                           BIT(9)
  42#define _module_io_osdep_c_             BIT(10)
  43#define _module_os_intfs_c_                     BIT(11)
  44#define _module_rtl871x_security_c_             BIT(12)
  45#define _module_rtl871x_eeprom_c_                       BIT(13)
  46#define _module_hal_init_c_             BIT(14)
  47#define _module_hci_hal_init_c_         BIT(15)
  48#define _module_rtl871x_ioctl_c_                BIT(16)
  49#define _module_rtl871x_ioctl_set_c_            BIT(17)
  50#define _module_rtl871x_ioctl_query_c_  BIT(18)
  51#define _module_rtl871x_pwrctrl_c_                      BIT(19)
  52#define _module_hci_intfs_c_                    BIT(20)
  53#define _module_hci_ops_c_                      BIT(21)
  54#define _module_osdep_service_c_                        BIT(22)
  55#define _module_mp_                     BIT(23)
  56#define _module_hci_ops_os_c_                   BIT(24)
  57#define _module_rtl871x_ioctl_os_c              BIT(25)
  58#define _module_rtl8712_cmd_c_          BIT(26)
  59/* define _module_efuse_                        BIT(27) */
  60#define _module_rtl8192c_xmit_c_ BIT(28)
  61#define _module_hal_xmit_c_     BIT(28)
  62#define _module_efuse_                  BIT(29)
  63#define _module_rtl8712_recv_c_         BIT(30)
  64#define _module_rtl8712_led_c_          BIT(31)
  65
  66#undef _MODULE_DEFINE_
  67
  68#if defined _RTW_XMIT_C_
  69        #define _MODULE_DEFINE_ _module_rtl871x_xmit_c_
  70#elif defined _XMIT_OSDEP_C_
  71        #define _MODULE_DEFINE_ _module_xmit_osdep_c_
  72#elif defined _RTW_RECV_C_
  73        #define _MODULE_DEFINE_ _module_rtl871x_recv_c_
  74#elif defined _RECV_OSDEP_C_
  75        #define _MODULE_DEFINE_ _module_recv_osdep_c_
  76#elif defined _RTW_MLME_C_
  77        #define _MODULE_DEFINE_ _module_rtl871x_mlme_c_
  78#elif defined _MLME_OSDEP_C_
  79        #define _MODULE_DEFINE_ _module_mlme_osdep_c_
  80#elif defined _RTW_MLME_EXT_C_
  81        #define _MODULE_DEFINE_ 1
  82#elif defined _RTW_STA_MGT_C_
  83        #define _MODULE_DEFINE_ _module_rtl871x_sta_mgt_c_
  84#elif defined _RTW_CMD_C_
  85        #define _MODULE_DEFINE_ _module_rtl871x_cmd_c_
  86#elif defined _CMD_OSDEP_C_
  87        #define _MODULE_DEFINE_ _module_cmd_osdep_c_
  88#elif defined _RTW_IO_C_
  89        #define _MODULE_DEFINE_ _module_rtl871x_io_c_
  90#elif defined _IO_OSDEP_C_
  91        #define _MODULE_DEFINE_ _module_io_osdep_c_
  92#elif defined _OS_INTFS_C_
  93        #define _MODULE_DEFINE_ _module_os_intfs_c_
  94#elif defined _RTW_SECURITY_C_
  95        #define _MODULE_DEFINE_ _module_rtl871x_security_c_
  96#elif defined _RTW_EEPROM_C_
  97        #define _MODULE_DEFINE_ _module_rtl871x_eeprom_c_
  98#elif defined _HAL_INTF_C_
  99        #define _MODULE_DEFINE_ _module_hal_init_c_
 100#elif (defined _HCI_HAL_INIT_C_) || (defined _SDIO_HALINIT_C_)
 101        #define _MODULE_DEFINE_ _module_hci_hal_init_c_
 102#elif defined _RTL871X_IOCTL_C_
 103        #define _MODULE_DEFINE_ _module_rtl871x_ioctl_c_
 104#elif defined _RTL871X_IOCTL_SET_C_
 105        #define _MODULE_DEFINE_ _module_rtl871x_ioctl_set_c_
 106#elif defined _RTL871X_IOCTL_QUERY_C_
 107        #define _MODULE_DEFINE_ _module_rtl871x_ioctl_query_c_
 108#elif defined _RTL871X_PWRCTRL_C_
 109        #define _MODULE_DEFINE_ _module_rtl871x_pwrctrl_c_
 110#elif defined _RTW_PWRCTRL_C_
 111        #define _MODULE_DEFINE_ 1
 112#elif defined _HCI_INTF_C_
 113        #define _MODULE_DEFINE_ _module_hci_intfs_c_
 114#elif defined _HCI_OPS_C_
 115        #define _MODULE_DEFINE_ _module_hci_ops_c_
 116#elif defined _SDIO_OPS_C_
 117        #define _MODULE_DEFINE_ 1
 118#elif defined _OSDEP_HCI_INTF_C_
 119        #define _MODULE_DEFINE_ _module_hci_intfs_c_
 120#elif defined _OSDEP_SERVICE_C_
 121        #define _MODULE_DEFINE_ _module_osdep_service_c_
 122#elif defined _HCI_OPS_OS_C_
 123        #define _MODULE_DEFINE_ _module_hci_ops_os_c_
 124#elif defined _RTL871X_IOCTL_LINUX_C_
 125        #define _MODULE_DEFINE_ _module_rtl871x_ioctl_os_c
 126#elif defined _RTL8712_CMD_C_
 127        #define _MODULE_DEFINE_ _module_rtl8712_cmd_c_
 128#elif defined _RTL8192C_XMIT_C_
 129        #define _MODULE_DEFINE_ 1
 130#elif defined _RTL8723AS_XMIT_C_
 131        #define _MODULE_DEFINE_ 1
 132#elif defined _RTL8712_RECV_C_
 133        #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
 134#elif defined _RTL8192CU_RECV_C_
 135        #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
 136#elif defined _RTL871X_MLME_EXT_C_
 137        #define _MODULE_DEFINE_ _module_mlme_osdep_c_
 138#elif defined _RTW_EFUSE_C_
 139        #define _MODULE_DEFINE_ _module_efuse_
 140#endif
 141
 142#define RT_TRACE(_Comp, _Level, Fmt) do{}while (0)
 143#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) do{}while (0)
 144
 145#define DBG_871X(x, ...) do {} while (0)
 146#define MSG_8192C(x, ...) do {} while (0)
 147#define DBG_8192C(x,...) do {} while (0)
 148#define DBG_871X_LEVEL(x,...) do {} while (0)
 149
 150#undef _dbgdump
 151
 152#ifndef _RTL871X_DEBUG_C_
 153        extern u32 GlobalDebugLevel;
 154        extern u64 GlobalDebugComponents;
 155#endif
 156
 157#define _dbgdump printk
 158
 159#define DRIVER_PREFIX "RTL8723BS: "
 160
 161#if defined(_dbgdump)
 162
 163/* with driver-defined prefix */
 164#undef DBG_871X_LEVEL
 165#define DBG_871X_LEVEL(level, fmt, arg...)     \
 166        do {\
 167                if (level <= GlobalDebugLevel) {\
 168                        if (level <= _drv_err_ && level > _drv_always_) \
 169                                _dbgdump(DRIVER_PREFIX"ERROR " fmt, ##arg);\
 170                        else \
 171                                _dbgdump(DRIVER_PREFIX fmt, ##arg);\
 172                }\
 173        }while (0)
 174
 175/* without driver-defined prefix */
 176#undef _DBG_871X_LEVEL
 177#define _DBG_871X_LEVEL(level, fmt, arg...)        \
 178        do {\
 179                if (level <= GlobalDebugLevel) {\
 180                        if (level <= _drv_err_ && level > _drv_always_) \
 181                                _dbgdump("ERROR " fmt, ##arg);\
 182                        else \
 183                                _dbgdump(fmt, ##arg);\
 184                }\
 185        }while (0)
 186
 187#define RTW_DBGDUMP NULL /* 'stream' for _dbgdump */
 188
 189/* dump message to selected 'stream' */
 190#define DBG_871X_SEL(sel, fmt, arg...)                                  \
 191        do {                                                            \
 192                if (sel == RTW_DBGDUMP)                                 \
 193                        _DBG_871X_LEVEL(_drv_always_, fmt, ##arg);      \
 194                else                                                    \
 195                        seq_printf(sel, fmt, ##arg);                    \
 196        } while (0)
 197
 198/* dump message to selected 'stream' with driver-defined prefix */
 199#define DBG_871X_SEL_NL(sel, fmt, arg...)                               \
 200        do {                                                            \
 201                if (sel == RTW_DBGDUMP)                                 \
 202                        DBG_871X_LEVEL(_drv_always_, fmt, ##arg);       \
 203                else                                                    \
 204                        seq_printf(sel, fmt, ##arg);                    \
 205        } while (0)
 206
 207#endif /* defined(_dbgdump) */
 208
 209#ifdef DEBUG
 210#if     defined(_dbgdump)
 211        #undef DBG_871X
 212        #define DBG_871X(...)     do {\
 213                _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
 214        }while (0)
 215
 216        #undef MSG_8192C
 217        #define MSG_8192C(...)     do {\
 218                _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
 219        }while (0)
 220
 221        #undef DBG_8192C
 222        #define DBG_8192C(...)     do {\
 223                _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
 224        }while (0)
 225#endif /* defined(_dbgdump) */
 226#endif /* DEBUG */
 227
 228#ifdef DEBUG_RTL871X
 229
 230#if     defined(_dbgdump) && defined(_MODULE_DEFINE_)
 231
 232        #undef RT_TRACE
 233        #define RT_TRACE(_Comp, _Level, Fmt)\
 234        do {\
 235                if ((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
 236                        _dbgdump("%s [0x%08x,%d]", DRIVER_PREFIX, (unsigned int)_Comp, _Level);\
 237                        _dbgdump Fmt;\
 238                }\
 239        }while (0)
 240
 241#endif /* defined(_dbgdump) && defined(_MODULE_DEFINE_) */
 242
 243
 244#if     defined(_dbgdump)
 245        #undef RT_PRINT_DATA
 246        #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen)                       \
 247                if (((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel))  \
 248                {                                                                       \
 249                        int __i;                                                                \
 250                        u8 *ptr = (u8 *)_HexData;                               \
 251                        _dbgdump("%s", DRIVER_PREFIX);                                          \
 252                        _dbgdump(_TitleString);                                         \
 253                        for (__i = 0; __i<(int)_HexDataLen; __i++)                              \
 254                        {                                                               \
 255                                _dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?"  ":" ");  \
 256                                if (((__i + 1) % 16) == 0)      _dbgdump("\n");                 \
 257                        }                                                               \
 258                        _dbgdump("\n");                                                 \
 259                }
 260#endif /* defined(_dbgdump) */
 261#endif /* DEBUG_RTL871X */
 262
 263#ifdef CONFIG_DBG_COUNTER
 264#define DBG_COUNTER(counter) counter++
 265#else
 266#define DBG_COUNTER(counter) do {} while (0)
 267#endif
 268
 269void dump_drv_version(void *sel);
 270void dump_log_level(void *sel);
 271
 272void sd_f0_reg_dump(void *sel, struct adapter *adapter);
 273
 274void mac_reg_dump(void *sel, struct adapter *adapter);
 275void bb_reg_dump(void *sel, struct adapter *adapter);
 276void rf_reg_dump(void *sel, struct adapter *adapter);
 277
 278#ifdef PROC_DEBUG
 279ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 280int proc_get_read_reg(struct seq_file *m, void *v);
 281ssize_t proc_set_read_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 282
 283int proc_get_fwstate(struct seq_file *m, void *v);
 284int proc_get_sec_info(struct seq_file *m, void *v);
 285int proc_get_mlmext_state(struct seq_file *m, void *v);
 286
 287int proc_get_roam_flags(struct seq_file *m, void *v);
 288ssize_t proc_set_roam_flags(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 289int proc_get_roam_param(struct seq_file *m, void *v);
 290ssize_t proc_set_roam_param(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 291ssize_t proc_set_roam_tgt_addr(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 292
 293int proc_get_qos_option(struct seq_file *m, void *v);
 294int proc_get_ht_option(struct seq_file *m, void *v);
 295int proc_get_rf_info(struct seq_file *m, void *v);
 296int proc_get_survey_info(struct seq_file *m, void *v);
 297int proc_get_ap_info(struct seq_file *m, void *v);
 298int proc_get_adapter_state(struct seq_file *m, void *v);
 299int proc_get_trx_info(struct seq_file *m, void *v);
 300int proc_get_rate_ctl(struct seq_file *m, void *v);
 301ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 302int proc_get_suspend_resume_info(struct seq_file *m, void *v);
 303
 304ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 305ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 306
 307int proc_get_all_sta_info(struct seq_file *m, void *v);
 308
 309int proc_get_rx_signal(struct seq_file *m, void *v);
 310ssize_t proc_set_rx_signal(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 311int proc_get_hw_status(struct seq_file *m, void *v);
 312
 313int proc_get_ht_enable(struct seq_file *m, void *v);
 314ssize_t proc_set_ht_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 315
 316int proc_get_bw_mode(struct seq_file *m, void *v);
 317ssize_t proc_set_bw_mode(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 318
 319int proc_get_ampdu_enable(struct seq_file *m, void *v);
 320ssize_t proc_set_ampdu_enable(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 321
 322int proc_get_rx_ampdu(struct seq_file *m, void *v);
 323ssize_t proc_set_rx_ampdu(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 324
 325int proc_get_rx_stbc(struct seq_file *m, void *v);
 326ssize_t proc_set_rx_stbc(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 327
 328int proc_get_en_fwps(struct seq_file *m, void *v);
 329ssize_t proc_set_en_fwps(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 330
 331/* int proc_get_two_path_rssi(struct seq_file *m, void *v); */
 332int proc_get_rssi_disp(struct seq_file *m, void *v);
 333ssize_t proc_set_rssi_disp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 334
 335int proc_get_btcoex_dbg(struct seq_file *m, void *v);
 336ssize_t proc_set_btcoex_dbg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 337int proc_get_btcoex_info(struct seq_file *m, void *v);
 338
 339int proc_get_odm_dbg_comp(struct seq_file *m, void *v);
 340ssize_t proc_set_odm_dbg_comp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 341int proc_get_odm_dbg_level(struct seq_file *m, void *v);
 342ssize_t proc_set_odm_dbg_level(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 343
 344int proc_get_odm_adaptivity(struct seq_file *m, void *v);
 345ssize_t proc_set_odm_adaptivity(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
 346
 347#ifdef CONFIG_DBG_COUNTER
 348int proc_get_rx_logs(struct seq_file *m, void *v);
 349int proc_get_tx_logs(struct seq_file *m, void *v);
 350int proc_get_int_logs(struct seq_file *m, void *v);
 351#endif
 352
 353#endif /* PROC_DEBUG */
 354
 355#endif  /* __RTW_DEBUG_H__ */
 356