1 // SPDX-License-Identifier: GPL-2.0 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. 5 * 6 ******************************************************************************/ 7 #define _RTW_DEBUG_C_ 8 9 #include <drv_types.h> 10 #include <rtw_debug.h> 11 #include <hal_btcoex.h> 12 13 u32 GlobalDebugLevel = _drv_err_; 14 15 #ifdef DEBUG_RTL871X 16 17 u64 GlobalDebugComponents = \ 18 _module_rtl871x_xmit_c_ | 19 _module_xmit_osdep_c_ | 20 _module_rtl871x_recv_c_ | 21 _module_recv_osdep_c_ | 22 _module_rtl871x_mlme_c_ | 23 _module_mlme_osdep_c_ | 24 _module_rtl871x_sta_mgt_c_ | 25 _module_rtl871x_cmd_c_ | 26 _module_cmd_osdep_c_ | 27 _module_rtl871x_io_c_ | 28 _module_io_osdep_c_ | 29 _module_os_intfs_c_| 30 _module_rtl871x_security_c_| 31 _module_rtl871x_eeprom_c_| 32 _module_hal_init_c_| 33 _module_hci_hal_init_c_| 34 _module_rtl871x_ioctl_c_| 35 _module_rtl871x_ioctl_set_c_| 36 _module_rtl871x_ioctl_query_c_| 37 _module_rtl871x_pwrctrl_c_| 38 _module_hci_intfs_c_| 39 _module_hci_ops_c_| 40 _module_hci_ops_os_c_| 41 _module_rtl871x_ioctl_os_c| 42 _module_rtl8712_cmd_c_| 43 _module_hal_xmit_c_| 44 _module_rtl8712_recv_c_ | 45 _module_mp_ | 46 _module_efuse_; 47 48 #endif /* DEBUG_RTL871X */ 49 50 #include <rtw_version.h> 51 52 void dump_drv_version(void *sel) 53 { 54 DBG_871X_SEL_NL(sel, "%s %s\n", "rtl8723bs", DRIVERVERSION); 55 } 56 57 void dump_log_level(void *sel) 58 { 59 DBG_871X_SEL_NL(sel, "log_level:%d\n", GlobalDebugLevel); 60 } 61 62 void sd_f0_reg_dump(void *sel, struct adapter *adapter) 63 { 64 int i; 65 66 for (i = 0x0; i <= 0xff; i++) { 67 if (i%16 == 0) 68 DBG_871X_SEL_NL(sel, "0x%02x ", i); 69 70 DBG_871X_SEL(sel, "%02x ", rtw_sd_f0_read8(adapter, i)); 71 72 if (i%16 == 15) 73 DBG_871X_SEL(sel, "\n"); 74 else if (i%8 == 7) 75 DBG_871X_SEL(sel, "\t"); 76 } 77 } 78 79 void mac_reg_dump(void *sel, struct adapter *adapter) 80 { 81 int i, j = 1; 82 83 DBG_871X_SEL_NL(sel, "======= MAC REG =======\n"); 84 85 for (i = 0x0; i < 0x800; i += 4) { 86 if (j%4 == 1) 87 DBG_871X_SEL_NL(sel, "0x%03x", i); 88 DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i)); 89 if ((j++)%4 == 0) 90 DBG_871X_SEL(sel, "\n"); 91 } 92 } 93 94 void bb_reg_dump(void *sel, struct adapter *adapter) 95 { 96 int i, j = 1; 97 98 DBG_871X_SEL_NL(sel, "======= BB REG =======\n"); 99 for (i = 0x800; i < 0x1000 ; i += 4) { 100 if (j%4 == 1) 101 DBG_871X_SEL_NL(sel, "0x%03x", i); 102 DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i)); 103 if ((j++)%4 == 0) 104 DBG_871X_SEL(sel, "\n"); 105 } 106 } 107 108 void rf_reg_dump(void *sel, struct adapter *adapter) 109 { 110 int i, j = 1, path; 111 u32 value; 112 u8 rf_type = 0; 113 u8 path_nums = 0; 114 115 rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); 116 if ((RF_1T2R == rf_type) || (RF_1T1R == rf_type)) 117 path_nums = 1; 118 else 119 path_nums = 2; 120 121 DBG_871X_SEL_NL(sel, "======= RF REG =======\n"); 122 123 for (path = 0; path < path_nums; path++) { 124 DBG_871X_SEL_NL(sel, "RF_Path(%x)\n", path); 125 for (i = 0; i < 0x100; i++) { 126 value = rtw_hal_read_rfreg(adapter, path, i, 0xffffffff); 127 if (j%4 == 1) 128 DBG_871X_SEL_NL(sel, "0x%02x ", i); 129 DBG_871X_SEL(sel, " 0x%08x ", value); 130 if ((j++)%4 == 0) 131 DBG_871X_SEL(sel, "\n"); 132 } 133 } 134 } 135