即插即用和电源管理例程设置的配置结构:
TheWDF_PNPPOWER_EVENT_CALLBACKS structure contains pointers to a driver's Plug and Play and power event callback functions.
typedef struct _WDF_PNPPOWER_EVENT_CALLBACKS {
ULONG ;
PFN_WDF_DEVICE_D0_ENTRY ;//进入正常工作电源D0状态的调用例程
PFN_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED ;//进入正常工作电源D0状态后,使能中断的例程
PFN_WDF_DEVICE_D0_EXIT ;//退出推出工作电源D0状态的调用例程
PFN_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED
;//退出工作电源D0状态之前,禁止中断的例程
PFN_WDF_DEVICE_PREPARE_HARDWARE ;//获取资源配置例程
PFN_WDF_DEVICE_RELEASE_HARDWARE ;//删除资源配置例程
PFN_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP ;//设备删除时调用,做一些清除工作
PFN_WDF_DEVICE_SELF_MANAGED_IO_FLUSH ;//设备删除时调用例程,做一些释放工作
PFN_WDF_DEVICE_SELF_MANAGED_IO_INIT ;//设备初次启动时调用例程,启动操作
PFN_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND ;//设备进入省点状态或删除时调用,停止操作
PFN_WDF_DEVICE_SELF_MANAGED_IO_RESTART ;//设备再次启动时调用例程,启动操作
PFN_WDF_DEVICE_SURPRISE_REMOVAL ;//设备意外拔出调用例程
PFN_WDF_DEVICE_QUERY_REMOVE ;//询问设备是否可以删除的调用例程
PFN_WDF_DEVICE_QUERY_STOP ;//询问设备是否可以停止的调用例程
PFN_WDF_DEVICE_USAGE_NOTIFICATION ;
PFN_WDF_DEVICE_RELATIONS_QUERY ;
} WDF_PNPPOWER_EVENT_CALLBACKS, *PWDF_PNPPOWER_EVENT_CALLBACKS;
使用 WDF_PNPPOWER_EVENT_CALLBACKS_INIT 进行例程初始化配置。The WDF_PNPPOWER_EVENT_CALLBACKS_INIT function initializes a driver's structure.
VOID
WDF_PNPPOWER_EVENT_CALLBACKS_INIT(
OUT PWDF_PNPPOWER_EVENT_CALLBACKS
);
使用 WdfDeviceInitSetPnpPowerEventCallbacks 进行设置。
(1)FDO 即插即用例程The WDF_FDO_EVENT_CALLBACKS structure contains pointers to a function driver's PnP event callback functions.
typedef struct _WDF_FDO_EVENT_CALLBACKS {
ULONG ;
PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS ;
PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS ;
PFN_WDF_DEVICE_REMOVE_ADDED_RESOURCES ;
} WDF_FDO_EVENT_CALLBACKS, *PWDF_FDO_EVENT_CALLBACKS;
The WDF_FDO_EVENT_CALLBACKS_INIT function initializes a structure.
VOID
WDF_FDO_EVENT_CALLBACKS_INIT(
OUT PWDF_FDO_EVENT_CALLBACKS
)
The WdfFdoInitSetEventCallbacks method registers a framework-based function driver's event callback functions, for a specified device.
VOID
WdfFdoInitSetEventCallbacks(
IN PWDFDEVICE_INIT ,
IN PWDF_FDO_EVENT_CALLBACKS
);
(2)PDO 即插即用例程The WDF_PDO_EVENT_CALLBACKS structure is the dispatch table for a bus driver's event callback functions.
typedef struct _WDF_PDO_EVENT_CALLBACKS {
ULONG ;
PFN_WDF_DEVICE_RESOURCES_QUERY ;
PFN_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY ;
PFN_WDF_DEVICE_EJECT ;
PFN_WDF_DEVICE_SET_LOCK ;
PFN_WDF_DEVICE_ENABLE_WAKE_AT_BUS ;
PFN_WDF_DEVICE_DISABLE_WAKE_AT_BUS ;
} WDF_PDO_EVENT_CALLBACKS, *PWDF_PDO_EVENT_CALLBACKS;
The WDF_PDO_EVENT_CALLBACKS_INIT function initializes a structure.
VOID FORCEINLINE
WDF_PDO_EVENT_CALLBACKS_INIT(
OUT PWDF_PDO_EVENT_CALLBACKS
);
The WdfPdoInitSetEventCallbacks method registers a bus driver's event callback functions.
VOID
WdfPdoInitSetEventCallbacks(
IN PWDFDEVICE_INIT ,
IN PWDF_PDO_EVENT_CALLBACKS
);