⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hwacproc.c

📁 Windows CE 6.0 BSP for VOIP sample phone. Intel PXA270 platform.
💻 C
📖 第 1 页 / 共 5 页
字号:
	
#ifdef UNDER_CE

    	{   	// Add FW version to registry
       	REG_VALUE_DESCR Vals[2];
        	wchar_t buf[50];

		swprintf(buf, TEXT("%d.%d.%d.%d"), ucA, ucB, ucC, ucP);

        	Vals[0].val_data = (PBYTE)buf;
        	Vals[0].val_name = TEXT("FWVersion");
        	Vals[0].val_type = REG_SZ;
        	Vals[1].val_name = NULL;

#ifdef MRV_CHIP_8385H
	 	AddKeyValues (TEXT("Comm\\CF8385H"), Vals);	// CF8385H	
#elif defined(MRV_CHIP_8385PN)
	 	AddKeyValues (TEXT("Comm\\CF8385PN"), Vals);	// CF8385PN
#elif defined(MRV_CHIP_8381PN)
	 	AddKeyValues (TEXT("Comm\\CF8381PN"), Vals);	// CF8381PN  
#elif defined(MRV_CHIP_8381P)
	 	AddKeyValues (TEXT("Comm\\CF8381P"), Vals);	// CF8381P 	 
#else
	 	AddKeyValues (TEXT("Comm\\EAGLEND5"), Vals);	// CF8305
#endif 

    	}

#endif // UNDER_CE

	DBGPRINT(DBG_CMDRESP,("*** Got 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]));

 	
	// Get the region code 
       // if it's unidentified region code, use the default (USA)
	Adapter->RegionTableIndex = 0;
	
       // the upper byte is the primary region code

	//AllenDBGPRINT(1 , ("Adapter->RegionCode = 0x%x\n",Adapter->RegionCode));
	   
       if (Adapter->RegionCode & 0xff00)   // reversion five eeprom structure
       {
 		Adapter->RegionCode = pHWSpec->RegionCode >> 8;
       }
	else    							// reversion A eeprom structure
	{
              Adapter->RegionCode = pHWSpec->RegionCode;
	}
	
	DBGPRINT(DBG_LOAD, ("Region code = 0x%x \n", Adapter->RegionCode));
		 
	for (i=0; i<MRVDRV_MAX_REGION_CODE; i++)
	{
		// use the region code to search for the index
		if ( Adapter->RegionCode == RegionCodeToIndex[i] )
		{
			Adapter->RegionTableIndex = (USHORT) i;
			break;
		}
	}

       // if it's unidentified region code, use the default (USA)
	if (i == MRVDRV_MAX_REGION_CODE)
       {
            Adapter->RegionCode = 0x10;
	     Adapter->RegionTableIndex = 0;
       }

	DBGPRINT(DBG_LOAD, ("Region code = 0x%x \n", Adapter->RegionCode));

	SetRegionCode(Adapter);   //set region band

	// if( Adapter->CurrentAddr[0] == 0xff )
	{ 
		NdisMoveMemory(
		    		(PVOID)Adapter->CurrentAddr, 
		    		(PVOID)pHWSpec->PermanentAddr,
		    		MRVDRV_ETH_ADDR_LEN);
	}
	
	NdisMoveMemory(
			(PVOID)TempBuf,
			(PVOID)pHWSpec->PermanentAddr,
			4);
		
#ifdef CF_DRIVER
		TempBuf[3] = MRVL_8100_COMPACTFLASH_VER_ID;
#else
		TempBuf[3] = MRVL_8100_PCI_VER_ID;
#endif
	
	NdisMoveMemory(
			(PVOID)&Adapter->VendorID,
			(PVOID)TempBuf,
			4);

    	Adapter->FWCapInfo = pHWSpec->fwCapInfo;

    	DBGPRINT(DBG_CMDRESP, ("FW Cap Info = 0x%x\n", Adapter->FWCapInfo));

	SetEvent( Adapter->hWaitForGetHwSpecEvent);		

}	

/******************************************************************************
 *
 *  Name: CopyBSSIDInfo()
 *
 *  Description: Copy BSSID Info
 *
 *  Arguments:  PCONDOR_ADAPTER Adapter
 *    			
 *
 *  Return Value:        
 * 
 *  Notes:               
 *
 *****************************************************************************/
VOID
CopyBSSIDInfo(
	PMRVDRV_ADAPTER Adapter
	)
{
    	PNDIS_WLAN_BSSID_EX pBSSIDListSrc;
    	PMRV_BSSID_IE_LIST   pIESrc;

    	pBSSIDListSrc = Adapter->PSBSSIDList;
    	pIESrc = Adapter->PSIEBuffer;
    
    	NdisMoveMemory( 	&Adapter->CurrentBSSIDDesciptor,
       				&pBSSIDListSrc[Adapter->ulCurrentBSSIDIndex],
              	      		sizeof(NDIS_WLAN_BSSID_EX));

    	NdisMoveMemory( 	&Adapter->CurrentBSSIDIEBuffer,
       	             		&pIESrc[Adapter->ulCurrentBSSIDIndex],
              	      		sizeof(MRV_BSSID_IE_LIST));

    	NdisMoveMemory( 	&Adapter->CurrentSSID,
       		      		&(pBSSIDListSrc[Adapter->ulCurrentBSSIDIndex].Ssid),
       		      		sizeof(NDIS_802_11_SSID));
		
	// Set the new BSSID (AP's MAC address) to current BSSID
	NdisMoveMemory( 	Adapter->CurrentBSSID,
				    	&(pBSSIDListSrc[Adapter->ulCurrentBSSIDIndex].MacAddress), 
				    	MRVDRV_ETH_ADDR_LEN);
		
	// Make a copy of current BSSID descriptor
	NdisMoveMemory( 	&(Adapter->CurrentBssDesciptor), 
					&(Adapter->PSBssDescList[Adapter->ulCurrentBSSIDIndex]), 
					sizeof(BSS_DESCRIPTION_SET_ALL_FIELDS));

	// Set the new configuration to the current config
	NdisMoveMemory(	&Adapter->CurrentConfiguration, 
					&(pBSSIDListSrc[Adapter->ulCurrentBSSIDIndex].Configuration),
					sizeof(NDIS_802_11_CONFIGURATION));

#ifdef ACTIVE_ROAMING

	if (Adapter->CurrentConfiguration .DSConfig > 5000000)
     	{
       	Adapter->connected_channel= (UCHAR)((Adapter->CurrentConfiguration.DSConfig - 5000000)/5000);
	 	Adapter->connected_band  = MRVDRV_802_11_BAND_A;	 
     	}
     	else if (Adapter->CurrentConfiguration .DSConfig > 2407000)
    	{
		Adapter->connected_channel  = (UCHAR)((Adapter->CurrentConfiguration.DSConfig  - 2407000)/5000);
#ifdef MRV_CHIP_8381
	      Adapter->connected_band  = MRVDRV_802_11_BAND_B;
#else
             Adapter->connected_band  = MRVDRV_802_11_BAND_BG; 
#endif
     	}
		
#endif  

}


/******************************************************************************
 *
 *  Name: HandleHostCmdFailure()
 *
 *  Description: Handle command failures
 *
 *  Arguments:	USHORT Ret
 *				PCONDOR_ADAPTER Adapter
 *    			PHostCmd_DS_GEN pRetPtr
 *
 *  Return Value:        
 * 
 *  Notes:               
 *
 *****************************************************************************/
NDIS_STATUS
HandleHostCmdFailure(
	USHORT Ret, 
	PMRVDRV_ADAPTER Adapter,
	PHostCmd_DS_GEN pRetPtr
	)
{

       DBGPRINT(DBG_CMDRESP,("HWAC - command 0x%x Failed\n", Ret));

       // In some cases, we need to report hardware status
	switch( Ret )
	{
		case HostCmd_RET_HW_SPEC_INFO:
            		break;

		case HostCmd_RET_802_11_RESET:

			DBGPRINT(DBG_CMDRESP,("HWAC - Reset command Failed\n"));
			
			Adapter->HardwareStatus = NdisHardwareStatusNotReady;
			break;

		case HostCmd_RET_802_11_STATUS_INFO:
			Adapter->HardwareStatus = NdisHardwareStatusNotReady;
			break;

		case HostCmd_RET_802_11_SCAN:

			Adapter->bIsAssociationBlockedByScan = FALSE;	
                     Adapter->bIsScanInProgress = FALSE;
					 
			if (Adapter->bTXRESOURCES==TRUE)
			{
				NdisMSendResourcesAvailable(Adapter->MrvDrvAdapterHdl); 
				Adapter->bTXRESOURCES=FALSE;
			}
	
			break;
			
	       case HostCmd_RET_802_11_ASSOCIATE:
	       case HostCmd_RET_802_11_REASSOCIATE:
	       case HostCmd_RET_802_11_AD_HOC_JOIN:
	       case HostCmd_RET_802_11_AD_HOC_START:

			Adapter->bIsAssociateInProgress = FALSE;
			
 			break;
	}

	if ( Adapter->CurCmd->PendingInfo == HostCmd_PENDING_ON_GET_OID )
			
				{		
					NdisMQueryInformationComplete(
							Adapter->MrvDrvAdapterHdl,
					NDIS_STATUS_SUCCESS);
				}
       else if ( Adapter->CurCmd->PendingInfo == HostCmd_PENDING_ON_SET_OID )
				{		
					NdisMSetInformationComplete(
						Adapter->MrvDrvAdapterHdl,
					NDIS_STATUS_SUCCESS);
				}				
				 

	ReturnCmdNode(Adapter, Adapter->CurCmd); 
	Adapter->CurCmd = NULL;
	
    	GetCmdFromQueueToExecute (Adapter);
	
	return NDIS_STATUS_FAILURE;
}

/******************************************************************************
 *
 *  Name: MrvDrvAddCurrentSSID()
 *
 *  Description: Add current SSID to the scan list if it is not on the list
 *
 *  Arguments:  Adapter             Adapter structure
 *              bSetActiveScanSSID  specific scan or not
 *    			
 *  Return Value:        
 * 
 *  Notes:               
 *
 *****************************************************************************/
VOID
MrvDrvAddCurrentSSID(PMRVDRV_ADAPTER Adapter,
                     BOOLEAN         bSetActiveScanSSID)
{
	ULONG i;

    	// try to find the current SSID in the new scan list
    	for (i=0; i<Adapter->ulPSNumOfBSSIDs; i++)
    	{
       	if ((NdisEqualMemory(Adapter->PSBSSIDList[i].Ssid.Ssid, 
              		                  Adapter->CurrentSSID.Ssid, 
                            		    Adapter->CurrentSSID.SsidLength)) &&
		    (NdisEqualMemory(Adapter->CurrentBSSID, 
                            		   &(Adapter->PSBSSIDList[i].MacAddress), 
                            		   MRVDRV_ETH_ADDR_LEN)))
              { 
              	break;
        	}
    	}

    	// if we found matching SSID, update the index
    	if (i < Adapter->ulPSNumOfBSSIDs)
    	{
		// Set the attempted BSSID Index to current
		Adapter->ulCurrentBSSIDIndex = i;

		// Set the new BSSID (AP's MAC address) to current BSSID
		NdisMoveMemory( Adapter->CurrentBSSID,
				             &(Adapter->PSBSSIDList[Adapter->ulCurrentBSSIDIndex].MacAddress), 
				             MRVDRV_ETH_ADDR_LEN);
	
        	// Make a copy of current BSSID descriptor
		NdisMoveMemory( &(Adapter->CurrentBSSIDDesciptor), 
				             &(Adapter->PSBSSIDList[Adapter->ulCurrentBSSIDIndex]),
                        		      sizeof(NDIS_WLAN_BSSID_EX));

        	NdisMoveMemory( &(Adapter->CurrentBSSIDIEBuffer),
                        		      &(Adapter->PSIEBuffer[Adapter->ulCurrentBSSIDIndex]),
                        		      sizeof(MRV_BSSID_IE_LIST));
		
		NdisMoveMemory( &(Adapter->CurrentBssDesciptor), 
				             &(Adapter->PSBssDescList[Adapter->ulCurrentBSSIDIndex]),
                        	 	      sizeof(BSS_DESCRIPTION_SET_ALL_FIELDS));
		
						
		// Set the new configuration to the current config
		NdisMoveMemory( &Adapter->CurrentConfiguration, 
				 	      &(Adapter->PSBSSIDList[Adapter->ulCurrentBSSIDIndex].Configuration),
					      sizeof(NDIS_802_11_CONFIGURATION));
    	}
    	// if the current associated SSID is not contained in the list, append it
    	else 
    	{
       	///if(bSetActiveScanSSID != TRUE)
        	{
            		DBGPRINT(DBG_CMDRESP,("HWAC - Append current SSID to SCAN list\n"));
            
            		if ( i < MRVDRV_MAX_BSSID_LIST )
            		{
                		Adapter->ulCurrentBSSIDIndex = i;
                		Adapter->ulPSNumOfBSSIDs++;
                
                		NdisMoveMemory( &(Adapter->PSBSSIDList[i]), 
                    					      &(Adapter->CurrentBSSIDDesciptor),      
                    					      sizeof(NDIS_WLAN_BSSID_EX));
                
                		NdisMoveMemory( &(Adapter->PSIEBuffer[i]),
                                			      &(Adapter->CurrentBSSIDIEBuffer),
                                			      sizeof(MRV_BSSID_IE_LIST));
				
				NdisMoveMemory( &Adapter->PSBssDescList[i], 
					           	      &(Adapter->CurrentBssDesciptor), 
                               			      sizeof(BSS_DESCRIPTION_SET_ALL_FIELDS));	
            		}
        	}
    	}
}

/******************************************************************************
 *
 *  Name: HandleScanResponse()
 *
 *  Description: Handle scan results
 *
 *  Arguments:	PHostCmd_DS_802_11_SCAN_RSP pRetPtr
 *				PMRVDRV_ADAPTER Adapter
 *    			
 *
 *  Return Value:        
 * 
 *  Notes:               
 *
 *****************************************************************************/
VOID
HandleScanResponse(
	PHostCmd_DS_802_11_SCAN_RSP pScanResponse,
	PMRVDRV_ADAPTER Adapter
    )
{
	ULONG i,j;
	USHORT Flag = 0;
	ULONG TempV = 0,k;
	NDIS_STATUS Status, ndStat;
    	BOOLEAN bISAssociationBlockedByScan;
    	BOOLEAN bSetActiveScanSSID = Adapter->SetActiveScanSSID;

  	if (Adapter->CurCmd->Pad[1] & MRVDRV_ES_ASSOCIATIONBLOCKED)
    		bISAssociationBlockedByScan = TRUE;
    	else
    		bISAssociationBlockedByScan = FALSE;

	if (Adapter->CurCmd->Pad[0] & MRVDRV_ES_NOTSPECIFICSCAN)
       	bSetActiveScanSSID = FALSE;
    	else
       	bSetActiveScanSSID = TRUE;    

	DBGPRINT(DBG_SCAN,("-----------------------   HostCmd_RET_802_11_SCAN ------------------------\n" ));
	DBGPRINT(DBG_SCAN,("Command %x\n",(ULONG)pScanResponse->Command));
	DBGPRINT(DBG_SCAN,("Size %d  SeqNum %d  Result %d \n",
					  (ULONG)pScanResponse -> Size, 
					  (ULONG)pScanResponse -> SeqNum,
					  (ULONG)pScanResponse -> Result
					  ));
	//DBGPRINT(DBG_SCAN ,("BSSID: %02x:%02x:%02x:%02x

⌨️ 快捷键说明

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