Device drivers are programs that allow your operating system to interact with your computer's hardware. Drivers are necessary for your computer's hardware to function properly. Writing device drivers for your PCI devices requires you to have an understanding of your operating system and your hardware.
Device drivers must be written in the C or C++ programming language. The most appropriate driver module for PCI drivers is the Kernel-Mode Driver Framework (KMDF). Much of the KMDF code resides in the framework requiring very minimal common code for PCI drivers.
Things you need
Windows Driver Kit
Windows debugging tools
C or C++ compiler
Download and install the Windows Drivers Kit (WDK) from Microsoft. A link is provided in the Resources section. The WDK will allow you to develop, compile and debug your drivers before deployment.
Search through the sample code provided with WDK for a driver that is similar to your PCI device. If possible, modify the sample code provided by WDK to your PCI device's specific needs. Modifying the existing sample code will save a lot of time and will prevent you from making numerous coding errors. The sample code can also serve as an educational tool to help you understand what is required to write drivers for Windows.
Compile and build your driver using the build utility that is included with the WDK.
Install a checked system build of Windows for testing and debugging. A checked build is slower than a free build, but it is easy to use and will generate extensive debugging information.
Create an INF file. The INF file contains most of the central information your computer uses to install the driver on your computer.
Test your new driver by installing it on your computer. Check to see if your new driver functions properly or if it causes any system errors.
Debug your new driver using the Driver Verifier. The Driver Verifier will test your driver to see how it performs in extreme and stressful situations.
Things you need
- Windows Driver Kit
- Windows debugging tools
- C or C++ compiler