2 ** $Id: //Department/DaVinci/BRANCHES/MT662X_593X_WIFI_DRIVER_V2_3/mgmt/swcr.c#1 $
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 * 06 04 2012 tsaiyuan.hsu
56 * [WCXRP00001249] [ALPS.ICS] Daily build warning on "wlan/mgmt/swcr.c#1"
57 * resolve build waring for "WNM_UNIT_TEST not defined".
61 * Sync CFG80211 modification from branch 2,2.
63 * 01 05 2012 tsaiyuan.hsu
64 * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
65 * add timing measurement support for 802.11v.
67 * 11 22 2011 tsaiyuan.hsu
68 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
69 * keep debug counter setting after wake up.
73 * Fix compiling warning
75 * 11 11 2011 tsaiyuan.hsu
76 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
77 * fix debug counters of rx in driver.
79 * 11 11 2011 tsaiyuan.hsu
80 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
81 * add debug counters of bb and ar for xlog.
83 * 11 10 2011 eddie.chen
84 * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
85 * Modify the QM xlog level and remove LOG_FUNC.
87 * 11 08 2011 tsaiyuan.hsu
88 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
89 * add debug counters, eCurPsProf, for PS.
91 * 11 07 2011 tsaiyuan.hsu
92 * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
93 * add debug counters and periodically dump counters for debugging.
96 * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
97 * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG
99 * 08 31 2011 tsaiyuan.hsu
100 * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
101 * remove obsolete code.
103 * 08 15 2011 tsaiyuan.hsu
104 * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver
105 * add swcr in driver reg, 0x9fxx0000, to disable roaming .
107 * 05 11 2011 eddie.chen
108 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
109 * Fix dest type when GO packet copying.
111 * 05 09 2011 eddie.chen
112 * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
113 * Check free number before copying broadcast packet.
115 * 04 14 2011 eddie.chen
116 * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
117 * Check the SW RFB free. Fix the compile warning..
119 * 04 12 2011 eddie.chen
120 * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
121 * Fix the sta index in processing security frame
122 * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4
125 * 03 28 2011 eddie.chen
126 * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning
127 * Fix Klockwork warning.
129 * 03 15 2011 eddie.chen
130 * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter
131 * Add sw debug counter for QM.
133 * 01 11 2011 eddie.chen
134 * [WCXRP00000322] Add WMM IE in beacon,
135 Add per station flow control when STA is in PS
143 /*******************************************************************************
144 * C O M P I L E R F L A G S
145 ********************************************************************************
148 /*******************************************************************************
149 * E X T E R N A L R E F E R E N C E S
150 ********************************************************************************
157 #pragma GCC diagnostic ignored "-Wformat"
159 /*******************************************************************************
161 ********************************************************************************
164 /*******************************************************************************
165 * P U B L I C D A T A
166 ********************************************************************************
169 extern SWCR_MAP_ENTRY_T g_arRlmArSwCrMap[];
170 SWCR_MOD_MAP_ENTRY_T g_arSwCrAllMaps[] = {
171 { SWCR_MAP_NUM(g_arRlmArSwCrMap), g_arRlmArSwCrMap}, /* 0x00nn */
176 VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
177 VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
178 VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
179 VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
180 void testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1);
181 VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data);
184 VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl);
185 VOID swCrDebugCheckTimeout(
186 IN P_ADAPTER_T prAdapter,
189 IN P_ADAPTER_T prAdapter,
190 IN P_CMD_INFO_T prCmdInfo,
191 IN PUINT_8 pucEventBuf
193 VOID swCrDebugQueryTimeout(
194 IN P_ADAPTER_T prAdapter,
195 IN P_CMD_INFO_T prCmdInfo);
197 UINT_32 g_au4SwCr[SWCR_CR_NUM]; /*: 0: command other: data */
199 static TIMER_T g_rSwcrDebugTimer;
200 static BOOLEAN g_fgSwcrDebugTimer = FALSE;
201 static UINT_32 g_u4SwcrDebugCheckTimeout = 0;
202 static ENUM_SWCR_DBG_TYPE_T g_ucSwcrDebugCheckType = 0;
203 static UINT_32 g_u4SwcrDebugFrameDumpType = 0;
205 /*******************************************************************************
206 * P R I V A T E D A T A
207 ********************************************************************************
211 const static PFN_CMD_RW_T g_arSwCtrlCmd[] ={
218 #if CFG_SUPPORT_802_11V
219 #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT ==1) && (WNM_UNIT_TEST ==1)
220 , testWNMCmdCategory0
226 const PFN_SWCR_RW_T g_arSwCrModHandle[] = {
232 /*******************************************************************************
234 ********************************************************************************
247 SWCTRL_DUMP_ALL_QUEUE_LEN,
251 SWCTRL_DUMP_QM_DBG_CNT,
254 SWCTRL_CATA0_INDEX_NUM
261 SWCTRL_CATA1_INDEX_NUM
270 TEST_PS_ENABLE_BEACON,
274 TEST_PS_UPDATE_BEACON,
275 TEST_PS_CATA0_INDEX_NUM
280 TEST_PS_STA_ENTER_PS,
282 TEST_PS_STA_TRIGGER_PSPOLL,
283 TEST_PS_STA_TRIGGER_FRAME,
284 TEST_PS_CATA1_INDEX_NUM
288 #if CFG_SUPPORT_802_11V
291 TEST_WNM_TIMING_MEAS,
292 TEST_WNM_CATA0_INDEX_NUM
298 #define _SWCTRL_MAGIC 0x66201642
300 /*******************************************************************************
301 * F U N C T I O N D E C L A R A T I O N S
302 ********************************************************************************
306 /*******************************************************************************
308 ********************************************************************************
311 void dumpQueue(P_ADAPTER_T prAdapter)
314 P_TX_CTRL_T prTxCtrl;
316 P_GLUE_INFO_T prGlueInfo;
321 DEBUGFUNC("dumpQueue");
323 prTxCtrl = &prAdapter->rTxCtrl;
324 prQM = &prAdapter->rQM;
325 prGlueInfo = prAdapter->prGlueInfo;
327 for(i = TC0_INDEX; i<=TC5_INDEX; i++) {
328 DBGLOG(SW4, INFO,( "TC %u\n",i));
329 DBGLOG(SW4, INFO,( "Max %u Free %u\n",
330 prTxCtrl->rTc.aucMaxNumOfBuffer[i], prTxCtrl->rTc.aucFreeBufferCount[i]));
332 DBGLOG(SW4, INFO,("Average %u minReserved %u CurrentTcResource %u GuaranteedTcResource %u\n",
333 QM_GET_TX_QUEUE_LEN(prAdapter, i),
334 prQM->au4MinReservedTcResource[i],
335 prQM->au4CurrentTcResource[i],
336 prQM->au4GuaranteedTcResource[i]));
341 for(i = 0; i<NUM_OF_PER_STA_TX_QUEUES; i++) {
342 DBGLOG(SW4, INFO,( "TC %u HeadStaIdx %u ForwardCount %u\n",i, prQM->au4HeadStaRecIndex[i],prQM->au4ForwardCount[i]));
345 DBGLOG(SW4, INFO,( "BMC or unknown TxQueue Len %u\n",prQM->arTxQueue[0].u4NumElem));
346 DBGLOG(SW4, INFO,( "Pending %d\n",prGlueInfo->i4TxPendingFrameNum));
347 DBGLOG(SW4, INFO,( "Pending Security %d\n",prGlueInfo->i4TxPendingSecurityFrameNum));
350 for(j=0;j<CFG_MAX_TXQ_NUM;j++){
351 DBGLOG(SW4, INFO,( "Pending Q[%u][%u] %d\n",i,j,prGlueInfo->ai4TxPendingFrameNumPerQueue[i][j]));
356 DBGLOG(SW4, INFO,( " rFreeSwRfbList %u\n", prAdapter->rRxCtrl.rFreeSwRfbList.u4NumElem));
357 DBGLOG(SW4, INFO,( " rReceivedRfbList %u\n", prAdapter->rRxCtrl.rReceivedRfbList.u4NumElem));
358 DBGLOG(SW4, INFO,( " rIndicatedRfbList %u\n", prAdapter->rRxCtrl.rIndicatedRfbList.u4NumElem));
359 DBGLOG(SW4, INFO,( " ucNumIndPacket %u\n", prAdapter->rRxCtrl.ucNumIndPacket));
360 DBGLOG(SW4, INFO,( " ucNumRetainedPacket %u\n", prAdapter->rRxCtrl.ucNumRetainedPacket));
366 void dumpSTA(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec)
370 P_BSS_INFO_T prBssInfo;
372 DEBUGFUNC("dumpSTA");
375 ucWTEntry = prStaRec->ucWTEntry;
377 prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex];
380 DBGLOG(SW4, INFO,("Mac address: " MACSTR " Rcpi %u" "\n", MAC2STR(prStaRec->aucMacAddr),prStaRec->ucRCPI));
382 DBGLOG(SW4, INFO,("Idx %u Wtbl %u Used %u State %u Bss Phy 0x%x Sta DesiredPhy 0x%x\n",
383 prStaRec->ucIndex, ucWTEntry,
384 prStaRec->fgIsInUse,prStaRec->ucStaState,
385 prBssInfo->ucPhyTypeSet,
386 prStaRec->ucDesiredPhyTypeSet));
388 DBGLOG(SW4, INFO,("Sta Operation 0x%x DesiredNontHtRateSet 0x%x Mcs 0x%x u2HtCapInfo 0x%x\n",
389 prStaRec->u2OperationalRateSet,prStaRec->u2DesiredNonHTRateSet,prStaRec->ucMcsSet, prStaRec->u2HtCapInfo));
392 for(i = 0; i<NUM_OF_PER_STA_TX_QUEUES; i++) {
393 DBGLOG(SW4, INFO,( "TC %u Queue Len %u\n",i,prStaRec->arTxQueue[i].u4NumElem));
396 DBGLOG(SW4, INFO, ("BmpDeliveryAC %x\n",prStaRec->ucBmpDeliveryAC));
397 DBGLOG(SW4, INFO, ("BmpTriggerAC %x\n",prStaRec->ucBmpTriggerAC));
398 DBGLOG(SW4, INFO, ("UapsdSpSupproted %u\n",prStaRec->fgIsUapsdSupported));
399 DBGLOG(SW4, INFO, ("IsQoS %u\n",prStaRec->fgIsQoS));
400 DBGLOG(SW4, INFO, ("AssocId %u\n",prStaRec->u2AssocId));
402 DBGLOG(SW4, INFO, ("fgIsInPS %u\n",prStaRec->fgIsInPS));
403 DBGLOG(SW4, INFO, ("ucFreeQuota %u\n",prStaRec->ucFreeQuota));
404 DBGLOG(SW4, INFO, ("ucFreeQuotaForDelivery %u\n",prStaRec->ucFreeQuotaForDelivery));
405 DBGLOG(SW4, INFO, ("ucFreeQuotaForNonDelivery %u\n",prStaRec->ucFreeQuotaForNonDelivery));
409 DBGLOG(SW4, INFO, ("IsQmmSup %u\n",prStaRec->fgIsWmmSupported));
410 DBGLOG(SW4, INFO, ("IsUapsdSup %u\n",prStaRec->fgIsUapsdSupported));
411 DBGLOG(SW4, INFO, ("AvailabaleDeliverPkts %u\n",prStaRec->ucAvailableDeliverPkts));
412 DBGLOG(SW4, INFO, ("BmpDeliverPktsAC %u\n",prStaRec->u4BmpDeliverPktsAC));
413 DBGLOG(SW4, INFO, ("BmpBufferAC %u\n",prStaRec->u4BmpBufferAC));
414 DBGLOG(SW4, INFO, ("BmpNonDeliverPktsAC %u\n",prStaRec->u4BmpNonDeliverPktsAC));
417 for(i=0;i<CFG_RX_MAX_BA_TID_NUM;i++) {
418 if(prStaRec->aprRxReorderParamRefTbl[i]){
419 DBGLOG(SW4, INFO,("RxReorder fgIsValid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->fgIsValid));
420 DBGLOG(SW4, INFO,("RxReorder Tid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->ucTid));
421 DBGLOG(SW4, INFO,("RxReorder rReOrderQue Len: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->rReOrderQue.u4NumElem));
422 DBGLOG(SW4, INFO,("RxReorder WinStart: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinStart));
423 DBGLOG(SW4, INFO,("RxReorder WinEnd: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinEnd));
424 DBGLOG(SW4, INFO,("RxReorder WinSize: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinSize));
431 VOID dumpBss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo)
434 DBGLOG(SW4, INFO, ("SSID %s\n",prBssInfo->aucSSID));
435 DBGLOG(SW4, INFO, ("OWN " MACSTR"\n",MAC2STR(prBssInfo->aucOwnMacAddr)));
436 DBGLOG(SW4, INFO, ("BSSID " MACSTR"\n",MAC2STR(prBssInfo->aucBSSID)));
437 DBGLOG(SW4, INFO, ("ucNetTypeIndex %u\n",prBssInfo->ucNetTypeIndex));
438 DBGLOG(SW4, INFO, ("eConnectionState %u\n",prBssInfo->eConnectionState));
439 DBGLOG(SW4, INFO, ("eCurrentOPMode %u\n",prBssInfo->eCurrentOPMode));
440 DBGLOG(SW4, INFO, ("fgIsQBSS %u\n",prBssInfo->fgIsQBSS));
441 DBGLOG(SW4, INFO, ("fgIsShortPreambleAllowed %u\n",prBssInfo->fgIsShortPreambleAllowed));
442 DBGLOG(SW4, INFO, ("fgUseShortPreamble %u\n",prBssInfo->fgUseShortPreamble));
443 DBGLOG(SW4, INFO, ("fgUseShortSlotTime %u\n",prBssInfo->fgUseShortSlotTime));
444 DBGLOG(SW4, INFO, ("ucNonHTBasicPhyType %x\n",prBssInfo->ucNonHTBasicPhyType));
445 DBGLOG(SW4, INFO, ("u2OperationalRateSet %x\n",prBssInfo->u2OperationalRateSet));
446 DBGLOG(SW4, INFO, ("u2BSSBasicRateSet %x\n",prBssInfo->u2BSSBasicRateSet));
447 DBGLOG(SW4, INFO, ("ucPhyTypeSet %x\n",prBssInfo->ucPhyTypeSet));
448 DBGLOG(SW4, INFO, ("rStaRecOfClientList %d\n",prBssInfo->rStaRecOfClientList.u4NumElem));
449 DBGLOG(SW4, INFO, ("u2CapInfo %x\n",prBssInfo->u2CapInfo));
450 DBGLOG(SW4, INFO, ("u2ATIMWindow %x\n",prBssInfo->u2ATIMWindow));
451 DBGLOG(SW4, INFO, ("u2AssocId %x\n",prBssInfo->u2AssocId));
452 DBGLOG(SW4, INFO, ("ucDTIMPeriod %x\n",prBssInfo->ucDTIMPeriod));
453 DBGLOG(SW4, INFO, ("ucDTIMCount %x\n",prBssInfo->ucDTIMCount));
454 DBGLOG(SW4, INFO, ("fgIsNetAbsent %x\n", prBssInfo->fgIsNetAbsent));
455 DBGLOG(SW4, INFO, ("eBand %d\n", prBssInfo->eBand));
456 DBGLOG(SW4, INFO, ("ucPrimaryChannel %d\n", prBssInfo->ucPrimaryChannel));
457 DBGLOG(SW4, INFO, ("ucHtOpInfo1 %d\n", prBssInfo->ucHtOpInfo1));
458 DBGLOG(SW4, INFO, ("ucHtOpInfo2 %d\n", prBssInfo->u2HtOpInfo2));
459 DBGLOG(SW4, INFO, ("ucHtOpInfo3 %d\n", prBssInfo->u2HtOpInfo3));
460 DBGLOG(SW4, INFO, ("fgErpProtectMode %d\n", prBssInfo->fgErpProtectMode));
461 DBGLOG(SW4, INFO, ("eHtProtectMode %d\n", prBssInfo->eHtProtectMode));
462 DBGLOG(SW4, INFO, ("eGfOperationMode %d\n", prBssInfo->eGfOperationMode));
463 DBGLOG(SW4, INFO, ("eRifsOperationMode %d\n", prBssInfo->eRifsOperationMode));
464 DBGLOG(SW4, INFO, ("fgObssErpProtectMode %d\n", prBssInfo->fgObssErpProtectMode));
465 DBGLOG(SW4, INFO, ("eObssHtProtectMode %d\n", prBssInfo->eObssHtProtectMode));
466 DBGLOG(SW4, INFO, ("eObssGfProtectMode %d\n", prBssInfo->eObssGfOperationMode));
467 DBGLOG(SW4, INFO, ("fgObssRifsOperationMode %d\n", prBssInfo->fgObssRifsOperationMode));
468 DBGLOG(SW4, INFO, ("fgAssoc40mBwAllowed %d\n", prBssInfo->fgAssoc40mBwAllowed));
469 DBGLOG(SW4, INFO, ("fg40mBwAllowed %d\n", prBssInfo->fg40mBwAllowed));
470 DBGLOG(SW4, INFO, ("eBssSCO %d\n", prBssInfo->eBssSCO));
477 VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
479 UINT_8 ucIndex,ucRead;
482 DEBUGFUNC("swCtrlCmdCategory0");
484 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
488 if(ucIndex>=SWCTRL_CATA0_INDEX_NUM) return;
490 if(ucRead == SWCR_WRITE) {
494 aucDebugModule[ucOpt0] = (UINT_8)g_au4SwCr[1];
497 case SWCTRL_WIFI_VAR:
501 case SWCTRL_DUMP_QM_DBG_CNT:
502 for(i=0;i<QM_DBG_CNT_NUM;i++) {
503 prAdapter->rQM.au4QmDebugCounters[i] = 0;
506 case SWCTRL_QM_DBG_CNT:
507 prAdapter->rQM.au4QmDebugCounters[ucOpt0] = g_au4SwCr[1];
512 case SWCTRL_RX_PKTS_DUMP:
513 //DBGLOG(SW4, INFO,("SWCTRL_RX_PKTS_DUMP: mask %x\n", g_au4SwCr[1]));
514 prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = g_au4SwCr[1];
525 g_au4SwCr[1] = aucDebugModule[ucOpt0] ;
529 g_au4SwCr[1] = _SWCTRL_MAGIC ;
530 DBGLOG(SW4, INFO,("BUILD TIME: %s %s\n", __DATE__, __TIME__));
534 P_QUE_MGT_T prQM = &prAdapter->rQM;
537 g_au4SwCr[1] = (QM_GET_TX_QUEUE_LEN(prAdapter, ucOpt1)) ;
538 g_au4SwCr[2] = prQM->au4MinReservedTcResource[ucOpt1] ;
539 g_au4SwCr[3] = prQM->au4CurrentTcResource[ucOpt1];
540 g_au4SwCr[4] = prQM->au4GuaranteedTcResource[ucOpt1];
544 g_au4SwCr[1] = prQM->au4ForwardCount[ucOpt1];
545 g_au4SwCr[2] = prQM->au4HeadStaRecIndex[ucOpt1];
549 g_au4SwCr[1] = prQM->arTxQueue[ucOpt1].u4NumElem; /* only one */
556 case SWCTRL_TX_CTRL_INFO:
558 P_TX_CTRL_T prTxCtrl;
559 prTxCtrl = &prAdapter->rTxCtrl;
562 g_au4SwCr[1] = prAdapter->rTxCtrl.rTc.aucFreeBufferCount[ucOpt1];
563 g_au4SwCr[2] = prAdapter->rTxCtrl.rTc.aucMaxNumOfBuffer[ucOpt1];
569 case SWCTRL_DUMP_QUEUE:
570 dumpQueue(prAdapter);
574 case SWCTRL_DUMP_QM_DBG_CNT:
575 for(i=0;i<QM_DBG_CNT_NUM;i++) {
576 DBGLOG(SW4, INFO,("QM:DBG %u %u\n",i , prAdapter->rQM.au4QmDebugCounters[i]));
580 case SWCTRL_QM_DBG_CNT:
581 g_au4SwCr[1] = prAdapter->rQM.au4QmDebugCounters[ucOpt0];
584 case SWCTRL_DUMP_BSS:
586 dumpBss(prAdapter, &(prAdapter->rWifiVar.arBssInfo[ucOpt0])) ;
598 VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
600 UINT_8 ucIndex,ucRead;
602 P_STA_RECORD_T prStaRec;
604 DEBUGFUNC("swCtrlCmdCategory1");
606 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
608 if(ucOpt0>=CFG_STA_REC_NUM) return;
610 //prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0);
611 prStaRec = &prAdapter->arStaRec[ucOpt0];
612 ucWTEntry = prStaRec->ucWTEntry;
613 if(ucRead == SWCR_WRITE) {
618 case SWCTRL_STA_QUE_INFO:
620 g_au4SwCr[1] = prStaRec->arTxQueue[ucOpt1].u4NumElem;
623 case SWCTRL_STA_INFO:
626 g_au4SwCr[1] = prStaRec->fgIsInPS;
632 case SWCTRL_DUMP_STA:
634 dumpSTA(prAdapter, prStaRec);
650 testPsSendQoSNullFrame (
651 IN P_ADAPTER_T prAdapter,
652 IN P_STA_RECORD_T prStaRec,
654 IN UINT_8 ucNetTypeIndex,
656 IN BOOLEAN fgIsBurstEnd,
657 IN BOOLEAN ucPacketType,
658 IN BOOLEAN ucPsSessionID,
662 P_MSDU_INFO_T prMsduInfo;
663 UINT_16 u2EstimatedFrameLen;
664 P_WLAN_MAC_HEADER_QOS_T prQoSNullFrame;
667 DEBUGFUNC("testPsSendQoSNullFrame");
668 DBGLOG(SW4, LOUD, ("\n"));
670 //4 <1> Allocate a PKT_INFO_T for Null Frame
671 /* Init with MGMT Header Length */
672 u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \
673 WLAN_MAC_HEADER_QOS_LEN;
675 /* Allocate a MSDU_INFO_T */
676 if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) {
677 DBGLOG(SW4, WARN, ("No PKT_INFO_T for sending Null Frame.\n"));
681 //4 <2> Compose Null frame in MSDU_INfO_T.
682 bssComposeQoSNullFrame(prAdapter,
683 (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD),
689 prMsduInfo->eSrc = TX_PACKET_MGMT;
690 //prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_DATA;
691 prMsduInfo->ucPacketType = ucPacketType;
692 prMsduInfo->ucStaRecIndex = prStaRec->ucIndex;
693 prMsduInfo->ucNetworkType = ucNetTypeIndex;
694 prMsduInfo->ucMacHeaderLength = WLAN_MAC_HEADER_QOS_LEN;
695 prMsduInfo->fgIs802_1x = FALSE;
696 prMsduInfo->fgIs802_11 = TRUE;
697 prMsduInfo->u2FrameLength = WLAN_MAC_HEADER_QOS_LEN;
698 prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter);
699 prMsduInfo->pfTxDoneHandler = NULL;
700 prMsduInfo->fgIsBasicRate = TRUE;
701 prMsduInfo->fgIsBurstEnd = fgIsBurstEnd;
702 prMsduInfo->ucUserPriority = ucUP;
703 prMsduInfo->ucPsSessionID = ucPsSessionID /* 0~7 Test 7 means NOACK*/;
705 prQoSNullFrame = (P_WLAN_MAC_HEADER_QOS_T)( (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD) );
708 prQoSNullFrame->aucAddr1[0] = 0xfd;
711 prQoSNullFrame->aucAddr1[5] = 0xdd;
714 //4 <4> Inform TXM to send this Null frame.
715 nicTxEnqueueMsdu(prAdapter, prMsduInfo);
723 IN P_ADAPTER_T prAdapter,
724 IN UINT_8 ucNetworkTypeIndex
727 P_BSS_INFO_T prBssInfo;
728 UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR;
730 DEBUGFUNC("testPsSetupBss()");
731 DBGLOG(SW4, INFO, ("index %d\n", ucNetworkTypeIndex));
733 prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetworkTypeIndex]);
735 //4 <1.2> Initiate PWR STATE
736 //SET_NET_PWR_STATE_IDLE(prAdapter, ucNetworkTypeIndex);
739 //4 <2> Initiate BSS_INFO_T - common part
740 BSS_INFO_INIT(prAdapter, ucNetworkTypeIndex);
742 prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED;
743 prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED;
744 prBssInfo->eCurrentOPMode = OP_MODE_ACCESS_POINT;
745 prBssInfo->fgIsNetActive = TRUE;
746 prBssInfo->ucNetTypeIndex = (ucNetworkTypeIndex);
747 prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED;
749 prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */
750 prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */
751 prBssInfo->u2BSSBasicRateSet = RATE_SET_ERP;
752 prBssInfo->u2OperationalRateSet = RATE_SET_OFDM;
753 prBssInfo->fgErpProtectMode = FALSE;
754 prBssInfo->fgIsQBSS = TRUE;
756 //4 <1.5> Setup MIB for current BSS
757 prBssInfo->u2BeaconInterval = 100;
758 prBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT;
759 prBssInfo->u2ATIMWindow = 0;
761 prBssInfo->ucBeaconTimeoutCount = 0;
764 bssInitForAP (prAdapter,prBssInfo, TRUE);
766 COPY_MAC_ADDR(prBssInfo->aucBSSID, _aucZeroMacAddr);
767 LINK_INITIALIZE(&prBssInfo->rStaRecOfClientList);
768 prBssInfo->fgIsBeaconActivated = TRUE;
769 prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG;
772 COPY_MAC_ADDR(prBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucMacAddress);
774 //4 <3> Initiate BSS_INFO_T - private part
776 prBssInfo->eBand = BAND_2G4;
777 prBssInfo->ucPrimaryChannel = 1;
778 prBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL;
781 //prBssInfo->fgErpProtectMode = eErpProectMode;
782 //prBssInfo->eHtProtectMode = eHtProtectMode;
783 //prBssInfo->eGfOperationMode = eGfOperationMode;
786 //4 <4> Allocate MSDU_INFO_T for Beacon
787 prBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter,
788 OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH);
790 if (prBssInfo->prBeacon) {
791 prBssInfo->prBeacon->eSrc = TX_PACKET_MGMT;
792 prBssInfo->prBeacon->ucNetworkType = ucNetworkTypeIndex;
795 DBGLOG(SW4, INFO, ("prBeacon allocation fail\n"));
799 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL;
800 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL;
801 prBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2;
803 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8)prAdapter->u4UapsdAcBmp;
804 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC =(UINT_8) prAdapter->u4UapsdAcBmp;
805 prBssInfo->rPmProfSetupInfo.ucUapsdSp = (UINT_8)prAdapter->u4MaxSpLen;
809 for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){
811 prBssInfo->arACQueParms[eAci].fgIsACMSet = FALSE;
812 prBssInfo->arACQueParms[eAci].u2Aifsn = (UINT_16) eAci;
813 prBssInfo->arACQueParms[eAci].u2CWmin = 7;
814 prBssInfo->arACQueParms[eAci].u2CWmax = 31;
815 prBssInfo->arACQueParms[eAci].u2TxopLimit = eAci+1;
816 DBGLOG(SW4, INFO, ("MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n",
817 eAci,prBssInfo->arACQueParms[eAci].fgIsACMSet ,
818 prBssInfo->arACQueParms[eAci].u2Aifsn,
819 prBssInfo->arACQueParms[eAci].u2CWmin,
820 prBssInfo->arACQueParms[eAci].u2CWmax,
821 prBssInfo->arACQueParms[eAci].u2TxopLimit));
827 DBGLOG(SW4, INFO, ("[2] ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x, ucUapsdSp:0x%x",
828 prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC,
829 prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC,
830 prBssInfo->rPmProfSetupInfo.ucUapsdSp));
838 VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
840 UINT_8 ucIndex,ucRead;
841 P_STA_RECORD_T prStaRec;
843 DEBUGFUNC("testPsCmdCategory0");
844 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
846 DBGLOG(SW4, LOUD, ("Read %u Index %u\n",ucRead,ucIndex));
848 prStaRec = cnmGetStaRecByIndex (prAdapter, 0);
850 if(ucIndex>=TEST_PS_CATA0_INDEX_NUM) return;
852 if(ucRead == SWCR_WRITE) {
854 case TEST_PS_SETUP_BSS:
855 testPsSetupBss(prAdapter, ucOpt0) ;
858 case TEST_PS_ENABLE_BEACON:
861 case TEST_PS_TRIGGER_BMC:
862 //txmForwardQueuedBmcPkts (ucOpt0);
864 case TEST_PS_SEND_NULL:
867 testPsSendQoSNullFrame (prAdapter,prStaRec,
868 (UINT_8)(g_au4SwCr[1] & 0xFF), /* UP */
870 (BOOLEAN)((g_au4SwCr[1] >>8)& 0xFF), /* BMC*/
871 (BOOLEAN)((g_au4SwCr[1] >>16)& 0xFF), /* BurstEnd*/
872 (BOOLEAN)((g_au4SwCr[1] >>24)& 0xFF), /* Packet type*/
873 (UINT_8)((g_au4SwCr[2] )& 0xFF), /* PS sesson ID 7: NOACK */
878 case TEST_PS_BUFFER_BMC:
879 //g_aprBssInfo[ucOpt0]->fgApToBufferBMC = (g_au4SwCr[1] & 0xFF);
881 case TEST_PS_UPDATE_BEACON:
882 bssUpdateBeaconContent(prAdapter, ucOpt0 /*networktype*/ );
893 g_au4SwCr[1] = 0x88660011 ;
904 VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
906 UINT_8 ucIndex,ucRead;
908 P_STA_RECORD_T prStaRec;
910 DEBUGFUNC("testPsCmdCategory1");
912 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
914 if(ucOpt0>=CFG_STA_REC_NUM) return;
916 prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0);
917 ucWTEntry = prStaRec->ucWTEntry;
918 if(ucRead == SWCR_WRITE) {
922 prStaRec->fgIsInPS = (BOOLEAN) (g_au4SwCr[1] & 0x1);
923 prStaRec->fgIsQoS = (BOOLEAN) (g_au4SwCr[1] >>8 & 0xFF);
924 prStaRec->fgIsUapsdSupported = (BOOLEAN) (g_au4SwCr[1] >>16 & 0xFF);
925 prStaRec->ucBmpDeliveryAC = (BOOLEAN) (g_au4SwCr[1] >>24 & 0xFF);
944 #if CFG_SUPPORT_802_11V
945 #if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT ==1) && (WNM_UNIT_TEST ==1)
946 VOID testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1)
948 UINT_8 ucIndex,ucRead;
949 P_STA_RECORD_T prStaRec;
951 DEBUGFUNC("testWNMCmdCategory0");
952 SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex);
954 DBGLOG(SW4, INFO, ("Read %u Index %u\n",ucRead,ucIndex));
956 if(ucIndex>=TEST_WNM_CATA0_INDEX_NUM) return;
958 if(ucRead == SWCR_WRITE) {
960 case TEST_WNM_TIMING_MEAS:
961 wnmTimingMeasUnitTest1(prAdapter, ucOpt0) ;
970 #endif //CFG_SUPPORT_802_11V
972 VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
974 /* According other register STAIDX */
976 ucOffset = (u2Addr>>2) & 0x3F;
978 if(ucOffset>= SWCR_CR_NUM) return;
980 if(ucRead==SWCR_WRITE) {
981 g_au4SwCr[ucOffset] = *pu4Data;
983 /* Commmand [31:24]: Category */
984 /* Commmand [23:23]: 1(W) 0(R) */
985 /* Commmand [22:16]: Index */
986 /* Commmand [15:08]: Option0 */
987 /* Commmand [07:00]: Option1 */
990 u4Cmd = g_au4SwCr[0];
991 ucCate = (UINT_8)(u4Cmd >> 24) ;
992 if(ucCate < sizeof(g_arSwCtrlCmd)/sizeof(g_arSwCtrlCmd[0])) {
993 if(g_arSwCtrlCmd[ucCate]!=NULL) {
994 g_arSwCtrlCmd[ucCate](prAdapter, ucCate, (UINT_8)(u4Cmd>>16 & 0xFF),(UINT_8)((u4Cmd>>8) & 0xFF), (UINT_8)(u4Cmd&0xFF));
1000 *pu4Data = g_au4SwCr[ucOffset];
1004 VOID swCrReadWriteCmd(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data)
1009 /* Address [15:8] MOD ID */
1010 /* Address [7:0] OFFSET */
1012 DEBUGFUNC("swCrReadWriteCmd");
1013 DBGLOG(SW4, INFO, ("%u addr 0x%x data 0x%x\n",ucRead,u2Addr,*pu4Data));
1015 if(ucMod < (sizeof(g_arSwCrModHandle)/sizeof(g_arSwCrModHandle[0])) ) {
1017 if(g_arSwCrModHandle[ucMod]!=NULL) {
1018 g_arSwCrModHandle[ucMod](prAdapter, ucRead, u2Addr, pu4Data);
1024 VOID swCrFrameCheckEnable(P_ADAPTER_T prAdapter, UINT_32 u4DumpType)
1026 g_u4SwcrDebugFrameDumpType = u4DumpType;
1027 prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = u4DumpType;
1030 VOID swCrDebugInit(P_ADAPTER_T prAdapter)
1033 if (g_u4SwcrDebugFrameDumpType) {
1034 swCrFrameCheckEnable(prAdapter, g_u4SwcrDebugFrameDumpType);
1038 g_fgSwcrDebugTimer = FALSE;
1040 cnmTimerInitTimer(prAdapter,
1042 (PFN_MGMT_TIMEOUT_FUNC)swCrDebugCheckTimeout,
1045 if (g_u4SwcrDebugCheckTimeout) {
1046 swCrDebugCheckEnable(prAdapter, TRUE, g_ucSwcrDebugCheckType, g_u4SwcrDebugCheckTimeout);
1050 VOID swCrDebugUninit(P_ADAPTER_T prAdapter)
1052 cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
1054 g_fgSwcrDebugTimer = FALSE;
1057 VOID swCrDebugCheckEnable(P_ADAPTER_T prAdapter, BOOLEAN fgIsEnable, UINT_8 ucType, UINT_32 u4Timeout)
1060 g_ucSwcrDebugCheckType = ucType;
1061 g_u4SwcrDebugCheckTimeout = u4Timeout;
1062 if (g_fgSwcrDebugTimer == FALSE) {
1063 swCrDebugCheckTimeout(prAdapter, 0);
1067 cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer);
1068 g_u4SwcrDebugCheckTimeout = 0;
1071 g_fgSwcrDebugTimer = fgIsEnable;
1074 VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl)
1076 P_RX_CTRL_T prRxCtrl;
1077 P_TX_CTRL_T prTxCtrl;
1081 prTxCtrl = &prAdapter->rTxCtrl;
1082 prRxCtrl = &prAdapter->rRxCtrl;
1086 if (prCmdSwCtrl->u4Data == SWCR_DBG_TYPE_ALL) {
1088 // TX Counter from fw
1089 DBGLOG(SW4, INFO, ("TX0\n" \
1090 "%08x %08x %08x %08x\n" \
1091 "%08x %08x %08x %08x\n",
1092 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_CNT],
1093 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_BCN_CNT],
1094 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_FAILED_CNT],
1095 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_RETRY_CNT],
1096 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_AGING_TIMEOUT_CNT],
1097 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_PS_OVERFLOW_CNT],
1098 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_MGNT_DROP_CNT],
1099 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_ERROR_CNT]));
1101 // TX Counter from drv
1102 DBGLOG(SW4, INFO, ("TX1\n" \
1103 "%08x %08x %08x %08x\n",
1104 (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_BSS_DROP),
1105 (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_STA_DROP),
1106 (UINT_32)TX_GET_CNT(prTxCtrl, TX_FORWARD_OVERFLOW_DROP),
1107 (UINT_32)TX_GET_CNT(prTxCtrl, TX_AP_BORADCAST_DROP)));
1111 DBGLOG(SW4, INFO, ("RX0\n" \
1112 "%08x %08x %08x %08x\n" \
1113 "%08x %08x %08x %08x\n" \
1114 "%08x %08x %08x %08x\n" \
1115 "%08x %08x %08x %08x\n",
1116 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CNT],
1117 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DROP_CNT],
1118 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DUP_DROP_CNT],
1119 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TYPE_ERROR_DROP_CNT],
1120 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CLASS_ERROR_DROP_CNT],
1121 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_AMPDU_ERROR_DROP_CNT],
1122 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_STATUS_ERROR_DROP_CNT],
1123 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FORMAT_ERROR_DROP_CNT],
1124 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_ICV_ERROR_DROP_CNT],
1125 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_KEY_ERROR_DROP_CNT],
1126 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TKIP_ERROR_DROP_CNT],
1127 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_MIC_ERROR_DROP_CNT],
1128 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_BIP_ERROR_DROP_CNT],
1129 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FCSERR_CNT],
1130 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FIFOFULL_CNT],
1131 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_PFDROP_CNT]));
1133 DBGLOG(SW4, INFO, ("RX1\n" \
1134 "%08x %08x %08x %08x\n" \
1135 "%08x %08x %08x %08x\n",
1136 (UINT_32)RX_GET_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT),
1137 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT),
1138 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETURNED_COUNT),
1139 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT),
1140 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT),
1141 (UINT_32)RX_GET_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT),
1142 (UINT_32)RX_GET_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT),
1143 (UINT_32)RX_GET_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT)));
1145 DBGLOG(SW4, INFO, ("PWR\n" \
1146 "%08x %08x %08x %08x\n" \
1147 "%08x %08x %08x %08x\n",
1148 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PS_POLL_CNT],
1149 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_TRIGGER_NULL_CNT],
1150 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_IND_CNT],
1151 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_TIMEOUT_CNT],
1152 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE0],
1153 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE1],
1154 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF0],
1155 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF1]));
1157 DBGLOG(SW4, INFO, ("ARM\n" \
1158 "%08x %08x %08x %08x\n" \
1160 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RATE],
1161 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_BWGI],
1162 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RX_RATE_RCPI],
1163 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ENABLE],
1164 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ROAM_CNT],
1165 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_INT_CNT]));
1167 DBGLOG(SW4, INFO, ("BB\n" \
1168 "%08x %08x %08x %08x\n" \
1169 "%08x %08x %08x %08x\n",
1170 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_MDRDY_CNT],
1171 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_FCSERR_CNT],
1172 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_PD_CNT],
1173 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_PD_CNT],
1174 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SFDERR_CNT],
1175 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SIGERR_CNT],
1176 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_TAGERR_CNT],
1177 prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_SIGERR_CNT]));
1182 // start the next check
1183 if (g_u4SwcrDebugCheckTimeout) {
1184 cnmTimerStartTimer(prAdapter, &g_rSwcrDebugTimer, g_u4SwcrDebugCheckTimeout * MSEC_PER_SEC);
1188 VOID swCrDebugCheckTimeout(
1189 IN P_ADAPTER_T prAdapter,
1192 CMD_SW_DBG_CTRL_T rCmdSwCtrl;
1193 WLAN_STATUS rStatus;
1195 rCmdSwCtrl.u4Id = (0xb000<<16) + g_ucSwcrDebugCheckType;
1196 rCmdSwCtrl.u4Data = 0;
1197 rStatus = wlanSendSetQueryCmd (
1198 prAdapter, /* prAdapter */
1199 CMD_ID_SW_DBG_CTRL, /* ucCID */
1200 FALSE, /* fgSetQuery */
1201 TRUE, /* fgNeedResp */
1202 FALSE, /* fgIsOid */
1203 swCrDebugQuery, /* pfCmdDoneHandler */
1204 swCrDebugQueryTimeout, /* pfCmdTimeoutHandler */
1205 sizeof(CMD_SW_DBG_CTRL_T), /* u4SetQueryInfoLen */
1206 (PUINT_8)&rCmdSwCtrl, /* pucInfoBuffer */
1207 NULL, /* pvSetQueryBuffer */
1208 0 /* u4SetQueryBufferLen */
1211 ASSERT(rStatus == WLAN_STATUS_PENDING);
1216 VOID swCrDebugQuery(
1217 IN P_ADAPTER_T prAdapter,
1218 IN P_CMD_INFO_T prCmdInfo,
1219 IN PUINT_8 pucEventBuf
1224 swCrDebugCheck(prAdapter, (P_CMD_SW_DBG_CTRL_T)(pucEventBuf));
1227 VOID swCrDebugQueryTimeout(
1228 IN P_ADAPTER_T prAdapter,
1229 IN P_CMD_INFO_T prCmdInfo)
1233 swCrDebugCheck(prAdapter, NULL);
1236 #endif /* CFG_SUPPORT_SWCR */