DPC crashing in NT4 legacy driver



I guess I'm thick here...

I'm trying to get the simplest possible DPC to run from an ISR without
crashing the system. My only purpose is to be able to test the hardware
we have built (PCI card).

I can handle interrupts OK and acknowledge them in the hardware in my
ISR. However when I try to call a DPC the system (XP SP2) reboots.

The DPC looks like this:
VOID TcmDpcRoutine(IN PKDPC Dpc, IN PDEVICE_OBJECT DeviceObject, IN
PIRP Irp, IN PVOID Context)
{
DbgPrint(DBG_MSG_HDR ": Dpc !!!!!!!!!!!!!!!!!!!!!!");
return;
}

The ISR looks like this:
BOOLEAN TcmInterruptServiceRoutine(IN PKINTERRUPT Interrupt, IN OUT
PVOID Context )
{
PTCM_DEVICE_EXTENSION deviceExtension = Context;
PDEVICE_OBJECT deviceObject = deviceExtension->DeviceObject;
TCM_REGISTERS *pRegisters = deviceExtension->pRegisters;
DbgPrint(DBG_MSG_HDR ": InterruptServiceRoutine - Got one!\n");

// Verify in our Interrupt Status Register we interrupted
if (not our interrupt)
{
return FALSE;
}

// Clear all active the interrupts in our hardware registers

IoRequestDpc(deviceObject, NULL, NULL);

return TRUE;
}

My interrrupt setup routine, called from DriverEntry():

NTSTATUS TcmSetupISR(PDEVICE_OBJECT deviceObject,
ULONG BusNumber,
ULONG interruptLine )
{
PTCM_DEVICE_EXTENSION deviceExtension = NULL;
NTSTATUS ioConnectStatus = 0;
KIRQL Irql = 0;
ULONG MappedSysVect = 0;

deviceExtension = deviceObject->DeviceExtension;

// register DPC routine
IoInitializeDpcRequest(deviceObject, TcmDpcRoutine);

//Get a mapped vector for our interrupt
MappedSysVect = HalGetInterruptVector(PCIBus,
BusNumber,
deviceExtension->Level,
deviceExtension->Vector,
&Irql,
&deviceExtension->Affinity);

KeInitializeSpinLock( &deviceExtension->ISRSpinLock);

// connect the device driver to the IRQ
ioConnectStatus =
IoConnectInterrupt(&deviceExtension->InterruptObject,
TcmInterruptServiceRoutine,
deviceExtension,

&deviceExtension->ISRSpinLock,
MappedSysVect,
Irql,
Irql,
LevelSensitive,
TRUE,
deviceExtension->Affinity,
FALSE
);

return ioConnectStatus;
}

I have no #pragma alloc_text statements so I believe all code will
remain resident.
Can anybody tell me what I am doing wrong?

Thanks

.



Relevant Pages

  • RE: DPC/ISR synchronization (windows ce)
    ... > the device's interrupt should be disabled in the ISR and enabled in the DPC. ... threads with lesser priority. ...
    (microsoft.public.development.device.drivers)
  • Re: receiving packets on multiprocessor machine
    ... there is absolutely no way to retrieve this info. ... Network card interrupt can hardly qualify for being either fixed or SMI ... they are dispensed to the least busy CPU ... KeSetTargetProcessorDpc(), it will run on the CPU that inserts DPC into ...
    (microsoft.public.development.device.drivers)
  • Re: Interrupts are not coming sometime in NIC miniport
    ... An ISR should do only what is absolutely necessary, ... This is usually done by reading some interrupt register on the ... The DPC then does all the real work. ... Fill up blob with data from the NICs data buffers. ...
    (microsoft.public.development.device.drivers)
  • Re: receiving packets on multiprocessor machine
    ... when using KeSetTargetProcessorDpc() ... Network card interrupt can hardly qualify for being either fixed or SMI ... they are dispensed to the least busy CPU ... KeSetTargetProcessorDpc(), it will run on the CPU that inserts DPC into ...
    (microsoft.public.development.device.drivers)
  • Re: Interrupts are not coming sometime in NIC miniport
    ... Is this HandleInterrupt routine your ISR or your DPC? ... After this the ISR should return because it has nothing else to do. ... Is this interrupt for me? ...
    (microsoft.public.development.device.drivers)