2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_cmd_event.c#1 $
5 /*! \file nic_cmd_event.c
6 \brief Callback functions for Command packets.
8 Various Event packet handlers which will be setup in the callback function of
15 ** $Log: nic_cmd_event.c $
17 * 04 10 2012 yuche.tsai
19 * Update address for wifi direct connection issue.
22 * [WCXRP00000785] [MT6620 Wi-Fi][Driver][FW] P2P/BOW MAC address is XOR with AIS MAC address
23 * P2P/BOW mac address XOR with local bit instead of OR
26 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
27 * add the code to get the check rsponse and indicate to app.
30 * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
31 * Add security check code.
34 * [WCXRP00000493] [MT6620 Wi-Fi][Driver] Do not indicate redundant disconnection to host when entering into RF test mode
35 * only indicate DISCONNECTION to host when entering RF test if necessary (connected -> disconnected cases)
37 * 01 20 2011 eddie.chen
38 * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control
39 * Add Oid for sw control debug command
42 * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system scheduling
43 * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being loaded
46 * [WCXRP00000223] MT6620 Wi-Fi][Driver][FW] Adopt NVRAM parameters when enter/exit RF test mode
47 * reload NVRAM settings before entering RF test mode and leaving from RF test mode.
50 * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module
51 * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
52 * 2) Remove CNM CH-RECOVER event handling
53 * 3) cfg read/write API renamed with kal prefix for unified naming rules.
56 * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore
57 * use OID_CUSTOM_TEST_MODE as indication for driver reset
58 * by dropping pending TX packets
61 * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android
62 * complete implementation of Android NVRAM access
65 * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated
66 * Do a complete reset with STA-REC null checking for RF test re-entry
68 * 09 15 2010 yuche.tsai
70 * Start to test AT GO only when P2P state is not IDLE.
72 * 09 09 2010 yuche.tsai
74 * Add AT GO Test mode after MAC address available.
76 * 09 03 2010 kevin.huang
78 * Refine #include sequence and solve recursive/nested #include issue
82 * eliminate klockwork errors
86 * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI.
87 * There is no CFG_SUPPORT_BOW in driver domain source.
91 * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G)
93 * 08 11 2010 yuche.tsai
95 * Add support for P2P Device Address query from FW.
99 * Centralize mgmt/system service procedures into independent calls.
103 * reset FSMs before entering RF test mode.
107 * 1) refine AIS-FSM indent.
108 * 2) when entering RF Test mode, flush 802.1X frames as well
109 * 3) when entering D3 state, flush 802.1X frames as well
113 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
116 * [WPD00003833][MT6620 and MT5931] Driver migration
117 * 1) change fake BSS_DESC from channel 6 to channel 1 due to channel switching is not done yet.
118 * 2) after MAC address is queried from firmware, all related variables in driver domain should be updated as well
121 * [WPD00003840][MT6620 5931] Security migration
122 * remove duplicate variable for migration.
124 * 06 06 2010 kevin.huang
125 * [WPD00003832][MT6620 5931] Create driver base
126 * [MT6620 5931] Create driver base
129 * [WPD00001943]Create WiFi test driver framework on WinXP
130 * change upon request: indicate as disconnected in driver domain when leaving from RF test mode
133 * [WPD00001943]Create WiFi test driver framework on WinXP
134 * do not clear scanning list array after disassociation
137 * [WPD00001943]Create WiFi test driver framework on WinXP
138 * 1) disable NETWORK_LAYER_ADDRESSES handling temporally.
139 * 2) finish statistics OIDs
142 * [WPD00001943]Create WiFi test driver framework on WinXP
143 * change OID behavior to meet WHQL requirement.
146 * [WPD00001943]Create WiFi test driver framework on WinXP
147 * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS
148 * 2) buffer statistics data for 2 seconds
149 * 3) use default value for adhoc parameters instead of 0
152 * [WPD00001943]Create WiFi test driver framework on WinXP
153 * 1) do not take timeout mechanism for power mode oids
154 * 2) retrieve network type from connection status
155 * 3) after disassciation, set radio state to off
156 * 4) TCP option over IPv6 is supported
159 * [WPD00001943]Create WiFi test driver framework on WinXP
160 * correct OID_802_11_DISASSOCIATE handling.
163 * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
164 * 1) add timeout handler mechanism for pending command packets
165 * 2) add p2p add/removal key
168 * [WPD00001943]Create WiFi test driver framework on WinXP
169 * treat BUS access failure as kind of card removal.
172 * [WPD00001943]Create WiFi test driver framework on WinXP
173 * information buffer for query oid/ioctl is now buffered in prCmdInfo
174 * * * * * * instead of glue-layer variable to improve multiple oid/ioctl capability
177 * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
178 * add framework for BT-over-Wi-Fi support.
179 * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
180 * * * * * * * * * * * * * * 2) command sequence number is now increased atomically
181 * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose
184 * [WPD00001943]Create WiFi test driver framework on WinXP
185 * accessing to firmware load/start address, and access to OID handling information
186 * are now handled in glue layer
189 * [WPD00001943]Create WiFi test driver framework on WinXP
190 * rWlanInfo should be placed at adapter rather than glue due to most operations
191 * * * * are done in adapter layer.
194 * [WPD00001943]Create WiFi test driver framework on WinXP
195 * add KAL API: kalFlushPendingTxPackets(), and take use of the API
198 * [WPD00001943]Create WiFi test driver framework on WinXP
199 * eliminate direct access to prGlueInfo->rWlanInfo.eLinkAttr.ucMediaStreamMode from non-glue layer.
201 * 04 06 2010 jeffrey.chang
202 * [WPD00003826]Initial import for Linux port
203 * improve none-glude code portability
206 * [WPD00001943]Create WiFi test driver framework on WinXP
207 * sync statistics data structure definition with firmware implementation
210 * [WPD00001943]Create WiFi test driver framework on WinXP
211 * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved
214 * [WPD00001943]Create WiFi test driver framework on WinXP
215 * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer
218 * [WPD00001943]Create WiFi test driver framework on WinXP
219 * statistics information OIDs are now handled by querying from firmware domain
222 * [WPD00001943]Create WiFi test driver framework on WinXP
223 * indicate media stream mode after set is done
225 * 03 24 2010 jeffrey.chang
226 * [WPD00003826]Initial import for Linux port
227 * initial import for Linux port
230 * [WPD00001943]Create WiFi test driver framework on WinXP
231 * implement custom OID: EEPROM read/write access
234 * [WPD00001943]Create WiFi test driver framework on WinXP
235 * implement OID_802_3_MULTICAST_LIST oid handling
238 * [WPD00001943]Create WiFi test driver framework on WinXP
239 * limit RSSI return value to microsoft defined range.
242 * [WPD00001943]Create WiFi test driver framework on WinXP
243 * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address
244 * * * * * * * 2. follow MSDN defined behavior when associates to another AP
245 * * * * * * * 3. for firmware download, packet size could be up to 2048 bytes
248 * [WPD00001943]Create WiFi test driver framework on WinXP
249 * block until firmware finished RF test enter/leave then indicate completion to upper layer
252 * [WPD00001943]Create WiFi test driver framework on WinXP
253 * when entering RF test mode and leaving from RF test mode, wait for W_FUNC_RDY bit to be asserted forever until it is set or card is removed.
256 * [WPD00001943]Create WiFi test driver framework on WinXP
257 * 1. eliminate improper variable in rHifInfo
258 * * * * * * * * 2. block TX/ordinary OID when RF test mode is engaged
259 * * * * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode
260 * * * * * * * * 4. correct some HAL implementation
263 * [WPD00001943]Create WiFi test driver framework on WinXP
264 * Under WinXP with SDIO, use prGlueInfo->rHifInfo.pvInformationBuffer instead of prGlueInfo->pvInformationBuffer
267 * [WPD00001943]Create WiFi test driver framework on WinXP
268 * implement following 802.11 OIDs:
269 * * * * * OID_802_11_RSSI,
270 * * * * * OID_802_11_RSSI_TRIGGER,
271 * * * * * OID_802_11_STATISTICS,
272 * * * * * OID_802_11_DISASSOCIATE,
273 * * * * * OID_802_11_POWER_MODE
276 * [WPD00001943]Create WiFi test driver framework on WinXP
277 * implement OID_802_11_MEDIA_STREAM_MODE
280 * [WPD00001943]Create WiFi test driver framework on WinXP
281 * 1) According to CMD/EVENT documentation v0.8,
282 * * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used,
283 * * * * * * * * and result is retrieved by get ATInfo instead
284 * * * * * * * * 2) add 4 counter for recording aggregation statistics
285 ** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-12-10 16:47:47 GMT mtk02752
286 ** only handle MCR read when accessing FW domain register
287 ** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-12-08 17:37:28 GMT mtk02752
288 ** * refine nicCmdEventQueryMcrRead
289 ** + add TxStatus/RxStatus for RF test QueryInformation OIDs
290 ** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-12-02 22:05:45 GMT mtk02752
291 ** kalOidComplete() will decrease i4OidPendingCount
292 ** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-12-01 23:02:57 GMT mtk02752
293 ** remove unnecessary spin locks
294 ** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-12-01 22:51:18 GMT mtk02752
295 ** maintein i4OidPendingCount
296 ** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-11-30 10:55:03 GMT mtk02752
297 ** modify for compatibility
298 ** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-11-23 14:46:32 GMT mtk02752
299 ** add another version of command-done handler upon new event structure
300 ** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-04-29 15:42:33 GMT mtk01461
302 ** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-04-21 19:32:42 GMT mtk01461
303 ** Add nicCmdEventSetCommon() for general set OID
304 ** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-04-21 01:40:35 GMT mtk01461
305 ** Command Done Handler
308 /*******************************************************************************
309 * C O M P I L E R F L A G S
310 ********************************************************************************
313 /*******************************************************************************
314 * E X T E R N A L R E F E R E N C E S
315 ********************************************************************************
320 /*******************************************************************************
322 ********************************************************************************
325 /*******************************************************************************
327 ********************************************************************************
330 /*******************************************************************************
331 * P U B L I C D A T A
332 ********************************************************************************
336 nicCmdEventQueryMcrRead (
337 IN P_ADAPTER_T prAdapter,
338 IN P_CMD_INFO_T prCmdInfo,
339 IN PUINT_8 pucEventBuf
342 UINT_32 u4QueryInfoLen;
343 P_PARAM_CUSTOM_MCR_RW_STRUC_T prMcrRdInfo;
344 P_GLUE_INFO_T prGlueInfo;
345 P_CMD_ACCESS_REG prCmdAccessReg;
352 //4 <2> Update information of OID
353 if (prCmdInfo->fgIsOid) {
354 prGlueInfo = prAdapter->prGlueInfo;
355 prCmdAccessReg = (P_CMD_ACCESS_REG)(pucEventBuf);
357 u4QueryInfoLen = sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T);
359 prMcrRdInfo = (P_PARAM_CUSTOM_MCR_RW_STRUC_T) prCmdInfo->pvInformationBuffer;
360 prMcrRdInfo->u4McrOffset = prCmdAccessReg->u4Address;
361 prMcrRdInfo->u4McrData = prCmdAccessReg->u4Data;
363 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
372 nicCmdEventQuerySwCtrlRead (
373 IN P_ADAPTER_T prAdapter,
374 IN P_CMD_INFO_T prCmdInfo,
375 IN PUINT_8 pucEventBuf
378 UINT_32 u4QueryInfoLen;
379 P_PARAM_CUSTOM_SW_CTRL_STRUC_T prSwCtrlInfo;
380 P_GLUE_INFO_T prGlueInfo;
381 P_CMD_SW_DBG_CTRL_T prCmdSwCtrl;
387 //4 <2> Update information of OID
388 if (prCmdInfo->fgIsOid) {
389 prGlueInfo = prAdapter->prGlueInfo;
390 prCmdSwCtrl = (P_CMD_SW_DBG_CTRL_T)(pucEventBuf);
392 u4QueryInfoLen = sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T);
394 prSwCtrlInfo = (P_PARAM_CUSTOM_SW_CTRL_STRUC_T) prCmdInfo->pvInformationBuffer;
395 prSwCtrlInfo->u4Id = prCmdSwCtrl->u4Id;
396 prSwCtrlInfo->u4Data = prCmdSwCtrl->u4Data;
398 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
408 nicCmdEventSetCommon (
409 IN P_ADAPTER_T prAdapter,
410 IN P_CMD_INFO_T prCmdInfo,
411 IN PUINT_8 pucEventBuf
417 if (prCmdInfo->fgIsOid) {
418 /* Update Set Infomation Length */
419 kalOidComplete(prAdapter->prGlueInfo,
420 prCmdInfo->fgSetQuery,
421 prCmdInfo->u4InformationBufferLength,
422 WLAN_STATUS_SUCCESS);
429 nicCmdEventSetDisassociate (
430 IN P_ADAPTER_T prAdapter,
431 IN P_CMD_INFO_T prCmdInfo,
432 IN PUINT_8 pucEventBuf
438 if (prCmdInfo->fgIsOid) {
439 /* Update Set Infomation Length */
440 kalOidComplete(prAdapter->prGlueInfo,
441 prCmdInfo->fgSetQuery,
443 WLAN_STATUS_SUCCESS);
446 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
447 WLAN_STATUS_MEDIA_DISCONNECT,
452 prAdapter->fgIsRadioOff = TRUE;
459 nicCmdEventSetIpAddress (
460 IN P_ADAPTER_T prAdapter,
461 IN P_CMD_INFO_T prCmdInfo,
462 IN PUINT_8 pucEventBuf
470 u4Count = (prCmdInfo->u4SetInfoLen - OFFSET_OF(CMD_SET_NETWORK_ADDRESS_LIST, arNetAddress))
471 / sizeof(IPV4_NETWORK_ADDRESS) ;
473 if (prCmdInfo->fgIsOid) {
474 /* Update Set Infomation Length */
475 kalOidComplete(prAdapter->prGlueInfo,
476 prCmdInfo->fgSetQuery,
477 OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress) + u4Count *
478 (OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP)),
479 WLAN_STATUS_SUCCESS);
486 nicCmdEventQueryRfTestATInfo(
487 IN P_ADAPTER_T prAdapter,
488 IN P_CMD_INFO_T prCmdInfo,
489 IN PUINT_8 pucEventBuf
492 P_EVENT_TEST_STATUS prTestStatus, prQueryBuffer;
493 P_GLUE_INFO_T prGlueInfo;
494 UINT_32 u4QueryInfoLen;
499 prTestStatus = (P_EVENT_TEST_STATUS)pucEventBuf;
501 if (prCmdInfo->fgIsOid) {
502 prGlueInfo = prAdapter->prGlueInfo;
503 prQueryBuffer = (P_EVENT_TEST_STATUS) prCmdInfo->pvInformationBuffer;
505 kalMemCopy(prQueryBuffer, prTestStatus, sizeof(EVENT_TEST_STATUS));
507 u4QueryInfoLen = sizeof(EVENT_TEST_STATUS);
509 /* Update Query Infomation Length */
510 kalOidComplete(prGlueInfo,
511 prCmdInfo->fgSetQuery,
513 WLAN_STATUS_SUCCESS);
520 nicCmdEventQueryLinkQuality(
521 IN P_ADAPTER_T prAdapter,
522 IN P_CMD_INFO_T prCmdInfo,
523 IN PUINT_8 pucEventBuf
526 PARAM_RSSI rRssi, *prRssi;
527 P_EVENT_LINK_QUALITY prLinkQuality;
528 P_GLUE_INFO_T prGlueInfo;
529 UINT_32 u4QueryInfoLen;
534 prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf;
536 rRssi = (PARAM_RSSI)prLinkQuality->cRssi; // ranged from (-128 ~ 30) in unit of dBm
538 if(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) {
539 if(rRssi > PARAM_WHQL_RSSI_MAX_DBM)
540 rRssi = PARAM_WHQL_RSSI_MAX_DBM;
541 else if(rRssi < PARAM_WHQL_RSSI_MIN_DBM)
542 rRssi = PARAM_WHQL_RSSI_MIN_DBM;
545 rRssi = PARAM_WHQL_RSSI_MIN_DBM;
548 if (prCmdInfo->fgIsOid) {
549 prGlueInfo = prAdapter->prGlueInfo;
550 prRssi = (PARAM_RSSI *) prCmdInfo->pvInformationBuffer;
552 kalMemCopy(prRssi, &rRssi, sizeof(PARAM_RSSI));
553 u4QueryInfoLen = sizeof(PARAM_RSSI);
555 kalOidComplete(prGlueInfo,
556 prCmdInfo->fgSetQuery,
558 WLAN_STATUS_SUCCESS);
563 /*----------------------------------------------------------------------------*/
565 * @brief This routine is in response of OID_GEN_LINK_SPEED query request
567 * @param prAdapter Pointer to the Adapter structure.
568 * @param prCmdInfo Pointer to the pending command info
573 /*----------------------------------------------------------------------------*/
575 nicCmdEventQueryLinkSpeed(
576 IN P_ADAPTER_T prAdapter,
577 IN P_CMD_INFO_T prCmdInfo,
578 IN PUINT_8 pucEventBuf
581 P_EVENT_LINK_QUALITY prLinkQuality;
582 P_GLUE_INFO_T prGlueInfo;
583 UINT_32 u4QueryInfoLen;
584 PUINT_32 pu4LinkSpeed;
589 prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf;
591 if (prCmdInfo->fgIsOid) {
592 prGlueInfo = prAdapter->prGlueInfo;
593 pu4LinkSpeed = (PUINT_32)(prCmdInfo->pvInformationBuffer);
595 if(prLinkQuality->u2LinkSpeed == 0) {
596 *pu4LinkSpeed = 10000; /* 10K * 100bps = 1Mbps */
599 *pu4LinkSpeed = prLinkQuality->u2LinkSpeed * 5000;
602 u4QueryInfoLen = sizeof(UINT_32);
604 kalOidComplete(prGlueInfo,
605 prCmdInfo->fgSetQuery,
607 WLAN_STATUS_SUCCESS);
613 nicCmdEventQueryStatistics(
614 IN P_ADAPTER_T prAdapter,
615 IN P_CMD_INFO_T prCmdInfo,
616 IN PUINT_8 pucEventBuf
619 P_PARAM_802_11_STATISTICS_STRUCT_T prStatistics;
620 P_EVENT_STATISTICS prEventStatistics;
621 P_GLUE_INFO_T prGlueInfo;
622 UINT_32 u4QueryInfoLen;
627 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
629 if (prCmdInfo->fgIsOid) {
630 prGlueInfo = prAdapter->prGlueInfo;
632 u4QueryInfoLen = sizeof(PARAM_802_11_STATISTICS_STRUCT_T);
633 prStatistics = (P_PARAM_802_11_STATISTICS_STRUCT_T) prCmdInfo->pvInformationBuffer;
635 prStatistics->u4Length = sizeof(PARAM_802_11_STATISTICS_STRUCT_T);
636 prStatistics->rTransmittedFragmentCount
637 = prEventStatistics->rTransmittedFragmentCount;
638 prStatistics->rMulticastTransmittedFrameCount
639 = prEventStatistics->rMulticastTransmittedFrameCount;
640 prStatistics->rFailedCount
641 = prEventStatistics->rFailedCount;
642 prStatistics->rRetryCount
643 = prEventStatistics->rRetryCount;
644 prStatistics->rMultipleRetryCount
645 = prEventStatistics->rMultipleRetryCount;
646 prStatistics->rRTSSuccessCount
647 = prEventStatistics->rRTSSuccessCount;
648 prStatistics->rRTSFailureCount
649 = prEventStatistics->rRTSFailureCount;
650 prStatistics->rACKFailureCount
651 = prEventStatistics->rACKFailureCount;
652 prStatistics->rFrameDuplicateCount
653 = prEventStatistics->rFrameDuplicateCount;
654 prStatistics->rReceivedFragmentCount
655 = prEventStatistics->rReceivedFragmentCount;
656 prStatistics->rMulticastReceivedFrameCount
657 = prEventStatistics->rMulticastReceivedFrameCount;
658 prStatistics->rFCSErrorCount
659 = prEventStatistics->rFCSErrorCount;
660 prStatistics->rTKIPLocalMICFailures.QuadPart
662 prStatistics->rTKIPICVErrors.QuadPart
664 prStatistics->rTKIPCounterMeasuresInvoked.QuadPart
666 prStatistics->rTKIPReplays.QuadPart
668 prStatistics->rCCMPFormatErrors.QuadPart
670 prStatistics->rCCMPReplays.QuadPart
672 prStatistics->rCCMPDecryptErrors.QuadPart
674 prStatistics->rFourWayHandshakeFailures.QuadPart
676 prStatistics->rWEPUndecryptableCount.QuadPart
678 prStatistics->rWEPICVErrorCount.QuadPart
680 prStatistics->rDecryptSuccessCount.QuadPart
682 prStatistics->rDecryptFailureCount.QuadPart
685 kalOidComplete(prGlueInfo,
686 prCmdInfo->fgSetQuery,
688 WLAN_STATUS_SUCCESS);
693 nicCmdEventEnterRfTest(
694 IN P_ADAPTER_T prAdapter,
695 IN P_CMD_INFO_T prCmdInfo,
696 IN PUINT_8 pucEventBuf
699 UINT_32 u4WHISR = 0, u4Value = 0;
700 UINT_8 aucTxCount[8];
706 prAdapter->fgTestMode = TRUE;
708 // 0. always indicate disconnection
709 if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) {
710 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
711 WLAN_STATUS_MEDIA_DISCONNECT,
716 // 1. Remove pending TX
717 nicTxRelease(prAdapter);
719 // 1.1 clear pending Security / Management Frames
720 kalClearSecurityFrames(prAdapter->prGlueInfo);
721 kalClearMgmtFrames(prAdapter->prGlueInfo);
723 // 1.2 clear pending TX packet queued in glue layer
724 kalFlushPendingTxPackets(prAdapter->prGlueInfo);
726 // 2. Reset driver-domain FSMs
727 nicUninitMGMT(prAdapter);
729 nicResetSystemService(prAdapter);
730 nicInitMGMT(prAdapter, NULL);
732 // 3. Disable Interrupt
733 HAL_INTR_DISABLE(prAdapter);
735 // 4. Block til firmware completed entering into RF test mode
738 HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value);
740 if (u4Value & WCIR_WLAN_READY) {
743 else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE
744 || fgIsBusAccessFailed == TRUE) {
745 if (prCmdInfo->fgIsOid) {
746 /* Update Set Infomation Length */
747 kalOidComplete(prAdapter->prGlueInfo,
748 prCmdInfo->fgSetQuery,
749 prCmdInfo->u4SetInfoLen,
750 WLAN_STATUS_NOT_SUPPORTED);
759 // 5. Clear Interrupt Status
760 HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR);
761 if(HAL_IS_TX_DONE_INTR(u4WHISR)) {
762 HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount);
765 // 6. Reset TX Counter
766 nicTxResetResource(prAdapter);
768 // 7. Re-enable Interrupt
769 HAL_INTR_ENABLE(prAdapter);
771 // 8. completion indication
772 if (prCmdInfo->fgIsOid) {
773 /* Update Set Infomation Length */
774 kalOidComplete(prAdapter->prGlueInfo,
775 prCmdInfo->fgSetQuery,
776 prCmdInfo->u4SetInfoLen,
777 WLAN_STATUS_SUCCESS);
780 #if CFG_SUPPORT_NVRAM
781 // 9. load manufacture data
782 wlanLoadManufactureData(prAdapter, kalGetConfiguration(prAdapter->prGlueInfo));
789 nicCmdEventLeaveRfTest(
790 IN P_ADAPTER_T prAdapter,
791 IN P_CMD_INFO_T prCmdInfo,
792 IN PUINT_8 pucEventBuf
795 UINT_32 u4WHISR = 0, u4Value = 0;
796 UINT_8 aucTxCount[8];
801 // 1. Disable Interrupt
802 HAL_INTR_DISABLE(prAdapter);
804 // 2. Block til firmware completed leaving from RF test mode
807 HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value);
809 if (u4Value & WCIR_WLAN_READY) {
812 else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE
813 || fgIsBusAccessFailed == TRUE) {
814 if (prCmdInfo->fgIsOid) {
815 /* Update Set Infomation Length */
816 kalOidComplete(prAdapter->prGlueInfo,
817 prCmdInfo->fgSetQuery,
818 prCmdInfo->u4SetInfoLen,
819 WLAN_STATUS_NOT_SUPPORTED);
829 // 3. Clear Interrupt Status
830 HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR);
831 if(HAL_IS_TX_DONE_INTR(u4WHISR)) {
832 HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount);
835 // 4. Reset TX Counter
836 nicTxResetResource(prAdapter);
838 // 5. Re-enable Interrupt
839 HAL_INTR_ENABLE(prAdapter);
841 // 6. set driver-land variable
842 prAdapter->fgTestMode = FALSE;
844 // 7. completion indication
845 if (prCmdInfo->fgIsOid) {
846 /* Update Set Infomation Length */
847 kalOidComplete(prAdapter->prGlueInfo,
848 prCmdInfo->fgSetQuery,
849 prCmdInfo->u4SetInfoLen,
850 WLAN_STATUS_SUCCESS);
853 /* 8. Indicate as disconnected */
854 if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) {
856 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
857 WLAN_STATUS_MEDIA_DISCONNECT,
861 prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick();
864 #if CFG_SUPPORT_NVRAM
865 /* 9. load manufacture data */
866 wlanLoadManufactureData(prAdapter, kalGetConfiguration(prAdapter->prGlueInfo));
869 /* 10. Override network address */
870 wlanUpdateNetworkAddress(prAdapter);
876 nicCmdEventQueryAddress(
877 IN P_ADAPTER_T prAdapter,
878 IN P_CMD_INFO_T prCmdInfo,
879 IN PUINT_8 pucEventBuf
882 UINT_32 u4QueryInfoLen;
883 P_GLUE_INFO_T prGlueInfo;
884 P_EVENT_BASIC_CONFIG prEventBasicConfig;
890 prEventBasicConfig = (P_EVENT_BASIC_CONFIG)(pucEventBuf);
893 kalMemCopy(&(prAdapter->rMyMacAddr), &(prEventBasicConfig->rMyMacAddr), MAC_ADDR_LEN);
895 //4 <2> Update information of OID
896 if (prCmdInfo->fgIsOid) {
897 prGlueInfo = prAdapter->prGlueInfo;
899 kalMemCopy(prCmdInfo->pvInformationBuffer, &(prEventBasicConfig->rMyMacAddr), MAC_ADDR_LEN);
900 u4QueryInfoLen = MAC_ADDR_LEN;
902 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
905 //4 <3> Update new MAC address and all 3 networks
906 COPY_MAC_ADDR(prAdapter->rWifiVar.aucMacAddress, prAdapter->rMyMacAddr);
907 COPY_MAC_ADDR(prAdapter->rWifiVar.aucDeviceAddress, prAdapter->rMyMacAddr);
908 prAdapter->rWifiVar.aucDeviceAddress[0] ^= MAC_ADDR_LOCAL_ADMIN;
910 COPY_MAC_ADDR(prAdapter->rWifiVar.aucInterfaceAddress, prAdapter->rMyMacAddr);
911 prAdapter->rWifiVar.aucInterfaceAddress[0] ^= MAC_ADDR_LOCAL_ADMIN;
913 COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].aucOwnMacAddr,
914 prAdapter->rMyMacAddr);
916 #if CFG_ENABLE_WIFI_DIRECT
917 if(prAdapter->fgIsP2PRegistered) {
918 COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].aucOwnMacAddr,
919 prAdapter->rWifiVar.aucDeviceAddress);
923 #if CFG_ENABLE_BT_OVER_WIFI
924 COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX].aucOwnMacAddr,
925 prAdapter->rWifiVar.aucDeviceAddress);
928 #if CFG_TEST_WIFI_DIRECT_GO
929 if (prAdapter->rWifiVar.prP2pFsmInfo->eCurrentState == P2P_STATE_IDLE) {
930 wlanEnableP2pFunction(prAdapter);
932 wlanEnableATGO(prAdapter);
936 kalUpdateMACAddress(prAdapter->prGlueInfo, prAdapter->rWifiVar.aucMacAddress);
942 nicCmdEventQueryMcastAddr(
943 IN P_ADAPTER_T prAdapter,
944 IN P_CMD_INFO_T prCmdInfo,
945 IN PUINT_8 pucEventBuf
948 UINT_32 u4QueryInfoLen;
949 P_GLUE_INFO_T prGlueInfo;
950 P_EVENT_MAC_MCAST_ADDR prEventMacMcastAddr;
956 //4 <2> Update information of OID
957 if (prCmdInfo->fgIsOid) {
958 prGlueInfo = prAdapter->prGlueInfo;
959 prEventMacMcastAddr = (P_EVENT_MAC_MCAST_ADDR)(pucEventBuf);
961 u4QueryInfoLen = prEventMacMcastAddr->u4NumOfGroupAddr * MAC_ADDR_LEN;
963 // buffer length check
964 if (prCmdInfo->u4InformationBufferLength < u4QueryInfoLen) {
965 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_BUFFER_TOO_SHORT);
968 kalMemCopy(prCmdInfo->pvInformationBuffer,
969 prEventMacMcastAddr->arAddress,
970 prEventMacMcastAddr->u4NumOfGroupAddr * MAC_ADDR_LEN);
972 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
978 nicCmdEventQueryEepromRead(
979 IN P_ADAPTER_T prAdapter,
980 IN P_CMD_INFO_T prCmdInfo,
981 IN PUINT_8 pucEventBuf
984 UINT_32 u4QueryInfoLen;
985 P_PARAM_CUSTOM_EEPROM_RW_STRUC_T prEepromRdInfo;
986 P_GLUE_INFO_T prGlueInfo;
987 P_EVENT_ACCESS_EEPROM prEventAccessEeprom;
993 //4 <2> Update information of OID
994 if (prCmdInfo->fgIsOid) {
995 prGlueInfo = prAdapter->prGlueInfo;
996 prEventAccessEeprom = (P_EVENT_ACCESS_EEPROM)(pucEventBuf);
998 u4QueryInfoLen = sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T);
1000 prEepromRdInfo = (P_PARAM_CUSTOM_EEPROM_RW_STRUC_T) prCmdInfo->pvInformationBuffer;
1001 prEepromRdInfo->ucEepromIndex = (UINT_8)(prEventAccessEeprom->u2Offset);
1002 prEepromRdInfo->u2EepromData = prEventAccessEeprom->u2Data;
1004 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1013 nicCmdEventSetMediaStreamMode(
1014 IN P_ADAPTER_T prAdapter,
1015 IN P_CMD_INFO_T prCmdInfo,
1016 IN PUINT_8 pucEventBuf
1019 PARAM_MEDIA_STREAMING_INDICATION rParamMediaStreamIndication;
1024 if (prCmdInfo->fgIsOid) {
1025 /* Update Set Infomation Length */
1026 kalOidComplete(prAdapter->prGlueInfo,
1027 prCmdInfo->fgSetQuery,
1028 prCmdInfo->u4SetInfoLen,
1029 WLAN_STATUS_SUCCESS);
1032 rParamMediaStreamIndication.rStatus.eStatusType =
1033 ENUM_STATUS_TYPE_MEDIA_STREAM_MODE;
1034 rParamMediaStreamIndication.eMediaStreamMode =
1035 prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode == 0 ?
1036 ENUM_MEDIA_STREAM_OFF : ENUM_MEDIA_STREAM_ON;
1038 kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
1039 WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
1040 (PVOID)&rParamMediaStreamIndication,
1041 sizeof(PARAM_MEDIA_STREAMING_INDICATION));
1045 /* Statistics responder */
1047 nicCmdEventQueryXmitOk(
1048 IN P_ADAPTER_T prAdapter,
1049 IN P_CMD_INFO_T prCmdInfo,
1050 IN PUINT_8 pucEventBuf
1053 P_EVENT_STATISTICS prEventStatistics;
1054 P_GLUE_INFO_T prGlueInfo;
1055 UINT_32 u4QueryInfoLen;
1062 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1064 if (prCmdInfo->fgIsOid) {
1065 prGlueInfo = prAdapter->prGlueInfo;
1067 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1068 u4QueryInfoLen = sizeof(UINT_32);
1070 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1071 *pu4Data = (UINT_32) prEventStatistics->rTransmittedFragmentCount.QuadPart;
1074 u4QueryInfoLen = sizeof(UINT_64);
1076 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1077 *pu8Data = prEventStatistics->rTransmittedFragmentCount.QuadPart;
1080 kalOidComplete(prGlueInfo,
1081 prCmdInfo->fgSetQuery,
1083 WLAN_STATUS_SUCCESS);
1089 nicCmdEventQueryRecvOk(
1090 IN P_ADAPTER_T prAdapter,
1091 IN P_CMD_INFO_T prCmdInfo,
1092 IN PUINT_8 pucEventBuf
1095 P_EVENT_STATISTICS prEventStatistics;
1096 P_GLUE_INFO_T prGlueInfo;
1097 UINT_32 u4QueryInfoLen;
1104 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1106 if (prCmdInfo->fgIsOid) {
1107 prGlueInfo = prAdapter->prGlueInfo;
1109 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1110 u4QueryInfoLen = sizeof(UINT_32);
1112 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1113 *pu4Data = (UINT_32) prEventStatistics->rReceivedFragmentCount.QuadPart;
1116 u4QueryInfoLen = sizeof(UINT_64);
1118 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1119 *pu8Data = prEventStatistics->rReceivedFragmentCount.QuadPart;
1122 kalOidComplete(prGlueInfo,
1123 prCmdInfo->fgSetQuery,
1125 WLAN_STATUS_SUCCESS);
1130 nicCmdEventQueryXmitError(
1131 IN P_ADAPTER_T prAdapter,
1132 IN P_CMD_INFO_T prCmdInfo,
1133 IN PUINT_8 pucEventBuf
1136 P_EVENT_STATISTICS prEventStatistics;
1137 P_GLUE_INFO_T prGlueInfo;
1138 UINT_32 u4QueryInfoLen;
1145 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1147 if (prCmdInfo->fgIsOid) {
1148 prGlueInfo = prAdapter->prGlueInfo;
1150 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1151 u4QueryInfoLen = sizeof(UINT_32);
1153 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1154 *pu4Data = (UINT_32) prEventStatistics->rFailedCount.QuadPart;
1157 u4QueryInfoLen = sizeof(UINT_64);
1159 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1160 *pu8Data = (UINT_64) prEventStatistics->rFailedCount.QuadPart;
1163 kalOidComplete(prGlueInfo,
1164 prCmdInfo->fgSetQuery,
1166 WLAN_STATUS_SUCCESS);
1172 nicCmdEventQueryRecvError(
1173 IN P_ADAPTER_T prAdapter,
1174 IN P_CMD_INFO_T prCmdInfo,
1175 IN PUINT_8 pucEventBuf
1178 P_EVENT_STATISTICS prEventStatistics;
1179 P_GLUE_INFO_T prGlueInfo;
1180 UINT_32 u4QueryInfoLen;
1187 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1189 if (prCmdInfo->fgIsOid) {
1190 prGlueInfo = prAdapter->prGlueInfo;
1192 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1193 u4QueryInfoLen = sizeof(UINT_32);
1195 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1196 *pu4Data = (UINT_32) prEventStatistics->rFCSErrorCount.QuadPart;
1197 // @FIXME, RX_ERROR_DROP_COUNT/RX_FIFO_FULL_DROP_COUNT is not calculated
1200 u4QueryInfoLen = sizeof(UINT_64);
1202 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1203 *pu8Data = prEventStatistics->rFCSErrorCount.QuadPart;
1204 // @FIXME, RX_ERROR_DROP_COUNT/RX_FIFO_FULL_DROP_COUNT is not calculated
1207 kalOidComplete(prGlueInfo,
1208 prCmdInfo->fgSetQuery,
1210 WLAN_STATUS_SUCCESS);
1216 nicCmdEventQueryRecvNoBuffer(
1217 IN P_ADAPTER_T prAdapter,
1218 IN P_CMD_INFO_T prCmdInfo,
1219 IN PUINT_8 pucEventBuf
1222 P_EVENT_STATISTICS prEventStatistics;
1223 P_GLUE_INFO_T prGlueInfo;
1224 UINT_32 u4QueryInfoLen;
1231 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1233 if (prCmdInfo->fgIsOid) {
1234 prGlueInfo = prAdapter->prGlueInfo;
1236 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1237 u4QueryInfoLen = sizeof(UINT_32);
1239 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1240 *pu4Data = 0; // @FIXME?
1243 u4QueryInfoLen = sizeof(UINT_64);
1245 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1246 *pu8Data = 0; //@FIXME?
1249 kalOidComplete(prGlueInfo,
1250 prCmdInfo->fgSetQuery,
1252 WLAN_STATUS_SUCCESS);
1258 nicCmdEventQueryRecvCrcError(
1259 IN P_ADAPTER_T prAdapter,
1260 IN P_CMD_INFO_T prCmdInfo,
1261 IN PUINT_8 pucEventBuf
1264 P_EVENT_STATISTICS prEventStatistics;
1265 P_GLUE_INFO_T prGlueInfo;
1266 UINT_32 u4QueryInfoLen;
1273 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1275 if (prCmdInfo->fgIsOid) {
1276 prGlueInfo = prAdapter->prGlueInfo;
1278 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1279 u4QueryInfoLen = sizeof(UINT_32);
1281 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1282 *pu4Data = (UINT_32) prEventStatistics->rFCSErrorCount.QuadPart;
1285 u4QueryInfoLen = sizeof(UINT_64);
1287 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1288 *pu8Data = prEventStatistics->rFCSErrorCount.QuadPart;
1291 kalOidComplete(prGlueInfo,
1292 prCmdInfo->fgSetQuery,
1294 WLAN_STATUS_SUCCESS);
1300 nicCmdEventQueryRecvErrorAlignment(
1301 IN P_ADAPTER_T prAdapter,
1302 IN P_CMD_INFO_T prCmdInfo,
1303 IN PUINT_8 pucEventBuf
1306 P_EVENT_STATISTICS prEventStatistics;
1307 P_GLUE_INFO_T prGlueInfo;
1308 UINT_32 u4QueryInfoLen;
1315 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1317 if (prCmdInfo->fgIsOid) {
1318 prGlueInfo = prAdapter->prGlueInfo;
1320 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1321 u4QueryInfoLen = sizeof(UINT_32);
1323 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1324 *pu4Data = (UINT_32) 0; //@FIXME
1327 u4QueryInfoLen = sizeof(UINT_64);
1329 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1330 *pu8Data = 0; //@FIXME
1333 kalOidComplete(prGlueInfo,
1334 prCmdInfo->fgSetQuery,
1336 WLAN_STATUS_SUCCESS);
1342 nicCmdEventQueryXmitOneCollision(
1343 IN P_ADAPTER_T prAdapter,
1344 IN P_CMD_INFO_T prCmdInfo,
1345 IN PUINT_8 pucEventBuf
1348 P_EVENT_STATISTICS prEventStatistics;
1349 P_GLUE_INFO_T prGlueInfo;
1350 UINT_32 u4QueryInfoLen;
1357 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1359 if (prCmdInfo->fgIsOid) {
1360 prGlueInfo = prAdapter->prGlueInfo;
1362 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1363 u4QueryInfoLen = sizeof(UINT_32);
1365 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1366 *pu4Data = (UINT_32) (prEventStatistics->rMultipleRetryCount.QuadPart - prEventStatistics->rRetryCount.QuadPart);
1369 u4QueryInfoLen = sizeof(UINT_64);
1371 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1372 *pu8Data = (UINT_64) (prEventStatistics->rMultipleRetryCount.QuadPart - prEventStatistics->rRetryCount.QuadPart);
1375 kalOidComplete(prGlueInfo,
1376 prCmdInfo->fgSetQuery,
1378 WLAN_STATUS_SUCCESS);
1384 nicCmdEventQueryXmitMoreCollisions(
1385 IN P_ADAPTER_T prAdapter,
1386 IN P_CMD_INFO_T prCmdInfo,
1387 IN PUINT_8 pucEventBuf
1390 P_EVENT_STATISTICS prEventStatistics;
1391 P_GLUE_INFO_T prGlueInfo;
1392 UINT_32 u4QueryInfoLen;
1399 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1401 if (prCmdInfo->fgIsOid) {
1402 prGlueInfo = prAdapter->prGlueInfo;
1404 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1405 u4QueryInfoLen = sizeof(UINT_32);
1407 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1408 *pu4Data = (UINT_32) prEventStatistics->rMultipleRetryCount.QuadPart;
1411 u4QueryInfoLen = sizeof(UINT_64);
1413 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1414 *pu8Data = (UINT_64) prEventStatistics->rMultipleRetryCount.QuadPart;
1417 kalOidComplete(prGlueInfo,
1418 prCmdInfo->fgSetQuery,
1420 WLAN_STATUS_SUCCESS);
1426 nicCmdEventQueryXmitMaxCollisions(
1427 IN P_ADAPTER_T prAdapter,
1428 IN P_CMD_INFO_T prCmdInfo,
1429 IN PUINT_8 pucEventBuf
1432 P_EVENT_STATISTICS prEventStatistics;
1433 P_GLUE_INFO_T prGlueInfo;
1434 UINT_32 u4QueryInfoLen;
1441 prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf;
1443 if (prCmdInfo->fgIsOid) {
1444 prGlueInfo = prAdapter->prGlueInfo;
1446 if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) {
1447 u4QueryInfoLen = sizeof(UINT_32);
1449 pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer;
1450 *pu4Data = (UINT_32) prEventStatistics->rFailedCount.QuadPart;
1453 u4QueryInfoLen = sizeof(UINT_64);
1455 pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer;
1456 *pu8Data = (UINT_64) prEventStatistics->rFailedCount.QuadPart;
1459 kalOidComplete(prGlueInfo,
1460 prCmdInfo->fgSetQuery,
1462 WLAN_STATUS_SUCCESS);
1467 /*----------------------------------------------------------------------------*/
1469 * @brief This function is called when command by OID/ioctl has been timeout
1471 * @param prAdapter Pointer to the Adapter structure.
1472 * @param prCmdInfo Pointer to the command information
1477 /*----------------------------------------------------------------------------*/
1479 nicOidCmdTimeoutCommon (
1480 IN P_ADAPTER_T prAdapter,
1481 IN P_CMD_INFO_T prCmdInfo
1486 kalOidComplete(prAdapter->prGlueInfo,
1487 prCmdInfo->fgSetQuery,
1489 WLAN_STATUS_FAILURE);
1493 /*----------------------------------------------------------------------------*/
1495 * @brief This function is a generic command timeout handler
1497 * @param pfnOidHandler Pointer to the OID handler
1501 /*----------------------------------------------------------------------------*/
1503 nicCmdTimeoutCommon (
1504 IN P_ADAPTER_T prAdapter,
1505 IN P_CMD_INFO_T prCmdInfo
1512 /*----------------------------------------------------------------------------*/
1514 * @brief This function is called when command for entering RF test has
1515 * failed sending due to timeout (highly possibly by firmware crash)
1517 * @param prAdapter Pointer to the Adapter structure.
1518 * @param prCmdInfo Pointer to the command information
1523 /*----------------------------------------------------------------------------*/
1525 nicOidCmdEnterRFTestTimeout (
1526 IN P_ADAPTER_T prAdapter,
1527 IN P_CMD_INFO_T prCmdInfo
1532 // 1. Remove pending TX frames
1533 nicTxRelease(prAdapter);
1535 // 1.1 clear pending Security / Management Frames
1536 kalClearSecurityFrames(prAdapter->prGlueInfo);
1537 kalClearMgmtFrames(prAdapter->prGlueInfo);
1539 // 1.2 clear pending TX packet queued in glue layer
1540 kalFlushPendingTxPackets(prAdapter->prGlueInfo);
1542 // 2. indiate for OID failure
1543 kalOidComplete(prAdapter->prGlueInfo,
1544 prCmdInfo->fgSetQuery,
1546 WLAN_STATUS_FAILURE);
1550 /*----------------------------------------------------------------------------*/
1552 * @brief This function is called when command for memory dump has
1555 * @param prAdapter Pointer to the Adapter structure.
1556 * @param prCmdInfo Pointer to the command information
1557 * @param pucEventBuf Pointer to event buffer
1562 /*----------------------------------------------------------------------------*/
1564 nicCmdEventQueryMemDump (
1565 IN P_ADAPTER_T prAdapter,
1566 IN P_CMD_INFO_T prCmdInfo,
1567 IN PUINT_8 pucEventBuf
1570 UINT_32 u4QueryInfoLen;
1571 P_PARAM_CUSTOM_MEM_DUMP_STRUC_T prMemDumpInfo;
1572 P_GLUE_INFO_T prGlueInfo;
1573 P_EVENT_DUMP_MEM_T prEventDumpMem;
1574 static UINT_8 aucPath[256];
1575 static UINT_32 u4CurTimeTick;
1579 ASSERT(pucEventBuf);
1581 //4 <2> Update information of OID
1582 if (prCmdInfo->fgIsOid) {
1583 prGlueInfo = prAdapter->prGlueInfo;
1584 prEventDumpMem = (P_EVENT_DUMP_MEM_T)(pucEventBuf);
1586 u4QueryInfoLen = sizeof(P_PARAM_CUSTOM_MEM_DUMP_STRUC_T);
1588 prMemDumpInfo = (P_PARAM_CUSTOM_MEM_DUMP_STRUC_T) prCmdInfo->pvInformationBuffer;
1589 prMemDumpInfo->u4Address = prEventDumpMem->u4Address;
1590 prMemDumpInfo->u4Length = prEventDumpMem->u4Length;
1591 prMemDumpInfo->u4RemainLength = prEventDumpMem->u4RemainLength;
1592 prMemDumpInfo->ucFragNum = prEventDumpMem->ucFragNum;
1597 printk("Rx dump address 0x%X, Length %d, FragNum %d, remain %d\n",
1598 prEventDumpMem->u4Address,
1599 prEventDumpMem->u4Length,
1600 prEventDumpMem->ucFragNum,
1601 prEventDumpMem->u4RemainLength);
1603 for(i = 0; i < prEventDumpMem->u4Length; i++) {
1604 printk("%02X ", prEventDumpMem->aucBuffer[i]);
1613 if(prEventDumpMem->ucFragNum == 1) {
1614 /* Store memory dump into sdcard,
1615 * path /sdcard/dump_<current system tick>_<memory address>_<memory length>.hex
1617 u4CurTimeTick = kalGetTimeTick();
1618 sprintf(aucPath, "/sdcard/dump_%ld_0x%08lX_%ld.hex",
1620 prEventDumpMem->u4Address,
1621 prEventDumpMem->u4Length + prEventDumpMem->u4RemainLength);
1622 kalWriteToFile(aucPath, FALSE, &prEventDumpMem->aucBuffer[0], prEventDumpMem->u4Length);
1625 /* Append current memory dump to the hex file */
1626 kalWriteToFile(aucPath, TRUE, &prEventDumpMem->aucBuffer[0], prEventDumpMem->u4Length);
1629 if(prEventDumpMem->u4RemainLength == 0 ||
1630 prEventDumpMem->u4Address == 0xFFFFFFFF) {
1631 /* The request is finished or firmware response a error */
1632 /* Reply time tick to iwpriv */
1633 *((PUINT_32)prCmdInfo->pvInformationBuffer) = u4CurTimeTick;
1634 kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS);
1637 /* The memory dump request is not finished, Send next command*/
1640 prCmdInfo->pvInformationBuffer,
1641 prCmdInfo->u4InformationBufferLength);