OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / hardware / ti / wlan / wl1271 / Test / rsnDbg.c
1 /*
2  * rsnDbg.c
3  *
4  * Copyright(c) 1998 - 2009 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 /*              MODULE:                                                                                                                         */
38 /*    PURPOSE:                                                                                                                          */
39 /*                                                                                                                                                      */                                              
40 /****************************************************************************/
41 /* #include "osTITypes.h" */
42 #include "osApi.h"
43 #include "rsnApi.h"
44 #include "rsn.h"
45 #include "report.h"
46 #include "paramOut.h"
47 #include "rsnDbg.h"
48 #ifdef XCC_MODULE_INCLUDED
49 #include "XCCMngr.h"
50 #endif
51
52 void printRsnDbgFunctions(void);
53 void printRogueApTable(TI_HANDLE hRogueAp);
54
55 static TI_UINT8 infoBuf[480];
56
57 /*************************************************************************
58  *                                                                                                                                               *
59  *************************************************************************
60 DESCRIPTION:                  
61                                                       
62 INPUT:       
63
64 OUTPUT:      
65
66 RETURN:     
67                                                    
68 ************************************************************************/
69 void rsnDebugFunction(TI_HANDLE hRsn, TI_UINT32 funcType, void *pParam)
70 {
71         paramInfo_t     param, *pRsnParam;
72         TI_UINT32                       value;
73     rsnAuthEncrCapability_t rsnAuthEncrCap;
74
75         switch (funcType)
76         {
77         case DBG_RSN_PRINT_HELP:
78                 printRsnDbgFunctions();
79                 break;
80
81         case DBG_RSN_SET_DESIRED_AUTH:
82                 WLAN_OS_REPORT(("RSN DBG - Set desired Authentication suite \n"));
83                 value = *(TI_UINT32*)pParam;
84
85                 param.paramType = RSN_EXT_AUTHENTICATION_MODE;
86                 param.content.rsnDesiredAuthType = (EAuthSuite)value;
87
88                 rsn_setParam(hRsn, &param);
89                 break;
90
91         case DBG_RSN_SET_DESIRED_CIPHER:
92                 WLAN_OS_REPORT(("RSN DBG - Set desired cipher suite \n"));
93                 value = *(TI_UINT32*)pParam;
94
95                 param.paramType = RSN_ENCRYPTION_STATUS_PARAM;
96                 param.content.rsnEncryptionStatus = (ECipherSuite)value;
97
98                 rsn_setParam(hRsn, &param);
99                 break;
100         
101
102         case DBG_RSN_GEN_MIC_FAILURE_REPORT:
103                 value = *(TI_UINT32*)pParam;
104                 /* generate unicast mic failure report to the OS and to the RSN module */
105                 rsn_reportMicFailure(hRsn, (TI_UINT8*)&value,1);
106                 break;
107
108         case DBG_RSN_GET_PARAM_802_11_CAPABILITY:
109                         
110                 param.paramType = RSN_AUTH_ENCR_CAPABILITY;
111         param.content.pRsnAuthEncrCapability = &rsnAuthEncrCap;
112         
113         /* Get 802_11 capability info */
114                 rsn_getParam(hRsn, &param);
115                 break;
116                 
117         case DBG_RSN_GET_PMKID_CACHE:
118                 
119                 pRsnParam = (paramInfo_t *)&infoBuf;
120                 pRsnParam->paramType = RSN_PMKID_LIST;
121                 pRsnParam->paramLength = 480;
122
123                 /* Get PMKID list */
124                 rsn_getParam(hRsn, pRsnParam);
125                 break;
126
127         case DBG_RSN_RESET_PMKID_CACHE:
128                 
129                 rsn_resetPMKIDList(hRsn);
130
131                 break;
132 #ifdef XCC_MODULE_INCLUDED
133     case DBG_RSN_PRINT_ROGUE_AP_TABLE:
134         printRogueApTable(((XCCMngr_t*)((rsn_t*)hRsn)->hXCCMngr)->hRogueAp);
135         break;
136 #endif
137
138     case DBG_RSN_SET_PORT_STATUS:
139         WLAN_OS_REPORT(("Setting PORT STATUS to open\n"));
140         rsn_setPortStatus(hRsn,TI_TRUE);
141         break;
142
143     case DBG_RSN_PRINT_PORT_STATUS:
144         {
145             TI_BOOL portStatus = TI_FALSE;
146             portStatus = rsn_getPortStatus(((rsn_t*)hRsn));
147             WLAN_OS_REPORT(("\n\nPORT is %s !!\n",(portStatus)?"OPEN":"CLOSE"));
148         }
149
150         break;
151         default:
152                 WLAN_OS_REPORT(("Invalid function type in RSN Function Command: %d\n", funcType));
153                 break;
154         }
155
156
157
158
159 void printRsnDbgFunctions(void)
160 {
161         WLAN_OS_REPORT(("   Rsn Debug Functions   \n"));
162         WLAN_OS_REPORT(("-------------------------\n"));
163
164         WLAN_OS_REPORT(("702 - Set default key id \n"));
165         WLAN_OS_REPORT(("703 - Set desired Authentication suite \n"));
166         WLAN_OS_REPORT(("704 - Set desired cipher suite \n"));
167
168         WLAN_OS_REPORT(("706 - Generate MIC FAILURE report (after 2 clicks less then 1 minute - disassociate)\n"));
169         WLAN_OS_REPORT(("707 - Get 802.11 authentication/encryption capability\n"));
170         WLAN_OS_REPORT(("708 - Get PMKID cache \n"));
171         WLAN_OS_REPORT(("709 - ReSet PMKID cache  \n"));
172         WLAN_OS_REPORT(("710 - Print Rogue AP table\n"));
173
174
175 }