brucezh
驱动老牛
驱动老牛
  • 注册日期2002-01-30
  • 最后登录2007-02-01
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望1点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:920回复:8

大虾来看,关于Irp的异步操作,用于DMA

楼主#
更多 发布于:2002-11-14 15:47
http://www.driverdevelop.com/forum/html_25734.html?1037259907

最新喜欢:

jinghuirenjinghu...
打一枪……换个地方……再打一枪……
ydyuse
驱动老牛
驱动老牛
  • 注册日期2002-07-25
  • 最后登录2005-03-26
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2002-11-14 16:24
还未搞定??
生命驱动,活力无限!
edriver
驱动小牛
驱动小牛
  • 注册日期2002-03-04
  • 最后登录2006-09-15
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望3点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-11-15 08:54
其实你只要加个cleanup()例程就搞定了!凡是有cancelirp例程的,一般情况下必须有这个清除例程!
brucezh
驱动老牛
驱动老牛
  • 注册日期2002-01-30
  • 最后登录2007-02-01
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望1点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2002-11-15 10:42
其实你只要加个cleanup()例程就搞定了!凡是有cancelirp例程的,一般情况下必须有这个清除例程!

DS生成的驱动框架中设备类中有CleanUp()例程,但我看了帮助,其中说一般要得到与Irp相连的文件对象然后调用队列对象的CleanUp函数。
帮助中只提到了使用队列实现asynchronitonizeIO的方法。我使用它的KDriverManageQueueEx类,结果就出现关机异常。
现在尝试自己返回STATUS_PENDING,进行后续处理就出现页错误。
打一枪……换个地方……再打一枪……
edriver
驱动小牛
驱动小牛
  • 注册日期2002-03-04
  • 最后登录2006-09-15
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望3点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-11-15 11:27
那你有没有在cleanup()里面加代码呢?
看看cancelirp():
This is the cancel routine, called when a READ IRP needs to be
//    cancelled.  The I/O manager calls this entry point at IRQL DISPATCH_LEVEL
//    with cancel spin lock held.
//
//    When we return from here one of two things will have occurred:
//
//    1.We found the IRP to cancel on our read queue. In this case, we simply
//      remove the IRP from the READ queue, complete it with STATUS_CANCELLED
//      and return from this routine.
//
//    2.We did not find the IRP to cancel on our read queue.  In this case,
//      we just return.  This could only happen when the request is in
//      progress, or is in the process of being moved from the queue to
//      being to being in progress.
//
//  Note that we take our own advice in this function, and don\'t worry about
//  cancelling requests that are in-progress on the device.  It\'s not that it\'s
//  not possible to cancel such requests, but rather that in-progress requests
//  will complete quickly, so there\'s no reason to add the extra complexity
//  of trying to cancel these requests on the hardware.

再看看ddk:
If the driver\'s device objects were set up as exclusive, thereby allowing only a single thread to use the device at any given time, the driver completes every IRP currently queued to the target device object with STATUS_CANCELLED set in each IRP\'s I/O status block. Otherwise, the driver must cancel and complete any currently queued IRPs for the holder of the file object handle that is being released. After cancelling outstanding IRPs in the queue, the driver completes the cleanup IRP with STATUS_SUCCESS set in its I/O status block.

edriver
驱动小牛
驱动小牛
  • 注册日期2002-03-04
  • 最后登录2006-09-15
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望3点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2002-11-15 11:35
你一定要好好理解在cancel里面发生的两种情况:两种情况的分界点是:IoSetCancelRoutine(Irp, NULL);执行前后!另外,用driver自身维护队列比较麻烦,你完全可以利用I/O管理器来维护!很是方便!
brucezh
驱动老牛
驱动老牛
  • 注册日期2002-01-30
  • 最后登录2007-02-01
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望1点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2002-11-15 11:38
看来大家都不对正在被硬件处理的Irp进行删除,那就更不该出现问题了,因为我的队列里只有一个Irp。
这段文章从哪找到的?能不能给发个拷贝?谢谢
打一枪……换个地方……再打一枪……
edriver
驱动小牛
驱动小牛
  • 注册日期2002-03-04
  • 最后登录2006-09-15
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望3点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2002-11-15 11:55
给个email地址。
brucezh
驱动老牛
驱动老牛
  • 注册日期2002-01-30
  • 最后登录2007-02-01
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望1点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2002-11-15 12:10
brucezh@vip.sina.com
打一枪……换个地方……再打一枪……
游客

返回顶部