wcmd.c
来自「VIA VT6656 USB linux source code.」· C语言 代码 · 共 1,271 行 · 第 1/4 页
C
1,271 行
s_bCommandComplete(pDevice); break; case WLAN_CMD_TBTT_WAKEUP_START: PSbIsNextTBTTWakeUp(pDevice); s_bCommandComplete(pDevice); break; case WLAN_CMD_BECON_SEND_START: bMgrPrepareBeaconToSend(pDevice, pMgmt); s_bCommandComplete(pDevice); break; case WLAN_CMD_SETPOWER_START: RFbSetPower(pDevice, pDevice->wCurrentRate, pMgmt->uCurrChannel); s_bCommandComplete(pDevice); break; case WLAN_CMD_CHANGE_ANTENNA_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); if ( pDevice->dwRxAntennaSel == 0) { pDevice->dwRxAntennaSel=1; if (pDevice->bTxRxAntInv == TRUE) BBvSetAntennaMode(pDevice, ANT_RXA); else BBvSetAntennaMode(pDevice, ANT_RXB); } else { pDevice->dwRxAntennaSel=0; if (pDevice->bTxRxAntInv == TRUE) BBvSetAntennaMode(pDevice, ANT_RXB); else BBvSetAntennaMode(pDevice, ANT_RXA); } s_bCommandComplete(pDevice); break; case WLAN_CMD_REMOVE_ALLKEY_START: KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); s_bCommandComplete(pDevice); break; case WLAN_CMD_MAC_DISPOWERSAVING_START: ControlvReadByte (pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); if ( (byData & PSCTL_PS) != 0 ) { // disable power saving hw function CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_DISABLE_PS, 0, 0, 0, NULL ); } s_bCommandComplete(pDevice); break; case WLAN_CMD_11H_CHSW_START: CARDbSetMediaChannel(pDevice, pDevice->byNewChannel); pDevice->bChannelSwitch = FALSE; pMgmt->uCurrChannel = pDevice->byNewChannel; pDevice->bStopDataPkt = FALSE; s_bCommandComplete(pDevice); break; default: s_bCommandComplete(pDevice); break; } //switch spin_unlock_irq(&pDevice->lock); return;}staticBOOLs_bCommandComplete ( PSDevice pDevice ){ PWLAN_IE_SSID pSSID; BOOL bRadioCmd = FALSE; //WORD wDeAuthenReason = 0; BOOL bForceSCAN = TRUE; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); pDevice->eCommandState = WLAN_CMD_IDLE; if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { //Command Queue Empty pDevice->bCmdRunning = FALSE; return TRUE; } else { pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID; bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd; bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN; ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue++; pDevice->bCmdRunning = TRUE; switch ( pDevice->eCommand ) { case WLAN_CMD_BSSID_SCAN: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); pDevice->eCommandState = WLAN_CMD_SCAN_START; pMgmt->uScanChannel = 0; if (pSSID->len != 0) { MEMvCopy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); } else { memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); }/* if ((bForceSCAN == FALSE) && (pDevice->bLinkPass == TRUE)) { if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && (MEMEqualMemory(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { pDevice->eCommandState = WLAN_CMD_IDLE; } }*/ break; case WLAN_CMD_SSID: pDevice->eCommandState = WLAN_CMD_SSID_START; if (pSSID->len > WLAN_SSID_MAXLEN) pSSID->len = WLAN_SSID_MAXLEN; if (pSSID->len != 0) MEMvCopy(pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); break; case WLAN_CMD_DISASSOCIATE: pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; break; case WLAN_CMD_RX_PSPOLL: pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START; break; case WLAN_CMD_RUN_AP: pDevice->eCommandState = WLAN_CMD_AP_MODE_START; break; case WLAN_CMD_RADIO: pDevice->eCommandState = WLAN_CMD_RADIO_START; pDevice->bRadioCmd = bRadioCmd; break; case WLAN_CMD_CHANGE_BBSENSITIVITY: pDevice->eCommandState = WLAN_CMD_CHANGE_BBSENSITIVITY_START; break; case WLAN_CMD_TBTT_WAKEUP: pDevice->eCommandState = WLAN_CMD_TBTT_WAKEUP_START; break; case WLAN_CMD_BECON_SEND: pDevice->eCommandState = WLAN_CMD_BECON_SEND_START; break; case WLAN_CMD_SETPOWER: pDevice->eCommandState = WLAN_CMD_SETPOWER_START; break; case WLAN_CMD_CHANGE_ANTENNA: pDevice->eCommandState = WLAN_CMD_CHANGE_ANTENNA_START; break; case WLAN_CMD_REMOVE_ALLKEY: pDevice->eCommandState = WLAN_CMD_REMOVE_ALLKEY_START; break; case WLAN_CMD_MAC_DISPOWERSAVING: pDevice->eCommandState = WLAN_CMD_MAC_DISPOWERSAVING_START; break; case WLAN_CMD_11H_CHSW: pDevice->eCommandState = WLAN_CMD_11H_CHSW_START; break; default: break; } vCommandTimerWait((HANDLE)pDevice, 0); } return TRUE;}BOOL bScheduleCommand ( IN HANDLE hDeviceContext, IN CMD_CODE eCommand, IN PBYTE pbyItem0 ){ PSDevice pDevice = (PSDevice)hDeviceContext; if (pDevice->cbFreeCmdQueue == 0) { return (FALSE); } pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = TRUE; memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); if (pbyItem0 != NULL) { switch (eCommand) { case WLAN_CMD_BSSID_SCAN: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = FALSE; MEMvCopy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; case WLAN_CMD_SSID: MEMvCopy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; case WLAN_CMD_DISASSOCIATE: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((PBOOL)pbyItem0); break;/* case WLAN_CMD_DEAUTH: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((PWORD)pbyItem0); break;*/ case WLAN_CMD_RADIO: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((PBOOL)pbyItem0); break; default: break; } } ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue--; if (pDevice->bCmdRunning == FALSE) { s_bCommandComplete(pDevice); } else { } return (TRUE);}/* * Description: * Clear BSSID_SCAN cmd in CMD Queue * * Parameters: * In: * hDeviceContext - Pointer to the adapter * eCommand - Command * Out: * none * * Return Value: TRUE if success; otherwise FALSE * */staticBOOL s_bClearBSSID_SCAN ( IN HANDLE hDeviceContext ){ PSDevice pDevice = (PSDevice)hDeviceContext; UINT uCmdDequeueIdx = pDevice->uCmdDequeueIdx; UINT ii; if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii ++) { if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN) pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE; ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE); if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx) break; } } return TRUE;}//2007-0115-08<Add>by MikeLiu#ifdef TxInSleepVOIDBSSvSecondTxData( IN HANDLE hDeviceContext ){ PSDevice pDevice = (PSDevice)hDeviceContext; pDevice->nTxDataTimeCout++; if(pDevice->nTxDataTimeCout<4) //don't tx data if timer less than 40s { // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__, // (int)pDevice->nTxDataTimeCout); pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback add_timer(&pDevice->sTimerTxData); return; } spin_lock_irq(&pDevice->lock); if(pDevice->bLinkPass ==TRUE) { // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__); pDevice->fTxDataInSleep = TRUE; PSbSendNullPacket(pDevice); //send null packet pDevice->fTxDataInSleep = FALSE; } spin_unlock_irq(&pDevice->lock); pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback add_timer(&pDevice->sTimerTxData); return;}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?