2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_2/mgmt/swcr.c#2 $
10 /*******************************************************************************
11 * Copyright (c) 2009 MediaTek Inc.
13 * All rights reserved. Copying, compilation, modification, distribution
14 * or any other use whatsoever of this material is strictly prohibited
15 * except in accordance with a Software License Agreement with
17 ********************************************************************************
20 /*******************************************************************************
23 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
24 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
25 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
26 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
27 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
28 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
29 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
30 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
31 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
32 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
33 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
34 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
35 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
37 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
38 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
39 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
40 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
41 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
43 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
44 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
45 * OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
46 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
47 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
49 ********************************************************************************
55 * 01 15 2012 yuche.tsai
57 * Fix wrong basic rate issue.
59 * 11 22 2011 tsaiyuan.hsu
60 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
61 * keep debug counter setting after wake up.
63 * 11 19 2011 eddie.chen
64 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
65 * Fix initialize the prTxCtrol
67 * 11 19 2011 eddie.chen
68 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
71 * 11 18 2011 eddie.chen
72 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
73 * Fix xlog format to hex format
77 * Fix compiling warning
79 * 11 11 2011 tsaiyuan.hsu
80 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
81 * fix debug counters of rx in driver.
83 * 11 11 2011 tsaiyuan.hsu
84 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
87 * 11 11 2011 tsaiyuan.hsu
88 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
89 * add txbcn count into xlog.
91 * 11 10 2011 tsaiyuan.hsu
92 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
93 * add debug counters of ar and bb for xlog.
95 * 11 10 2011 eddie.chen
96 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
97 * Modify the QM xlog level and remove LOG_FUNC.
99 * 11 08 2011 tsaiyuan.hsu
100 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
103 * 11 04 2011 tsaiyuan.hsu
104 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
105 * add debug counters and periodically dump counters for Xlog debugging.
108 * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
109 * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG
111 * 06 27 2011 tsaiyuan.hsu
112 * [WCXRP00000816] [MT6620 Wi-Fi][Driver] add control to enable rx data dump or not
113 * add control to enable rx data dump by packet type.
115 * 05 11 2011 eddie.chen
116 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
117 * Fix dest type when GO packet copying.
119 * 05 09 2011 eddie.chen
120 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
121 * Check free number before copying broadcast packet.
123 * 04 14 2011 eddie.chen
124 * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
125 * Check the SW RFB free. Fix the compile warning..
127 * 04 12 2011 eddie.chen
128 * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
129 * Fix the sta index in processing security frame
130 * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4
133 * 03 28 2011 eddie.chen
134 * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
135 * Fix Klocwork warning.
138 * [WCXRP00000577] [MT6620 Wi-Fi][Driver][FW] Create V2.0 branch for firmware and driver
139 * create V2.0 driver release based on label "MT6620_WIFI_DRIVER_V2_0_110318_1600" from main trunk
141 * 03 15 2011 eddie.chen
142 * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter
143 * Add sw debug counter for QM.
145 * 01 11 2011 eddie.chen
146 * [WCXRP00000322] Add WMM IE in beacon,
147 Add per station flow control when STA is in PS
155 /*******************************************************************************
156 * C O M P I L E R F L A G S
157 ********************************************************************************
160 /*******************************************************************************
161 * E X T E R N A L R E F E R E N C E S
162 ********************************************************************************
169 #pragma GCC diagnostic ignored "-Wformat"
171 /*******************************************************************************
173 ********************************************************************************
176 /*******************************************************************************
177 * P U B L I C D A T A
178 ********************************************************************************
181 extern SWCR_MAP_ENTRY_T g_arRlmArSwCrMap[];
182 SWCR_MOD_MAP_ENTRY_T g_arSwCrAllMaps[] = {
183 { SWCR_MAP_NUM(g_arRlmArSwCrMap), g_arRlmArSwCrMap}, /* 0x00nn */
188 VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
189 VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
190 VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
191 VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
192 VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data);
195 VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl);
196 VOID swCrDebugCheckTimeout(
197 IN P_ADAPTER_T prAdapter,
200 IN P_ADAPTER_T prAdapter,
201 IN P_CMD_INFO_T prCmdInfo,
202 IN PUINT_8 pucEventBuf
204 VOID swCrDebugQueryTimeout(
205 IN P_ADAPTER_T prAdapter,
206 IN P_CMD_INFO_T prCmdInfo);
208 UINT_32 g_au4SwCr[SWCR_CR_NUM]; /*: 0: command other: data */
210 static TIMER_T g_rSwcrDebugTimer;
211 static BOOLEAN g_fgSwcrDebugTimer = FALSE;
212 static UINT_32 g_u4SwcrDebugCheckTimeout = 0;
213 static ENUM_SWCR_DBG_TYPE_T g_ucSwcrDebugCheckType = 0;
214 static UINT_32 g_u4SwcrDebugFrameDumpType = 0;
216 /*******************************************************************************
217 * P R I V A T E D A T A
218 ********************************************************************************
222 const static PFN_CMD_RW_T g_arSwCtrlCmd[] ={
233 const PFN_SWCR_RW_T g_arSwCrModHandle[] = {
239 /*******************************************************************************
241 ********************************************************************************
254 SWCTRL_DUMP_ALL_QUEUE_LEN,
258 SWCTRL_DUMP_QM_DBG_CNT,
261 SWCTRL_CATA0_INDEX_NUM
268 SWCTRL_CATA1_INDEX_NUM
277 TEST_PS_ENABLE_BEACON,
281 TEST_PS_UPDATE_BEACON,
282 TEST_PS_CATA0_INDEX_NUM
287 TEST_PS_STA_ENTER_PS,
289 TEST_PS_STA_TRIGGER_PSPOLL,
290 TEST_PS_STA_TRIGGER_FRAME,
291 TEST_PS_CATA1_INDEX_NUM
299 #define _SWCTRL_MAGIC 0x66201642
301 /*******************************************************************************
302 * F U N C T I O N D E C L A R A T I O N S
303 ********************************************************************************
307 /*******************************************************************************
309 ********************************************************************************
312 void dumpQueue(P_ADAPTER_T prAdapter)
315 P_TX_CTRL_T prTxCtrl;
317 P_GLUE_INFO_T prGlueInfo;
322 DEBUGFUNC("dumpQueue");
324 prTxCtrl = &prAdapter->rTxCtrl;
325 prQM = &prAdapter->rQM;
326 prGlueInfo = prAdapter->prGlueInfo;
328 for(i = TC0_INDEX; i<=TC5_INDEX; i++) {
329 DBGLOG(SW4, INFO,( "TC %u\n",i));
330 DBGLOG(SW4, INFO,( "Max %u Free %u\n",
331 prTxCtrl->rTc.aucMaxNumOfBuffer[i], prTxCtrl->rTc.aucFreeBufferCount[i]));
333 DBGLOG(SW4, INFO,("Average %u minReserved %u CurrentTcResource %u GuaranteedTcResource %u\n",
334 QM_GET_TX_QUEUE_LEN(prAdapter, i),
335 prQM->au4MinReservedTcResource[i],
336 prQM->au4CurrentTcResource[i],
337 prQM->au4GuaranteedTcResource[i]));
342 for(i = 0; i<NUM_OF_PER_STA_TX_QUEUES; i++) {
343 DBGLOG(SW4, INFO,( "TC %u HeadStaIdx %u ForwardCount %u\n",i, prQM->au4HeadStaRecIndex[i],prQM->au4ForwardCount[i]));
346 DBGLOG(SW4, INFO,( "BMC or unknown TxQueue Len %u\n",prQM->arTxQueue[0].u4NumElem));
347 DBGLOG(SW4, INFO,( "Pending %d\n",prGlueInfo->i4TxPendingFrameNum));
348 DBGLOG(SW4, INFO,( "Pending Security %d\n",prGlueInfo->i4TxPendingSecurityFrameNum));
351 for(j=0;j<CFG_MAX_TXQ_NUM;j++){
352 DBGLOG(SW4, INFO,( "Pending Q[%u][%u] %d\n",i,j,prGlueInfo->ai4TxPendingFrameNumPerQueue[i][j]));
357 DBGLOG(SW4, INFO,( " rFreeSwRfbList %u\n", prAdapter->rRxCtrl.rFreeSwRfbList.u4NumElem));
358 DBGLOG(SW4, INFO,( " rReceivedRfbList %u\n", prAdapter->rRxCtrl.rReceivedRfbList.u4NumElem));
359 DBGLOG(SW4, INFO,( " rIndicatedRfbList %u\n", prAdapter->rRxCtrl.rIndicatedRfbList.u4NumElem));
360 DBGLOG(SW4, INFO,( " ucNumIndPacket %u\n", prAdapter->rRxCtrl.ucNumIndPacket));
361 DBGLOG(SW4, INFO,( " ucNumRetainedPacket %u\n", prAdapter->rRxCtrl.ucNumRetainedPacket));
367 void dumpSTA(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec)
371 P_BSS_INFO_T prBssInfo;
373 DEBUGFUNC("dumpSTA");
376 ucWTEntry = prStaRec->ucWTEntry;
378 prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex];
381 DBGLOG(SW4, INFO,("Mac address: " MACSTR " Rcpi %u" "\n", MAC2STR(prStaRec->aucMacAddr),prStaRec->ucRCPI));
383 DBGLOG(SW4, INFO,("Idx %u Wtbl %u Used %u State %u Bss Phy 0x%x Sta DesiredPhy 0x%x\n",
384 prStaRec->ucIndex, ucWTEntry,
385 prStaRec->fgIsInUse,prStaRec->ucStaState,
386 prBssInfo->ucPhyTypeSet,
387 prStaRec->ucDesiredPhyTypeSet));
389 DBGLOG(SW4, INFO,("Sta Operation 0x%x DesiredNontHtRateSet 0x%x Mcs 0x%x u2HtCapInfo 0x%x\n",
390 prStaRec->u2OperationalRateSet,prStaRec->u2DesiredNonHTRateSet,prStaRec->ucMcsSet, prStaRec->u2HtCapInfo));
393 for(i = 0; i<NUM_OF_PER_STA_TX_QUEUES; i++) {
394 DBGLOG(SW4, INFO,( "TC %u Queue Len %u\n",i,prStaRec->arTxQueue[i].u4NumElem));
397 DBGLOG(SW4, INFO, ("BmpDeliveryAC %x\n",prStaRec->ucBmpDeliveryAC));
398 DBGLOG(SW4, INFO, ("BmpTriggerAC %x\n",prStaRec->ucBmpTriggerAC));
399 DBGLOG(SW4, INFO, ("UapsdSpSupproted %u\n",prStaRec->fgIsUapsdSupported));
400 DBGLOG(SW4, INFO, ("IsQoS %u\n",prStaRec->fgIsQoS));
401 DBGLOG(SW4, INFO, ("AssocId %u\n",prStaRec->u2AssocId));
403 DBGLOG(SW4, INFO, ("fgIsInPS %u\n",prStaRec->fgIsInPS));
404 DBGLOG(SW4, INFO, ("ucFreeQuota %u\n",prStaRec->ucFreeQuota));
405 DBGLOG(SW4, INFO, ("ucFreeQuotaForDelivery %u\n",prStaRec->ucFreeQuotaForDelivery));
406 DBGLOG(SW4, INFO, ("ucFreeQuotaForNonDelivery %u\n",prStaRec->ucFreeQuotaForNonDelivery));
410 DBGLOG(SW4, INFO, ("IsQmmSup %u\n",prStaRec->fgIsWmmSupported));
411 DBGLOG(SW4, INFO, ("IsUapsdSup %u\n",prStaRec->fgIsUapsdSupported));
412 DBGLOG(SW4, INFO, ("AvailabaleDeliverPkts %u\n",prStaRec->ucAvailableDeliverPkts));
413 DBGLOG(SW4, INFO, ("BmpDeliverPktsAC %u\n",prStaRec->u4BmpDeliverPktsAC));
414 DBGLOG(SW4, INFO, ("BmpBufferAC %u\n",prStaRec->u4BmpBufferAC));
415 DBGLOG(SW4, INFO, ("BmpNonDeliverPktsAC %u\n",prStaRec->u4BmpNonDeliverPktsAC));
418 for(i=0;i<CFG_RX_MAX_BA_TID_NUM;i++) {
419 if(prStaRec->aprRxReorderParamRefTbl[i]){
420 DBGLOG(SW4, INFO,("RxReorder fgIsValid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->fgIsValid));
421 DBGLOG(SW4, INFO,("RxReorder Tid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->ucTid));
422 DBGLOG(SW4, INFO,("RxReorder rReOrderQue Len: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->rReOrderQue.u4NumElem));
423 DBGLOG(SW4, INFO,("RxReorder WinStart: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinStart));
424 DBGLOG(SW4, INFO,("RxReorder WinEnd: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinEnd));
425 DBGLOG(SW4, INFO,("RxReorder WinSize: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinSize));
432 VOID dumpBss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo)
435 DBGLOG(SW4, INFO, ("SSID %s\n",prBssInfo->aucSSID));
436 DBGLOG(SW4, INFO, ("OWN " MACSTR"\n",MAC2STR(prBssInfo->aucOwnMacAddr)));
437 DBGLOG(SW4, INFO, ("BSSID " MACSTR"\n",MAC2STR(prBssInfo->aucBSSID)));
438 DBGLOG(SW4, INFO, ("ucNetTypeIndex %u\n",prBssInfo->ucNetTypeIndex));
439 DBGLOG(SW4, INFO, ("eConnectionState %u\n",prBssInfo->eConnectionState));
440 DBGLOG(SW4, INFO, ("eCurrentOPMode %u\n",prBssInfo->eCurrentOPMode));
441 DBGLOG(SW4, INFO, ("fgIsQBSS %u\n",prBssInfo->fgIsQBSS));
442 DBGLOG(SW4, INFO, ("fgIsShortPreambleAllowed %u\n",prBssInfo->fgIsShortPreambleAllowed));
443 DBGLOG(SW4, INFO, ("fgUseShortPreamble %u\n",prBssInfo->fgUseShortPreamble));
444 DBGLOG(SW4, INFO, ("fgUseShortSlotTime %u\n",prBssInfo->fgUseShortSlotTime));
445 DBGLOG(SW4, INFO, ("ucNonHTBasicPhyType %x\n",prBssInfo->ucNonHTBasicPhyType));
446 DBGLOG(SW4, INFO, ("u2OperationalRateSet %x\n",prBssInfo->u2OperationalRateSet));
447 DBGLOG(SW4, INFO, ("u2BSSBasicRateSet %x\n",prBssInfo->u2BSSBasicRateSet));
448 DBGLOG(SW4, INFO, ("ucPhyTypeSet %x\n",prBssInfo->ucPhyTypeSet));
449 DBGLOG(SW4, INFO, ("rStaRecOfClientList %d\n",prBssInfo->rStaRecOfClientList.u4NumElem));
450 DBGLOG(SW4, INFO, ("u2CapInfo %x\n",prBssInfo->u2CapInfo));
451 DBGLOG(SW4, INFO, ("u2ATIMWindow %x\n",prBssInfo->u2ATIMWindow));
452 DBGLOG(SW4, INFO, ("u2AssocId %x\n",prBssInfo->u2AssocId));
453 DBGLOG(SW4, INFO, ("ucDTIMPeriod %x\n",prBssInfo->ucDTIMPeriod));
454 DBGLOG(SW4, INFO, ("ucDTIMCount %x\n",prBssInfo->ucDTIMCount));
455 DBGLOG(SW4, INFO, ("fgIsNetAbsent %x\n", prBssInfo->fgIsNetAbsent));
456 DBGLOG(SW4, INFO, ("eBand %d\n", prBssInfo->eBand));
457 DBGLOG(SW4, INFO, ("ucPrimaryChannel %d\n", prBssInfo->ucPrimaryChannel));
458 DBGLOG(SW4, INFO, ("ucHtOpInfo1 %d\n", prBssInfo->ucHtOpInfo1));
459 DBGLOG(SW4, INFO, ("ucHtOpInfo2 %d\n", prBssInfo->u2HtOpInfo2));
460 DBGLOG(SW4, INFO, ("ucHtOpInfo3 %d\n", prBssInfo->u2HtOpInfo3));
461 DBGLOG(SW4, INFO, ("fgErpProtectMode %d\n", prBssInfo->fgErpProtectMode));
462 DBGLOG(SW4, INFO, ("eHtProtectMode %d\n", prBssInfo->eHtProtectMode));
463 DBGLOG(SW4, INFO, ("eGfOperationMode %d\n", prBssInfo->eGfOperationMode));
464 DBGLOG(SW4, INFO, ("eRifsOperationMode %d\n", prBssInfo->eRifsOperationMode));
465 DBGLOG(SW4, INFO, ("fgObssErpProtectMode %d\n", prBssInfo->fgObssErpProtectMode));
466 DBGLOG(SW4, INFO, ("eObssHtProtectMode %d\n", prBssInfo->eObssHtProtectMode));
467 DBGLOG(SW4, INFO, ("eObssGfProtectMode %d\n", prBssInfo->eObssGfOperationMode));
468 DBGLOG(SW4, INFO, ("fgObssRifsOperationMode %d\n", prBssInfo->fgObssRifsOperationMode));
469 DBGLOG(SW4, INFO, ("fgAssoc40mBwAllowed %d\n", prBssInfo->fgAssoc40mBwAllowed));
470 DBGLOG(SW4, INFO, ("fg40mBwAllowed %d\n", prBssInfo->fg40mBwAllowed));
471 DBGLOG(SW4, INFO, ("eBssSCO %d\n", prBssInfo->eBssSCO));
478 VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
480 UINT_8 ucIndex,ucRead;
483 DEBUGFUNC("swCtrlCmdCategory0");
485 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
489 if(ucIndex>=SWCTRL_CATA0_INDEX_NUM) return;
491 if(ucRead == SWCR_WRITE) {
495 aucDebugModule[ucOpt0] = (UINT_8)g_au4SwCr[1];
498 case SWCTRL_WIFI_VAR:
502 case SWCTRL_DUMP_QM_DBG_CNT:
503 for(i=0;i<QM_DBG_CNT_NUM;i++) {
504 prAdapter->rQM.au4QmDebugCounters[i] = 0;
507 case SWCTRL_QM_DBG_CNT:
508 prAdapter->rQM.au4QmDebugCounters[ucOpt0] = g_au4SwCr[1];
513 case SWCTRL_RX_PKTS_DUMP:
514 //DBGLOG(SW4, INFO,("SWCTRL_RX_PKTS_DUMP: mask %x\n", g_au4SwCr[1]));
515 prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = g_au4SwCr[1];
526 g_au4SwCr[1] = aucDebugModule[ucOpt0] ;
530 g_au4SwCr[1] = _SWCTRL_MAGIC ;
531 DBGLOG(SW4, INFO,("BUILD TIME: %s %s\n", __DATE__, __TIME__));
535 P_QUE_MGT_T prQM = &prAdapter->rQM;
538 g_au4SwCr[1] = (QM_GET_TX_QUEUE_LEN(prAdapter, ucOpt1)) ;
539 g_au4SwCr[2] = prQM->au4MinReservedTcResource[ucOpt1] ;
540 g_au4SwCr[3] = prQM->au4CurrentTcResource[ucOpt1];
541 g_au4SwCr[4] = prQM->au4GuaranteedTcResource[ucOpt1];
545 g_au4SwCr[1] = prQM->au4ForwardCount[ucOpt1];
546 g_au4SwCr[2] = prQM->au4HeadStaRecIndex[ucOpt1];
550 g_au4SwCr[1] = prQM->arTxQueue[ucOpt1].u4NumElem; /* only one */
557 case SWCTRL_TX_CTRL_INFO:
559 P_TX_CTRL_T prTxCtrl;
560 prTxCtrl = &prAdapter->rTxCtrl;
563 g_au4SwCr[1] = prAdapter->rTxCtrl.rTc.aucFreeBufferCount[ucOpt1];
564 g_au4SwCr[2] = prAdapter->rTxCtrl.rTc.aucMaxNumOfBuffer[ucOpt1];
570 case SWCTRL_DUMP_QUEUE:
571 dumpQueue(prAdapter);
575 case SWCTRL_DUMP_QM_DBG_CNT:
576 for(i=0;i<QM_DBG_CNT_NUM;i++) {
577 DBGLOG(SW4, INFO,("QM:DBG %u %u\n",i , prAdapter->rQM.au4QmDebugCounters[i]));
581 case SWCTRL_QM_DBG_CNT:
582 g_au4SwCr[1] = prAdapter->rQM.au4QmDebugCounters[ucOpt0];
585 case SWCTRL_DUMP_BSS:
587 dumpBss(prAdapter, &(prAdapter->rWifiVar.arBssInfo[ucOpt0])) ;
599 VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
601 UINT_8 ucIndex,ucRead;
603 P_STA_RECORD_T prStaRec;
605 DEBUGFUNC("swCtrlCmdCategory1");
607 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
609 if(ucOpt0>=CFG_STA_REC_NUM) return;
611 //prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0);
612 prStaRec = &prAdapter->arStaRec[ucOpt0];
613 ucWTEntry = prStaRec->ucWTEntry;
614 if(ucRead == SWCR_WRITE) {
619 case SWCTRL_STA_QUE_INFO:
621 g_au4SwCr[1] = prStaRec->arTxQueue[ucOpt1].u4NumElem;
624 case SWCTRL_STA_INFO:
627 g_au4SwCr[1] = prStaRec->fgIsInPS;
633 case SWCTRL_DUMP_STA:
635 dumpSTA(prAdapter, prStaRec);
651 testPsSendQoSNullFrame (
652 IN P_ADAPTER_T prAdapter,
653 IN P_STA_RECORD_T prStaRec,
655 IN UINT_8 ucNetTypeIndex,
657 IN BOOLEAN fgIsBurstEnd,
658 IN BOOLEAN ucPacketType,
659 IN BOOLEAN ucPsSessionID,
663 P_MSDU_INFO_T prMsduInfo;
664 UINT_16 u2EstimatedFrameLen;
665 P_WLAN_MAC_HEADER_QOS_T prQoSNullFrame;
668 DEBUGFUNC("testPsSendQoSNullFrame");
669 DBGLOG(SW4, LOUD, ("\n"));
671 //4 <1> Allocate a PKT_INFO_T for Null Frame
672 /* Init with MGMT Header Length */
673 u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \
674 WLAN_MAC_HEADER_QOS_LEN;
676 /* Allocate a MSDU_INFO_T */
677 if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) {
678 DBGLOG(SW4, WARN, ("No PKT_INFO_T for sending Null Frame.\n"));
682 //4 <2> Compose Null frame in MSDU_INfO_T.
683 bssComposeQoSNullFrame(prAdapter,
684 (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD),
690 prMsduInfo->eSrc = TX_PACKET_MGMT;
691 //prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_DATA;
692 prMsduInfo->ucPacketType = ucPacketType;
693 prMsduInfo->ucStaRecIndex = prStaRec->ucIndex;
694 prMsduInfo->ucNetworkType = ucNetTypeIndex;
695 prMsduInfo->ucMacHeaderLength = WLAN_MAC_HEADER_QOS_LEN;
696 prMsduInfo->fgIs802_1x = FALSE;
697 prMsduInfo->fgIs802_11 = TRUE;
698 prMsduInfo->u2FrameLength = WLAN_MAC_HEADER_QOS_LEN;
699 prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter);
700 prMsduInfo->pfTxDoneHandler = NULL;
701 prMsduInfo->fgIsBasicRate = TRUE;
702 prMsduInfo->fgIsBurstEnd = fgIsBurstEnd;
703 prMsduInfo->ucUserPriority = ucUP;
704 prMsduInfo->ucPsSessionID = ucPsSessionID /* 0~7 Test 7 means NOACK*/;
706 prQoSNullFrame = (P_WLAN_MAC_HEADER_QOS_T)( (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD) );
709 prQoSNullFrame->aucAddr1[0] = 0xfd;
712 prQoSNullFrame->aucAddr1[5] = 0xdd;
715 //4 <4> Inform TXM to send this Null frame.
716 nicTxEnqueueMsdu(prAdapter, prMsduInfo);
724 IN P_ADAPTER_T prAdapter,
725 IN UINT_8 ucNetworkTypeIndex
728 P_BSS_INFO_T prBssInfo;
729 UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR;
731 DEBUGFUNC("testPsSetupBss()");
732 DBGLOG(SW4, INFO, ("index %d\n", ucNetworkTypeIndex));
734 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetworkTypeIndex]);
736 //4 <1.2> Initiate PWR STATE
737 //SET_NET_PWR_STATE_IDLE(prAdapter, ucNetworkTypeIndex);
740 //4 <2> Initiate BSS_INFO_T - common part
741 BSS_INFO_INIT(prAdapter, ucNetworkTypeIndex);
743 prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED;
744 prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED;
745 prBssInfo->eCurrentOPMode = OP_MODE_ACCESS_POINT;
746 prBssInfo->fgIsNetActive = TRUE;
747 prBssInfo->ucNetTypeIndex = (ucNetworkTypeIndex);
748 prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED;
750 prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */
751 prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */
752 prBssInfo->u2BSSBasicRateSet = RATE_SET_ERP;
753 prBssInfo->u2OperationalRateSet = RATE_SET_OFDM;
754 prBssInfo->fgErpProtectMode = FALSE;
755 prBssInfo->fgIsQBSS = TRUE;
757 //4 <1.5> Setup MIB for current BSS
758 prBssInfo->u2BeaconInterval = 100;
759 prBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
760 prBssInfo->u2ATIMWindow = 0;
762 prBssInfo->ucBeaconTimeoutCount = 0;
765 bssInitForAP (prAdapter,prBssInfo, TRUE);
767 COPY_MAC_ADDR(prBssInfo->aucBSSID, _aucZeroMacAddr);
768 LINK_INITIALIZE(&prBssInfo->rStaRecOfClientList);
769 prBssInfo->fgIsBeaconActivated = TRUE;
770 prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG;
773 COPY_MAC_ADDR(prBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucMacAddress);
775 //4 <3> Initiate BSS_INFO_T - private part
777 prBssInfo->eBand = BAND_2G4;
778 prBssInfo->ucPrimaryChannel = 1;
779 prBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL;
782 //prBssInfo->fgErpProtectMode = eErpProectMode;
783 //prBssInfo->eHtProtectMode = eHtProtectMode;
784 //prBssInfo->eGfOperationMode = eGfOperationMode;
787 //4 <4> Allocate MSDU_INFO_T for Beacon
788 prBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
789 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
791 if (prBssInfo->prBeacon) {
792 prBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
793 prBssInfo->prBeacon->ucNetworkType = ucNetworkTypeIndex;
796 DBGLOG(SW4, INFO, ("prBeacon allocation fail\n"));
800 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
801 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
802 prBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
804 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8)prAdapter->u4UapsdAcBmp;
805 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC =(UINT_8) prAdapter->u4UapsdAcBmp;
806 prBssInfo->rPmProfSetupInfo.ucUapsdSp = (UINT_8)prAdapter->u4MaxSpLen;
810 for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){
812 prBssInfo->arACQueParms[eAci].fgIsACMSet = FALSE;
813 prBssInfo->arACQueParms[eAci].u2Aifsn = (UINT_16) eAci;
814 prBssInfo->arACQueParms[eAci].u2CWmin = 7;
815 prBssInfo->arACQueParms[eAci].u2CWmax = 31;
816 prBssInfo->arACQueParms[eAci].u2TxopLimit = eAci+1;
817 DBGLOG(SW4, INFO, ("MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n",
818 eAci,prBssInfo->arACQueParms[eAci].fgIsACMSet ,
819 prBssInfo->arACQueParms[eAci].u2Aifsn,
820 prBssInfo->arACQueParms[eAci].u2CWmin,
821 prBssInfo->arACQueParms[eAci].u2CWmax,
822 prBssInfo->arACQueParms[eAci].u2TxopLimit));
828 DBGLOG(SW4, INFO, ("[2] ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x, ucUapsdSp:0x%x",
829 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC,
830 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC,
831 prBssInfo->rPmProfSetupInfo.ucUapsdSp));
839 VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
841 UINT_8 ucIndex,ucRead;
842 P_STA_RECORD_T prStaRec;
844 DEBUGFUNC("testPsCmdCategory0");
845 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
847 DBGLOG(SW4, LOUD, ("Read %u Index %u\n",ucRead,ucIndex));
849 prStaRec = cnmGetStaRecByIndex (prAdapter, 0);
851 if(ucIndex>=TEST_PS_CATA0_INDEX_NUM) return;
853 if(ucRead == SWCR_WRITE) {
855 case TEST_PS_SETUP_BSS:
856 testPsSetupBss(prAdapter, ucOpt0) ;
859 case TEST_PS_ENABLE_BEACON:
862 case TEST_PS_TRIGGER_BMC:
863 //txmForwardQueuedBmcPkts (ucOpt0);
865 case TEST_PS_SEND_NULL:
868 testPsSendQoSNullFrame (prAdapter,prStaRec,
869 (UINT_8)(g_au4SwCr[1] & 0xFF), /* UP */
871 (BOOLEAN)((g_au4SwCr[1] >>8)& 0xFF), /* BMC*/
872 (BOOLEAN)((g_au4SwCr[1] >>16)& 0xFF), /* BurstEnd*/
873 (BOOLEAN)((g_au4SwCr[1] >>24)& 0xFF), /* Packet type*/
874 (UINT_8)((g_au4SwCr[2] )& 0xFF), /* PS sesson ID 7: NOACK */
879 case TEST_PS_BUFFER_BMC:
880 //g_aprBssInfo[ucOpt0]->fgApToBufferBMC = (g_au4SwCr[1] & 0xFF);
882 case TEST_PS_UPDATE_BEACON:
883 bssUpdateBeaconContent(prAdapter, ucOpt0 /*networktype*/ );
894 g_au4SwCr[1] = 0x88660011 ;
905 VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
907 UINT_8 ucIndex,ucRead;
909 P_STA_RECORD_T prStaRec;
911 DEBUGFUNC("testPsCmdCategory1");
913 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
915 if(ucOpt0>=CFG_STA_REC_NUM) return;
917 prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0);
918 ucWTEntry = prStaRec->ucWTEntry;
919 if(ucRead == SWCR_WRITE) {
923 prStaRec->fgIsInPS = (BOOLEAN) (g_au4SwCr[1] & 0x1);
924 prStaRec->fgIsQoS = (BOOLEAN) (g_au4SwCr[1] >>8 & 0xFF);
925 prStaRec->fgIsUapsdSupported = (BOOLEAN) (g_au4SwCr[1] >>16 & 0xFF);
926 prStaRec->ucBmpDeliveryAC = (BOOLEAN) (g_au4SwCr[1] >>24 & 0xFF);
947 VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
949 /* According other register STAIDX */
951 ucOffset = (u2Addr>>2) & 0x3F;
953 if(ucOffset>= SWCR_CR_NUM) return;
955 if(ucRead==SWCR_WRITE) {
956 g_au4SwCr[ucOffset] = *pu4Data;
958 /* Commmand [31:24]: Category */
959 /* Commmand [23:23]: 1(W) 0(R) */
960 /* Commmand [22:16]: Index */
961 /* Commmand [15:08]: Option0 */
962 /* Commmand [07:00]: Option1 */
965 u4Cmd = g_au4SwCr[0];
966 ucCate = (UINT_8)(u4Cmd >> 24) ;
967 if(ucCate < sizeof(g_arSwCtrlCmd)/sizeof(g_arSwCtrlCmd[0])) {
968 if(g_arSwCtrlCmd[ucCate]!=NULL) {
969 g_arSwCtrlCmd[ucCate](prAdapter, ucCate, (UINT_8)(u4Cmd>>16 & 0xFF),(UINT_8)((u4Cmd>>8) & 0xFF), (UINT_8)(u4Cmd&0xFF));
975 *pu4Data = g_au4SwCr[ucOffset];
979 VOID swCrReadWriteCmd(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
984 /* Address [15:8] MOD ID */
985 /* Address [7:0] OFFSET */
987 DEBUGFUNC("swCrReadWriteCmd");
988 DBGLOG(SW4, INFO, ("%u addr 0x%x data 0x%x\n",ucRead,u2Addr,*pu4Data));
990 if(ucMod < (sizeof(g_arSwCrModHandle)/sizeof(g_arSwCrModHandle[0])) ) {
992 if(g_arSwCrModHandle[ucMod]!=NULL) {
993 g_arSwCrModHandle[ucMod](prAdapter, ucRead, u2Addr, pu4Data);
999 VOID swCrFrameCheckEnable(P_ADAPTER_T prAdapter, UINT_32 u4DumpType)
1001 g_u4SwcrDebugFrameDumpType = u4DumpType;
1002 prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = u4DumpType;
1005 VOID swCrDebugInit(P_ADAPTER_T prAdapter)
1008 if (g_u4SwcrDebugFrameDumpType) {
1009 swCrFrameCheckEnable(prAdapter, g_u4SwcrDebugFrameDumpType);
1013 g_fgSwcrDebugTimer = FALSE;
1015 cnmTimerInitTimer(prAdapter,
1017 (PFN_MGMT_TIMEOUT_FUNC)swCrDebugCheckTimeout,
1020 if (g_u4SwcrDebugCheckTimeout) {
1021 swCrDebugCheckEnable(prAdapter, TRUE, g_ucSwcrDebugCheckType, g_u4SwcrDebugCheckTimeout);
1025 VOID swCrDebugUninit(P_ADAPTER_T prAdapter)
1027 cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
1029 g_fgSwcrDebugTimer = FALSE;
1032 VOID swCrDebugCheckEnable(P_ADAPTER_T prAdapter, BOOLEAN fgIsEnable, UINT_8 ucType, UINT_32 u4Timeout)
1035 g_ucSwcrDebugCheckType = ucType;
1036 g_u4SwcrDebugCheckTimeout = u4Timeout;
1037 if (g_fgSwcrDebugTimer == FALSE) {
1038 swCrDebugCheckTimeout(prAdapter, 0);
1042 cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
1043 g_u4SwcrDebugCheckTimeout = 0;
1046 g_fgSwcrDebugTimer = fgIsEnable;
1049 VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl)
1051 P_RX_CTRL_T prRxCtrl;
1052 P_TX_CTRL_T prTxCtrl;
1056 prTxCtrl = &prAdapter->rTxCtrl;
1057 prRxCtrl = &prAdapter->rRxCtrl;
1061 if (prCmdSwCtrl->u4Data == SWCR_DBG_TYPE_ALL) {
1063 // TX Counter from fw
1064 DBGLOG(SW4, INFO, ("TX0\n" \
1065 "%08x %08x %08x %08x\n" \
1066 "%08x %08x %08x %08x\n",
1067 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_CNT],
1068 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_BCN_CNT],
1069 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_FAILED_CNT],
1070 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_RETRY_CNT],
1071 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_AGING_TIMEOUT_CNT],
1072 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_PS_OVERFLOW_CNT],
1073 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_MGNT_DROP_CNT],
1074 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_ERROR_CNT]));
1076 // TX Counter from drv
1077 DBGLOG(SW4, INFO, ("TX1\n" \
1078 "%08x %08x %08x %08x\n",
1079 (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_BSS_DROP),
1080 (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_STA_DROP),
1081 (UINT_32)TX_GET_CNT(prTxCtrl, TX_FORWARD_OVERFLOW_DROP),
1082 (UINT_32)TX_GET_CNT(prTxCtrl, TX_AP_BORADCAST_DROP)));
1086 DBGLOG(SW4, INFO, ("RX0\n" \
1087 "%08x %08x %08x %08x\n" \
1088 "%08x %08x %08x %08x\n" \
1089 "%08x %08x %08x %08x\n" \
1090 "%08x %08x %08x %08x\n",
1091 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CNT],
1092 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DROP_CNT],
1093 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DUP_DROP_CNT],
1094 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TYPE_ERROR_DROP_CNT],
1095 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CLASS_ERROR_DROP_CNT],
1096 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_AMPDU_ERROR_DROP_CNT],
1097 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_STATUS_ERROR_DROP_CNT],
1098 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FORMAT_ERROR_DROP_CNT],
1099 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_ICV_ERROR_DROP_CNT],
1100 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_KEY_ERROR_DROP_CNT],
1101 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TKIP_ERROR_DROP_CNT],
1102 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_MIC_ERROR_DROP_CNT],
1103 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_BIP_ERROR_DROP_CNT],
1104 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FCSERR_CNT],
1105 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FIFOFULL_CNT],
1106 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_PFDROP_CNT]));
1108 DBGLOG(SW4, INFO, ("RX1\n" \
1109 "%08x %08x %08x %08x\n" \
1110 "%08x %08x %08x %08x\n",
1111 (UINT_32)RX_GET_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT),
1112 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT),
1113 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETURNED_COUNT),
1114 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT),
1115 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT),
1116 (UINT_32)RX_GET_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT),
1117 (UINT_32)RX_GET_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT),
1118 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT)));
1120 DBGLOG(SW4, INFO, ("PWR\n" \
1121 "%08x %08x %08x %08x\n" \
1122 "%08x %08x %08x %08x\n",
1123 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PS_POLL_CNT],
1124 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_TRIGGER_NULL_CNT],
1125 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_IND_CNT],
1126 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_TIMEOUT_CNT],
1127 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE0],
1128 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE1],
1129 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF0],
1130 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF1]));
1132 DBGLOG(SW4, INFO, ("ARM\n" \
1133 "%08x %08x %08x %08x\n" \
1135 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RATE],
1136 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_BWGI],
1137 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RX_RATE_RCPI],
1138 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ENABLE],
1139 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ROAM_CNT],
1140 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_INT_CNT]));
1142 DBGLOG(SW4, INFO, ("BB\n" \
1143 "%08x %08x %08x %08x\n" \
1144 "%08x %08x %08x %08x\n",
1145 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_MDRDY_CNT],
1146 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_FCSERR_CNT],
1147 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_PD_CNT],
1148 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_PD_CNT],
1149 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SFDERR_CNT],
1150 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SIGERR_CNT],
1151 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_TAGERR_CNT],
1152 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_SIGERR_CNT]));
1157 // start the next check
1158 if (g_u4SwcrDebugCheckTimeout) {
1159 cnmTimerStartTimer(prAdapter, &g_rSwcrDebugTimer, g_u4SwcrDebugCheckTimeout * MSEC_PER_SEC);
1163 VOID swCrDebugCheckTimeout(
1164 IN P_ADAPTER_T prAdapter,
1167 CMD_SW_DBG_CTRL_T rCmdSwCtrl;
1168 WLAN_STATUS rStatus;
1170 rCmdSwCtrl.u4Id = (0xb000<<16) + g_ucSwcrDebugCheckType;
1171 rCmdSwCtrl.u4Data = 0;
1172 rStatus = wlanSendSetQueryCmd (
1173 prAdapter, /* prAdapter */
1174 CMD_ID_SW_DBG_CTRL, /* ucCID */
1175 FALSE, /* fgSetQuery */
1176 TRUE, /* fgNeedResp */
1177 FALSE, /* fgIsOid */
1178 swCrDebugQuery, /* pfCmdDoneHandler */
1179 swCrDebugQueryTimeout, /* pfCmdTimeoutHandler */
1180 sizeof(CMD_SW_DBG_CTRL_T), /* u4SetQueryInfoLen */
1181 (PUINT_8)&rCmdSwCtrl, /* pucInfoBuffer */
1182 NULL, /* pvSetQueryBuffer */
1183 0 /* u4SetQueryBufferLen */
1186 ASSERT(rStatus == WLAN_STATUS_PENDING);
1191 VOID swCrDebugQuery(
1192 IN P_ADAPTER_T prAdapter,
1193 IN P_CMD_INFO_T prCmdInfo,
1194 IN PUINT_8 pucEventBuf
1199 swCrDebugCheck(prAdapter, (P_CMD_SW_DBG_CTRL_T)(pucEventBuf));
1202 VOID swCrDebugQueryTimeout(
1203 IN P_ADAPTER_T prAdapter,
1204 IN P_CMD_INFO_T prCmdInfo)
1208 swCrDebugCheck(prAdapter, NULL);
1211 #endif /* CFG_SUPPORT_SWCR */