views:

246

answers:

4

How should I approach implementing a USB device driver for Windows? How should I take into account different versions of windows e.g: - Windows XP - Windows Vista - Windows 7

Is there open source solutions which could be used as a starting point? I'm a total newbie to windows driver development.

We have an embedded device with USB device port and we would like to have as low latency communication from the application level to the device as possible without sacrificing the data throughput. The actual data transferred is ADC/DAC data. Basically there is a lot of data which we need to transfer to a Windows machine as fast as possible.

+1  A: 

Start here: Windows Driver Kit Introduction

Nissan Fan
with total newbie I didn't mean that level of a newbie ;-)
Velho Kerho
Sorry, I took total newbie too literally. The answer below is exceptionally detailed for someone at your level.
Nissan Fan
+4  A: 

We need more information about the device to point you in the right direction, but here are a few steps to get you started:

  • register with Microsoft Connect so you can download the Windows Driver Kit
  • register with osr-online as you'll find great articles, plenty of information, and a newsgroup dediciated just to Windows drivers -- this place is a goldmine
  • buy Developing Drives with WDF, which will help you make sense of driver development on Windows and give you a good foundation to read articles from OSR and Microsoft
  • Hope that you can use UMDF (user-mode drivers) as you can use C++ and just write COM code. If you're doing anything with USB that requires kernel-space....you've got a lot of reading and learning to do for the next year!

To answer your question on versions, the Driver Kit has tools that will help you manage creating different drivers. If you write a good driver, it should run on all three OS with no problems, and the differences will just be in the config area (not the binary)

Basically, it depends on how complex your device is. What type of driver are you trying to write? File system? MP3 player? Camera? Modem?

If you end up having to write a kernel mode driver, let me know and I can point you to some good articles and what not.

I should also add that for around US $5,000, you can buy a license for WinDriver, a tool that takes all of the hard stuff out of driver development. You can use C++ or C# user-mode code to communicate with their driver that is custom generated for your device. This is the way to go if you have a tight deadline.

Dr. Watson
We have embedded device with USB device port and we would like to have as low latency communication from the application level to the device without sacrificing the data throughput.
Velho Kerho
The latency is going to heavily depend on your hardware's USB controller. If I were you I'd throw together a test UMDF (user-mode) driver first and see if it meets your latency needs. Forget about nice interfaces and what not, just get the I/O functionality implemented and a Win32 test app for pushing and pulling data. With the book I mentioned above you should be able to have a basic driver ready in about a week. The advantage of UMDF is that it is quite easy to implement and easy to debug as you don't need the kernel debugger. You can always go with KMDF if UMDF doesn't cut it.
Dr. Watson
A: 

If you have some form of control over the device side, have it implement an interface for which Windows already provides drivers. E.g. the USB HID class (literally Human Input Device, but neither the Human nor the Input is mandatory) already has Windows drivers, and there is a reasonable Win32 API on top. You're not going to get data rates anywhere near 480 Mbps, though.

MSalters
A: 

Start learning docs :
Windows Driver Kit (WDK) Documentation
Download libs, tools and samples :
Windows Driver Kit Version 7.0.0 (GRMWDK_EN_7600.ISO)

lsalamon