亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩精品高清不卡| 欧美一区二区三区精品| 91精品免费观看| 国产精品麻豆一区二区| 精品一区二区三区在线观看 | 亚洲一区二区三区四区在线观看 | 日韩三级在线观看| 亚洲精品美腿丝袜| 成人性生交大片免费| 欧美一区二区成人6969| 亚洲国产视频一区二区| 成人国产精品免费网站| 久久久久国产免费免费| 免费在线观看成人| 91精品婷婷国产综合久久性色| 国产精品亲子伦对白| 国产综合色精品一区二区三区| 这里是久久伊人| 丝袜脚交一区二区| 欧美另类久久久品| 亚洲综合色婷婷| 在线免费一区三区| 亚洲精品久久久蜜桃| 99久久精品国产网站| 中文在线一区二区| 成人app网站| 中文字幕av一区二区三区免费看| 国产福利一区二区三区视频在线 | 国产欧美一区在线| 国产盗摄精品一区二区三区在线 | 亚洲二区在线观看| 欧美日韩国产综合一区二区三区| 亚洲自拍偷拍av| 在线视频一区二区三| 综合av第一页| 欧美亚洲高清一区| 天堂午夜影视日韩欧美一区二区| 欧美日韩国产小视频在线观看| 亚洲综合在线免费观看| 欧美日韩大陆一区二区| 日韩成人免费看| 日韩一区二区三区高清免费看看| 美女视频一区二区三区| 精品粉嫩aⅴ一区二区三区四区| 麻豆免费看一区二区三区| 国产欧美精品一区二区色综合| 丰满白嫩尤物一区二区| 综合色中文字幕| 精品视频全国免费看| 免费在线观看一区二区三区| 久久一区二区三区国产精品| 99热精品国产| 午夜激情久久久| 国产午夜久久久久| 国产精品欧美综合在线| 色一情一乱一乱一91av| 天天av天天翘天天综合网| 精品国产一区二区三区四区四| 高清成人在线观看| 亚洲成人第一页| 欧美精品一区二区在线观看| 99v久久综合狠狠综合久久| 亚洲一区免费观看| 久久久久久**毛片大全| 欧美日韩一区中文字幕| 麻豆91在线观看| 自拍偷拍亚洲欧美日韩| 欧美一区二区三区男人的天堂| 国产91精品入口| 五月婷婷激情综合网| 国产亚洲精品免费| 欧美日免费三级在线| 国产精品1区2区| 视频一区二区三区入口| 中文字幕在线不卡一区二区三区 | 色综合久久久久综合| 日产欧产美韩系列久久99| 国产精品久久久久久久午夜片 | 久久99国产精品麻豆| 一区在线中文字幕| 久久久亚洲精品一区二区三区| 日本黄色一区二区| 国产乱妇无码大片在线观看| 爽好久久久欧美精品| 国产精品日日摸夜夜摸av| 日韩视频在线一区二区| 欧美在线视频全部完| 国产经典欧美精品| 麻豆91在线观看| 亚洲不卡在线观看| 亚洲精品视频自拍| 亚洲国产精品精华液2区45| 日韩欧美色综合网站| 欧美无砖砖区免费| 一本一道久久a久久精品| 国产一本一道久久香蕉| 免费在线看一区| 日韩中文欧美在线| 亚洲小说欧美激情另类| 一区二区三区丝袜| 中文字幕一区二区三区精华液 | 久久久欧美精品sm网站| 欧美一级高清大全免费观看| 欧亚洲嫩模精品一区三区| 91麻豆产精品久久久久久| 国产aⅴ综合色| 国产精品综合二区| 国产麻豆欧美日韩一区| 国产麻豆视频一区二区| 国内精品视频666| 激情综合亚洲精品| 国产专区欧美精品| 国产精品2024| 国产成人精品综合在线观看| 国产精品一区二区91| 国产传媒日韩欧美成人| 国产乱人伦偷精品视频免下载| 黄色日韩三级电影| 国产精品一区二区在线观看网站| 久久成人精品无人区| 精品中文字幕一区二区小辣椒| 美女视频黄免费的久久| 国产做a爰片久久毛片| 国产乱码精品1区2区3区| 成人av第一页| 91福利精品视频| 在线不卡免费欧美| 欧美xxxx在线观看| 国产欧美日产一区| 夜夜精品浪潮av一区二区三区| 午夜久久久影院| 国产一区二区三区日韩| 成人毛片在线观看| 欧美少妇一区二区| 欧美大白屁股肥臀xxxxxx| 国产喂奶挤奶一区二区三区| 亚洲人成人一区二区在线观看 | 日韩三级在线观看| 中文一区二区完整视频在线观看| 亚洲欧洲日本在线| 午夜精品一区二区三区电影天堂 | 日韩美女视频在线| 中文字幕一区免费在线观看| 亚洲亚洲人成综合网络| 国产在线精品免费av| 99久久免费精品高清特色大片| 欧美剧情片在线观看| 欧美精品一区二区高清在线观看| 国产精品久线在线观看| 日韩精品一区第一页| 国产精品一二三四区| 欧美婷婷六月丁香综合色| 2欧美一区二区三区在线观看视频| 亚洲欧洲99久久| 麻豆91免费观看| 91丨国产丨九色丨pron| 欧美电影免费提供在线观看| 亚洲色图20p| 久久精品国产一区二区三| 91在线精品秘密一区二区| 日韩欧美精品在线视频| 一卡二卡欧美日韩| 成人网在线播放| 日韩精品一区二区三区在线播放 | 中文成人综合网| 日本免费新一区视频| 91亚洲精品久久久蜜桃网站| 欧美xxx久久| 午夜视频在线观看一区二区| 白白色亚洲国产精品| 欧美成人精品二区三区99精品| 一区二区高清免费观看影视大全| 成人自拍视频在线观看| 日韩欧美一二三四区| 亚洲国产成人tv| 在线免费观看日本一区| 18欧美亚洲精品| 成人性生交大片| 国产亚洲制服色| 久草精品在线观看| 91麻豆精品国产91| 午夜精品一区二区三区免费视频 | 国产综合色在线| 欧美tk—视频vk| 人人爽香蕉精品| 欧美精品18+| 亚洲成人av一区| 91麻豆精品国产91久久久资源速度 | 欧美zozo另类异族| 免费国产亚洲视频| 欧美欧美午夜aⅴ在线观看| 亚洲影院免费观看| 色噜噜狠狠成人中文综合| 国产精品毛片久久久久久久| 福利视频网站一区二区三区| 欧美国产乱子伦| www.亚洲精品| 一区二区三区国产精品| 欧美在线一二三| 丝袜亚洲另类欧美|