我想做一个XP下的sdio驱动。但是当IRP_MN_START_DEVICE把IRP包发送到sdbus层时,
返回错误,提示STATUS_DEVICE_BUSY(code:80000011)。
请问IRP_MN_START_DEVICE主要完成什么功能?
出现这个错误是不是因为之前有IRP包没发送出去,阻塞了的缘故,还是硬件有问题?
我刚接触XP驱动编程,希望能得到帮助,谢谢!
你好,我也遇到了这个问题。
我们能研究一下吗?
我的邮箱limiji@163.com
如果你卸载驱动然后重新按装就有可能通过。
估计PNP没有解决好。
另外程序结构可能也要调整。
IRP_MN_START_DEVICE
All PnP drivers must handle this IRP.
Major Code
IRP_MJ_PNP
When Sent
The PnP Manager sends this IRP after it has assigned hardware resources, if any, to the device. The device may have been recently enumerated and is being started for the first time, or the device may be restarting after being stopped for resource rebalancing.
Sometimes the PnP Manager sends an IRP_MN_START_DEVICE to a device that is already started, supplying a different set of resources than the device is currently using. A driver initiates this action by calling IoInvalidateDeviceState and responding to the subsequent IRP_MN_QUERY_PNP_DEVICE_STATE request with the PNP_RESOURCE_REQUIREMENTS_CHANGED flag set. A bus driver might use this mechanism, for example, to open a new aperture on a PCI-to-PCI bridge.
The PnP Manager sends this IRP at IRQL PASSIVE_LEVEL in the context of a system thread.
Input
The Parameters.StartDevice.AllocatedResources member of the IO_STACK_LOCATION structure points to a CM_RESOURCE_LIST describing the hardware resources that the PnP Manager assigned to the device. This list contains the resources in raw form. Use the raw resources to program the device.
Parameters.StartDevice.AllocatedResourcesTranslated points to a CM_RESOURCE_LIST describing the hardware resources that the PnP Manager assigned to the device. This list contains the resources in translated form. Use the translated resources to connect the interrupt vector, map I/O space, and map memory.
Output
None
I/O Status Block
A driver sets Irp->IoStatus.Status to STATUS_SUCCESS or to an appropriate error status such as STATUS_UNSUCCESSFUL or STATUS_INSUFFICIENT_RESOURCES.
If a driver requires some time to execute its start operations for a device, it can mark the IRP pending and return STATUS_PENDING.
Operation
This IRP must be handled first by the parent bus driver for a device and then by each higher driver in the device stack.
In response to this IRP, drivers start a device for the first time or restart a device that was stopped. The exact operations required to start a device vary from device to device, but can include powering on the device, performing device-specific initialization, and connecting the interrupt.
A driver can typically handle this IRP in the same way whether it is starting a device for the first time or restarting a device after an IRP_MN_STOP_DEVICE, except if a driver needs to restore device state on a restart after a stop.
For more information about handling a start IRP, see Starting a Device.
Sending This IRP
Reserved for system use. Drivers must not send this IRP.
See Also
IRP_MN_STOP_DEVICE
Built on Friday, April 11, 2003
我告诉你吧,答案会很让你失望。只是微软的sd host controller驱动的一个bug。
你升级至windows xp sp3,就会好了
不好意思,很久没有登录了,把这事给忘了,谢谢各位的回复。
我最后找到的原因是:当卡插入时,系统会发一组初始化命令;
而调用IRP_MN_START_DEVICE时又会发一组初始化命令,
但是我的设备不支持这种重发方式,需要reset,IRP_MN_START_DEVICE才能成功。
不知道windows xp sp3,是不是也是这种机制。
“我告诉你吧,答案会很让你失望。只是微软的sd host controller驱动的一个bug。
你升级至windows xp sp3,就会好了。”
谢谢你,帆子。完全正确。