开发者

Creating drivers and firmware

If I was told I needed to create a driver for some product (say, a game controller), how would I go about creating one? Is this something you could do normally in C/C++?

And wha开发者_开发技巧t about firmware for external deviced connect to USB? How is this created usually? Is this also done in C/C++, or some lower level language?

Thanks!


Device drivers for desktop computer operating systems are generally written in either C or C++. The operating system you would target will have some form of framework or device driver development environment. Often these development kits can be obtained free of charge.

There are books available for Windows, Linux, and MacOS X (and others) that detail the process of creating a device driver.

If your driver is related to a device on a specific hardware bus (PCI, PCI-X, USB, SCSI, SATA, etc.) you can also get books on that specific technology. An understanding of that hardware system can greatly facilitate the design of your driver.

Another good resource is the open source code for similar devices to yours. You can obtain that from the Linux kernel source or FreeBSD source and study how certain aspects of your type of device are implemented.

EDIT: I nearly forgot to mention that you will also need data sheets, schematics, and/or theory of operation information about the device itself.


I'll add to Amardeep's good answer with the following books that will help you think about the context device drivers operate in, and how they're structured:

Linux: http://www.amazon.com/Understanding-Linux-Kernel-Third-Daniel/dp/0596005652

Windows: http://www.amazon.com/Programming-Microsoft-Windows-Driver-Model/dp/0735618038/ref=sr_1_1?ie=UTF8&s=books&qid=1277439434&sr=1-1

Mac OS: http://www.amazon.com/Mac-OS-Internals-Systems-Approach/dp/0321278542/ref=sr_1_1?ie=UTF8&s=books&qid=1277439467&sr=1-1


You do it in any language that can talk to the interface. If it requires poking ports or addresses directly then you use assembly or C. If there's a higher-level interface such as libusb then you can use almost any language you like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜