亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? m8usbdrvdevice.cpp

?? avr mega8單片機與pdiusbd12芯片實現usb通信
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// M8usbdrvDevice.cpp
// Implementation of M8usbdrvDevice device class
//
// Generated by DriverWizard version DriverStudio 2.7.0 (Build 562)
// Requires Compuware's DriverWorks classes
//

#pragma warning(disable:4065) // Allow switch statement with no cases
		  
#include <vdw.h>
#include <kusb.h>
#include "..\M8usbdrvDeviceinterface.h"

#include "M8usbdrv.h"
#include "M8usbdrvDevice.h"
#include "..\m8usbdrvioctl.h"

#pragma hdrstop("M8usbdrv.pch")

extern KTrace t;			// Global driver trace object	

GUID M8usbdrvDevice_Guid = M8usbdrvDevice_CLASS_GUID;

////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::M8usbdrvDevice
//
//	Routine Description:
//		This is the constructor for the Functional Device Object, or FDO.
//		It is derived from KPnpDevice, which builds in automatic
//	    dispatching of subfunctions of IRP_MJ_POWER and IRP_MJ_PNP to
//		virtual member functions.
//
//	Parameters:
//		Pdo - Physical Device Object - this is a pointer to a system
//			device object that represents the physical device.
//
//		Unit - Unit number. This is a number to append to the device's
//			base device name to form the Logical Device Object's name
//
//	Return Value:
//		None   
//
//	Comments:
//		The object being constructed contains a data member (m_Lower) of type
//		KPnpLowerDevice. By initializing it, the driver binds the FDO to the
//		PDO and creates an interface to the upper edge of the system class driver.
//

M8usbdrvDevice::M8usbdrvDevice(PDEVICE_OBJECT Pdo, ULONG Unit) :
	KPnpDevice(Pdo, &M8usbdrvDevice_Guid)
{
	t << "Entering M8usbdrvDevice::M8usbdrvDevice (constructor)\n";


	// Check constructor status
    if ( ! NT_SUCCESS(m_ConstructorStatus) )
	{
	    return;
	}

	// Remember our unit number
	m_Unit = Unit;

	// Initialize the lower device
	m_Lower.Initialize(this, Pdo);

	// Initialize the interface object.  The wizard generates code 
	// to support a single interface.  You may create and add additional 
	// interfaces.  By default, the wizard uses InterfaceNumber 0 (the 
	// first interface descriptor), ConfigurationValue 1 (the first
	// configuration descriptor), and initial interface alternate
	// setting of 0.  If your device has multiple interfaces or alternate
	// settings for an interface, you can add additional KUsbInterface
	// objects or adjust the parameters passed to this function.
	m_Interface.Initialize(
					m_Lower, //KUsbLowerDevice
					0,		 //InterfaceNumber
					1,		 //ConfigurationValue 
					0		 //Initial Interface Alternate Setting
					); 

	// Initialize each Pipe object
	m_Endpoint1OUT.Initialize(m_Lower, 0x1, 16); 
	m_Endpoint1IN.Initialize(m_Lower, 0x81, 16); 
	m_Endpoint2OUT.Initialize(m_Lower, 0x2, 16); 
	m_Endpoint2IN.Initialize(m_Lower, 0x82, 16); 

    // Inform the base class of the lower edge device object
	SetLowerDevice(&m_Lower);

	// Initialize the PnP Policy settings to the "standard" policy
	SetPnpPolicy();

// TODO:	Customize the PnP Policy for this device by setting
//			flags in m_Policies.

	// Initialize the Power Policy settings to the "standard" policy
	SetPowerPolicy();

// TODO:	Customize the Power Policy for this device by setting
//			flags in m_PowerPolicies.

}


////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::~M8usbdrvDevice
//
//	Routine Description:
//		This is the destructor for the Functional Device Object, or FDO.
//
//	Parameters:
//		None
//
//	Return Value:
//		None
//
//	Comments:
//		None
//

M8usbdrvDevice::~M8usbdrvDevice()
{
	t << "Entering M8usbdrvDevice::~M8usbdrvDevice() (destructor)\n";
}

////////////////////////////////////////////////////////////////////////
//  PNPMinorFunctionName
//
//	Routine Description:
//		Return a string describing the Plug and Play minor function	
//
//	Parameters:
//		mn - Minor function code
//
//	Return Value:
//		char * - Ascii name of minor function
//
//	Comments:
//		This function is used for tracing the IRPs.  Remove the function,
//		or conditionalize it for debug-only builds, if you want to save
//		space in the driver image.
//
	
char *PNPMinorFunctionName(ULONG mn)
{
	static char* minors[] = {
		"IRP_MN_START_DEVICE",
		"IRP_MN_QUERY_REMOVE_DEVICE",
		"IRP_MN_REMOVE_DEVICE",
		"IRP_MN_CANCEL_REMOVE_DEVICE",
		"IRP_MN_STOP_DEVICE",
		"IRP_MN_QUERY_STOP_DEVICE",
		"IRP_MN_CANCEL_STOP_DEVICE",
		"IRP_MN_QUERY_DEVICE_RELATIONS",
		"IRP_MN_QUERY_INTERFACE",
		"IRP_MN_QUERY_CAPABILITIES",
		"IRP_MN_QUERY_RESOURCES",
		"IRP_MN_QUERY_RESOURCE_REQUIREMENTS",
		"IRP_MN_QUERY_DEVICE_TEXT",
		"IRP_MN_FILTER_RESOURCE_REQUIREMENTS",
		"<unknown minor function>",
		"IRP_MN_READ_CONFIG",
		"IRP_MN_WRITE_CONFIG",
		"IRP_MN_EJECT",
		"IRP_MN_SET_LOCK",
		"IRP_MN_QUERY_ID",
		"IRP_MN_QUERY_PNP_DEVICE_STATE",
		"IRP_MN_QUERY_BUS_INFORMATION",
		"IRP_MN_DEVICE_USAGE_NOTIFICATION",
		"IRP_MN_SURPRISE_REMOVAL",
		"IRP_MN_QUERY_LEGACY_BUS_INFORMATION"
	};

	if (mn > 0x18) // IRP_MN_QUERY_LEGACY_BUS_INFORMATION
		return "<unknown minor function>";
	else
		return minors[mn];
}

////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::DefaultPnp
//
//	Routine Description:
//		Default handler for IRP_MJ_PNP
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result returned from lower device
//
//	Comments:
//		This routine just passes the IRP through to the lower device. It is 
//		the default handler for IRP_MJ_PNP. IRPs that correspond to
//		any virtual members of KpnpDevice that handle minor functions of
//		IRP_MJ_PNP and that are not overridden get passed to this routine.
//

NTSTATUS M8usbdrvDevice::DefaultPnp(KIrp I) 
{
	t << "Entering M8usbdrvDevice::DefaultPnp with IRP minor function="
	  << PNPMinorFunctionName(I.MinorFunction()) << EOL;

	I.ForceReuseOfCurrentStackLocationInCalldown();
	return m_Lower.PnpCall(this, I);
}


////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::DefaultPower
//
//	Routine Description:
//		Default handler for IRP_MJ_POWER 
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result returned from lower device
//
//	Comments:
//		This routine just passes the IRP through to the lower device. It is 
//		the default handler for IRP_MJ_POWER.
//

NTSTATUS M8usbdrvDevice::DefaultPower(KIrp I) 
{
	t << "Entering M8usbdrvDevice::DefaultPower\n";

	I.IndicatePowerIrpProcessed();
	I.CopyParametersDown();
	return m_Lower.PnpPowerCall(this, I);
}

////////////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::SystemControl
//
//	Routine Description:
//		Default handler for IRP_MJ_SYSTEM_CONTROL
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result returned from lower device
//
//	Comments:
//		This routine just passes the IRP through to the next device since this driver
//		is not a WMI provider.
//

NTSTATUS M8usbdrvDevice::SystemControl(KIrp I) 
{
	t << "Entering M8usbdrvDevice::SystemControl\n";

	I.ForceReuseOfCurrentStackLocationInCalldown();
	return m_Lower.PnpCall(this, I);
}

////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::OnStartDevice
//
//	Routine Description:
//		Handler for IRP_MJ_PNP subfcn IRP_MN_START_DEVICE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:
//		Typically, the driver sends a SET CONFIGURATION request for the
//		USB device by using KUsbLowerDevice::ActivateConfiguration with
//		the ConfigurationValue to activate.  The wizard generates code to 
//		support a single configuration.  You may create and add additional 
//		configurations. 
//

NTSTATUS M8usbdrvDevice::OnStartDevice(KIrp I)
{
	t << "Entering M8usbdrvDevice::OnStartDevice\n";

	NTSTATUS status = STATUS_UNSUCCESSFUL;

	AC_STATUS acStatus = AC_SUCCESS;

	I.Information() = 0;

	// The default Pnp policy has already cleared the IRP with the lower device

	//By default, the wizard passes a ConfigurationValue of 1 to 
	//ActivateConfiguration().  This corresponds to the first configuration 
	//that the device reports in its configuration descriptor.  If the device 
	//supports multiple configurations, pass the appropriate
	//ConfigurationValue of the configuration to activate here.
	acStatus = m_Lower.ActivateConfiguration(
		1	// ConfigurationValue 1 (the first configuration)
		);

	switch (acStatus)
	{
		case AC_SUCCESS:
			t << "USB Configuration OK\n";
			status = STATUS_SUCCESS;
			break;

		case AC_COULD_NOT_LOCATE_INTERFACE:
			t << "Could not locate interface\n";
			break;

		case AC_COULD_NOT_PRECONFIGURE_INTERFACE:
			t << "Could not get configuration descriptor\n";
			break;

		case AC_CONFIGURATION_REQUEST_FAILED:
			t << "Board did not accept configuration URB\n";
			break;

		case AC_FAILED_TO_INITIALIZE_INTERFACE_OBJECT:
			t << "Failed to initialize interface object\n";
			break;

		case AC_FAILED_TO_GET_DESCRIPTOR:
			t << "Failed to get device descriptor\n";
			break;

		case AC_FAILED_TO_OPEN_PIPE_OBJECT:
			//NOTE: this may not be an error.  It could mean that
			//the device has an endpoint for which a KUsbPipe object has
			//not been instanced.  If the intention is to not use this endpoint,
			//then it's likely not a problem.  
			status = STATUS_SUCCESS;
			t << "Failed to open pipe object\n";
			break;

		default:
			t << "Unexpected error activating USB configuration\n";
			break;
	}

   return status;  // base class completes the IRP
}


////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::OnStopDevice
//
//	Routine Description:
//		Handler for IRP_MJ_PNP subfcn IRP_MN_STOP_DEVICE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:
//		The system calls this when the device is stopped.
//		The driver should release any hardware resources
//		in this routine.
//
//		The base class passes the irp to the lower device.
//

NTSTATUS M8usbdrvDevice::OnStopDevice(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	t << "Entering M8usbdrvDevice::OnStopDevice\n";

	m_Lower.DeActivateConfiguration();


// TODO:	Add device-specific code to stop your device   

	return status;
	
	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::OnRemoveDevice
//
//	Routine Description:
//		Handler for IRP_MJ_PNP subfcn IRP_MN_REMOVE_DEVICE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:
//		The system calls this when the device is removed.
//		Our PnP policy will take care of 
//			(1) giving the IRP to the lower device
//			(2) detaching the PDO
//			(3) deleting the device object
//

NTSTATUS M8usbdrvDevice::OnRemoveDevice(KIrp I)
{
	t << "Entering M8usbdrvDevice::OnRemoveDevice\n";

	// Device removed, release the system resources used by the USB lower device.
	m_Lower.ReleaseResources();




// TODO:	Add device-specific code to remove your device   

	return STATUS_SUCCESS;

	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::OnDevicePowerUp
//
//	Routine Description:
//		Handler for IRP_MJ_POWER with minor function IRP_MN_SET_POWER
//		for a request to go to power on state from low power state
//
//	Parameters:
//		I - IRP containing POWER request
//
//	Return Value:
//		NTSTATUS - Status code indicating success or failure
//
//	Comments:
//		This routine implements the OnDevicePowerUp function.
//		This function was called by the framework from the completion
//		routine of the IRP_MJ_POWER dispatch handler in KPnpDevice.
//		The bus driver has completed the IRP and this driver can now
//		access the hardware device.  
//		This routine runs at dispatch level.
//	

NTSTATUS M8usbdrvDevice::OnDevicePowerUp(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	t << "Entering M8usbdrvDevice::OnDevicePowerUp\n";

// TODO:	Service the device.
//			Restore any context to the hardware device that
//			was saved during the handling of a power down request.
//			See the OnDeviceSleep function.
//			Do NOT complete this IRP.
//
	return status;

	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::OnDeviceSleep
//
//	Routine Description:
//		Handler for IRP_MJ_POWER with minor function IRP_MN_SET_POWER
//		for a request to go to a low power state from a high power state
//
//	Parameters:
//		I - IRP containing POWER request
//
//	Return Value:
//		NTSTATUS - Status code indicating success or failure
//
//	Comments:
//		This routine implements the OnDeviceSleep function.
//		This function was called by the framework from the IRP_MJ_POWER 
//		dispatch handler in KPnpDevice prior to forwarding to the PDO.
//		The hardware has yet to be powered down and this driver can now
//		access the hardware device.  
//		This routine runs at passive level.
//	

NTSTATUS M8usbdrvDevice::OnDeviceSleep(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	t << "Entering M8usbdrvDevice::OnDeviceSleep\n";

// TODO:	Service the device.
//			Save any context to the hardware device that will be required 
//			during a power up request. See the OnDevicePowerUp function.
//			Do NOT complete this IRP.  The base class handles forwarding
//			this IRP to the PDO.
//
	return status;

	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  M8usbdrvDevice::Create
//
//	Routine Description:
//		Handler for IRP_MJ_CREATE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲三级在线看| 色拍拍在线精品视频8848| 日韩精品一区二| 黄色小说综合网站| 亚洲国产精品t66y| 91久久免费观看| 日韩精品亚洲专区| 久久久精品天堂| 一本一道久久a久久精品综合蜜臀| 国产精品电影一区二区| 欧美亚洲丝袜传媒另类| 免费成人在线影院| 中文字幕精品一区二区三区精品| 99视频有精品| 午夜天堂影视香蕉久久| 欧美电视剧免费全集观看| 国产99一区视频免费| 亚洲一线二线三线久久久| 日韩一级高清毛片| 99视频国产精品| 日本一道高清亚洲日美韩| 久久久www免费人成精品| 99久久精品免费看| 免播放器亚洲一区| 国产精品久久久久久久午夜片| 日本电影欧美片| 麻豆精品国产传媒mv男同| 国产精品天天看| 在线成人免费观看| 国产.欧美.日韩| 亚洲国产毛片aaaaa无费看| 久久一二三国产| 欧美最猛黑人xxxxx猛交| 韩国精品久久久| 亚洲图片欧美色图| 日本一二三不卡| 日韩美女在线视频| 欧美视频一区在线| 国产91精品精华液一区二区三区| 丝袜美腿一区二区三区| 国产精品的网站| 久久一区二区三区国产精品| 欧美久久一二三四区| 99久久99久久综合| 麻豆精品国产91久久久久久| 亚洲一区二区精品视频| 国产精品毛片高清在线完整版| 欧美顶级少妇做爰| 在线视频中文字幕一区二区| 成人中文字幕在线| 九九国产精品视频| 视频一区视频二区中文字幕| 亚洲影院久久精品| 国产精品初高中害羞小美女文| 久久久无码精品亚洲日韩按摩| 正在播放亚洲一区| 欧美三级三级三级爽爽爽| 91猫先生在线| 色综合天天在线| 99国产精品久久久| 91色综合久久久久婷婷| 成人免费观看视频| 国产宾馆实践打屁股91| 国产高清在线精品| 国产精一区二区三区| 国产一区二区91| 韩国av一区二区三区四区| 麻豆国产91在线播放| 亚洲成人激情社区| 亚洲午夜在线视频| 亚洲地区一二三色| 亚洲资源中文字幕| 一区二区三区免费网站| 亚洲人妖av一区二区| 自拍偷拍欧美精品| 亚洲精品少妇30p| 亚洲国产色一区| 日韩高清在线观看| 老司机一区二区| 久久国产精品第一页| 九九精品视频在线看| 国产精品一区二区果冻传媒| 国产成人啪午夜精品网站男同| 国产精品资源在线看| 成人免费看的视频| 91在线观看下载| 欧美在线你懂得| 欧美放荡的少妇| 久久综合九色综合欧美就去吻| 久久久蜜臀国产一区二区| 国产喷白浆一区二区三区| 中文字幕日韩精品一区| 亚洲精品久久久蜜桃| 爽好多水快深点欧美视频| 蜜乳av一区二区三区| 国产盗摄女厕一区二区三区| 99久久精品国产毛片| 精品视频在线免费看| 欧美α欧美αv大片| 国产欧美一区在线| 中文字幕一区二区不卡 | 亚洲第一电影网| 麻豆成人91精品二区三区| 国产激情一区二区三区四区 | 亚洲欧美日韩一区二区三区在线观看| 国产精品久久久一区麻豆最新章节| 亚洲欧洲中文日韩久久av乱码| 亚洲第四色夜色| 国产精品一二三区在线| 色哟哟一区二区| 日韩精品一区二区三区中文不卡 | 精品国产乱码久久久久久1区2区| 久久精品欧美一区二区三区不卡| 国产精品国产三级国产aⅴ无密码| 一区二区日韩av| 久久不见久久见免费视频1| 成人伦理片在线| 91精品国产日韩91久久久久久| 国产日韩欧美在线一区| 樱桃视频在线观看一区| 久久国产精品无码网站| 色屁屁一区二区| 国产视频亚洲色图| 天堂在线一区二区| av午夜精品一区二区三区| 日韩一级免费一区| 亚洲男同1069视频| 国产麻豆精品theporn| 欧美日韩成人一区二区| 国产精品国产自产拍高清av王其 | 国产一区二区在线观看免费| 99久久久精品| 久久精品日产第一区二区三区高清版 | 99久久99久久综合| 久久尤物电影视频在线观看| 一区二区三区日韩欧美| 国产91在线观看丝袜| 日韩欧美不卡一区| 亚洲成av人片在线观看| 91在线高清观看| 久久影院视频免费| 久久精品国产精品亚洲精品| 欧美在线高清视频| 中文字幕一区二区三| 国产成人自拍网| 日韩欧美亚洲国产另类| 亚洲国产综合视频在线观看| av成人动漫在线观看| 日本一区二区视频在线| 国产寡妇亲子伦一区二区| 精品伦理精品一区| 日韩精品欧美精品| 在线播放欧美女士性生活| 夜夜精品视频一区二区| 91色视频在线| 亚洲欧美日韩一区二区 | 欧美日韩一区二区三区四区五区 | 成年人国产精品| 国产日韩精品一区| 国产老妇另类xxxxx| 久久网站热最新地址| 精品一区二区成人精品| 日韩欧美第一区| 国产在线一区二区| 久久精品亚洲精品国产欧美kt∨ | 精品一区二区三区在线观看 | 国产欧美1区2区3区| 国产精品88888| 国产午夜精品一区二区三区视频 | 波多野结衣在线aⅴ中文字幕不卡| 精品99久久久久久| 国产一区不卡在线| 国产精品色呦呦| 91美女片黄在线观看91美女| 一区二区视频在线看| 欧美色图第一页| 日韩成人免费电影| 精品久久久久久无| 国产精品一二三四区| 国产精品美女久久久久av爽李琼| 99国产精品国产精品久久| 亚洲一区在线观看视频| 8x8x8国产精品| 韩国精品主播一区二区在线观看 | 欧洲人成人精品| 香港成人在线视频| 精品理论电影在线观看| 国产盗摄一区二区| 亚洲精品老司机| 欧美一区二区三区喷汁尤物| 久久精品999| 国产精品美女久久久久久久久| 91视频com| 男女男精品网站| 欧美极品少妇xxxxⅹ高跟鞋 | av日韩在线网站| 亚洲mv在线观看| 国产亚洲一区二区三区在线观看| 成人av动漫网站| 日韩在线一二三区|