Writing WDF Drivers for Windows
The Windows Driver Foundation (WDF) is the latest standard for creating Windows drivers, and is the preferred way to implement most new drivers for Windows.
This seminar is designed for engineers who need to understand how to design, develop, and test Windows drivers using the WDF Kernel Mode Driver Framework (KMDF). The seminar provides the groundwork and concepts for writing any supported type of WDF driver. The seminar specifically focuses on providing practical experience in developing KMDF software drivers, filter drivers, and drivers for USB devices, as well as the basics for writing drivers for programmed I/O (PIO) type devices on PCI/PCI-X/PCI-Express buses is also covered. Once an attendee understands these concepts, creating KMDF drivers for other classes of devices and creating drivers using the User Mode Driver Framework (UMDF) should be relatively easy.
Hardware Included: A valuable part of your learning experience in this course will be the lab exercises targeted for use with the OSR USB FX2 Learning Kit (check out the OSR Online Store for more information. Of course, we want your learning experience to extend beyond the classroom, so each student will walk away with their very own OSR USB FX2 Learning Kit.
Interested in Windows 8 on SoC platforms (Intel or ARM)? Contact us about special offerings focusing on these areas.
Length: 5 days
Format: Lecture and Lab
Cost: $3,425 ($3,950 for non-U.S. locations)
4 week advanced payment -10%; 2 week advanced payment -5%
(contact OSR for previous and multi-student discounts)
Writing WDF Drivers for Windows
7-11 October, 2013
Engineers who need to understand how to design, develop, and test Windows drivers using the Windows Driver Foundation's (WDF) Kernel Mode Driver Framework (KMDF).
Note: Writing WDF Drivers for Windows is most appropriate for developers focused on writing new drivers for which WDF is applicable. Developers who seek a thorough understanding of the workings of the Windows I/O subsystem in preparation for writing non-WDF drivers are strongly urged to attend OSR's Writing WDM Kernel Drivers for Windows seminar instead of this seminar.
Students attending this seminar must have solid knowledge of general operating systems concepts (user mode versus kernel mode, virtual memory concepts, concurrency issues), device concepts (registers, interrupts), and the basics of Windows O/S Architecture. Previous experience developing device drivers (on any operating system) will definitely be an advantage.
Due to the hands-on orientation of this seminar, attendees will be assumed to be able to use Windows at a user level, including using Microsoft's Developer's Studio (VC++). Working knowledge of the C programming language, and how to read and write to a file using Win32 (CreateFile, ReadFile, WriteFile) are also assumed.
Welcome remarks, seminar goals and objectives, and a brief introduction to WDF and KMDF.
- Windows Architecture Overview
A brief review of Windows operating system architecture, focused specifically on the details needed by a KMDF driver writer.
- The Windows Device Tree
A description of how the Windows PnP subsystem discovers and enumerates drivers. All about Physical Device Objects (PDOs), Function Device Objects (FDOs), and filter devices. How filter drivers work their magic. How requests are processed, and passed from driver to driver within the Windows I/O Subsystem.
- Driver Installation
How to create installation control files for KMDF drivers. The Ten Most Frequently Used INF File Sections are discussed. The KMDF Co-Installer, and how to specify it in an INF file, is described.
- The WDF Object Model
WDF object characteristics and taxonomy. How objects are instantiated and used in KMDF. An overview of the most common WDF objects.
- Driver Initialization
How to initialize a KMDF driver and its associated device. Also, handling typical PnP and power management events such as device arrival, power-up, and power-down. How KMDF drivers are notified of and claim their hardware resources.
- Building and Debugging
Using the WDK to build KMDF drivers. How to setup WinDbg, and a brief overview of the WDF Kernel Debugger Extensions (WDFKD), including retrieving the WDF Log from the "in flight recorder." Also a discussion of various driver debugging tools relevant to WDF drivers (Driver Verifier, Static Driver Verifier, PREfast for Drivers).
- Lab: Building and Debugging, Driver Initialization (DriverEntry, EvtDeviceD0Entry, etc.).
- Interrupt Levels & DPCs
In this module, we discuss the all-important concept of Interrupt Request Levels (IRQLs), and the specific uses that Windows makes of various IRQLs. We also discuss Deferred Procedure Calls (DPCs) and how they're used in Windows for Interrupt Service Routine completion (DPCforISR).
- Queues and Requests
In this section, we discuss WDFQUEUEs and WDFREQUESTS. Topics include how Queues are instantiated, Queue dispatch types, and how Queues can be used to sort Requests. We also discuss Framework Requests and how Requests are processed and completed.
- Buffer Methods and Device Controls
In this section, the different ways that requestor data buffers can be described are discussed. Direct I/O, Buffered I/O and "Neither I/O" are described, compared, and contrasted. Also discussed is how to define custom Device IO Control Codes (IOCTLs), and how the previously described buffering methods apply to IOCTLs.
- Case Study 1: Programmed I/O (PCI/PCI-Express) Devices
Drawing on all the information presented in the seminar to this point, this section describes the details of how PIO type devices are supported. Discussions about PnP and Power management for these types of devices, and code walk through of significant functions including ISR and DPC are included.
- Lab: Request Processing and Completion, Filtering
- I/O Targets
Local, Remote, and Special I/O Targets are discussed. How to forward Requests both synchronously and asynchronously to other drivers in the system for processing. Completion routines are also covered.
- Case Study 2: USB Concepts
The basics of USB are discussed including device, configuration, and interface descriptors. Endpoints and pipes are described.
- Case Study 2 (continued): Implementing WDF USB Drivers
In this section, we describe how USB drivers are implemented in KMDF. This includes how a configuration and interface is chosen, and how endpoints are retrieved. How to send vendor commands to a device via Endpoint 0. Using Bulk and Interrupt endpoints. The WDF Continuous Reader is briefly discussed, as is supporting Selective Suspend (USB device power management).
- Lab: USB, Using the OSR USB-FX2 device
In this module, we discuss issues relating to synchronizing access to shared data from within your driver. The much misunderstood topic of KMDF Synchronization Scope is fully described, as is extending sync scope to other callback routines via the Automatic Serialization parameter. WDFSPINLOCKs and WDFWAITLOCKs are discussed, along with the underlying implementations of each and how they're used.
- Cleanup, Close and Cancel
Strategies for handling queued and in-progress requests are discussed, as what processing typically takes place as part of cleanup and close processing.
- Helpful Classes
A brief description of a few Framework classes such as WDFCOLLECTION, WDFWORKITEM, and WDFTIMER that might be useful additions to your "bag of tricks."
- Lab: USB continued, Open/Close processing
More on Seminars
Interested in Win8 on ARM or SoC?
We offer private presentations, at your location or ours, of our Writing WDF Drivers for Windows seminar focused specifically on Windows 8 running on System on Chip (SoC) systems (Intel or ARM). These custom seminar presentations include coverage of the unique role of ACPI on these systems as well as writing drivers for devices connected to I2C, SPI, and GPIO controllers. OSR has experience delivering this training for organizations world-wide that are gearing up for Windows 8 and the new types of devices it is expected to support. An added bonus of arranging this type of private seminar presentation is that we can customize the seminar content to meet your team's specific background and needs. For more information, including the specialized syllabus and cost information, please contact an OSR seminar coordinator.