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

📄 pnp.c

📁 一个amccs5933芯片的驱动程序开发源程序和部分文档
💻 C
字号:
// PnP.c

// Need an AddDevice routine.  It creates the device (currently in DriverEntry)
// and adds it to the device stack via IoAttachDeviceToDeviceStack.  Creates
// a Function Device Object (FDO) and attaches it to the device stack.
// The device stack constitutes the devnode for the device.  The stack will
// always contain a Physical Device Object (provided by the OS) an the FDO.

// A PnP driver must have an 
//  INF file that installs the driver files, 
//  a CAT file that contains the digital signature for the driver package,
//  a DriverEntry routine that initializes the driver
//  a AddDevice routine that initializes the device
//  a DispatchPnp routine that handles PnP IRPs
//  a DispatchPower routine that handles power management IRPs
//  a Unload routine that reverses DriverEntry

// Add to DriverEntry:
//  DriverObject->DriverExtension->AddDevice = XxxAddDevice;
//  DriverObject->MajorFunction[IRP_MJ_PNP] = XxxDispatchPnp;
//  DriverObject->MajorFunction[IRP_MJ_POWER] = XxxDispatchPower;

//  called only once to initialize the driver

// AddDevice:
//	NTSTATUS XxxAddDevice(
//     IN PDRIVER_OBJECT  DriverObject,
//     IN PDEVICE_OBJECT  PhysicalDeviceObject
//	)

//  gets called after DriverEntry
//  called for each board (device) so most DriverEntry stuff will move to here:
//
//  IoCreateDevice
//  RegisterDeviceInterface (symbolic link to an application)
//  Hardware resources, such as I/O ports, are configured later, in response to 
//   an IRP_MN_START_DEVICE request (look at Win98 PnPStart in PlugNPlay.c)
//  IoAttachDeviceToDeviceStack

//  PnP IRPs are handled in XxxDispatchPnp; required IRPs:
//    START_DEVICE - should include a call PoSetPowerState
//    IRPs you don't handle are simply passed on the next lower driver object
//   

// PowerManagement
//	QUERY_POWER and SET_POWER IRPs are required to be handled - just handle
//  all IRPs by passing them on to the next lower driver object (PoStartNextPowerIrp,
//  IoSkip... and PoCallDriver).

// INF
//  Models entry registers the HW ID (device, vendor IDs)
//   DeviceDesc1 = InstallSection1, INF_HWID_1, INF_CID_1
//   %Sample1%  = Sample1.DDInstall, PCI\VEN_12BE&DEV_3042&SUBSYS_304212BE

//  DriverVer entry (if digitally signed)

//  Service-Install-Section
//   StartType SERVICE_DEMAND_START (0x3)

// DestinationDirs
//  DefaultDestDir
     

⌨️ 快捷键说明

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