NdisMRegisterInterrupt

This function sets up a mapping between a network adapter driver's MiniportISR and MiniportHandleInterrupt functions, already registered with NdisMRegisterMiniport, and the bus-relative vector and level on which its network adapter interrupts.

NDIS_STATUS NdisMRegisterInterrupt(
OUT PNDIS_MINIPORT_INTERRUPT Interrupt, 
IN NDIS_HANDLE MiniportAdapterHandle, 
IN UINT InterruptVector, 
IN UINT InterruptLevel, 
IN BOOLEAN RequestIsr, 
IN BOOLEAN SharedInterrupt, 
IN NDIS_INTERRUPT_MODE InterruptMode );

Parameters

  • Interrupt
    Pointer to caller-allocated resident memory containing an opaque interrupt object, which this function initializes and for which it returns a handle that the miniport uses in subsequent calls to the NdisMSynchronizeWithInterrupt function.
  • MiniportAdapterHandle
    Handle input to the MiniportInitialize function.
  • InterruptVector
    Specifies the bus-relative vector number used by the network adapter.
  • InterruptLevel
    Specifies the bus-relative DIRQL for the interrupt. This value is almost always the same as that of InterruptVector.
    Note This parameter is not used in Windows CE.
  • RequestIsr
    Specifies TRUE if the MiniportISR function should be called each time the network adapter interrupts. If the network adapter can share an interrupt with other devices on the I/O bus, this parameter must be set to TRUE.
  • SharedInterrupt
    Specifies TRUE if other devices on the I/O bus can use this interrupt line. If this parameter is set to FALSE and another device has already claimed the specified interrupt vector in the registry, this function fails.
  • InterruptMode
    Specifies the type of interrupt that the network adapter generates as one of the following values:
    Value Description
    NdisInterruptLatched Interrupts are triggered by a transition from low to high on the interrupt line.
    NdisInterruptLevelSensitive Interrupts are active as long as the interrupt line is asserted.

Return Values

Returns one of the following values:

  • NDIS_STATUS_SUCCESS
    NDIS initialized the interrupt object and returned a valid Interrupt handle, claimed hardware resources in the registry for the network adapter, such as the specified vector if the network adapter does not share an IRQ, and set up the MiniportISR or MiniportDisableInterrupt and associated MiniportHandleInterrupt functions to be called when an interrupt occurs as requested in the call to this function.
  • NDIS_STATUS_RESOURCE_CONFLICT
    An attempt to claim the vector or level in the registry has failed, possibly because another driver already claimed the interrupt for its device. This function logs an error if this occurs.
  • NDIS_STATUS_RESOURCES
    NDIS could not allocate sufficient memory to claim resources in the registry for the network adapter.
  • NDIS_STATUS_FAILURE
    The attempt to initialize the interrupt object failed, possibly due to another driver's prior claim on the InterruptVector or InterruptLevel in the registry.

Remarks

An network adapter driver must call this function from its MiniportInitialize function if its network adapter generates interrupts. The driver of a network adapter that does not generate interrupts calls the NdisMInitializeTimer and NdisMSetPeriodicTimer functions instead of this function.

MiniportInitialize must call NdisMSetAttributes or NdisMSetAttributesEx before calling this function.

MiniportInitialize obtains the bus-relative values passed to this function either from the registry or by calling a bus-type-specific NdisXXX configuration function.

If its call to this function fails, MiniportInitialize releases all resources that it already allocated for its network adapter, and then fails initialization for that network adapter.

When interrupts are enabled on the network adapter, a driver's MiniportISR function can be called at any time following a successful call to this function, even during initialization. Such a driver's MiniportInitialize function should not call this function until it has set up all state that the driver needs to handle an interrupt. The MiniportHandleInterrupt function is not queued for subsequent execution if the driver's MiniportInitialize function is currently executing and an interrupt occurs.

Whether a miniport with an ISR sets RequestIsr to TRUE when it calls this function or not, NDIS acknowledges the interrupt to the operating system so that interrupts from other devices are not blocked.

If a miniport sets RequestIsr to TRUE when it calls this function, it must dismiss the interrupt on its network adapter by setting the state of the network adapter so that it no longer asserts the interrupt. Interrupts can remain enabled on the network adapter following the dismissal of the interrupt, or they can be disabled, depending on the design of the driver. The timing of such a dismissal depends on the InterruptMode specified when the driver calls this function, as follows:

  • For NdisInterruptLevelSensitive interrupts, MiniportISR must dismiss each interrupt as its network adapter generates that interrupt. Otherwise, the interrupt is reasserted on the network adapter as soon as MiniportISR returns control. If MiniportISR determines that the network adapter did not generate a particular interrupt, it returns control with FALSE as soon as possible so that the ISRs for other devices on the same bus can be called promptly to dismiss the interrupt on the device that actually generated that interrupt.
  • For NdisInterruptLatched interrupts, dismissing an interrupt on the network adapter is not as time-critical as it is for shared interrupts. If the miniport is designed so that each call to MiniportISR causes a subsequent call to the associated MiniportHandleInterrupt function, MiniportHandleInterrupt dismisses the interrupt on the network adapter. As an alternative, such a driver can set RequestIsr to FALSE when it calls this function and supply a MiniportDisableInterrupt function, which is called instead of MiniportISR, unless MiniportHalt or MiniportInitialize is currently executing.

When a miniport supports full-duplex sends and receives, NDIS serializes calls to its MiniportISR or MiniportDisableInterrupt function for sends. NDIS separately serializes calls to its MiniportISR or MiniportDisableInterrupt function for all other operations that can cause an interrupt. Calls to the MiniportReset function are both synchronized and synchronous; NDIS prevents all other code paths in a full-duplex miniport from being entered while a device-reset operation is occurring.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Ndis.h   Ndislib.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

MiniportDisableInterrupt, MiniportHalt, MiniportHandleInterrupt, MiniportISR, MiniportReset, NdisMDeregisterInterrupt, NdisMInitializeTimer, NdisMPciAssignResources, NdisMRegisterMiniport, NdisMSetAttributes, NdisMSetAttributesEx, NdisMSetPeriodicTimer, NdisMSynchronizeWithInterrupt, NdisOpenConfiguration, NdisReadPciSlotInformation

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.