Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Re: How to pending a IO Request in WDF driver on Windows 7

Tim_RobertsTim_Roberts Member - All Emails Posts: 12,914
xxxxx@sina.com wrote:
>
> Now I have a new question, how can I recognise which request should be
> finished?
>
> In my application , I need run multiple I/O requests on a single file
> handle. In overlapped I/O, all the things will be done in asynchronous.
> so it's likely to happen that the latter request is finished before
> the former.

Well, that depends. If you only have one DMA engine, then it will act
as a "serializer". You can't start the next DMA operation until the
first one completes, so when you get a completion, you are assured that
it belongs to the top item in the "waiting for DMA" queue. You can then
pop the next item off, and set up its transfer.

Remember that I/O queues are lightweight. If it helps your design to
have one queue for "in process DMA" and a separate queue for "waiting to
setup DMA", then do that.


> At the begining, I intend to use WdfRequestForwardToIoQueue to save
> the request I want to pending, and then
> use WdfIoQueueRetrieveNextRequest to get the requset and complete it.
> However, when I have done these actually, I find there hasn't enough
> information to recognise the very request I wanted.
> For example, when I receive a device interrupt for DMA complete, I
> should release the corresponding transaction and request.
>
> Should I establish a user-defined data structure to save all the
> information I need? Or there's a better way to slove it via WDF
> framework supplied routines?

KMDF makes it very easy to attach a context structure to any KMDF
object, so you can carry a bunch of information with your WDFREQUEST, if
that makes things easier. I have one driver where my WDFREQUEST context
structure includes the WDFDMATRANSACTION and the WDFMEMORY for the DMA
descriptors, among other data. So, in my DMA complete interrupt, I pop
the top item off of the "in process DMA" queue, and now I have the
transaction I need to complete.

--
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Writing WDF Drivers 25 Feb 2019 OSR Seminar Space
Developing Minifilters 8 April 2019 OSR Seminar Space