cmdsend.c

来自「marvell8385 GSPI开发驱动」· C语言 代码 · 共 1,764 行 · 第 1/5 页

C
1,764
字号

                // TKIP key is 16 bytes long
                NdisMoveMemory(pCmdPwk->TkipEncryptKey, pKey->EncryptionKey, 16);

                DBGPRINT(DBG_WPA, ("HostCmd_CMD_802_11_GRP_KEY: \n"));
                DBGPRINT(DBG_WPA, ("\tTKIP Key: 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x - 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x\n", 
                    pCmdPwk->TkipEncryptKey[0],
                    pCmdPwk->TkipEncryptKey[1],
                    pCmdPwk->TkipEncryptKey[2],
                    pCmdPwk->TkipEncryptKey[3],
                    pCmdPwk->TkipEncryptKey[4],
                    pCmdPwk->TkipEncryptKey[5],
                    pCmdPwk->TkipEncryptKey[6],
                    pCmdPwk->TkipEncryptKey[7],
                    pCmdPwk->TkipEncryptKey[8],
                    pCmdPwk->TkipEncryptKey[9],
                    pCmdPwk->TkipEncryptKey[10],
                    pCmdPwk->TkipEncryptKey[11],
                    pCmdPwk->TkipEncryptKey[12],
                    pCmdPwk->TkipEncryptKey[13],
                    pCmdPwk->TkipEncryptKey[14],
                    pCmdPwk->TkipEncryptKey[15]));

                DBGPRINT(DBG_WPA, ("\tTX MIC Key: 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x 0x2%x\n",
                    pCmdPwk->TkipTxMicKey[0],
                    pCmdPwk->TkipTxMicKey[1],
                    pCmdPwk->TkipTxMicKey[2],
                    pCmdPwk->TkipTxMicKey[3],
                    pCmdPwk->TkipTxMicKey[4],
                    pCmdPwk->TkipTxMicKey[5],
                    pCmdPwk->TkipTxMicKey[6],
                    pCmdPwk->TkipTxMicKey[7]));

                DBGPRINT(DBG_WPA, ("\tRX MIC Key: 0x2%x 0x2%x 0x2%x 0x2%x "
                    "0x2%x 0x2%x 0x2%x 0x2%x\n",
                    pCmdPwk->TkipRxMicKey[0],
                    pCmdPwk->TkipRxMicKey[1],
                    pCmdPwk->TkipRxMicKey[2],
                    pCmdPwk->TkipRxMicKey[3],
                    pCmdPwk->TkipRxMicKey[4],
                    pCmdPwk->TkipRxMicKey[5],
                    pCmdPwk->TkipRxMicKey[6],
                    pCmdPwk->TkipRxMicKey[7]));
            }

            break;

        case HostCmd_CMD_802_11_PAIRWISE_TSC:
            break;

        case HostCmd_CMD_802_11_GROUP_TSC:
            break;

#endif // #ifdef WPA

        // TX and RX commands are the same
        case HostCmd_CMD_TEST_RX_MODE:
        case HostCmd_CMD_TEST_TX_MODE:
            {
                POID_MRVL_DS_TX_MODE        pUserBuffer;
                PHostCmd_DS_CMD_TXRX_MODE   pCmd;

                // set only
                if ( CmdOption != HostCmd_ACT_SET )
                    return NDIS_STATUS_NOT_ACCEPTED;

                // TX and RX mode command does not check for valid mode value
                // Check should be done before calling this function
                pCmd = (PHostCmd_DS_CMD_TXRX_MODE)pCmdPtr;
                pUserBuffer = (POID_MRVL_DS_TX_MODE) InformationBuffer;
                pCmd->Mode = (UCHAR)pUserBuffer->ulMode;
                Size = sizeof(HostCmd_DS_CMD_TXRX_MODE);
            }
            break;

        case HostCmd_CMD_REGION_CODE:
            {
                POID_MRVL_DS_REGION_CODE    pUserBuffer;
                PHostCmd_DS_CMD_REGION_CODE pCmd;

                pCmd = (PHostCmd_DS_CMD_REGION_CODE)pCmdPtr;
                pCmd->Action = CmdOption;

		if(pCmd->Action==HostCmd_ACT_SET)
		{
                 pUserBuffer = (POID_MRVL_DS_REGION_CODE)InformationBuffer;
                 pCmd->RegionCode = (USHORT)(pUserBuffer->usRegionCode);
                 //DBGPRINT(DBG_OID, ("***** 1 PrepareAndSendCommand:HostCmd_CMD_REGION_CODE pCmd->RegionCode=%d\n",pCmd->RegionCode));
              }
               
                Size = sizeof(HostCmd_DS_CMD_REGION_CODE);

		V5DbgMsg( (L"+++ Ready to download region_code cmd\n") );
            }
            break;

        case HostCmd_CMD_MAC_ADDRESS:
            {
                PHostCmd_DS_CMD_MAC_ADDRESS     pCmd;
                POID_MRVL_DS_MAC_ADDRESS    pUserBuffer;

        DBGPRINT(DBG_ALLEN,("***+ HostCmd_CMD_MAC_ADDRES\n"));  
                pCmd = (PHostCmd_DS_CMD_MAC_ADDRESS)pCmdPtr;
                pCmd->Action = CmdOption;
                pUserBuffer = (POID_MRVL_DS_MAC_ADDRESS)InformationBuffer;
                NdisMoveMemory( pCmd->MacAddress,
                                pUserBuffer->EthAddr,
                                MRVDRV_ETH_ADDR_LEN);
                Size = sizeof(HostCmd_DS_CMD_MAC_ADDRESS);       
            }
            break;

        case HostCmd_CMD_BBP_REG_ACCESS:
            {
                PHostCmd_DS_CMD_BBP_REG_ACCESS pCmd;
                POID_MRVL_DS_BBP_REGISTER_ACCESS pUserBuffer;

                pCmd = (PHostCmd_DS_CMD_BBP_REG_ACCESS)pCmdPtr;
                pCmd->Action = CmdOption;

                pUserBuffer = (POID_MRVL_DS_BBP_REGISTER_ACCESS)InformationBuffer;
                pCmd->Offset = pUserBuffer->usOffset;

                // no harm in setting the value if it is a read
                pCmd->Value = (UCHAR)pUserBuffer->ulValue; 

                Size = sizeof(HostCmd_DS_CMD_BBP_REG_ACCESS);
            }

        case HostCmd_CMD_MAC_REG_ACCESS:
            {
                PHostCmd_DS_CMD_MAC_REG_ACCESS pCmd;
                POID_MRVL_DS_MAC_REGISTER_ACCESS pUserBuffer;

                pCmd = (PHostCmd_DS_CMD_MAC_REG_ACCESS)pCmdPtr;
                pCmd->Action = CmdOption;

                pUserBuffer = (POID_MRVL_DS_MAC_REGISTER_ACCESS)InformationBuffer;
                pCmd->Offset = pUserBuffer->usOffset;

                // no harm in setting the value if it is a read
                pCmd->Value = pUserBuffer->ulValue; 

                Size = sizeof(HostCmd_DS_CMD_MAC_REG_ACCESS);
            }

            break;

        case HostCmd_CMD_RF_REG_ACCESS:
            {
                PHostCmd_DS_CMD_RF_REG_ACCESS pCmd;
                POID_MRVL_DS_RF_REGISTER_ACCESS pUserBuffer;

                pCmd = (PHostCmd_DS_CMD_RF_REG_ACCESS)pCmdPtr;
                pCmd->Action = CmdOption;

                pUserBuffer = (POID_MRVL_DS_RF_REGISTER_ACCESS)InformationBuffer;
                pCmd->Offset = pUserBuffer->usOffset;

                // no harm in setting the value if it is a read
                pCmd->Value = (UCHAR)pUserBuffer->ulValue; 

                Size = sizeof(HostCmd_DS_CMD_RF_REG_ACCESS);
            }

            break;
            
    case HostCmd_CMD_802_11_ENABLE_QOS_WME:
      Size = (USHORT)(sizeof(HostCmd_CMD_QOS_WME_ENABLE_STATE));
      {
        PHostCmd_CMD_QOS_WME_ENABLE_STATE pCmd;

        pCmd = (PHostCmd_CMD_QOS_WME_ENABLE_STATE)pCmdPtr;
        
        pCmd->Action = CmdOption;

        if ( pCmd->Action == HostCmd_ACT_SET )
        {
          pCmd->Enabled = (USHORT)Adapter->EnableQOS;
        }
      }

      break;

    case HostCmd_CMD_802_11_WME_AC_PARAMS :
      Size = 
        (USHORT)sizeof(HostCmd_CMD_QOS_WME_ACCESS_CATEGORY_PARAMETERS);
      {

        PHostCmd_CMD_QOS_WME_ACCESS_CATEGORY_PARAMETERS pCmd;

        pCmd = (PHostCmd_CMD_QOS_WME_ACCESS_CATEGORY_PARAMETERS)pCmdPtr;
        pCmd->Action = CmdOption;

        if ( pCmd->Action == HostCmd_ACT_SET )
        {
          pCmd->AC_BE = Adapter->QOSParams.AC_BE;
          pCmd->AC_BE_XTRA = Adapter->QOSParams.AC_BE_XTRA;
          pCmd->AC_BK = Adapter->QOSParams.AC_BK;
          pCmd->AC_BK_XTRA = Adapter->QOSParams.AC_BK_XTRA;
          pCmd->AC_VI = Adapter->QOSParams.AC_VI;
          pCmd->AC_VI_XTRA = Adapter->QOSParams.AC_VI_XTRA;
          pCmd->AC_VO = Adapter->QOSParams.AC_VO;
          pCmd->AC_VO_XTRA = Adapter->QOSParams.AC_VO_XTRA;
        }
      }

      break;

    case HostCmd_CMD_802_11_RSSI:
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_RSSI));
      break;

    case HostCmd_CMD_802_11_GET_LOG:
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_GET_LOG));
      break;

    case HostCmd_CMD_GET_HW_SPEC:
      Size = (USHORT)(sizeof(HostCmd_DS_GET_HW_SPEC));
      pHWSpec = (PHostCmd_DS_GET_HW_SPEC)pCmdPtr;
      
      // Move Adapter->CurrentAddr to address field
      NdisMoveMemory(pHWSpec->PermanentAddr, Adapter->CurrentAddr, MRVDRV_ETH_ADDR_LEN);
    
      DBGPRINT(DBG_CMDRESP,("*** set f/w permanent addr : %2x %2x %2x %2x %2x %2x ***\n", 
        pHWSpec->PermanentAddr[0],
        pHWSpec->PermanentAddr[1],
        pHWSpec->PermanentAddr[2],
        pHWSpec->PermanentAddr[3],
        pHWSpec->PermanentAddr[4],
        pHWSpec->PermanentAddr[5]));        
    break;
  
    case HostCmd_CMD_802_11_RESET:
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_RESET));
      pReset = (PHostCmd_DS_802_11_RESET)pCmdPtr;
      pReset->Action = CmdOption;
    break;
  
    case HostCmd_CMD_802_11_QUERY_STATUS:
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_QUERY_STATUS));
      pStatus = (PHostCmd_DS_802_11_QUERY_STATUS)pCmdPtr;
    break;
  
    case HostCmd_CMD_802_11_QUERY_TRAFFIC:
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_QUERY_TRAFFIC));
      pTraffic = (PHostCmd_DS_802_11_QUERY_TRAFFIC)pCmdPtr;
    break;
  
    case HostCmd_CMD_MAC_CONTROL:
      Size = (USHORT)(sizeof(HostCmd_DS_MAC_CONTROL));
      pControl = (PHostCmd_DS_MAC_CONTROL)pCmdPtr;
      pControl->Action = CmdOption;
    break;
  
    case HostCmd_CMD_MAC_MULTICAST_ADR:
      Size = (USHORT)(sizeof(HostCmd_DS_MAC_MULTICAST_ADR));
      pMCastAdr = (PHostCmd_DS_MAC_MULTICAST_ADR)pCmdPtr;
      pMCastAdr->Action = CmdOption;
      pMCastAdr->NumOfAdrs = (USHORT)Adapter->NumOfMulticastMACAddr;
      
      NdisMoveMemory(
        (PVOID)pMCastAdr->MACList, 
        (PVOID)Adapter->MulticastList,
        Adapter->NumOfMulticastMACAddr*ETH_LENGTH_OF_ADDRESS);
    break;
  
    case HostCmd_CMD_802_11_GET_STAT:
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_GET_STAT));
      p11Stat = (PHostCmd_DS_802_11_GET_STAT)pCmdPtr;
    break;
  
    case HostCmd_CMD_802_3_GET_STAT:  
      Size = (USHORT)(sizeof(HostCmd_DS_802_3_GET_STAT));
      p3Stat = (PHostCmd_DS_802_3_GET_STAT)pCmdPtr;
    break;
  
    case HostCmd_CMD_802_11_PS_MODE:
         {
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_PS_MODE));
      pPSMode = (PHostCmd_DS_802_11_PS_MODE)pCmdPtr;

      //pPSMode->Action = 0;
      pPSMode->SubCommand = (USHORT)InformationBuffer;
      pPSMode->PowerMode = 0;
                 
#if 0 //dralee, 20051031, move to DownloadCommand()
//tt ++ ra fail
	if ( pPSMode->SubCommand == HostCmd_SubCmd_Enter_PS )
	{
		EnterCriticalSection(&Adapter->TxCriticalSection);
		BatchIndicateRetQPkts(Adapter);
		LeaveCriticalSection(&Adapter->TxCriticalSection);
	}
//tt -- 
#endif

        #ifdef MRVL_USE_MULTIPLE_DTIM
            pPSMode->PSNumDtims = Adapter->DTIMNum;
          #else
                  pPSMode->PSNumDtims = 0x1;
          #endif
    }
    break;
  
    case HostCmd_CMD_802_11_DATA_RATE:
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_DATA_RATE));
      pDataRate = (PHostCmd_DS_802_11_DATA_RATE)pCmdPtr;
      
      SetupDataRate(CmdOption, pDataRate, Adapter,InformationBuffer);
    break;

    case HostCmd_CMD_802_11_BAND_CONFIG:
    {
      PHostCmd_DS_802_11_BAND_CONFIG bc;

      bc = (PHostCmd_DS_802_11_BAND_CONFIG)InformationBuffer;
      Size = (USHORT)(sizeof(HostCmd_DS_802_11_BAND_CONFIG));
      pBandConfig = (PHostCmd_DS_802_11_BAND_CONFIG)pCmdPtr;

      pBandConfig->Action = CmdOption;
      pBandConfig->Channel = bc->Channel;
      pBandConfig->BandSelection = bc->BandSelection; 
    }
        break;
  
#if 0  //dralee 081105, V4
    case HostCmd_CMD_802_11_SCAN:


    { 
      PREGION_CHANNEL region_channel;
      //PHostCmd_DS_802_11_BAND_CONFIG pBandC;
      PHostCmd_DS_802_11_SCAN pScanCMD;
      USHORT i,j,k,cmd_index;
      CmdCtrlNode *pTempScanCmd[20];
      //CmdCtrlNode *pTempBandCmd[20];
            USHORT TotalChan;
      HostCmd_DS_802_11_BAND_CONFIG bc;

            // scan in progress --> set the flag 
      Adapter->bIsScanInProgress = TRUE;
      
      // clean up the list
      if ((Adapter->bIsScanWhileConnect == FALSE) &&
        (Adapter->SetActiveScanSSID == FALSE))
      {
        Adapter->ulPSNumOfBSSIDs = 0;
      }
      

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?