• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2017  Realtek Corporation.
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  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 
26 #ifndef __HALRF_DEBUG_H__
27 #define __HALRF_DEBUG_H__
28 
29 /*@============================================================*/
30 /*@include files*/
31 /*@============================================================*/
32 
33 /*@============================================================*/
34 /*@Definition */
35 /*@============================================================*/
36 
37 #if DBG
38 
39 #if (DM_ODM_SUPPORT_TYPE == ODM_AP)
40 #define RF_DBG(dm, comp, fmt, args...)                     \
41 	do {                                               \
42 		if ((comp) & dm->rf_table.rf_dbg_comp) { \
43 			pr_debug("[RF] ");                 \
44 			RT_PRINTK(fmt, ##args);            \
45 		}                                          \
46 	} while (0)
47 
48 #elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
49 
RF_DBG(PDM_ODM_T dm,int comp,char * fmt,...)50 static __inline void RF_DBG(PDM_ODM_T dm, int comp, char *fmt, ...)
51 {
52 	RT_STATUS rt_status;
53 	va_list args;
54 	char buf[PRINT_MAX_SIZE] = {0};
55 
56 	if ((comp & dm->rf_table.rf_dbg_comp) == 0)
57 		return;
58 
59 	if (fmt == NULL)
60 		return;
61 
62 	va_start(args, fmt);
63 	rt_status = (RT_STATUS)RtlStringCbVPrintfA(buf, PRINT_MAX_SIZE, fmt, args);
64 	va_end(args);
65 
66 	if (rt_status != RT_STATUS_SUCCESS) {
67 		DbgPrint("Failed (%d) to print message to buffer\n", rt_status);
68 		return;
69 	}
70 
71 	DbgPrint("[RF] %s", buf);
72 }
73 
74 #elif (DM_ODM_SUPPORT_TYPE == ODM_IOT)
75 
76 #define RF_DBG(dm, comp, fmt, args...)                     \
77 	do {                                               \
78 		if ((comp) & dm->rf_table.rf_dbg_comp) { \
79 			RT_DEBUG(COMP_PHYDM, DBG_DMESG, "[RF] " fmt, ##args);  \
80 		}                                          \
81 	} while (0)
82 
83 #else
84 #define RF_DBG(dm, comp, fmt, args...)                                         \
85 	do {                                                                   \
86 		struct dm_struct *__dm = dm;                                   \
87 		if ((comp) & __dm->rf_table.rf_dbg_comp) {                     \
88 			RT_TRACE(((struct rtl_priv *)__dm->adapter),           \
89 				 COMP_PHYDM, DBG_DMESG, "[RF] " fmt, ##args);  \
90 		}                                                              \
91 	} while (0)
92 #endif
93 
94 #else /*#if DBG*/
95 
96 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
RF_DBG(struct dm_struct * dm,int comp,char * fmt,...)97 static __inline void RF_DBG(struct dm_struct *dm, int comp, char *fmt, ...)
98 {
99 #if 0
100 	RT_STATUS rt_status;
101 	va_list args;
102 	char buf[128] = {0};/*PRINT_MAX_SIZE*/
103 
104 	if ((comp & dm->rf_table.rf_dbg_comp) == 0)
105 		return;
106 
107 	if (NULL != fmt) {
108 		va_start(args, fmt);
109 		rt_status = (RT_STATUS)RtlStringCbVPrintfA(buf, sizeof(buf), fmt, args);
110 		va_end(args);
111 		if (rt_status == RT_STATUS_SUCCESS) {
112 			halrf_rt_trace(buf);
113 		}
114 	}
115 #endif
116 }
117 #else
118 #define RF_DBG(dm, comp, fmt, args...)
119 #endif
120 
121 #endif /*#if DBG*/
122 
123 /*@============================================================*/
124 /*@ enumeration */
125 /*@============================================================*/
126 
127 /*@============================================================*/
128 /*@ structure */
129 /*@============================================================*/
130 
131 /*@============================================================*/
132 /*@ function prototype */
133 /*@============================================================*/
134 
135 void halrf_cmd_parser(void *dm_void, char input[][16], u32 *_used, char *output,
136 		      u32 *_out_len, u32 input_num);
137 
138 void halrf_init_debug_setting(void *dm_void);
139 
140 #endif /*__HALRF_H__*/
141