Bewerken

Delen via


WdfInterruptSetPolicy function (wdfinterrupt.h)

[Applies to KMDF and UMDF]

The WdfInterruptSetPolicy method specifies the interrupt priority, processor affinity, and affinity policy for a specified interrupt.

Syntax

void WdfInterruptSetPolicy(
  [in] WDFINTERRUPT           Interrupt,
  [in] WDF_INTERRUPT_POLICY   Policy,
  [in] WDF_INTERRUPT_PRIORITY Priority,
  [in] KAFFINITY              TargetProcessorSet
);

Parameters

[in] Interrupt

A handle to a framework interrupt object.

[in] Policy

A WDF_INTERRUPT_POLICY-typed enumerator that specifies a processor affinity policy for the interrupt.

[in] Priority

A WDF_INTERRUPT_PRIORITY-typed enumerator that specifies a priority for the interrupt.

[in] TargetProcessorSet

A KAFFINITY-typed value that specifies a processor affinity for the interrupt, if the Policy parameter is set to WdfIrqPolicySpecifiedProcessors.

Return value

None

Remarks

A bug check occurs if the driver supplies an invalid object handle.

Windows Vista and later versions of the operating system allow drivers to specify an interrupt's priority, processor affinity, and affinity policy. For information about how to use the registry to override the values that WdfInterruptSetPolicy sets, see Interrupt Affinity and Priority.

If a driver is running on an operating system version that is earlier than Windows Vista, the framework ignores the values that the driver specifies when it calls WdfInterruptSetPolicy.

For more information about registry values and INF sections that specify an interrupt's priority, processor affinity, and affinity policy, see Interrupt Affinity and Priority.

If a driver calls WdfInterruptSetPolicy, it typically does so in its EvtDriverDeviceAdd callback function, after calling WdfInterruptCreate.

If your driver creates interrupts in EvtDevicePrepareHardware, do not use WdfInterruptSetPolicy or WdfInterruptSetExtendedPolicy. Instead, apply policy in EvtDeviceFilterAddResourceRequirements, by directly manipulating the interrupt resource requirement that this callback function receives in its IoResourceRequirementsList parameter.

For more information about handling interrupts in framework-based drivers, see Handling Hardware Interrupts.

Examples

The following code example assigns a device interrupt to processor 0, with normal priority.

#define AFFINITY_MASK(n) ((ULONG_PTR)1 << (n))

WdfInterruptSetPolicy(
                      Interrupt,
                      WdfIrqPolicySpecifiedProcessors,
                      WdfIrqPriorityNormal,
                      AFFINITY_MASK(0)
                      );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfinterrupt.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <=DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf)

See also

EvtDriverDeviceAdd

WdfInterruptCreate

WdfInterruptSetExtendedPolicy