• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2 **+-----------------------------------------------------------------------+**
3 **|                                                                       |**
4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
5 **| All rights reserved.                                                  |**
6 **|                                                                       |**
7 **| Redistribution and use in source and binary forms, with or without    |**
8 **| modification, are permitted provided that the following conditions    |**
9 **| are met:                                                              |**
10 **|                                                                       |**
11 **|  * Redistributions of source code must retain the above copyright     |**
12 **|    notice, this list of conditions and the following disclaimer.      |**
13 **|  * Redistributions in binary form must reproduce the above copyright  |**
14 **|    notice, this list of conditions and the following disclaimer in    |**
15 **|    the documentation and/or other materials provided with the         |**
16 **|    distribution.                                                      |**
17 **|  * Neither the name Texas Instruments nor the names of its            |**
18 **|    contributors may be used to endorse or promote products derived    |**
19 **|    from this software without specific prior written permission.      |**
20 **|                                                                       |**
21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
32 **|                                                                       |**
33 **+-----------------------------------------------------------------------+**
34 ****************************************************************************/
35 
36 
37 #include "ioctl_init.h"
38 #include "esta_drv.h"
39 
40 #include "ioctl_utils.h"
41 
42 #include "report.h"
43 #include "osClsfr.h"
44 
45 #define CONFIG_MGR(dev) ((configMgr_t *) \
46     ((dev && dev->priv) ? ((tiwlan_net_dev_t *) dev->priv)->adapter.CoreHalCtx : NULL ) )
47 
48 
49 typedef struct
50 {
51     int err_code;
52     char *desc;
53 }
54 configMgr_error_desc_t;
55 
56 
57 static configMgr_error_desc_t configMgr_error_desc[] =
58 {
59     { OK,		"OK"	},
60     { NOK,		"NOK"	},
61     { PARAM_NOT_SUPPORTED,	"PARAM_NOT_SUPPORTED"	},
62     { PARAM_VALUE_NOT_VALID,	"PARAM_VALUE_NOT_VALID"	},
63     { CONFIGURATION_NOT_VALID,	"CONFIGURATION_NOT_VALID"	},
64     { NO_SITE_SELECTED_YET,		"NO_SITE_SELECTED_YET"	},
65     { RE_SCAN_NEEDED,		"RE_SCAN_NEEDED"	},
66     { EXTERNAL_SET_PARAM_DENIED,	"EXTERNAL_SET_PARAM_DENIED"	},
67     { EXTERNAL_GET_PARAM_DENIED,	"EXTERNAL_GET_PARAM_DENIED"	},
68     { PARAM_MODULE_NUMBER_INVALID,	"PARAM_MODULE_NUMBER_INVALID"	},
69     { STATION_IS_NOT_RUNNING,	"STATION_IS_NOT_RUNNING"	},
70     { CARD_IS_NOT_INSTALLED,	"CARD_IS_NOT_INSTALLED"	},
71     /* Data path section */
72     /* 	{ RX_BSS_TYPE_ERROR			,*/
73     /* 	{ RX_BSS_ID_ERROR				,*/
74     /* 	{ TX_QUEUE_SELECTED_OK		,*/
75     /* 	{ NO_TX_QUEUE_SELECTED		,*/
76     /* 	{ TX_STATUS_PENDING			,*/
77     /* 	{ TX_STATUS_NO_RESOURCES		,*/
78     /* 	{ TX_STATUS_FAILURE			,*/
79     /* 	{ TX_STATUS_OK				,*/
80 
81     /* 4x section */
82     /* 	{ MAKE_CONCATENATION			,*/
83     /* 	{ SEND_ONE_MSDU				,*/
84     /* 	{ DO_NOT_SEND_MSDU			,*/
85     /* 	{ FOUR_X_DISABLE				,*/
86     /**/
87     /* 	 (Scanning section) */
88     /* 	{ NO_COUNTRY					,*/
89     /**/
90     /* 	 (Setting power after select) */
91     /* 	{ TX_POWER_SHOULD_NOT_BE_SET	,*/
92     /* 	(changing service channel)       */
93     /* 	{ CHANNEL_CHANGED				,*/
94     /* 	{ SUPPORT_IMMEDIATE_MEASUREMENT_ONLY,*/
95     /* 	{ MEASUREMENT_TYPE_NOT_SUPPORT,*/
96     /* 	{ MEASUREMENT_CAN_NOT_EXECUTED_IN_PARALLEL,*/
97     /* 	{ MEASUREMENT_REQUEST_IGNORED,*/
98     /* 	{ CANNOT_SET_MEASUREMENT_PARAM_WHEN_ACTIVATED,*/
99     /* 	{ REGULATORY_DOMAIN_SET_TX_POWER_PARAM,*/
100     /* 	{ CANNOT_SET_CHANNEL_THAT_IS_NOT_SUPPORTED,*/
101 };
102 
103 
print_err_desc(int err)104 int print_err_desc(int err)
105 {
106     int i;
107     for( i=0; i<SIZE_ARR(configMgr_error_desc);i++ )
108     {
109         if(configMgr_error_desc[i].err_code == err )
110         {
111             print_err("---err(%d) configMgr() = %s\n", err, configMgr_error_desc[i].desc );
112             return -err;
113         }
114     }
115     print_err("---err(%d) configMgr failed\n", err);
116     return -err;
117 }
118 
print_memory_dump(char * addr,int size)119 void print_memory_dump(char *addr, int size )
120 {
121 #ifdef DEBUG_MESSAGES
122         int i;
123         char buf[4096];
124 
125         if( size * 4 > sizeof(buf) ) {
126                 print_err("print_memory_dump(): buffer too small\n");
127                 return;
128         }
129 
130         buf[0] = 0;
131         for(i=0; i<size; i++ ) {
132                 if( !(i % 16) )
133                         sprintf(&buf[strlen(buf)], "%s%p: ", (i) ? "\n" : "", addr+i );
134                 sprintf(&buf[strlen(buf)], "%02x ", (unsigned char)addr[i] );
135         }
136         print_info("%s\n", buf);
137 #endif /* DEBUG_MESSAGES */
138 }
139 
140 #ifdef TI_DBG
141 #ifndef TIWLAN_MSM7000
142 TI_STATUS debugFunction(TI_HANDLE hConfigMgr,
143 			UINT32 functionNumber,
144 			void *pParam);
145 #endif
146 #endif
util_hal_debug_print(struct net_device * dev,ULONG * data)147 int util_hal_debug_print(struct net_device *dev, ULONG *data)
148 {
149     hal_print_param_t *p = (hal_print_param_t *) data;
150     UINT32 opt_data = 0;
151 
152     if( p->optional_param )
153     {
154         if( copy_from_user(&opt_data, p->optional_param, sizeof(opt_data) ) )
155             return -EFAULT;
156     }
157 
158     print_deb("HAL_DEBUG_PRINT: func_id=%d, param=%x\n", p->func_id, opt_data );
159 #ifdef TI_DBG
160     debugFunction(CONFIG_MGR(dev), p->func_id, &opt_data );
161 #endif
162     return 0;
163 }
164 
165