GPIO-Based Interrupt Resources

Drivers for peripheral devices that send interrupts to general-purpose I/O (GPIO) pins acquire GPIO interrupts as abstract Windows interrupt resources. Kernel-mode driver framework (KMDF) drivers and User-mode driver framework (UMDF) drivers receive these resources through their EvtDevicePrepareHardware event callback functions.

Peripheral device drivers that use GPIO-based interrupt resources can ignore low-level implementation details, such as whether an interrupt is generated by a GPIO pin instead of by an interrupt controller or by an interrupt pin on a processor chip.

A GPIO-based interrupt is a resource of type CmResourceTypeInterrupt. The configuration parameters for this interrupt are contained in the u.Interrupt member of the CM_PARTIAL_RESOURCE_DESCRIPTOR structure that describes the interrupt resource. To connect an interrupt service routine (ISR) to an interrupt, a UMDF or KMDF driver supplies both the raw and translated descriptions of the interrupt resource to an interrupt-creation method.

The KMDF or UMDF driver for a peripheral device calls the WdfInterruptCreate method to connect an ISR to the interrupt from the device. One of the input parameters to this method is a pointer to a WDF_INTERRUPT_CONFIG structure that contains configuration information for the interrupt. For more information, see Handling Hardware Interrupts.

If a peripheral device driver uses more than one GPIO interrupt resource, this driver must be aware of the order in which these resources appear in the raw and translated resource lists that are supplied as input parameters to the EvtDevicePrepareHardware function or OnPrepareHardware method. The resources in these lists appear in the order in which they are described in the platform firmware, which must match the order that is expected by the driver.