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

📄 pnpproc.c

📁 marvell8385 GSPI开发驱动
💻 C
字号:
/******************* ?Marvell Semiconductor, Inc., 2001-2004 *****************
 *
 *  Purpose:    This module provides PnP and Power management routine
 *
 *	$Author: Wuz $
 *
 *	$Date: 2006/07/25 04:23:25 $
 *
 *	$Revision: 1.2 $
 *
 *****************************************************************************/


/*
===============================================================================
                                 INCLUDE FILES
===============================================================================
*/
#include "precomp.h"


/*
===============================================================================
                           CODED PUBLIC PROCEDURES
===============================================================================
*/

/******************************************************************************
 *
 *  Name: MrvDrvPnPEventNotify()
 *
 *  Description: 
 *
 *  Conditions for Use: NDIS wrapper will call MrvDrvPnPEventNotify() to notify PnP event
 *						WINXP specific function
 *  Arguments:
 *
 *    IN NDIS_HANDLE  MiniportAdapterContext,
 *    IN NDIS_DEVICE_PNP_EVENT  PnPEvent,
 *    IN PVOID  InformationBuffer,
 *    IN ULONG  InformationBufferLength
 *    
 *  Return Value: none
 * 
 *  Notes:   
 *
 *****************************************************************************/
VOID
MrvDrvPnPEventNotify(
    IN NDIS_HANDLE  MiniportAdapterContext,
    IN NDIS_DEVICE_PNP_EVENT  PnPEvent,
    IN PVOID  InformationBuffer,
    IN ULONG  InformationBufferLength
)
{
	PMRVDRV_ADAPTER Adapter;
	NDIS_POWER_PROFILE PWProfile;
	BOOLEAN timerStatus;
	
RETAILMSG(1,(L"MrvDrvPnPEventNotify,PnPEvent=0x%x,hd=0x%x\r\n",PnPEvent,MiniportAdapterContext));

     /// add for test 
    return;

	Adapter = (PMRVDRV_ADAPTER)(MiniportAdapterContext);

	switch( PnPEvent )
	{
		case NdisDevicePnPEventSurpriseRemoved:

			DBGPRINT(DBG_PNP,("PNP - Got NdisDevicePnPEventSurpriseRemoved event !!! \n"));
			RETAILMSG(1,(TEXT("PNP - Got NdisDevicePnPEventSurpriseRemoved event !!! \n\r")));
			Adapter->SurpriseRemoved = TRUE;

#ifdef UNDER_CE
			//MessageBox(NULL, TEXT("Got pnp surprise remove"), TEXT("MrvDrvND5"), MB_OK);
#endif // #ifdef UNDER_CE

			// We should disable bus interrupt
			DisableInterrupt(Adapter);

			// Reset Tx and command queue (Will be called again in CondorHalt())
      CleanUpSingleTxBuffer(Adapter);
    	ResetRxPDQ(Adapter);
      ResetCmdBuffer(Adapter);
        
			
      if(Adapter->TxPktTimerIsSet==TRUE){		
	        	NdisMCancelTimer(&Adapter->MrvDrvTxPktTimer, &timerStatus);
		    	Adapter->TxPktTimerIsSet=FALSE;
    		}
	    	Adapter->TxPktTimerIsSet=FALSE;	

     		NdisMCancelTimer(&Adapter->MrvDrvCommandTimer, &timerStatus);

			DBGPRINT(DBG_PNP,("**** PNP - Finished NdisDevicePnPEventSurpriseRemoved ****\n"));

			break;

		case NdisDevicePnPEventPowerProfileChanged:

			PWProfile = *((PNDIS_POWER_PROFILE)InformationBuffer);

#ifndef UNDER_CE
        	// broken under xp 
        	return;
#endif // #ifndef UNDER_CE

			if ( PWProfile == NdisPowerProfileBattery )
			{
            	DBGPRINT(DBG_PNP,("PNP - Power profile has been changed to NdisPowerProfileBattery !!! \n"));
			
            	// only set TX power if OS/App did not set the desired power
            	if ( Adapter->TxPowerLevelIsSetByOS == FALSE )
            	{
                	Adapter->CurrentTxPowerLevel = HostCmd_ACT_TX_POWER_INDEX_MID;
			    
			    	// Set Tx power to battery profile
			    	PrepareAndSendCommand(
							    Adapter,
							    HostCmd_CMD_802_11_RF_TX_POWER,
				  		  		HostCmd_ACT_TX_POWER_OPT_SET_MID,
				    			HostCmd_OPTION_USE_INT,
				    			0,
				    			HostCmd_PENDING_ON_NONE,
				    			0,
				    			FALSE,
				    			NULL,
				    			NULL,
				    			NULL,
				    			NULL);
            	}
			}
			else
			{ 
				// NdisPowerProfileAcOnLine
				DBGPRINT(DBG_PNP,("PNP - Power profile has been changed to NdisPowerProfileAcOnLine !!! \n"));
			
            	// only set TX power if OS/App did not set the desired power
           	 	if ( Adapter->TxPowerLevelIsSetByOS == FALSE )
            	{

				USHORT usValue;

                #ifdef MRV_CHIP_8385PN
							usValue = 17;
                #elif defined(MRV_CHIP_8381PN)
							usValue = 15;
                #elif defined(MRV_CHIP_8381P)
							usValue = 15;
                #elif defined(MRV_CHIP_8305)
							usValue = 19;
                 #elif defined(MRV_CHIP_8399)
							usValue = 17;
                #elif defined(MRV_CHIP_8385H)
							usValue = 17;							
                #elif defined(MRV_CHIP_8686PN) //dralee_1209
							usValue = 17;							
                #else
							usValue = 15;
                #endif 
			    	Adapter->CurrentTxPowerLevel = HostCmd_ACT_TX_POWER_INDEX_HIGH;
			    
			    	// Set Tx power to AC profile
			    	// Set Tx power to battery profile
                    //lykao, 051105, mask for initial stop on SD8385PN, SD8385H, FW: 3.4.0.p6
                    /*
					PrepareAndSendCommand (
				    			Adapter,
				    			HostCmd_CMD_802_11_RF_TX_POWER,
				    			HostCmd_ACT_TX_POWER_OPT_SET_HIGH,
				    			HostCmd_OPTION_USE_INT,
				    			0,
				    			HostCmd_PENDING_ON_NONE,
				    			0,
				    			FALSE,
				    			NULL,
				    			NULL,
				    			NULL,
				    			&usValue);
				   */ 	
				   /*
				   PrepareAndSendCommand (
				    			Adapter,
				    			HostCmd_CMD_802_11_RF_TX_POWER,
				    			HostCmd_ACT_TX_POWER_OPT_SET_HIGH,
				    			HostCmd_OPTION_USE_INT,
				    			0,
				    			HostCmd_PENDING_ON_NONE,
				    			0,
				    			FALSE,
				    			NULL,
				    			NULL,
				    			NULL,
				    			NULL);
				   */ 			
            	}
			}

			break;
	}

	return;
}

⌨️ 快捷键说明

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