SoundConnectInterrupt

NTSTATUS
SoundConnectInterrupt(
IN ULONG
InterruptNumber,
IN INTERFACE_TYPE
BusType,
IN ULONG
BusNumber,
IN PKSERVICE_ROUTINE
Isr,
IN PVOID
ServiceContext,
IN KINTERRUPT_MODE
InterruptMode,
IN BOOLEAN
ShareVector,
OUT PKINTERRUPT
*Interrupt
);

The SoundConnectInterrupt function creates an interrupt object and installs an interrupt handler.

Parameters

InterruptNumber

Interrupt number.

BusType

Bus type. INTERFACE_TYPE is defined in ntddk.h.

BusNumber

Bus number, as returned from SoundGetBusNumber.

Isr

Pointer to an interrupt service routine (ISR). PKSERVICE_ROUTINE is defined in ntddk.h as follows:

typedef BOOLEAN

(*PKSERVICE_ROUTINE) (

IN struct _KINTERRUPT *Interrupt,

IN PVOID ServiceContext

);

ServiceContext

Pointer to driver-specified information that is passed to the ISR.

InterruptMode

Interrupt mode (Latched or LevelSensitive). KINTERRUPT_MODE is defined in ntddk.h.

ShareVector

TRUE if interrupt is shareable, FALSE otherwise.

Interrupt

Pointer to one or more system-defined interrupt objects in nonpaged memory.

Return Value

Returns one of the following values.

Value Definition
STATUS_SUCCESS Operation succeeded.
STATUS_DEVICE_CONFIGURATION_ERROR Improper input parameter.
STATUS_INSUFFICIENT_RESOURCES Insufficient system resources.

Comments

Interrupt objects are of type _KINTERRUPT. These are a system-defined type that your driver doesn't reference directly. Save the interrupt object pointer received in Interrupt, because it must be passed as input to KeSynchronizeExecution.

The ISR is responsible for clearing device interrupts. The HAL handles controller interrupts. After interrupts are cleared, the ISR should call IoRequestDPC to queue a deferred procedure call to the DPC function pointed to by the DeferredRoutine member of the SOUND_DEVICE_INIT structure. The DPC function should finish processing the interrupt.

Prior to being unloaded, the driver must release the interrupt objects by calling IoDisconnectInterrupt.

For discussions of interrupt objects and deferred procedure calls, see the Kernel-Mode Drivers Design Guide.