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

📄 power.c

📁 marvell8385 GSPI开发驱动
💻 C
字号:
/******************* ?Marvell Semiconductor, Inc., 2003 ********************
 *
 *  Purpose:
 *
 *      This module provides the implementation of power management routines
 *
 *	$Author: xiaojie $
 *
 *	$Date: 2006/07/18 11:11:40 $
 *
 *	$Revision: 1.1 $
 *
 *****************************************************************************/

#include "precomp.h"
#include "If.h"

VOID
PSWakeup(
	IN PMRVDRV_ADAPTER Adapter
	)
{
	CmdCtrlNode *NewCmd  = NULL;
	
	DBGPRINT(DBG_NEWPS,("PSWakeup: exit powersave mode!\n"));

    // Add a PS Exit command in Q1
	NewCmd = GetFreeCmdCtrlNode(Adapter);
	if (NewCmd)
		MakePsCmd (Adapter, NewCmd, HostCmd_SubCmd_Exit_PS);
              
    //dralee_1108++
    EnterCriticalSection(&Adapter->CmdQueueExeSection);

	InsertCmdToQueue(Adapter, NewCmd);

    //dralee_1108++ 
    LeaveCriticalSection(&Adapter->CmdQueueExeSection); 


	GetCmdFromQueueToExecute(Adapter);

	return;
}


VOID
PSSleep(
	IN PMRVDRV_ADAPTER Adapter
	)
{
	CmdCtrlNode *NewCmd  = NULL;
	
	DBGPRINT(DBG_CMDRESP | DBG_POWERSAVE | DBG_CRLF ,("PSSleep: enter powersave mode!\n"));

    // Add a PS Exit command in Q1
	NewCmd = GetFreeCmdCtrlNode(Adapter);
	if (NewCmd)
		MakePsCmd (Adapter, NewCmd, HostCmd_SubCmd_Enter_PS);
                                       

    //dralee_1108++
    EnterCriticalSection(&Adapter->CmdQueueExeSection);

	InsertCmdToQueue(Adapter, NewCmd);    

    //dralee_1108++ 
    LeaveCriticalSection(&Adapter->CmdQueueExeSection); 


	GetCmdFromQueueToExecute (Adapter);	

	return;
}


// should change this to inline later
// acknowledge the sleep from the FW
VOID
PSConfirmSleep(
	IN PMRVDRV_ADAPTER Adapter
	)
{
	CmdCtrlNode *NewCmd  = NULL;  

                              
	
	DBGPRINT(DBG_CMDRESP | DBG_POWERSAVE | DBG_CRLF ,("PSConfirmSleep: confirm sleep\n"));
    
    // Add a PS Exit command in Q1
	NewCmd = GetFreeCmdCtrlNode(Adapter);
	if (NewCmd)
		MakePsCmd (Adapter, NewCmd, HostCmd_SubCmd_Sleep_Confirmed);
                               
    //dralee_1108++
    EnterCriticalSection(&Adapter->CmdQueueExeSection);

	InsertCmdToQueue(Adapter, NewCmd);

    //dralee_1108++ 
    LeaveCriticalSection(&Adapter->CmdQueueExeSection); 


	GetCmdFromQueueToExecute (Adapter);	
	return;
}

VOID
MakePsCmd(IN PMRVDRV_ADAPTER Adapter,
	      IN CmdCtrlNode *pTempCmd,
	      IN USHORT SubCmd)
{			   
	PHostCmd_DS_802_11_PS_MODE pCmdPtr;

	if (!pTempCmd)
		return;
	
	pCmdPtr = (PHostCmd_DS_802_11_PS_MODE)(pTempCmd->BufVirtualAddr);
	
	pCmdPtr->Command = HostCmd_CMD_802_11_PS_MODE;
	pCmdPtr->Size    = (USHORT)(sizeof(HostCmd_DS_802_11_PS_MODE));
	Adapter->SeqNum += 1;
	pCmdPtr->SeqNum  = Adapter->SeqNum;
	pCmdPtr->Result  = HostCmd_OPTION_USE_INT;
	//pCmdPtr->Action  = 0;  //dralee
	pCmdPtr->SubCommand = SubCmd;
	
	pCmdPtr->PowerMode  = 0;
	pCmdPtr->PSNumDtims=0x1;	

	///crlo:test ++
	if (SubCmd == HostCmd_SubCmd_Enter_PS) {
//		pCmdPtr->PSNumDtims=0x1;
		pCmdPtr->PSNumDtims= Adapter->DTIMNum;
	} else {
		pCmdPtr->PSNumDtims=0;
	}
#ifdef WLAN_PMU_DEBUG
       RETAILMSG(1,(L"Ps command:" L"the makePScmd->PSNumDtimes=%d", pCmdPtr->PSNumDtims)); 
#endif
	///crlo:test --
#if 0
#ifdef HOST_SLEEP_SYNC_PS
  if( Adapter->bHostWakeCfgSet && Adapter->bHostSleepSyncPs)
      pCmdPtr->hwmMode = 1; 
  else
      pCmdPtr->hwmMode = 0; 
#endif 
#else
   pCmdPtr->hwmMode = 0;    
#endif

	pTempCmd->ExpectedRetCode	= GetExpectedRetCode(HostCmd_CMD_802_11_PS_MODE);
	pTempCmd->Next				= NULL;
	pTempCmd->PendingOID		= 0;
	pTempCmd->PendingInfo		= HostCmd_PENDING_ON_NONE;
	pTempCmd->INTOption			= HostCmd_OPTION_USE_INT;
	pTempCmd->BatchQNum			= 0;
	pTempCmd->IsLastBatchCmd	= FALSE;
	pTempCmd->BytesWritten		= NULL;
	pTempCmd->BytesRead			= NULL;
	pTempCmd->BytesNeeded		= NULL;
	pTempCmd->InformationBuffer = NULL;

	return;
}



⌨️ 快捷键说明

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