rtw_debug.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __RTW_DEBUG_H__
  21. #define __RTW_DEBUG_H__
  22. #define _drv_always_ 1
  23. #define _drv_emerg_ 2
  24. #define _drv_alert_ 3
  25. #define _drv_crit_ 4
  26. #define _drv_err_ 5
  27. #define _drv_warning_ 6
  28. #define _drv_notice_ 7
  29. #define _drv_info_ 8
  30. #define _drv_dump_ 9
  31. #define _drv_debug_ 10
  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. #undef _MODULE_DEFINE_
  66. #if defined _RTW_XMIT_C_
  67. #define _MODULE_DEFINE_ _module_rtl871x_xmit_c_
  68. #elif defined _XMIT_OSDEP_C_
  69. #define _MODULE_DEFINE_ _module_xmit_osdep_c_
  70. #elif defined _RTW_RECV_C_
  71. #define _MODULE_DEFINE_ _module_rtl871x_recv_c_
  72. #elif defined _RECV_OSDEP_C_
  73. #define _MODULE_DEFINE_ _module_recv_osdep_c_
  74. #elif defined _RTW_MLME_C_
  75. #define _MODULE_DEFINE_ _module_rtl871x_mlme_c_
  76. #elif defined _MLME_OSDEP_C_
  77. #define _MODULE_DEFINE_ _module_mlme_osdep_c_
  78. #elif defined _RTW_MLME_EXT_C_
  79. #define _MODULE_DEFINE_ 1
  80. #elif defined _RTW_STA_MGT_C_
  81. #define _MODULE_DEFINE_ _module_rtl871x_sta_mgt_c_
  82. #elif defined _RTW_CMD_C_
  83. #define _MODULE_DEFINE_ _module_rtl871x_cmd_c_
  84. #elif defined _CMD_OSDEP_C_
  85. #define _MODULE_DEFINE_ _module_cmd_osdep_c_
  86. #elif defined _RTW_IO_C_
  87. #define _MODULE_DEFINE_ _module_rtl871x_io_c_
  88. #elif defined _IO_OSDEP_C_
  89. #define _MODULE_DEFINE_ _module_io_osdep_c_
  90. #elif defined _OS_INTFS_C_
  91. #define _MODULE_DEFINE_ _module_os_intfs_c_
  92. #elif defined _RTW_SECURITY_C_
  93. #define _MODULE_DEFINE_ _module_rtl871x_security_c_
  94. #elif defined _RTW_EEPROM_C_
  95. #define _MODULE_DEFINE_ _module_rtl871x_eeprom_c_
  96. #elif defined _HAL_INTF_C_
  97. #define _MODULE_DEFINE_ _module_hal_init_c_
  98. #elif (defined _HCI_HAL_INIT_C_) || (defined _SDIO_HALINIT_C_)
  99. #define _MODULE_DEFINE_ _module_hci_hal_init_c_
  100. #elif defined _RTL871X_IOCTL_C_
  101. #define _MODULE_DEFINE_ _module_rtl871x_ioctl_c_
  102. #elif defined _RTL871X_IOCTL_SET_C_
  103. #define _MODULE_DEFINE_ _module_rtl871x_ioctl_set_c_
  104. #elif defined _RTL871X_IOCTL_QUERY_C_
  105. #define _MODULE_DEFINE_ _module_rtl871x_ioctl_query_c_
  106. #elif defined _RTL871X_PWRCTRL_C_
  107. #define _MODULE_DEFINE_ _module_rtl871x_pwrctrl_c_
  108. #elif defined _RTW_PWRCTRL_C_
  109. #define _MODULE_DEFINE_ 1
  110. #elif defined _HCI_INTF_C_
  111. #define _MODULE_DEFINE_ _module_hci_intfs_c_
  112. #elif defined _HCI_OPS_C_
  113. #define _MODULE_DEFINE_ _module_hci_ops_c_
  114. #elif defined _SDIO_OPS_C_
  115. #define _MODULE_DEFINE_ 1
  116. #elif defined _OSDEP_HCI_INTF_C_
  117. #define _MODULE_DEFINE_ _module_hci_intfs_c_
  118. #elif defined _OSDEP_SERVICE_C_
  119. #define _MODULE_DEFINE_ _module_osdep_service_c_
  120. #elif defined _HCI_OPS_OS_C_
  121. #define _MODULE_DEFINE_ _module_hci_ops_os_c_
  122. #elif defined _RTL871X_IOCTL_LINUX_C_
  123. #define _MODULE_DEFINE_ _module_rtl871x_ioctl_os_c
  124. #elif defined _RTL8712_CMD_C_
  125. #define _MODULE_DEFINE_ _module_rtl8712_cmd_c_
  126. #elif defined _RTL8192C_XMIT_C_
  127. #define _MODULE_DEFINE_ 1
  128. #elif defined _RTL8723AS_XMIT_C_
  129. #define _MODULE_DEFINE_ 1
  130. #elif defined _RTL8712_RECV_C_
  131. #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
  132. #elif defined _RTL8192CU_RECV_C_
  133. #define _MODULE_DEFINE_ _module_rtl8712_recv_c_
  134. #elif defined _RTL871X_MLME_EXT_C_
  135. #define _MODULE_DEFINE_ _module_mlme_osdep_c_
  136. #elif defined _RTW_MP_C_
  137. #define _MODULE_DEFINE_ _module_mp_
  138. #elif defined _RTW_MP_IOCTL_C_
  139. #define _MODULE_DEFINE_ _module_mp_
  140. #elif defined _RTW_EFUSE_C_
  141. #define _MODULE_DEFINE_ _module_efuse_
  142. #endif
  143. #ifdef PLATFORM_OS_CE
  144. extern void rtl871x_cedbg(const char *fmt, ...);
  145. #endif
  146. #define RT_TRACE(_Comp, _Level, Fmt) do{}while(0)
  147. #define _func_enter_ do{}while(0)
  148. #define _func_exit_ do{}while(0)
  149. #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) do{}while(0)
  150. #ifdef PLATFORM_WINDOWS
  151. #define DBG_871X do {} while(0)
  152. #define MSG_8192C do {} while(0)
  153. #define DBG_8192C do {} while(0)
  154. #define DBG_871X_LEVEL do {} while(0)
  155. #else
  156. #define DBG_871X(x, ...) do {} while(0)
  157. #define MSG_8192C(x, ...) do {} while(0)
  158. #define DBG_8192C(x,...) do {} while(0)
  159. #define DBG_871X_LEVEL(x,...) do {} while(0)
  160. #endif
  161. #undef _dbgdump
  162. #ifdef PLATFORM_WINDOWS
  163. #ifdef PLATFORM_OS_XP
  164. #define _dbgdump DbgPrint
  165. #elif defined PLATFORM_OS_CE
  166. #define _dbgdump rtl871x_cedbg
  167. #endif
  168. #elif defined PLATFORM_LINUX
  169. #define _dbgdump printk
  170. #elif defined PLATFORM_FREEBSD
  171. #define _dbgdump printf
  172. #endif
  173. #define DRIVER_PREFIX "RTL871X: "
  174. #define DEBUG_LEVEL (_drv_err_)
  175. #if defined (_dbgdump)
  176. #undef DBG_871X_LEVEL
  177. #define DBG_871X_LEVEL(level, fmt, arg...) \
  178. do {\
  179. if (level <= DEBUG_LEVEL) {\
  180. if (level <= _drv_err_ && level > _drv_always_) \
  181. _dbgdump(DRIVER_PREFIX"ERROR " fmt, ##arg);\
  182. else \
  183. _dbgdump(DRIVER_PREFIX fmt, ##arg);\
  184. }\
  185. }while(0)
  186. #endif
  187. #ifdef CONFIG_DEBUG
  188. #if defined (_dbgdump)
  189. #undef DBG_871X
  190. #define DBG_871X(...) do {\
  191. _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
  192. }while(0)
  193. #undef MSG_8192C
  194. #define MSG_8192C(...) do {\
  195. _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
  196. }while(0)
  197. #undef DBG_8192C
  198. #define DBG_8192C(...) do {\
  199. _dbgdump(DRIVER_PREFIX __VA_ARGS__);\
  200. }while(0)
  201. #endif
  202. #endif /* CONFIG_DEBUG */
  203. #ifdef CONFIG_DEBUG_RTL871X
  204. #ifndef _RTL871X_DEBUG_C_
  205. extern u32 GlobalDebugLevel;
  206. extern u64 GlobalDebugComponents;
  207. #endif
  208. #if defined (_dbgdump) && defined (_MODULE_DEFINE_)
  209. #undef RT_TRACE
  210. #define RT_TRACE(_Comp, _Level, Fmt)\
  211. do {\
  212. if((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
  213. _dbgdump("%s [0x%08x,%d]", DRIVER_PREFIX, (unsigned int)_Comp, _Level);\
  214. _dbgdump Fmt;\
  215. }\
  216. }while(0)
  217. #endif
  218. #if defined (_dbgdump)
  219. #undef _func_enter_
  220. #define _func_enter_ \
  221. do { \
  222. if (GlobalDebugLevel >= _drv_debug_) \
  223. { \
  224. _dbgdump("\n %s : %s enters at %d\n", DRIVER_PREFIX, __FUNCTION__, __LINE__);\
  225. } \
  226. } while(0)
  227. #undef _func_exit_
  228. #define _func_exit_ \
  229. do { \
  230. if (GlobalDebugLevel >= _drv_debug_) \
  231. { \
  232. _dbgdump("\n %s : %s exits at %d\n", DRIVER_PREFIX, __FUNCTION__, __LINE__); \
  233. } \
  234. } while(0)
  235. #undef RT_PRINT_DATA
  236. #define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
  237. if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
  238. { \
  239. int __i; \
  240. u8 *ptr = (u8 *)_HexData; \
  241. _dbgdump("%s", DRIVER_PREFIX); \
  242. _dbgdump(_TitleString); \
  243. for( __i=0; __i<(int)_HexDataLen; __i++ ) \
  244. { \
  245. _dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \
  246. if (((__i + 1) % 16) == 0) _dbgdump("\n"); \
  247. } \
  248. _dbgdump("\n"); \
  249. }
  250. #endif
  251. #endif /* CONFIG_DEBUG_RTL871X */
  252. #ifdef CONFIG_PROC_DEBUG
  253. int proc_get_drv_version(char *page, char **start,
  254. off_t offset, int count,
  255. int *eof, void *data);
  256. int proc_get_write_reg(char *page, char **start,
  257. off_t offset, int count,
  258. int *eof, void *data);
  259. int proc_set_write_reg(struct file *file, const char *buffer,
  260. unsigned long count, void *data);
  261. int proc_get_read_reg(char *page, char **start,
  262. off_t offset, int count,
  263. int *eof, void *data);
  264. int proc_set_read_reg(struct file *file, const char *buffer,
  265. unsigned long count, void *data);
  266. int proc_get_fwstate(char *page, char **start,
  267. off_t offset, int count,
  268. int *eof, void *data);
  269. int proc_get_sec_info(char *page, char **start,
  270. off_t offset, int count,
  271. int *eof, void *data);
  272. int proc_get_mlmext_state(char *page, char **start,
  273. off_t offset, int count,
  274. int *eof, void *data);
  275. int proc_get_qos_option(char *page, char **start,
  276. off_t offset, int count,
  277. int *eof, void *data);
  278. int proc_get_ht_option(char *page, char **start,
  279. off_t offset, int count,
  280. int *eof, void *data);
  281. int proc_get_rf_info(char *page, char **start,
  282. off_t offset, int count,
  283. int *eof, void *data);
  284. int proc_get_ap_info(char *page, char **start,
  285. off_t offset, int count,
  286. int *eof, void *data);
  287. int proc_get_adapter_state(char *page, char **start,
  288. off_t offset, int count,
  289. int *eof, void *data);
  290. int proc_get_trx_info(char *page, char **start,
  291. off_t offset, int count,
  292. int *eof, void *data);
  293. int proc_get_mac_reg_dump1(char *page, char **start,
  294. off_t offset, int count,
  295. int *eof, void *data);
  296. int proc_get_mac_reg_dump2(char *page, char **start,
  297. off_t offset, int count,
  298. int *eof, void *data);
  299. int proc_get_mac_reg_dump3(char *page, char **start,
  300. off_t offset, int count,
  301. int *eof, void *data);
  302. int proc_get_bb_reg_dump1(char *page, char **start,
  303. off_t offset, int count,
  304. int *eof, void *data);
  305. int proc_get_bb_reg_dump2(char *page, char **start,
  306. off_t offset, int count,
  307. int *eof, void *data);
  308. int proc_get_bb_reg_dump3(char *page, char **start,
  309. off_t offset, int count,
  310. int *eof, void *data);
  311. int proc_get_rf_reg_dump1(char *page, char **start,
  312. off_t offset, int count,
  313. int *eof, void *data);
  314. int proc_get_rf_reg_dump2(char *page, char **start,
  315. off_t offset, int count,
  316. int *eof, void *data);
  317. int proc_get_rf_reg_dump3(char *page, char **start,
  318. off_t offset, int count,
  319. int *eof, void *data);
  320. int proc_get_rf_reg_dump4(char *page, char **start,
  321. off_t offset, int count,
  322. int *eof, void *data);
  323. #ifdef CONFIG_AP_MODE
  324. int proc_get_all_sta_info(char *page, char **start,
  325. off_t offset, int count,
  326. int *eof, void *data);
  327. #endif
  328. #ifdef DBG_MEMORY_LEAK
  329. int proc_get_malloc_cnt(char *page, char **start,
  330. off_t offset, int count,
  331. int *eof, void *data);
  332. #endif
  333. #ifdef CONFIG_FIND_BEST_CHANNEL
  334. int proc_get_best_channel(char *page, char **start,
  335. off_t offset, int count,
  336. int *eof, void *data);
  337. #endif
  338. int proc_get_rx_signal(char *page, char **start,
  339. off_t offset, int count,
  340. int *eof, void *data);
  341. int proc_set_rx_signal(struct file *file, const char *buffer,
  342. unsigned long count, void *data);
  343. #ifdef CONFIG_80211N_HT
  344. int proc_get_ht_enable(char *page, char **start,
  345. off_t offset, int count,
  346. int *eof, void *data);
  347. int proc_set_ht_enable(struct file *file, const char *buffer,
  348. unsigned long count, void *data);
  349. int proc_get_bw_mode(char *page, char **start,
  350. off_t offset, int count,
  351. int *eof, void *data);
  352. int proc_set_bw_mode(struct file *file, const char *buffer,
  353. unsigned long count, void *data);
  354. int proc_get_ampdu_enable(char *page, char **start,
  355. off_t offset, int count,
  356. int *eof, void *data);
  357. int proc_set_ampdu_enable(struct file *file, const char *buffer,
  358. unsigned long count, void *data);
  359. int proc_get_rx_stbc(char *page, char **start,
  360. off_t offset, int count,
  361. int *eof, void *data);
  362. int proc_set_rx_stbc(struct file *file, const char *buffer,
  363. unsigned long count, void *data);
  364. #endif //CONFIG_80211N_HT
  365. int proc_get_two_path_rssi(char *page, char **start,
  366. off_t offset, int count,
  367. int *eof, void *data);
  368. int proc_get_rssi_disp(char *page, char **start,
  369. off_t offset, int count,
  370. int *eof, void *data);
  371. int proc_set_rssi_disp(struct file *file, const char *buffer,
  372. unsigned long count, void *data);
  373. #ifdef CONFIG_BT_COEXIST
  374. int proc_get_btcoex_dbg(char *page, char **start,
  375. off_t offset, int count,
  376. int *eof, void *data);
  377. int proc_set_btcoex_dbg(struct file *file, const char *buffer,
  378. unsigned long count, void *data);
  379. #endif //CONFIG_BT_COEXIST
  380. #if defined(DBG_CONFIG_ERROR_DETECT)
  381. int proc_get_sreset(char *page, char **start, off_t offset, int count, int *eof, void *data);
  382. int proc_set_sreset(struct file *file, const char *buffer, unsigned long count, void *data);
  383. #endif /* DBG_CONFIG_ERROR_DETECT */
  384. #endif //CONFIG_PROC_DEBUG
  385. #endif //__RTW_DEBUG_H__