Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CreateInterrupt method

IWDFDevice3::CreateInterrupt method

The CreateInterrupt method creates a framework interrupt object.

Syntax


HRESULT CreateInterrupt(
  [in]  PWUDF_INTERRUPT_CONFIG *Configuration,
  [out] IWDFInterrupt          **ppInterrupt
);

Parameters

Configuration [in]

A pointer to a WUDF_INTERRUPT_CONFIG structure that was initialized by a call to the WUDF_INTERRUPT_CONFIG_INIT macro.

ppInterrupt [out]

A pointer to a buffer that receives a pointer to the IWDFInterrupt interface for the new interrupt object.

Return value

The method returns S_OK if the operation succeeds. Otherwise, this method returns one of the error codes that are defined in Winerror.h.

Remarks

Your driver must call CreateInterrupt one time for each interrupt vector that its device requires. If the device supports message-signaled interrupts (MSI), the driver must create an interrupt object for each message that the device can support.

Drivers typically call the CreateInterrupt method from an OnDeviceAdd callback function, but can also call this method from IPnpCallbackHardware2::OnPrepareHardware.

After the Plug and Play (PnP) manager assigns system resources to the device, the framework stores information about the device's assigned interrupt resources in the interrupt objects that the driver has created. (Drivers that do not support Plug and Play cannot use interrupt objects.)

The system might not assign all the interrupt resources that a device can support. For example, a driver creates eight interrupt objects for a device that is capable of supporting eight MSI messages. However, the system might assign only one message to the device. In that case, seven of the interrupt objects will be unused.

Typically, your driver should store interrupt-specific information, such as the copied contents of device interrupt registers, in the interrupt object's context space. A driver calls IWDFObject::AssignContext to register a context and to request notification when the object becomes invalid.

UMDF supports level-triggered interrupts starting in Windows 8. If a driver running on an operating system earlier than Windows 8 creates a level-triggered interrupt in OnDeviceAdd, CreateInterrupt succeeds because the operating system has not yet assigned resources. However, when the framework attempts to connect the interrupt later, the device fails to start.

For more information about handling interrupts in UMDF drivers, see Accessing Hardware and Handling Interrupts.

Examples


HRESULT  hr;
IWDFInterrupt* pInterrupt;
WUDF_INTERRUPT_CONFIG  interruptConfig;

WUDF_INTERRUPT_CONFIG_INIT(&interruptConfig,
                           MyInterruptIsr,
                           MyInterruptWorkItem);

hr = pDevice->Create(&interruptConfig, 
                     &pInterrupt);


Requirements

Target platform

Desktop

End of support

Unavailable in UMDF 2.0 and later.

Minimum UMDF version

1.11

Header

Wudfddi.h

DLL

WUDFx.dll

See also

IWDFDevice3
WUDF_INTERRUPT_CONFIG
WUDF_INTERRUPT_CONFIG_INIT

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft