WdfDmaTransactionInitializeUsingRequest

Hi All,

Upon IOCTL request I’m calling to:

WdfDmaTransactionInitializeUsingRequest (devExt->ReadDmaTransation,
Request,

WdfDmaTransactionInitializeUsingRequest sets a scatter gather list to my FPGA.

Hi All,

Upon IOCTL request I’m calling to:

WdfDmaTransactionInitializeUsingRequest (devExt->ReadDmaTransation,
Request,
PLxEvtProgramReadDma,
WdfDmaDirectionReadFromDevice)

In PLxEvtProgramReadDma I write the scatter-gather list to the FPGA.

But in my case, I do not want to run the DMA. Only set it to hardware.

This setup will not change till application shutdown.

Later, upon another IOCTL request, a write to the hardware should start the DMA.

Upon application shutdown the DMA should stop.

In my case, Should I call to WdfDmaTransactionExecute ?
What does WdfDmaTransactionExecute do (e.g in PLx9x5x demo) ?

Shoudl I call to WdfDmaTransactionRelease ?

Thanks,
Zvika.

You misunderstand what WDF stuff does. It never communicates with hardware directly. WDF only helps a driver to prepare a DMA transaction, for example allocating Scatter Gather List. It is up to a driver initiate DMA transaction or avoid it. What do you mean “But in my case, I do not want to run the DMA. Only set it to hardware.” ?

Igor Sharovar

You need to leave the transaction active until you’re ready to undo the “set it to hardware”. Once you stop the DMA the device is doing you can complete the DMA transaction and release it. Then complete the request.

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, November 10, 2011 3:21 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfDmaTransactionInitializeUsingRequest

Hi All,

Upon IOCTL request I’m calling to:

WdfDmaTransactionInitializeUsingRequest (devExt->ReadDmaTransation,
Request,
PLxEvtProgramReadDma,
WdfDmaDirectionReadFromDevice)

In PLxEvtProgramReadDma I write the scatter-gather list to the FPGA.

But in my case, I do not want to run the DMA. Only set it to hardware.

This setup will not change till application shutdown.

Later, upon another IOCTL request, a write to the hardware should start the DMA.

Upon application shutdown the DMA should stop.

In my case, Should I call to WdfDmaTransactionExecute ?
What does WdfDmaTransactionExecute do (e.g in PLx9x5x demo) ?

Shoudl I call to WdfDmaTransactionRelease ?

Thanks,
Zvika.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The FPGA works in the following way:

The driver writes the scatter-gather list to hardware only once upon IOCTL
request the contains METHOD_OUT_DIRECT
Upon this request, driver calls to WdfDmaTransactionInitializeUsingRequest
and to WdfDmaTransactionExecute.

Then upon another IOCTL driver writes a ‘go’ command to the FPGA to start
writing to RAM.

Whenever FPGA receive data from external source it writes the data to RAM
using DMA to a pre-allocated buffer.

When FPGA reaches to the end of the buffer it starts writing from start.

DMA from FPGA to RAM is always active (from ‘go’) and not only upon
‘ReadFile’ from user space.

Thanks,
Zvika

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, November 10, 2011 19:38
Subject: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest

> You misunderstand what WDF stuff does. It never communicates with hardware
> directly. WDF only helps a driver to prepare a DMA transaction, for
> example allocating Scatter Gather List. It is up to a driver initiate DMA
> transaction or avoid it. What do you mean “But in my case, I do not want
> to run the DMA. Only set it to hardware.” ?
>
> Igor Sharovar
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

You should do what Peter suggest. Leave a transaction open and finish it when the driver gets the second “go” IOCTL. You need also synchronize work between the first IOCTL, which open a transaction, and the second which initiate ‘go’. I would use an event. When PLxEvtProgramReadDma is called it waits on an event which set up by the second IOCTL.

Igor Sharovar

That’s not a problem. You would want to open an overlapped handle to your device from user-mode so that you can have more than one IOCTL outstanding at a time. Issue the first IOCTL and when DeviceIoControl returns ERROR_IO_PENDING you can go ahead and send the second IOCTL.

In your driver you probably want a sequential queue so that you’re not dealing with a race between these IOCTLs. Setup the DMA from the first IOCTL then forward it to a second queue for holding. This releases the first queue which can then dispatch your next request (the “go” request).

If the app crashes or close its handle, the first IOCTL will be cancelled. You can stop any running transfer, tear down the DMA structures, flush the DMA transaction and you’re good to go.

You should be aware though, that since you’re using app memory and not common buffer for your shared memory section that there’s a chance that a page not accessible to the device might get copied by the HAL into a bounce buffer. The bounce buffer’s contents won’t be copied back to the client buffer until you complete the DMA transaction. If you really want to have live access to the data from your FPGA then this may not work for you.

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
Sent: Thursday, November 10, 2011 11:41 AM
To: Windows System Software Devs Interest List
Subject: Re: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest

The FPGA works in the following way:

The driver writes the scatter-gather list to hardware only once upon IOCTL request the contains METHOD_OUT_DIRECT Upon this request, driver calls to WdfDmaTransactionInitializeUsingRequest
and to WdfDmaTransactionExecute.

Then upon another IOCTL driver writes a ‘go’ command to the FPGA to start writing to RAM.

Whenever FPGA receive data from external source it writes the data to RAM using DMA to a pre-allocated buffer.

When FPGA reaches to the end of the buffer it starts writing from start.

DMA from FPGA to RAM is always active (from ‘go’) and not only upon ‘ReadFile’ from user space.

Thanks,
Zvika

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, November 10, 2011 19:38
Subject: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest

> You misunderstand what WDF stuff does. It never communicates with hardware
> directly. WDF only helps a driver to prepare a DMA transaction, for
> example allocating Scatter Gather List. It is up to a driver initiate DMA
> transaction or avoid it. What do you mean “But in my case, I do not want
> to run the DMA. Only set it to hardware.” ?
>
> Igor Sharovar
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hello,

After calling to WdfDmaTransactionExecute, I do not call to
WdfRequestCompleteWithInformation in the IOCTL handler.

Instead, PLxEvtProgramReadDma (3rd parameter to
WdfDmaTransactionInitializeUsingRequest)
call it upon completion of setting the scatter-gather list to hardware.

So I think user space receive reply to DeviceIoControl upon completion and I
do not need a event mechanism.

Am I right ?

Thanks,
Zvika.

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Thursday, November 10, 2011 23:41
Subject: RE: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest

That’s not a problem. You would want to open an overlapped handle to your
device from user-mode so that you can have more than one IOCTL outstanding
at a time. Issue the first IOCTL and when DeviceIoControl returns
ERROR_IO_PENDING you can go ahead and send the second IOCTL.

In your driver you probably want a sequential queue so that you’re not
dealing with a race between these IOCTLs. Setup the DMA from the first
IOCTL then forward it to a second queue for holding. This releases the
first queue which can then dispatch your next request (the “go” request).

If the app crashes or close its handle, the first IOCTL will be cancelled.
You can stop any running transfer, tear down the DMA structures, flush the
DMA transaction and you’re good to go.

You should be aware though, that since you’re using app memory and not
common buffer for your shared memory section that there’s a chance that a
page not accessible to the device might get copied by the HAL into a bounce
buffer. The bounce buffer’s contents won’t be copied back to the client
buffer until you complete the DMA transaction. If you really want to have
live access to the data from your FPGA then this may not work for you.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
Sent: Thursday, November 10, 2011 11:41 AM
To: Windows System Software Devs Interest List
Subject: Re: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest

The FPGA works in the following way:

The driver writes the scatter-gather list to hardware only once upon IOCTL
request the contains METHOD_OUT_DIRECT Upon this request, driver calls to
WdfDmaTransactionInitializeUsingRequest
and to WdfDmaTransactionExecute.

Then upon another IOCTL driver writes a ‘go’ command to the FPGA to start
writing to RAM.

Whenever FPGA receive data from external source it writes the data to RAM
using DMA to a pre-allocated buffer.

When FPGA reaches to the end of the buffer it starts writing from start.

DMA from FPGA to RAM is always active (from ‘go’) and not only upon
‘ReadFile’ from user space.

Thanks,
Zvika

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, November 10, 2011 19:38
Subject: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest

> You misunderstand what WDF stuff does. It never communicates with hardware
> directly. WDF only helps a driver to prepare a DMA transaction, for
> example allocating Scatter Gather List. It is up to a driver initiate DMA
> transaction or avoid it. What do you mean “But in my case, I do not want
> to run the DMA. Only set it to hardware.” ?
>
> Igor Sharovar
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Am 10.11.2011 22:41, schrieb Peter Wieland:

You should be aware though, that since you’re using app memory and not common
buffer for your shared memory section that there’s a chance that a page not
accessible to the device might get copied by the HAL into a bounce buffer. The
bounce buffer’s contents won’t be copied back to the client buffer until you
complete the DMA transaction. If you really want to have live access to the
data from your FPGA then this may not work for you.

Peter,
is your statement about the bounce buffer true even if DMA direct method is used?
And if even if the PCI (Express) device has been designed 64-bit capable and is
therefore able to address all physical memory?

-p

It can be true even with a 64 bit device, if driver verifier is turned on for your driver or in rare cases where the root pci bus controller has a bug.

Method direct vs method buffered has nothing to do with it.

-p

On Nov 11, 2011, at 1:30 AM, “Charles” <charles.gardiner> wrote:

> Am 10.11.2011 22:41, schrieb Peter Wieland:
>>
>> You should be aware though, that since you’re using app memory and not common
>> buffer for your shared memory section that there’s a chance that a page not
>> accessible to the device might get copied by the HAL into a bounce buffer. The
>> bounce buffer’s contents won’t be copied back to the client buffer until you
>> complete the DMA transaction. If you really want to have live access to the
>> data from your FPGA then this may not work for you.
>>
>
> Peter,
> is your statement about the bounce buffer true even if DMA direct method is used?
> And if even if the PCI (Express) device has been designed 64-bit capable and is
> therefore able to address all physical memory?
>
>> -p
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
></charles.gardiner>

As long as you want the physical addresses you’ve programmed to your controller to be usable for dma, you should not end the transaction. And you should not complete the request that the buffers came from.

-p

On Nov 10, 2011, at 9:01 PM, “Zvi Vered” wrote:

> Hello,
>
> After calling to WdfDmaTransactionExecute, I do not call to WdfRequestCompleteWithInformation in the IOCTL handler.
>
> Instead, PLxEvtProgramReadDma (3rd parameter to WdfDmaTransactionInitializeUsingRequest)
> call it upon completion of setting the scatter-gather list to hardware.
>
> So I think user space receive reply to DeviceIoControl upon completion and I do not need a event mechanism.
>
> Am I right ?
>
> Thanks,
> Zvika.
>
>
>
> ----- Original Message ----- From: “Peter Wieland”
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, November 10, 2011 23:41
> Subject: RE: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
>
> That’s not a problem. You would want to open an overlapped handle to your device from user-mode so that you can have more than one IOCTL outstanding at a time. Issue the first IOCTL and when DeviceIoControl returns ERROR_IO_PENDING you can go ahead and send the second IOCTL.
>
> In your driver you probably want a sequential queue so that you’re not dealing with a race between these IOCTLs. Setup the DMA from the first IOCTL then forward it to a second queue for holding. This releases the first queue which can then dispatch your next request (the “go” request).
>
> If the app crashes or close its handle, the first IOCTL will be cancelled. You can stop any running transfer, tear down the DMA structures, flush the DMA transaction and you’re good to go.
>
> You should be aware though, that since you’re using app memory and not common buffer for your shared memory section that there’s a chance that a page not accessible to the device might get copied by the HAL into a bounce buffer. The bounce buffer’s contents won’t be copied back to the client buffer until you complete the DMA transaction. If you really want to have live access to the data from your FPGA then this may not work for you.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
> Sent: Thursday, November 10, 2011 11:41 AM
> To: Windows System Software Devs Interest List
> Subject: Re: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
> The FPGA works in the following way:
>
> The driver writes the scatter-gather list to hardware only once upon IOCTL request the contains METHOD_OUT_DIRECT Upon this request, driver calls to WdfDmaTransactionInitializeUsingRequest
> and to WdfDmaTransactionExecute.
>
> Then upon another IOCTL driver writes a ‘go’ command to the FPGA to start writing to RAM.
>
> Whenever FPGA receive data from external source it writes the data to RAM using DMA to a pre-allocated buffer.
>
> When FPGA reaches to the end of the buffer it starts writing from start.
>
> DMA from FPGA to RAM is always active (from ‘go’) and not only upon ‘ReadFile’ from user space.
>
> Thanks,
> Zvika
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, November 10, 2011 19:38
> Subject: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
>
>> You misunderstand what WDF stuff does. It never communicates with hardware
>> directly. WDF only helps a driver to prepare a DMA transaction, for
>> example allocating Scatter Gather List. It is up to a driver initiate DMA
>> transaction or avoid it. What do you mean “But in my case, I do not want
>> to run the DMA. Only set it to hardware.” ?
>>
>> Igor Sharovar
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Dear Mr. Wieland,

So I should not call to WdfRequestCompleteWithInformation ?

This will cause DeviceIoControl to hang.

I do not want to run DeviceIoControl in a different thread.

Thanks,
Zvika.

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Cc: “Windows System Software Devs Interest List”
Sent: Friday, November 11, 2011 17:37
Subject: Re: [ntdev] WdfDmaTransactionInitializeUsingRequest

As long as you want the physical addresses you’ve programmed to your
controller to be usable for dma, you should not end the transaction. And you
should not complete the request that the buffers came from.

-p

On Nov 10, 2011, at 9:01 PM, “Zvi Vered” wrote:

> Hello,
>
> After calling to WdfDmaTransactionExecute, I do not call to
> WdfRequestCompleteWithInformation in the IOCTL handler.
>
> Instead, PLxEvtProgramReadDma (3rd parameter to
> WdfDmaTransactionInitializeUsingRequest)
> call it upon completion of setting the scatter-gather list to hardware.
>
> So I think user space receive reply to DeviceIoControl upon completion and
> I do not need a event mechanism.
>
> Am I right ?
>
> Thanks,
> Zvika.
>
>
>
> ----- Original Message ----- From: “Peter Wieland”
>
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, November 10, 2011 23:41
> Subject: RE: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
>
> That’s not a problem. You would want to open an overlapped handle to your
> device from user-mode so that you can have more than one IOCTL outstanding
> at a time. Issue the first IOCTL and when DeviceIoControl returns
> ERROR_IO_PENDING you can go ahead and send the second IOCTL.
>
> In your driver you probably want a sequential queue so that you’re not
> dealing with a race between these IOCTLs. Setup the DMA from the first
> IOCTL then forward it to a second queue for holding. This releases the
> first queue which can then dispatch your next request (the “go” request).
>
> If the app crashes or close its handle, the first IOCTL will be cancelled.
> You can stop any running transfer, tear down the DMA structures, flush the
> DMA transaction and you’re good to go.
>
> You should be aware though, that since you’re using app memory and not
> common buffer for your shared memory section that there’s a chance that a
> page not accessible to the device might get copied by the HAL into a
> bounce buffer. The bounce buffer’s contents won’t be copied back to the
> client buffer until you complete the DMA transaction. If you really want
> to have live access to the data from your FPGA then this may not work for
> you.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
> Sent: Thursday, November 10, 2011 11:41 AM
> To: Windows System Software Devs Interest List
> Subject: Re: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
> The FPGA works in the following way:
>
> The driver writes the scatter-gather list to hardware only once upon IOCTL
> request the contains METHOD_OUT_DIRECT Upon this request, driver calls to
> WdfDmaTransactionInitializeUsingRequest
> and to WdfDmaTransactionExecute.
>
> Then upon another IOCTL driver writes a ‘go’ command to the FPGA to start
> writing to RAM.
>
> Whenever FPGA receive data from external source it writes the data to RAM
> using DMA to a pre-allocated buffer.
>
> When FPGA reaches to the end of the buffer it starts writing from start.
>
> DMA from FPGA to RAM is always active (from ‘go’) and not only upon
> ‘ReadFile’ from user space.
>
> Thanks,
> Zvika
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, November 10, 2011 19:38
> Subject: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
>
>> You misunderstand what WDF stuff does. It never communicates with
>> hardware
>> directly. WDF only helps a driver to prepare a DMA transaction, for
>> example allocating Scatter Gather List. It is up to a driver initiate DMA
>> transaction or avoid it. What do you mean “But in my case, I do not want
>> to run the DMA. Only set it to hardware.” ?
>>
>> Igor Sharovar
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

You should read about overlapped I/O. See http://msdn.microsoft.com/en-us/windows/hardware/gg463203

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
Sent: Friday, November 11, 2011 9:20 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] WdfDmaTransactionInitializeUsingRequest

Dear Mr. Wieland,

So I should not call to WdfRequestCompleteWithInformation ?

This will cause DeviceIoControl to hang.

I do not want to run DeviceIoControl in a different thread.

Thanks,
Zvika.

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Cc: “Windows System Software Devs Interest List”
Sent: Friday, November 11, 2011 17:37
Subject: Re: [ntdev] WdfDmaTransactionInitializeUsingRequest

As long as you want the physical addresses you’ve programmed to your
controller to be usable for dma, you should not end the transaction. And you
should not complete the request that the buffers came from.

-p

On Nov 10, 2011, at 9:01 PM, “Zvi Vered” wrote:

> Hello,
>
> After calling to WdfDmaTransactionExecute, I do not call to
> WdfRequestCompleteWithInformation in the IOCTL handler.
>
> Instead, PLxEvtProgramReadDma (3rd parameter to
> WdfDmaTransactionInitializeUsingRequest)
> call it upon completion of setting the scatter-gather list to hardware.
>
> So I think user space receive reply to DeviceIoControl upon completion and
> I do not need a event mechanism.
>
> Am I right ?
>
> Thanks,
> Zvika.
>
>
>
> ----- Original Message ----- From: “Peter Wieland”
>
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, November 10, 2011 23:41
> Subject: RE: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
>
> That’s not a problem. You would want to open an overlapped handle to your
> device from user-mode so that you can have more than one IOCTL outstanding
> at a time. Issue the first IOCTL and when DeviceIoControl returns
> ERROR_IO_PENDING you can go ahead and send the second IOCTL.
>
> In your driver you probably want a sequential queue so that you’re not
> dealing with a race between these IOCTLs. Setup the DMA from the first
> IOCTL then forward it to a second queue for holding. This releases the
> first queue which can then dispatch your next request (the “go” request).
>
> If the app crashes or close its handle, the first IOCTL will be cancelled.
> You can stop any running transfer, tear down the DMA structures, flush the
> DMA transaction and you’re good to go.
>
> You should be aware though, that since you’re using app memory and not
> common buffer for your shared memory section that there’s a chance that a
> page not accessible to the device might get copied by the HAL into a
> bounce buffer. The bounce buffer’s contents won’t be copied back to the
> client buffer until you complete the DMA transaction. If you really want
> to have live access to the data from your FPGA then this may not work for
> you.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Zvi Vered
> Sent: Thursday, November 10, 2011 11:41 AM
> To: Windows System Software Devs Interest List
> Subject: Re: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
> The FPGA works in the following way:
>
> The driver writes the scatter-gather list to hardware only once upon IOCTL
> request the contains METHOD_OUT_DIRECT Upon this request, driver calls to
> WdfDmaTransactionInitializeUsingRequest
> and to WdfDmaTransactionExecute.
>
> Then upon another IOCTL driver writes a ‘go’ command to the FPGA to start
> writing to RAM.
>
> Whenever FPGA receive data from external source it writes the data to RAM
> using DMA to a pre-allocated buffer.
>
> When FPGA reaches to the end of the buffer it starts writing from start.
>
> DMA from FPGA to RAM is always active (from ‘go’) and not only upon
> ‘ReadFile’ from user space.
>
> Thanks,
> Zvika
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, November 10, 2011 19:38
> Subject: RE:[ntdev] WdfDmaTransactionInitializeUsingRequest
>
>
>> You misunderstand what WDF stuff does. It never communicates with
>> hardware
>> directly. WDF only helps a driver to prepare a DMA transaction, for
>> example allocating Scatter Gather List. It is up to a driver initiate DMA
>> transaction or avoid it. What do you mean “But in my case, I do not want
>> to run the DMA. Only set it to hardware.” ?
>>
>> Igor Sharovar
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer