How does one being writing a device driver for a piece of hardware?

I mean from an operating system independent rule here.

Say I decide to write a device driver in C/C++ right now for, let's say, an Intel GMA video card.

Where do I start?

Do I study the specifications?

Will I need a vast knowledge of the hardware?

If so, where would I attain this?

Intel has information on how to program for the device, but how do I write a piece of executable software that can enable a SERVICE to a user-level application, and request video memory in a highly-characterized and sufficiently adequate manner how I please?

Would not only low-level programming be essential here, but maybe deeper hardware knowledge on video cards?

I am confused. Do device driver programmers for modern OSes, like Windows and Mac, worry about the driver's necessary performance level, or about understanding it to the full potential for them to use?

Any help would be appreciated.

I mean from an operating system independent rule here.

There's no such thing as an operating system independent device driver. A device driver is the interface between the operating system and the hardware and is therefore specific to an operating system.


Will I need a vast knowledge of the hardware?

You will need a thorough understanding of both the hardware and the specific operating system.


If so, where would I attain this?

I'd suggest starting by studying some of the open source device drivers.
http://malideveloper.arm.com/develop-for-mali/drivers/open-source-mali-gpus-linux-kernel-device-drivers/
http://www.codethink.co.uk/2012/01/23/open-source-graphics-drivers/


Do device driver programmers for modern OSes, like Windows and Mac, worry about the driver's necessary performance level, or about understanding it to the full potential for them to use?

yes and yes.
closed account (zb0S216C)
Lying Cataract wrote:
"Do I study the specifications?"

That would be the smart thing to do. Let's run through a scenario: you've just wrote and compiled a device driver for the Intel GMA video card. You then install the driver only to encounter a error; you've just accessed an address that's deemed protected by the on-board CPU.

Stumped by the error, you begin read the specification for the Intel GMA video card, only to realise that addresses X through to Y are protected and writing to them will cause the CPU to generate an access violation exception. You should've read the specification.

Lying Cataract wrote:
"Will I need a vast knowledge of the hardware?"

You will need to know the architecture of the system you're writing the driver for, yes. Knowledge of bits, bytes, addresses, CPU access modes, etcetera are vital pieces of information. Most information is available all over the net, but for the missing information, you'd need to own a book on computer hardware.

Lying Cataract wrote:
"Intel has information on how to program for the device, but how do I write a piece of executable software that can enable a SERVICE to a user-level application, and request video memory in a highly-characterized and sufficiently adequate manner how I please?"

That depends on the OS and the driver.

Lying Cataract wrote:
"Would not only low-level programming be essential here, but maybe deeper hardware knowledge on video cards?"

Knowledge on how graphics cards work in general would help with a general understanding, but to realise the capabilities of the video card, you'd need to read the manufacturer's specification. If you're writing a device driver for a piece of hardware, you'd better have a good understanding of the target hardware.

Lying Cataract wrote:
"Do device driver programmers for modern OSes, like Windows and Mac, worry about the driver's necessary performance level, or about understanding it to the full potential for them to use?"

Yes. However, driver developers tend to care more about stability than performance since device drivers interact with the OS's kernel. And because the kernel contains sensitive information, one wrong move and you'd bring the machine to its knees, especially with BIOSs (be really careful with these).

Ensure that you're fluent with the following:

1) x86 Assembly
2) C/C++
3) Low-level memory management
4) The target hardware's specification
5) The target OS's kernel architecture and API
6) Interrupt and exception handling (programming-based, but to be specific)

Wazzak
Last edited on
Topic archived. No new replies allowed.