4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
34 /***************************************************************************/
36 /* MODULE: MibDbg.c */
37 /* PURPOSE: MIB debug implementation */
39 /***************************************************************************/
47 ***********************************************************************
48 * Internal functions definitions
49 ***********************************************************************
52 static void mibDbgGetArpIpTable(TI_HANDLE hTWD)
54 TI_STATUS status = TI_OK;
59 mib.aMib = MIB_arpIpAddressesTable;
60 mib.aData.ArpIpAddressesTable.FilteringEnable = 0;
61 for ( i = 0 ; i < IP_V4_ADDR_LEN ; i++ )
63 mib.aData.ArpIpAddressesTable.addr[i] = 0;
66 status = TWD_ReadMib(hTWD,NULL,NULL,(void*)&mib);
69 WLAN_OS_REPORT(("Get ARP Table failed\n"));
74 WLAN_OS_REPORT(("ARP IP Table:\n"));
75 WLAN_OS_REPORT(("FilteringEnable: %s (%d)\n",
76 (mib.aData.ArpIpAddressesTable.FilteringEnable)?"Enable":"Disable",
77 mib.aData.ArpIpAddressesTable.FilteringEnable));
78 WLAN_OS_REPORT(("ArpIpAddress: %d.%d.%d.%d\n",
79 mib.aData.ArpIpAddressesTable.addr[0],
80 mib.aData.ArpIpAddressesTable.addr[1],
81 mib.aData.ArpIpAddressesTable.addr[2],
82 mib.aData.ArpIpAddressesTable.addr[3]));
85 static void mibDbgGetGroupAddressTable(TI_HANDLE hTWD)
87 TI_STATUS status = TI_OK;
92 mib.aMib = MIB_dot11GroupAddressesTable;
93 mib.aData.GroupAddressTable.bFilteringEnable = 0;
94 mib.aData.GroupAddressTable.nNumberOfAddresses = 0;
95 for ( i = 0 ; i < MIB_MAX_MULTICAST_GROUP_ADDRS ; i++ )
97 for ( j = 0 ; j < MAC_ADDR_LEN ; j++ )
99 mib.aData.GroupAddressTable.aGroupTable[i][j] = 0;
103 status = TWD_ReadMib(hTWD,NULL,NULL,(void*)&mib);
106 WLAN_OS_REPORT(("Get Group Address Table failed\n"));
110 /* print Group Address Table */
111 WLAN_OS_REPORT(("Group addresses Table:\n"));
112 WLAN_OS_REPORT(("FilteringEnable: %s (%d)\n",
113 (mib.aData.GroupAddressTable.bFilteringEnable)?"Enable":"Disable",
114 mib.aData.GroupAddressTable.bFilteringEnable));
115 WLAN_OS_REPORT(("nNumberOfAddresses: %d\n",
116 mib.aData.GroupAddressTable.nNumberOfAddresses));
118 WLAN_OS_REPORT(("Group addresses: \n"));
119 for ( i = 0 ; i < MIB_MAX_MULTICAST_GROUP_ADDRS ; i++ )
120 WLAN_OS_REPORT(("%x:%x:%x:%x:%x:%x\n",
121 mib.aData.GroupAddressTable.aGroupTable[i][0],
122 mib.aData.GroupAddressTable.aGroupTable[i][1],
123 mib.aData.GroupAddressTable.aGroupTable[i][2],
124 mib.aData.GroupAddressTable.aGroupTable[i][3],
125 mib.aData.GroupAddressTable.aGroupTable[i][4],
126 mib.aData.GroupAddressTable.aGroupTable[i][5]));
129 static void mibDbgGetCounterTable(TI_HANDLE hTWD)
131 TI_STATUS status = TI_OK;
135 mib.aMib = MIB_countersTable;
136 mib.aData.CounterTable.FCSErrorCount = 0;
137 mib.aData.CounterTable.PLCPErrorCount = 0;
138 mib.aData.CounterTable.SeqNumMissCount = 0;
140 status = TWD_ReadMib(hTWD,NULL,NULL,(void*)&mib);
143 WLAN_OS_REPORT(("Get Counter Table failed\n"));
147 /* print Counter Table */
148 WLAN_OS_REPORT(("FCS error count= %d \nPLCP error count = %d \nSeq error count= %d\n",
149 mib.aData.CounterTable.FCSErrorCount,
150 mib.aData.CounterTable.PLCPErrorCount,
151 mib.aData.CounterTable.SeqNumMissCount));
155 static void mibDbgModifyCtsToSelf(TI_HANDLE hTWD, void* pParam)
157 TI_STATUS status = TI_OK;
162 WLAN_OS_REPORT(("Modify CTS To Self failed: No Parameter received\n"));
167 mib.aMib = MIB_ctsToSelf;
168 mib.aData.CTSToSelfEnable = 0;
169 mib.aData.CTSToSelfEnable = *(TI_UINT32*)pParam;
171 status = TWD_WriteMib(hTWD, &mib);
174 WLAN_OS_REPORT(("Modify CTS To Self failed\n"));
177 WLAN_OS_REPORT(("Modify CTS To Self OK\n"));
179 WLAN_OS_REPORT(("CtsToSelf = %s (%d)\n",
180 mib.aData.CTSToSelfEnable?"Enable":"Disable",
181 mib.aData.CTSToSelfEnable));
182 WLAN_OS_REPORT(("CTS to self: [0 - Disable, 1 - Enable]\n"));
185 static void mibDbgGetCtsToSelf(TI_HANDLE hTWD)
187 TI_STATUS status = TI_OK;
191 mib.aMib = MIB_ctsToSelf;
192 mib.aData.CTSToSelfEnable = 0;
194 status = TWD_ReadMib(hTWD,NULL,NULL,(void*)&mib);
197 WLAN_OS_REPORT(("Get CTS To Self failed\n"));
201 WLAN_OS_REPORT(("CtsToSelf = %s (%d)\n",
202 mib.aData.CTSToSelfEnable?"Enable":"Disable",
203 mib.aData.CTSToSelfEnable));
204 WLAN_OS_REPORT(("CTS to self: [0 - Disable, 1 - Enable]\n"));
207 static void mibDbgSetMaxRxLifetime(TI_HANDLE hTWD, void* pParam)
209 TI_STATUS status = TI_OK;
214 WLAN_OS_REPORT(("Set Maximum Rx Life Time failed: No Parameter received\n"));
219 mib.aMib = MIB_dot11MaxReceiveLifetime;
220 mib.aData.MaxReceiveLifeTime = *(TI_UINT32*)pParam;
222 status = TWD_WriteMib(hTWD, &mib);
225 WLAN_OS_REPORT(("Set Maximum Rx Life Time failed\n"));
231 ***********************************************************************
232 * External functions definitions
233 ***********************************************************************
235 void mibDbgPrintFunctions(void)
237 WLAN_OS_REPORT(("\n MIB Dbg Functions \n"));
238 WLAN_OS_REPORT(("--------------------------------------\n"));
240 WLAN_OS_REPORT(("2101 - Print ARP Table\n"));
241 WLAN_OS_REPORT(("2102 - Print Group Address Table\n"));
242 WLAN_OS_REPORT(("2103 - Print Counter Table\n"));
243 WLAN_OS_REPORT(("2104 - Print Modify CTS to Self\n"));
244 WLAN_OS_REPORT(("2105 - Print Max RX Life Time\n"));
247 void MibDebugFunction(TI_HANDLE hTWD ,TI_UINT32 funcType, void* pParam)
256 case DBG_MIB_PRINT_HELP:
257 mibDbgPrintFunctions();
259 case DBG_MIB_GET_ARP_TABLE:
260 mibDbgGetArpIpTable(hTWD);
262 case DBG_MIB_GET_GROUP_ADDRESS_TABLE:
263 mibDbgGetGroupAddressTable(hTWD);
265 case DBG_MIB_GET_COUNTER_TABLE:
266 mibDbgGetCounterTable(hTWD);
268 case DBG_MIB_MODIFY_CTS_TO_SELF:
269 mibDbgModifyCtsToSelf(hTWD, pParam);
271 case DBG_MIB_GET_CTS_TO_SELF:
272 mibDbgGetCtsToSelf(hTWD);
274 case DBG_MIB_SET_MAX_RX_LIFE_TIME:
275 mibDbgSetMaxRxLifetime(hTWD, pParam);
278 WLAN_OS_REPORT(("MIB Debug: Invalid function type in MIB Debug function: %d\n", funcType));