DMA over USB

Dear Friends,

Does Windows 7 or any Windows support DMA over USB? Or there is no such thing as DMA over USB? Your help is highly appreciated.

Thank you very much in advance!
John

Dma exists at the host controller level. A usb client driver uses the usb protocol packets (URBs) to tell the host controller what to schedule on the dma engine. So, no, there is no such thing as dma over usb from a usb client driver perspective. What problem are you trying to solve?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Thursday, May 30, 2013 11:42 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] DMA over USB

Dear Friends,

Does Windows 7 or any Windows support DMA over USB? Or there is no such thing as DMA over USB? Your help is highly appreciated.

Thank you very much in advance!
John


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

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

Hi Doron,

Thank you very much for your reply.
The problem I am trying to solve is: we are designing some data acquisition board which will be connected to PC through USB connection. We are just wondering whether we can do something like “DMA over USB” when the PC collects the sampled data from the data acquisition board: the PC sends a “start DMA” command to acquisition board, the acqusition board starts to do bulk transfer of data to the PC over USB, when the specified length of data are transferred from the acquisition board to PC, the transfer stops. Then the PC can process the transferred data. I am just wondering whether there is some mechanism where we can specify the memory address like “DMA destination address” for the USB controller on the PC to continuously put data in? I am new in Windows software development. Thank you very much for your help!

John

USB controller will do DMA for you, just pass the correct IRPs down to it.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi Doron,
>
> Thank you very much for your reply.
> The problem I am trying to solve is: we are designing some data acquisition board which will be connected to PC through USB connection. We are just wondering whether we can do something like “DMA over USB” when the PC collects the sampled data from the data acquisition board: the PC sends a “start DMA” command to acquisition board, the acqusition board starts to do bulk transfer of data to the PC over USB, when the specified length of data are transferred from the acquisition board to PC, the transfer stops. Then the PC can process the transferred data. I am just wondering whether there is some mechanism where we can specify the memory address like “DMA destination address” for the USB controller on the PC to continuously put data in? I am new in Windows software development. Thank you very much for your help!
>
> John
>

Hi Maxim,

Thank you very much for your answer.
I am very new on windows driver development. Would you be able to give me more directions by pointing me to some Microsoft documents or giving me a little bit more details?

Thanks a lot!
John

xxxxx@yahoo.com wrote:

The problem I am trying to solve is: we are designing some data acquisition board which will be connected to PC through USB connection. We are just wondering whether we can do something like “DMA over USB” when the PC collects the sampled data from the data acquisition board: the PC sends a “start DMA” command to acquisition board, the acqusition board starts to do bulk transfer of data to the PC over USB, when the specified length of data are transferred from the acquisition board to PC, the transfer stops. Then the PC can process the transferred data. I am just wondering whether there is some mechanism where we can specify the memory address like “DMA destination address” for the USB controller on the PC to continuously put data in? I am new in Windows software development. Thank you very much for your help!

You need to learn a little more about USB. USB is more than just a pair
of wires. It is a shared, packet-based bus with a well-defined protocol.

Here’s the way it works. You send a set of read requests down to the
USB host controller driver. The HCD then schedules time for you on the
bus. When your time comes, the host controller tells your device “OK,
time to send”, and the device can send a 512-byte packet. That process
repeats until your buffer is full, at which point the request is
completed. Your application processes that data and sends the empty
buffer back to the HCD. Meanwhile, because you sent down several
requests, the data transfer process can still continue.

You do not need a driver for this. You can use WinUSB directly from
your application (or from a DLL that abstracts the interface). In fact,
WinUSB includes a “continuous reader” that runs a transfer loop for you,
much like what I’ve just described.


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

Tim Roberts wrote:

You do not need a driver for this. You can use WinUSB directly from
your application (or from a DLL that abstracts the interface). In fact,
WinUSB includes a “continuous reader” that runs a transfer loop for you,
much like what I’ve just described.

OK, shame on me, the continuous reader is part of KMDF, not part of
WinUSB. I know better than that.

Even so, it’s not hard to implement this yourself. For custom devices,
there is no reason to write a kernel-mode USB driver today.


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

Hi Maxim, ???I posted the following reply on the OSR site. But just in case, I email the message to you trying to get more help from you. Thank you very much for your answer.
I am very new on windows driver development. Would you be able to give me
more directions by pointing me to some Microsoft documents or giving me a little
bit more details?

Thanks a lot!
John


From: Maxim S. Shatskih
To: Windows System Software Devs Interest List
Sent: Thursday, May 30, 2013 1:13:53 PM
Subject: Re:[ntdev] DMA over USB

? ? USB controller will do DMA for you, just pass the correct IRPs down to it.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com/

wrote in message news:xxxxx@ntdev…
> Hi Doron,
>
>? ? Thank you very much for your reply.
>? ? The problem I am trying to solve is: we are designing some data acquisition board which will be connected to PC through USB connection. We are just wondering whether we can do something like “DMA over USB” when the PC collects the sampled data from the data acquisition board: the PC sends a “start DMA” command to acquisition board, the acqusition board starts to do bulk transfer of data to the PC over USB, when the specified length of data are transferred from the acquisition board to PC, the transfer stops. Then the PC can process the transferred data. I am just wondering whether there is some mechanism where we can specify the memory address like “DMA destination address” for the USB controller on the PC to continuously put data in? I am new in Windows software development. Thank you very much for your help!
>
> John
>


NTDEV is sponsored by OSR

OSR is HIRING!!? See http://www.osr.com/careers

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 get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA. If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts. The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function) When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER. Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR. When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information. Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost. Key here Is to make sure you free up the resources you have
consumed.
joe

Hi Maxim,     I posted the following reply on the OSR site. But just in
case, I email the message to you trying to get more help from you. Thank
you very much for your answer.
I am very new on windows driver
development. Would you be able to give me
more directions by pointing me
to some Microsoft documents or giving me a little
bit more
details?

Thanks a lot!
John


From: Maxim S. Shatskih
> To: Windows System Software Devs Interest List
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com/
>
> wrote in message news:xxxxx@ntdev…
>> Hi Doron,
>>
>> Thank you very much for your reply.
>> The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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

> I saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

They are most certainly supported in wdm. They are fully implemented. Kmdf doesn’t wrap them, but you can easily use kmdf for all of your USB needs and thunk to wdm for isoch. Winusb doesn’t currently support isoch either.

Isoch is difficult for many reasons, three big ones are

  1. there is no crc checking for over the wire transfers. That means you must validate your data OR just accept lossy data. The intent for isoch is audio and video streaming where loss of data is ok and momentary and crc checking slows things down too much. Speed was supremely important on USB 1.1 where eaking out every bit of bandwidth was paramount.

  2. you have to be very cognizant of timing and making sure you have transfers ready. With bulk, you still have to have pending xfers, but timing is not as big a factor

  3. you have a more complex descriptor and you need to manage multiple alt settings per interface to manage isoch bandwidth consumption

d

Bent from my phone


From: xxxxx@flounder.commailto:xxxxx
Sent: ?5/?30/?2013 4:28 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: Re: [ntdev] DMA over USB

You should get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA. If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts. The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function) When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER. Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR. When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information. Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost. Key here Is to make sure you free up the resources you have
consumed.
joe

> Hi Maxim, I posted the following reply on the OSR site. But just in
> case, I email the message to you trying to get more help from you. Thank
> you very much for your answer.
I am very new on windows driver
> development. Would you be able to give me
more directions by pointing me
> to some Microsoft documents or giving me a little
bit more
> details?

Thanks a lot!
John
>
> ________________________________
> From: Maxim S. Shatskih
> To: Windows System Software Devs Interest List
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com/
>
> wrote in message news:xxxxx@ntdev…
>> Hi Doron,
>>
>> Thank you very much for your reply.
>> The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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

OSR is HIRING!! See http://www.osr.com/careers

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</mailto:xxxxx></mailto:xxxxx>

xxxxx@flounder.com wrote:

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

Besides being inaccurate, this is also irrelevant. He already said his
device does bulk transfers.

Isochronous pipes work just fine. Every web camera and every USB audio
device uses them. They just work differently from the other types.

Having said that, unless you are doing video and audio, isochronous is
almost never the right choice.


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

Hi Joe,
?
??? Thank you very much for your detailed explanation.
???WDK provides a sample PCI device driver which uses?DMA over?PCI. So is what I am saying below make sense?
???For the KMDF driver’s DMA part, DMA over USB and DMA over PCI should be similar. Maybe the big difference is in that DMA over PCI can use interrupt, but DMA over USB can’t, which you explained in your previous posting.
?
??? If what I am thinking is not correct, could you please give me more directions?
?
Thanks a lot!
John
?


From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Thursday, May 30, 2013 4:26:38 PM
Subject: Re: [ntdev] DMA over USB

You should get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!”? It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA.? If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts.? The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function)? When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER.? Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR.? When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information.? Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost.? Key here Is to make sure you free up the resources you have
consumed.
? ? ? joe

> Hi Maxim, ???I posted the following reply on the OSR site. But just in
> case, I email the message to you trying to get more help from you. Thank
> you very much for your answer.
? ? I am very new on windows driver
> development. Would you be able to give me
more directions by pointing me
> to some Microsoft documents or giving me a little
bit more
> details?

Thanks a lot!
John
>
> ________________________________
> From: Maxim S. Shatskih
> To: Windows System Software Devs Interest List
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> ? ? USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com/
>
> wrote in message news:xxxxx@ntdev…
>> Hi Doron,
>>
>>? ? Thank you very much for your reply.
>>? ? The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!!? See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!!? See http://www.osr.com/careers
>
> 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

OSR is HIRING!!? See http://www.osr.com/careers

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

It is not correct. With PCI you have direct access to hw resources (ports, interrupts) and the bandwidth is different. With USB, you have an indirect interface to HW over protocol packets and the USB on the wire model. /forget/ DMA over USB. USB can easily be used to transport your data, just don’t think of how you communicate with your USB device in any DMA concepts at all

d

Bent from my phone


From: jianhong xumailto:xxxxx
Sent: ?5/?31/?2013 6:38 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Cc: xxxxx@flounder.commailto:xxxxx
Subject: Re: [ntdev] DMA over USB

Hi Joe,

Thank you very much for your detailed explanation.
WDK provides a sample PCI device driver which uses DMA over PCI. So is what I am saying below make sense?
For the KMDF driver’s DMA part, DMA over USB and DMA over PCI should be similar. Maybe the big difference is in that DMA over PCI can use interrupt, but DMA over USB can’t, which you explained in your previous posting.

If what I am thinking is not correct, could you please give me more directions?

Thanks a lot!
John

From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Thursday, May 30, 2013 4:26:38 PM
Subject: Re: [ntdev] DMA over USB

You should get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA. If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts. The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function) When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER. Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR. When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information. Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost. Key here Is to make sure you free up the resources you have
consumed.
joe

> Hi Maxim, I posted the following reply on the OSR site. But just in
> case, I email the message to you trying to get more help from you. Thank
> you very much for your answer.
I am very new on windows driver
> development. Would you be able to give me
more directions by pointing me
> to some Microsoft documents or giving me a little
bit more
> details?

Thanks a lot!
John
>
> ________________________________
> From: Maxim S. Shatskih >
> To: Windows System Software Devs Interest List >
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.commailto:xxxxx
> http://www.storagecraft.com/
>
> > wrote in message news:xxxxx@ntdev…mailto:xxxxx
>> Hi Doron,
>>
>> Thank you very much for your reply.
>> The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

You are confusing two essentially different bus architectures:

  • backplane type buses, where drivers for attached devices access the device’s hardware resources (ports, registers, shared memory, interrupts, dam channels) directly;

  • protocol-based buses, where drivers for attached devices access those devices only indirectly through the controller for the bus.

Examples of backplane type buses are PCI, PCIe, etc.

Examples of protocol-based buses are USB, SCSI, SATA, 1395, etc.

Does that help at all?

Peter
OSR

Hi Doron,
 
     Thank you very much for your reply.
 
     I was talking about the KMDF coding similarity between “DMA over USB” and “DMA over PCI”, of course you are correct on that PCI and USB works quite differently on the lower level. 
     I have used “DMA over PCIe” for Windows. Both PCIe and USB use “packets” (not “wired”) to do communication, so if we can do “DMA over PCIe”, we should be able to do “DMA over USB”, is this correct? Except that PCIe can use MSI interrupts, but there is no similar thing for USB.
      Could you please give me more directions if I am wrong?
 
Thanks a lot!
John
  


From: Doron Holan
To: Windows System Software Devs Interest List
Cc: “xxxxx@flounder.com
Sent: Friday, May 31, 2013 7:08:56 AM
Subject: RE: [ntdev] DMA over USB

It is not correct. With PCI you have direct access to hw resources (ports, interrupts) and the bandwidth is different. With USB, you have an indirect interface to HW over protocol packets and the USB on the wire model. /forget/ DMA over USB. USB can easily be used to transport your data, just don’t think of how you communicate with your USB device in any DMA concepts at all

d

Bent from my phone


From: jianhong xu
Sent: ‎5/‎31/‎2013 6:38 AM
To: Windows System Software Devs Interest List
Cc: xxxxx@flounder.com
Subject: Re: [ntdev] DMA over USB

Hi Joe,

Thank you very much for your detailed explanation.
WDK provides a sample PCI device driver which uses DMA over PCI. So is what I am saying below make sense?
For the KMDF driver’s DMA part, DMA over USB and DMA over PCI should be similar. Maybe the big difference is in that DMA over PCI can use interrupt, but DMA over USB can’t, which you explained in your previous posting.

If what I am thinking is not correct, could you please give me more directions?

Thanks a lot!
John



From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Thursday, May 30, 2013 4:26:38 PM
Subject: Re: [ntdev] DMA over USB

You should get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA. If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts. The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function) When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER. Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR. When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information. Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost. Key here Is to make sure you free up the resources you have
consumed.
joe

> Hi Maxim, I posted the following reply on the OSR site. But just in
> case, I email the message to you trying to get more help from you. Thank
> you very much for your answer.
I am very new on windows driver
> development. Would you be able to give me
more directions by pointing me
> to some Microsoft documents or giving me a little
bit more
> details?

Thanks a lot!
John
>
> ________________________________
> From: Maxim S. Shatskih
> To: Windows System Software Devs Interest List
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com/
>
> wrote in message news:xxxxx@ntdev…
>> Hi Doron,
>>
>> Thank you very much for your reply.
>> The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

Throw away any concept of DMA you have in your head. Start over with a blank slate. Look at the fx2 sample driver and how it continuously reads on a bulk pipe

d

Bent from my phone


From: jianhong xumailto:xxxxx
Sent: ?5/?31/?2013 7:39 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Cc: xxxxx@flounder.commailto:xxxxx; Doron Holanmailto:xxxxx
Subject: Re: [ntdev] DMA over USB

Hi Doron,

Thank you very much for your reply.

I was talking about the KMDF coding similarity between “DMA over USB” and “DMA over PCI”, of course you are correct on that PCI and USB works quite differently on the lower level.
I have used “DMA over PCIe” for Windows. Both PCIe and USB use “packets” (not “wired”) to do communication, so if we can do “DMA over PCIe”, we should be able to do “DMA over USB”, is this correct? Except that PCIe can use MSI interrupts, but there is no similar thing for USB.
Could you please give me more directions if I am wrong?

Thanks a lot!
John

From: Doron Holan
To: Windows System Software Devs Interest List
Cc: “xxxxx@flounder.com
Sent: Friday, May 31, 2013 7:08:56 AM
Subject: RE: [ntdev] DMA over USB

It is not correct. With PCI you have direct access to hw resources (ports, interrupts) and the bandwidth is different. With USB, you have an indirect interface to HW over protocol packets and the USB on the wire model. /forget/ DMA over USB. USB can easily be used to transport your data, just don’t think of how you communicate with your USB device in any DMA concepts at all

d

Bent from my phone
From: jianhong xumailto:xxxxx
Sent: ?5/?31/?2013 6:38 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Cc: xxxxx@flounder.commailto:xxxxx
Subject: Re: [ntdev] DMA over USB

Hi Joe,

Thank you very much for your detailed explanation.
WDK provides a sample PCI device driver which uses DMA over PCI. So is what I am saying below make sense?
For the KMDF driver’s DMA part, DMA over USB and DMA over PCI should be similar. Maybe the big difference is in that DMA over PCI can use interrupt, but DMA over USB can’t, which you explained in your previous posting.

If what I am thinking is not correct, could you please give me more directions?

Thanks a lot!
John

From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Thursday, May 30, 2013 4:26:38 PM
Subject: Re: [ntdev] DMA over USB

You should get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA. If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts. The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function) When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER. Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR. When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information. Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost. Key here Is to make sure you free up the resources you have
consumed.
joe

> Hi Maxim, I posted the following reply on the OSR site. But just in
> case, I email the message to you trying to get more help from you. Thank
> you very much for your answer.
I am very new on windows driver
> development. Would you be able to give me
more directions by pointing me
> to some Microsoft documents or giving me a little
bit more
> details?

Thanks a lot!
John
>
> ________________________________
> From: Maxim S. Shatskih >
> To: Windows System Software Devs Interest List >
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.commailto:xxxxx
> http://www.storagecraft.com/
>
> > wrote in message news:xxxxx@ntdev…mailto:xxxxx
>> Hi Doron,
>>
>> Thank you very much for your reply.
>> The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

Hi Doron,
 
     OK! I will read the sample driver. Thank you very much for your help.
 
Best regards,
John


From: Doron Holan
To: Windows System Software Devs Interest List
Cc: “xxxxx@flounder.com
Sent: Friday, May 31, 2013 7:41:42 AM
Subject: RE: [ntdev] DMA over USB

Throw away any concept of DMA you have in your head. Start over with a blank slate. Look at the fx2 sample driver and how it continuously reads on a bulk pipe

d

Bent from my phone


From: jianhong xu
Sent: ‎5/‎31/‎2013 7:39 AM
To: Windows System Software Devs Interest List
Cc: xxxxx@flounder.com; Doron Holan
Subject: Re: [ntdev] DMA over USB

Hi Doron,

Thank you very much for your reply.

I was talking about the KMDF coding similarity between “DMA over USB” and “DMA over PCI”, of course you are correct on that PCI and USB works quite differently on the lower level.
I have used “DMA over PCIe” for Windows. Both PCIe and USB use “packets” (not “wired”) to do communication, so if we can do “DMA over PCIe”, we should be able to do “DMA over USB”, is this correct? Except that PCIe can use MSI interrupts, but there is no similar thing for USB.
Could you please give me more directions if I am wrong?

Thanks a lot!
John



From: Doron Holan
To: Windows System Software Devs Interest List
Cc: “xxxxx@flounder.com
Sent: Friday, May 31, 2013 7:08:56 AM
Subject: RE: [ntdev] DMA over USB

It is not correct. With PCI you have direct access to hw resources (ports, interrupts) and the bandwidth is different. With USB, you have an indirect interface to HW over protocol packets and the USB on the wire model. /forget/ DMA over USB. USB can easily be used to transport your data, just don’t think of how you communicate with your USB device in any DMA concepts at all

d

Bent from my phone


From: jianhong xu
Sent: ‎5/‎31/‎2013 6:38 AM
To: Windows System Software Devs Interest List
Cc: xxxxx@flounder.com
Subject: Re: [ntdev] DMA over USB

Hi Joe,

Thank you very much for your detailed explanation.
WDK provides a sample PCI device driver which uses DMA over PCI. So is what I am saying below make sense?
For the KMDF driver’s DMA part, DMA over USB and DMA over PCI should be similar. Maybe the big difference is in that DMA over PCI can use interrupt, but DMA over USB can’t, which you explained in your previous posting.

If what I am thinking is not correct, could you please give me more directions?

Thanks a lot!
John



From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Thursday, May 30, 2013 4:26:38 PM
Subject: Re: [ntdev] DMA over USB

You should get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA. If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts. The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function) When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER. Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR. When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information. Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost. Key here Is to make sure you free up the resources you have
consumed.
joe

> Hi Maxim, I posted the following reply on the OSR site. But just in
> case, I email the message to you trying to get more help from you. Thank
> you very much for your answer.
I am very new on windows driver
> development. Would you be able to give me
more directions by pointing me
> to some Microsoft documents or giving me a little
bit more
> details?

Thanks a lot!
John
>
> ________________________________
> From: Maxim S. Shatskih
> To: Windows System Software Devs Interest List
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com/
>
> wrote in message news:xxxxx@ntdev…
>> Hi Doron,
>>
>> Thank you very much for your reply.
>> The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

Hi Doron,
 
     If you could give me a brief explanation about why we can do “DMA over PCIe” but we can’t do “DMA over USB”, it would be really helpful.
 
Thanks a lot.
John 


From: jianhong xu
To: Windows System Software Devs Interest List
Cc: “xxxxx@flounder.com” ; “xxxxx@microsoft.com
Sent: Friday, May 31, 2013 8:06:04 AM
Subject: Re: [ntdev] DMA over USB

Hi Doron,

OK! I will read the sample driver. Thank you very much for your help.

Best regards,
John


From: Doron Holan
To: Windows System Software Devs Interest List
Cc: “xxxxx@flounder.com
Sent: Friday, May 31, 2013 7:41:42 AM
Subject: RE: [ntdev] DMA over USB

Throw away any concept of DMA you have in your head. Start over with a blank slate. Look at the fx2 sample driver and how it continuously reads on a bulk pipe

d

Bent from my phone


From: jianhong xu
Sent: ‎5/‎31/‎2013 7:39 AM
To: Windows System Software Devs Interest List
Cc: xxxxx@flounder.com; Doron Holan
Subject: Re: [ntdev] DMA over USB

Hi Doron,

Thank you very much for your reply.

I was talking about the KMDF coding similarity between “DMA over USB” and “DMA over PCI”, of course you are correct on that PCI and USB works quite differently on the lower level.
I have used “DMA over PCIe” for Windows. Both PCIe and USB use “packets” (not “wired”) to do communication, so if we can do “DMA over PCIe”, we should be able to do “DMA over USB”, is this correct? Except that PCIe can use MSI interrupts, but there is no similar thing for USB.
Could you please give me more directions if I am wrong?

Thanks a lot!
John



From: Doron Holan
To: Windows System Software Devs Interest List
Cc: “xxxxx@flounder.com
Sent: Friday, May 31, 2013 7:08:56 AM
Subject: RE: [ntdev] DMA over USB

It is not correct. With PCI you have direct access to hw resources (ports, interrupts) and the bandwidth is different. With USB, you have an indirect interface to HW over protocol packets and the USB on the wire model. /forget/ DMA over USB. USB can easily be used to transport your data, just don’t think of how you communicate with your USB device in any DMA concepts at all

d

Bent from my phone


From: jianhong xu
Sent: ‎5/‎31/‎2013 6:38 AM
To: Windows System Software Devs Interest List
Cc: xxxxx@flounder.com
Subject: Re: [ntdev] DMA over USB

Hi Joe,

Thank you very much for your detailed explanation.
WDK provides a sample PCI device driver which uses DMA over PCI. So is what I am saying below make sense?
For the KMDF driver’s DMA part, DMA over USB and DMA over PCI should be similar. Maybe the big difference is in that DMA over PCI can use interrupt, but DMA over USB can’t, which you explained in your previous posting.

If what I am thinking is not correct, could you please give me more directions?

Thanks a lot!
John



From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Thursday, May 30, 2013 4:26:38 PM
Subject: Re: [ntdev] DMA over USB

You should get a copy of the latest USB standard, which you can get at

http://www.usb.org/developers/docs/

However, a warning: you might look at Isochronous transfers and declare
“that’s just perfect for my app!” It might be, but from what I think I
saw in many threads on this NG is that Isochronous transfers are either
unsupported or so poorly supported that you should avoid them.

As others have explained, the lowest-level USB driver that talks to the
root hub does DMA. If you are not a lowest-level driver talking to
hardware (and no “USB driver” you are likely to see–unless you work for a
USB chip vendor or a motherboard vendor, writing that lowest-level
hardware driver) you will never see interrupts. The logical equivalent
that you will see is a “completion routine” (see IoSetCompletionRoutine,
which may be wrapped in some KMDF function) When all the lower-level
drivers have completed the “in-flight” IRP (although there may be several
IRPs in-flight, and it is your responsibility to deal sanely with that
case) then your driver’s completion routine is called, if the IRP
satisfies the conditions established when IoSetCompletionRoutine was
called–TRUE,TRUE,TRUE will catch all conditions.

If you need to pass information about the IRP to the completion routine,
the most common way is to allocate a block of memory which is
sizeof(WHATEVER) and cast the pointer to a PWHATEVER. Fill in the fields
you have created to hold the inforation you want to transmit to the
completion routine, and pass the pointer in to IoSCR. When the completion
routine is called, it has an LPVOID which you cast back to a PWHATEVER,
and do whatever you need to do with/to the information. Bear in mind that
when returning STATUS_SUCCESS (or anything other than
STATUS_MORE_PROCESING_REQUIRED) that the only pointers to that storage may
be lost. Key here Is to make sure you free up the resources you have
consumed.
joe

> Hi Maxim, I posted the following reply on the OSR site. But just in
> case, I email the message to you trying to get more help from you. Thank
> you very much for your answer.
I am very new on windows driver
> development. Would you be able to give me
more directions by pointing me
> to some Microsoft documents or giving me a little
bit more
> details?

Thanks a lot!
John
>
>

> From: Maxim S. Shatskih
> To: Windows System Software Devs Interest List
> Sent: Thursday, May 30, 2013 1:13:53 PM
> Subject: Re:[ntdev] DMA over USB
>
>
> USB controller will do DMA for you, just pass the correct IRPs down to
> it.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com/
>
> wrote in message news:xxxxx@ntdev…
>> Hi Doron,
>>
>> Thank you very much for your reply.
>> The problem I am trying to solve is: we are designing some data
>> acquisition board which will be connected to PC through USB connection.
>> We are just wondering whether we can do something like “DMA over USB”
>> when the PC collects the sampled data from the data acquisition board:
>> the PC sends a “start DMA” command to acquisition board, the acqusition
>> board starts to do bulk transfer of data to the PC over USB, when the
>> specified length of data are transferred from the acquisition board to
>> PC, the transfer stops. Then the PC can process the transferred data. I
>> am just wondering whether there is some mechanism where we can specify
>> the memory address like “DMA destination address” for the USB controller
>> on the PC to continuously put data in? I am new in Windows software
>> development. Thank you very much for your help!
>>
>> John
>>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

OSR is HIRING!! See http://www.osr.com/careers

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

PLEASE go read my reply again.

You are confused. I suspect you are mixing up a set of concepts (how USB devices are supported and DMA operations)… either that or you seriously misunderstand computer architecture.

Either way, sit back and read the WDK docs about how you write a KMDF driver that reads from a USB Bulk IN endpoint/pipe. Please. Do that before posting again here.

Once you understand the general flow of how that works, THEN please reconsider and repost your question here.

You absolutely CAN transfer data from your USB device to a user’s data buffer using DMA. But this doesn’t mean your device is doing “DMA over USB” – It means the USB host controller, which controls the USB bus, is doing the DMA operation (over the PCI bus, in fact).

So, please… read the WDK docs. Then read some basic conceptual information about USB on the internet. And please don’t repost here until you’ve done that. I’m asking nicely.

OK?

Peter
OSR

DMA is not a protocol like TCP/IP, it is more like a memcpy.

You say to the DMA hardware: “Copy something from here to there and tell me when it is done”.