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

📄 guicmd.c

📁 Windows CE 6.0 BSP for VOIP sample phone. Intel PXA270 platform.
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
/** @file guicmd.c
 *  @This module has implmentation of station command 
 *   processing functions 
 *
 *  Copyright (c) Marvell Semiconductor, Inc. 
 */

/*
===============================================================================
                                 INCLUDE FILES
===============================================================================
*/

#include "precomp.h"

ULONG beaconFrame[26] =   {
       0x00000a00, 0xc000075C, 0x00010002, 0x00403c34, 0x00000000,
       0x00000000, 0x00050005, 0x0080002c, 0xffff0014, 0xffffffff,
       0xaa55aa54, 0x1122aa55, 0x11221122, 0x00000000, 0xd8142ffd,
       0x000003f6, 0x00000000, 0x00040001, 0x616d0700, 0x6c657672,
       0x3802016c, 0x01010332, 0x02000604, 0x00010001, 0x01000605,
       0x33323100      };
       


/******************************************************************************
 *
 *  Name: ProcessHostCommand()
 *
 *  Description: Pass GUI host command to station
 *
 *  Arguments:	PMRVDRV_ADAPTER Adapter
 *    
 *  Return Value:        
 * 
 *  Notes: Driver will assign a sequence number for GUI command
 *
 *****************************************************************************/
NDIS_STATUS
ProcessHostCommand(
	IN PMRVDRV_ADAPTER Adapter,
	IN PUCHAR pCmdBuf
)
{
	// ULONG OPCode;
	USHORT Cmd, Size;
	PHostCmd_DS_GEN pCmdPtr;
	NDIS_STATUS Status;
	PHostCmd_DS_802_11_GET_STAT p11Stat;
	PHostCmd_DS_802_3_GET_STAT  p3Stat;
	// PHostCmd_DS_802_11_RSSI     pRSSI;

	pCmdPtr = (PHostCmd_DS_GEN)pCmdBuf;
	// Get cmd and size info
	Cmd = pCmdPtr->Command;
	Size = pCmdPtr->Size;

	Status = NDIS_STATUS_SUCCESS;
	// Check if we can process this command
	switch( Cmd ){
	case HostCmd_CMD_802_11_GET_STAT:
		pCmdPtr->Command = GetExpectedRetCode(Cmd);
		p11Stat = (PHostCmd_DS_802_11_GET_STAT)pCmdBuf;
		// ToDo: Update 11 stat
		return Status;
		break;
	case HostCmd_CMD_802_3_GET_STAT:
		pCmdPtr->Command = GetExpectedRetCode(Cmd);
		p3Stat = (PHostCmd_DS_802_3_GET_STAT)pCmdBuf;
		p3Stat->XmitOK		= (ULONG)Adapter->XmitOK;
		p3Stat->RcvOK		= (ULONG)Adapter->RcvOK;
		p3Stat->XmitError	= (ULONG)Adapter->XmitError;
		p3Stat->RcvError	= (ULONG)Adapter->RcvError;
		p3Stat->RcvNoBuffer = (ULONG)Adapter->RcvNoBuffer;
		p3Stat->RcvCRCError = (ULONG)Adapter->RcvCRCError;
		return Status;
		break;
//	case HostCmd_CMD_802_11_RSSI:
//		pCmdPtr->Command = GetExpectedRetCode(Cmd);
//		pRSSI = (PHostCmd_DS_802_11_RSSI)pCmdBuf;
//		pRSSI->RSSI = Adapter->LastRSSI;
//		return Status;
//		break;
	default:
		// First to check if the FW is busy processing any command
		// if( Adapter->CmdState != HostCmd_STATE_IDLE )
		// {
	    //     pCmdPtr->Result = HostCmd_RESULT_BUSY;
		//     Status = NDIS_STATUS_SUCCESS;
		// }
		// else
		// {
		//     Status = PassHostCommand(Adapter, pCmdBuf);
		// }
		Status = NDIS_STATUS_PENDING;
	}
	return Status;
}

/******************************************************************************
 *
 *  Name: PassHostCommand()
 *
 *  Description: Pass GUI host command to station
 *
 *  Arguments:	PMRVDRV_ADAPTER Adapter
 *    
 *  Return Value:
 *      NDIS_STATUS_RESOURCES
 *      NDIS_STATUS_PENDING
 * 
 *  Notes: Driver will assign a sequence number for GUI command
 *
 *****************************************************************************/
NDIS_STATUS
PassHostCommand(
	IN PMRVDRV_ADAPTER Adapter,
	IN USHORT PendingInfo,
	IN PVOID InformationBuffer,
	IN ULONG InformationBufferLength,
	IN PULONG BytesWritten,
	IN PULONG BytesNeeded
)
{
	//ULONG OPCode;
	//ULONG TempULONG;
	USHORT Cmd, Size;
	//USHORT Ret;
	PHostCmd_DS_GEN pCmdPtr;
	CmdCtrlNode *pTempCmd;

	pCmdPtr = (PHostCmd_DS_GEN)InformationBuffer;
	//      Get cmd and size info
	Cmd = pCmdPtr->Command;
	Size = pCmdPtr->Size;

	//      Get next free commnad control node
	pTempCmd = GetFreeCmdCtrlNode(Adapter);
	if( pTempCmd == NULL )
	{	
		DBGPRINT(DBG_ALLEN, ("return NDIS_STATUS_RESOURCES\n"));
		return NDIS_STATUS_RESOURCES;
	}
	pTempCmd->ExpectedRetCode = GetExpectedRetCode(Cmd);
	pTempCmd->Next = NULL;

	//      Assign new sequence number
	Adapter->SeqNum++;
	pCmdPtr->SeqNum = Adapter->SeqNum;

	switch(Cmd)
	{
/*		case HostCmd_CMD_SET_ACTIVE_SCAN_SSID:
		{
			PHostCmd_DS_SET_ACTIVE_SCAN_SSID pActiveScanSSID;
			
			Adapter->SetActiveScanSSID = TRUE;
			pActiveScanSSID = (PHostCmd_DS_SET_ACTIVE_SCAN_SSID)InformationBuffer;
			NdisMoveMemory(&(Adapter->ActiveScanSSID), 
							&(pActiveScanSSID->ActiveScanSSID), 
							sizeof(NDIS_802_11_SSID)); 
			return NDIS_STATUS_SUCCESS;
			
		}
*/		
/*
		case HostCmd_CMD_DUTY_CYCLE_TEST:
		{
			ULONG i;
			PHostCmd_DS_DUTY_CYCLE_TEST pCmdPtrDutyTest;	
			
			pCmdPtrDutyTest=(PHostCmd_DS_DUTY_CYCLE_TEST)InformationBuffer;
			beaconFrame[2]=pCmdPtrDutyTest->RFParam;
			for(i=0;i<26;i++)
			{
				NdisMoveToMappedMemory((PVOID)((ULONG)Adapter->MrvDrvVirtualAddrBAR2+pCmdPtrDutyTest->BeaconOffsetInSQ +i*4),
						&beaconFrame[i], 
						sizeof(ULONG));
			}	
		}				 						
			return NDIS_STATUS_SUCCESS;	
*/
/*		
		case HostCmd_CMD_802_11_RF_CHANNEL:
		{			
			PHostCmd_DS_802_11_RF_CHANNEL pRF;
			
			pRF = (PHostCmd_DS_802_11_RF_CHANNEL)InformationBuffer;
			if ( pRF->Action == HostCmd_ACT_GEN_SET ) {
				Adapter->Channel = pRF->CurentChannel;
				return NDIS_STATUS_SUCCESS;
			}
			break;
		}
*/
		default:
			break;
	}
	
	SetCmdCtrlNode(
		Adapter,
		pTempCmd,
		OID_MRVL_OEM_COMMAND,
		PendingInfo,
		HostCmd_OPTION_USE_INT,
		0,
		FALSE,
		BytesWritten,
		NULL,
		BytesNeeded,
		InformationBuffer);

	// Copy command to command buffer
	NdisMoveMemory((PVOID)pTempCmd->BufVirtualAddr, (PVOID)pCmdPtr, (ULONG)Size);

	// If there is no pending commnad, else, append command to Q
		InsertCmdToQueue (Adapter, pTempCmd); 
	GetCmdFromQueueToExecute(Adapter);


	
	return NDIS_STATUS_PENDING;
}

⌨️ 快捷键说明

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