Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm looking at a new chapter in my career. I'm a web developer, but now I'm starting to play around with C, compilers, and things I didn't have to work with before. It's all very intriguing!

As I'm getting more and more into the "lower level" arena, I'm wondering how devices (mice, printers, webcams, microphones, etc...) are controlled, managed, detected, or used in general with software.

I ask because I'm really having a hard time finding straightforward documentation online describing or giving examples of how hardware interacts with software.

Does someone know of decent sites that can get me started learning this?

share

migration rejected from stackoverflow.com Nov 18 '13 at 11:00

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by gnat, GlenH7, MichaelT, Bart van Ingen Schenau, TZHX Nov 18 '13 at 11:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, MichaelT
If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Whoever migrated this here was seriously mistaken. It should have stayed on stack overflow and been rephrased, to be a better question or if it had to go somewhere, then electronics. –  Chris Stratton Feb 19 '11 at 5:31

4 Answers 4

I'd recommend playing around with something like Arduino and exploring projects at Make.

share
    
+1 Arduino (flexible, yet simple). The Windows Driver Development Kit (DDK, also related to as WDK and WDF) is another good resource as they tend to provide abstractions to code to and you can get sense of how it works in a modern desktop. It also might be useful to look at various Linux/BSD codebases as they to utilize hardware abstractions, but often from a different perspective. –  JustinC Mar 6 '11 at 21:22

Best way to start is with a very small embedded system board, but one big enough that it comes with a C compiler development environment. Lots of them listed in the advertisements in Circuit Celler magazine. Then just spend some time writing code to make lights blinks, generate tones with a speaker, sense buttons, etc.

Maybe get a serial-to-USB dongle, and see if you can send data to/from the board with your PC/Mac.

Or just get a ton of old back issues of digital circuit hobbyist magazines from the library, and start reading until you start groking it all.

share

You are probably not going to find "strait forward" documentation, because it depends on the operating system, the processor that you are using, the memory map of the given processor and the device that you are using. Since these components can come in any variation I don't believe that any one reference exists.

The manufacture of the device that you are writing the driver for will usually have a document describing how to set the device up including the start up sequence, what the registers mean, what the descriptor layout must be...ect. More often than not peripheral devices sit on the PCI bus, so you are going to have learn how to set that up, which involves an intimate understanding of the processor's memory map. Data transfers are often executed through DMA, so you are going to need to learn about that too. And finally notification of events is usually accomplished through interrupts, so you are going to need to understand how they work and how they are setup on the OS that you are using. The best way start is to look at an example. I am not exactly sure where to to find them, but that would be my suggestion. Perhaps something in the Linux realm.

Also writing a USB driver is not trivial...I would not recommend that as a first project.

share

In order to be anything other than a copy-and-paste device driver developer, one will need to have a firm grasp of computer organization and architecture. These two areas where taught down to the gate level when I was a CS undergraduate. Today, one has to enroll in a computer engineering program at most universities in order to study these topics at the gate level.

Device driver development is about clocking data into/out of a device. A device can be interrupt driven, or it can be polled. Devices can have their own I/O bus, or they can be memory mapped. Debugging a driver for a new device often requires the use of a logic analyzer. Device manufacturers usually include bus timing waveforms with their data sheets. For example, the bus timing waveforms for the Philips ISP1581 USB chip start on page 53 the following PDF: http://www.datasheetsite.com/extpdf.php?q=http%3A%2F%2Fpdfdata.datasheetsite.com%2Fpdf1%2FPhilips%2FISP1581.pdf .

share