1/*
2 * TxDbg.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 "tidef.h"
42#include "DataCtrl_Api.h"
43#include "dataCtrlDbg.h"
44#include "osApi.h"
45#include "report.h"
46#include "siteMgrApi.h"
47#include "TWDriver.h"
48#include "txCtrl.h"
49
50void printTxRxDbgFunctions(void);
51
52
53
54/*************************************************************************
55 *							rxTxDebugFunction							 *
56 *************************************************************************
57DESCRIPTION:   Call the requested Tx or Rx debug print function.
58************************************************************************/
59
60void rxTxDebugFunction(TI_HANDLE hRxTxHandle, TI_UINT32 funcType, void *pParam)
61{
62	txCtrl_t *pTxCtrl = (txCtrl_t *)hRxTxHandle;  /* Relevant only for some of the cases below! */
63
64	switch ((ERxTxDbgFunc)funcType)
65	{
66	case TX_RX_DBG_FUNCTIONS:
67		printTxRxDbgFunctions();
68		break;
69
70	/*
71	 *  TX DEBUG FUNCTIONS:
72	 *  ===================
73	 */
74	case PRINT_TX_CTRL_INFO:
75		txCtrlParams_printInfo (hRxTxHandle);
76		break;
77
78    case PRINT_TX_CTRL_COUNTERS:
79        txCtrlParams_printDebugCounters (hRxTxHandle);
80        break;
81
82	case PRINT_TX_DATA_QUEUE_INFO:
83		txDataQ_PrintModuleParams (pTxCtrl->hTxDataQ);
84		break;
85
86	case PRINT_TX_DATA_QUEUE_COUNTERS:
87		txDataQ_PrintQueueStatistics (pTxCtrl->hTxDataQ);
88		break;
89
90	case PRINT_TX_MGMT_QUEUE_INFO:
91		txMgmtQ_PrintModuleParams (pTxCtrl->hTxMgmtQ);
92		break;
93
94	case PRINT_TX_MGMT_QUEUE_COUNTERS:
95		txMgmtQ_PrintQueueStatistics (pTxCtrl->hTxMgmtQ);
96		break;
97
98    case PRINT_TX_CTRL_BLK_INFO:
99		TWD_PrintTxInfo (pTxCtrl->hTWD, TWD_PRINT_TX_CTRL_BLK_TBL);
100        break;
101
102    case PRINT_TX_HW_QUEUE_INFO:
103		TWD_PrintTxInfo (pTxCtrl->hTWD, TWD_PRINT_TX_HW_QUEUE_INFO);
104        break;
105
106    case PRINT_TX_XFER_INFO:
107		TWD_PrintTxInfo (pTxCtrl->hTWD, TWD_PRINT_TX_XFER_INFO);
108        break;
109
110	case PRINT_TX_RESULT_INFO:
111		TWD_PrintTxInfo (pTxCtrl->hTWD, TWD_PRINT_TX_RESULT_INFO);
112        break;
113
114	case PRINT_TX_DATA_CLSFR_TABLE:
115        txDataClsfr_PrintClsfrTable (pTxCtrl->hTxDataQ);
116        break;
117
118
119	case RESET_TX_CTRL_COUNTERS:
120		txCtrlParams_resetDbgCounters (hRxTxHandle);
121		break;
122
123	case RESET_TX_DATA_QUEUE_COUNTERS:
124		txDataQ_ResetQueueStatistics (pTxCtrl->hTxDataQ);
125		break;
126
127    case RESET_TX_DATA_CLSFR_TABLE:
128        {
129            EClsfrType  myLocalType;
130
131            /* Setting again the current classifier type clears the table */
132            txDataClsfr_GetClsfrType (pTxCtrl->hTxDataQ, &myLocalType);
133            txDataClsfr_SetClsfrType (pTxCtrl->hTxDataQ, myLocalType);
134        }
135		break;
136
137	case RESET_TX_MGMT_QUEUE_COUNTERS:
138		txMgmtQ_ResetQueueStatistics (pTxCtrl->hTxMgmtQ);
139		break;
140
141
142	/*
143	 *  RX DEBUG FUNCTIONS:
144	 *  ===================
145	 */
146	case PRINT_RX_BLOCK:
147		WLAN_OS_REPORT(("RX DBG - Print Rx Block \n\n"));
148		rxData_printRxBlock(hRxTxHandle);
149		break;
150
151	case PRINT_RX_COUNTERS:
152		WLAN_OS_REPORT(("RX DBG - Print Rx counters \n\n"));
153		rxData_printRxCounters(hRxTxHandle);
154		break;
155
156	case RESET_RX_COUNTERS:
157		WLAN_OS_REPORT(("RX DBG - Reset Rx counters \n\n"));
158		rxData_resetCounters(hRxTxHandle);
159		rxData_resetDbgCounters(hRxTxHandle);
160		break;
161
162    case PRINT_RX_THROUGHPUT_START:
163		rxData_startRxThroughputTimer (hRxTxHandle);
164		break;
165
166    case PRINT_RX_THROUGHPUT_STOP:
167		rxData_stopRxThroughputTimer (hRxTxHandle);
168		break;
169
170	default:
171		WLAN_OS_REPORT(("Invalid function type in Debug Tx Function Command: %d\n\n", funcType));
172		break;
173	}
174}
175
176
177void printTxRxDbgFunctions(void)
178{
179	WLAN_OS_REPORT(("\n          Tx Dbg Functions   \n"));
180	WLAN_OS_REPORT(("--------------------------------------\n"));
181
182	WLAN_OS_REPORT(("301 - Print TxCtrl info.\n"));
183	WLAN_OS_REPORT(("302 - Print TxCtrl Statistics.\n"));
184	WLAN_OS_REPORT(("303 - Print TxDataQueue info.\n"));
185	WLAN_OS_REPORT(("304 - Print TxDataQueue Statistics.\n"));
186	WLAN_OS_REPORT(("305 - Print TxMgmtQueue info.\n"));
187	WLAN_OS_REPORT(("306 - Print TxMgmtQueue Statistics.\n"));
188	WLAN_OS_REPORT(("307 - Print Tx control-block table.\n"));
189	WLAN_OS_REPORT(("308 - Print Tx HW queue info.\n"));
190	WLAN_OS_REPORT(("309 - Print Tx Xfer info.\n"));
191	WLAN_OS_REPORT(("310 - Print Tx result info.\n"));
192	WLAN_OS_REPORT(("311 - Print TxDataClsfr Classifier Table.\n"));
193
194	WLAN_OS_REPORT(("320 - Reset TxCtrl Statistics.\n"));
195	WLAN_OS_REPORT(("321 - Reset TxDataQueue Statistics.\n"));
196	WLAN_OS_REPORT(("322 - Reset TxDataClsfr Classifier Table.\n"));
197	WLAN_OS_REPORT(("323 - Reset TxMgmtQueue Statistics.\n"));
198
199	WLAN_OS_REPORT(("\n          Rx Dbg Functions   \n"));
200	WLAN_OS_REPORT(("--------------------------------------\n"));
201	WLAN_OS_REPORT(("350 - Print Rx block.\n"));
202	WLAN_OS_REPORT(("351 - Print Rx counters.\n"));
203	WLAN_OS_REPORT(("352 - Reset Rx counters.\n"));
204	WLAN_OS_REPORT(("353 - Start Rx throughput timer.\n"));
205	WLAN_OS_REPORT(("354 - Stop  Rx throughput timer.\n"));
206}
207
208
209