1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #ifndef __RTW_DEBUG_H__
8 #define __RTW_DEBUG_H__
9 
10 #include <osdep_service.h>
11 #include <drv_types.h>
12 
13 #define DRIVERVERSION	"v4.1.4_6773.20130222"
14 #define _drv_always_			1
15 #define _drv_emerg_			2
16 #define _drv_alert_			3
17 #define _drv_crit_			4
18 #define _drv_err_			5
19 #define	_drv_warning_			6
20 #define _drv_notice_			7
21 #define _drv_info_			8
22 #define	_drv_debug_			9
23 
24 #define _module_rtl871x_xmit_c_		BIT(0)
25 #define _module_xmit_osdep_c_		BIT(1)
26 #define _module_rtl871x_recv_c_		BIT(2)
27 #define _module_recv_osdep_c_		BIT(3)
28 #define _module_rtl871x_mlme_c_		BIT(4)
29 #define _module_mlme_osdep_c_		BIT(5)
30 #define _module_rtl871x_sta_mgt_c_	BIT(6)
31 #define _module_rtl871x_cmd_c_		BIT(7)
32 #define _module_cmd_osdep_c_		BIT(8)
33 #define _module_rtl871x_io_c_		BIT(9)
34 #define _module_io_osdep_c_		BIT(10)
35 #define _module_os_intfs_c_		BIT(11)
36 #define _module_rtl871x_security_c_	BIT(12)
37 #define _module_rtl871x_eeprom_c_	BIT(13)
38 #define _module_hal_init_c_		BIT(14)
39 #define _module_hci_hal_init_c_		BIT(15)
40 #define _module_rtl871x_ioctl_c_	BIT(16)
41 #define _module_rtl871x_ioctl_set_c_	BIT(17)
42 #define _module_rtl871x_ioctl_query_c_	BIT(18)
43 #define _module_rtl871x_pwrctrl_c_	BIT(19)
44 #define _module_hci_intfs_c_		BIT(20)
45 #define _module_hci_ops_c_		BIT(21)
46 #define _module_osdep_service_c_	BIT(22)
47 #define _module_mp_			BIT(23)
48 #define _module_hci_ops_os_c_		BIT(24)
49 #define _module_rtl871x_ioctl_os_c	BIT(25)
50 #define _module_rtl8712_cmd_c_		BIT(26)
51 #define	_module_rtl8192c_xmit_c_	BIT(27)
52 #define _module_hal_xmit_c_		BIT(28)
53 #define _module_efuse_			BIT(29)
54 #define _module_rtl8712_recv_c_		BIT(30)
55 #define _module_rtl8712_led_c_		BIT(31)
56 
57 #define DRIVER_PREFIX	"R8188EU: "
58 
59 extern u32 GlobalDebugLevel;
60 
61 #define DBG_88E_LEVEL(_level, fmt, arg...)				\
62 	do {								\
63 		if (_level <= GlobalDebugLevel)				\
64 			pr_info(DRIVER_PREFIX fmt, ##arg);	\
65 	} while (0)
66 
67 #define DBG_88E(...)							\
68 	do {								\
69 		if (_drv_err_ <= GlobalDebugLevel)			\
70 			pr_info(DRIVER_PREFIX __VA_ARGS__);		\
71 	} while (0)
72 
73 #define MSG_88E(...)							\
74 	do {								\
75 		if (_drv_err_ <= GlobalDebugLevel)			\
76 			pr_info(DRIVER_PREFIX __VA_ARGS__);			\
77 	} while (0)
78 
79 #define RT_TRACE(_comp, _level, fmt)					\
80 	do {								\
81 		if (_level <= GlobalDebugLevel) {			\
82 			pr_info("%s [0x%08x,%d]", DRIVER_PREFIX,	\
83 				 (unsigned int)_comp, _level);		\
84 			pr_info fmt;					\
85 		}							\
86 	} while (0)
87 
88 #define RT_PRINT_DATA(_comp, _level, _titlestring, _hexdata, _hexdatalen)\
89 	do {								\
90 		if (_level <= GlobalDebugLevel) {			\
91 			int __i;					\
92 			u8	*ptr = (u8 *)_hexdata;			\
93 			pr_info("%s", DRIVER_PREFIX);			\
94 			pr_info(_titlestring);				\
95 			for (__i = 0; __i < (int)_hexdatalen; __i++) {	\
96 				pr_info("%02X%s", ptr[__i],		\
97 					 (((__i + 1) % 4) == 0) ?	\
98 					 "  " : " ");	\
99 				if (((__i + 1) % 16) == 0)		\
100 					pr_cont("\n");			\
101 			}						\
102 			pr_cont("\n");					\
103 		}							\
104 	} while (0)
105 
106 int proc_get_drv_version(char *page, char **start,
107 			 off_t offset, int count,
108 			 int *eof, void *data);
109 
110 int proc_get_write_reg(char *page, char **start,
111 		       off_t offset, int count,
112 		       int *eof, void *data);
113 
114 int proc_set_write_reg(struct file *file, const char __user *buffer,
115 		       unsigned long count, void *data);
116 int proc_get_read_reg(char *page, char **start,
117 		      off_t offset, int count,
118 		      int *eof, void *data);
119 
120 int proc_set_read_reg(struct file *file, const char __user *buffer,
121 		      unsigned long count, void *data);
122 
123 int proc_get_adapter_state(char *page, char **start,
124 			   off_t offset, int count,
125 			   int *eof, void *data);
126 
127 int proc_get_best_channel(char *page, char **start,
128 			  off_t offset, int count,
129 			  int *eof, void *data);
130 
131 #endif	/* __RTW_DEBUG_H__ */
132