Click to See Complete Forum and Search --> : writing device drivers


biosx
07-09-2001, 08:48 PM
Just out of curiosity, I am wondering if anybody here writes (or knows how to write device drivers).

Where did/do you learn the parameters for each device? What language(s) do you primarily use?

I'm not really saying "teach me how to program device drivers," I'm just most interested on where most people get their info and what programming techniques they use.

Thanks for replying

------------------
## root is the greed of all evil ##

/* Navi Specs */
Abit KT7-RAID
Duron 800 @ 1GHz
Geforce 2 GTS
512MB Micron/Crucial SDRAM
SB Live! 5.1 w/ Live! Drive
Maxtor ATA100 40GB
Pioneer 16x DVD
HP 9300 series CD-RW
Netgear FA311 NIC

Zoma
07-10-2001, 01:01 PM
Well, you need documentation from the hardware manufacturers to write device drivers. Mostly in ASM, possibly C with inline ASM. Programs then access your drivers by calling whatever functions you wrote (eg, if you wrote drivers for a printer, then you may have a "printchar" function, and a program calling it could print one character at a time to your printer).

oefinger
07-10-2001, 02:27 PM
You can write device drivers using C/C++ more easily than in assembly. If you are writing Windows device drivers, you'll need to understand WinAPI (or use MFC) in order to access memory-mapped I/O, which is protected memory in Windows. One exception is the parallel port, LPT1 (usually base address 0x378) which is not protected and can be accessed directly without making Windows calls. Linux is an entirely different beast, but you would definitely want to write drivers in C. I agree with Zoma's comment: you will indeed need to know manufacturer specific details of the hardware in order to write drivers. The whole point of the device driver is to take hardware-independent OS calls (in the case of Windows) and translate them into the proper hardware-level calls to the device.

Ex: Windows may have a call to "write the information stored in buffer x to the printer." The OS calls your driver's "write" function, which then takes care of the hardware specifics of your printer.

You will definitely need to understand Windows API or MFC if you are going to write drivers.

I don't profess to write drivers myself, but I work with some driver gurus and I know this is how they do it.

Good luck,
Oefinger