WDF - how to share interrupt between two driver those are in the same stack?
- From: "泛若不繫舟" <ZivHuang@xxxxxxxxx>
- Date: Wed, 20 Feb 2008 06:09:43 -0800 (PST)
Hi all,
I have a PCI card and I need to create a KMDF bus driver and create a
static KMDF child driver above that bus driver.
The bus driver can get hardware resources and the WDF automatically
connects and disconnects interrupts for the driver .
In the WDM, I can create a IOCTL to get interrupt resource from bus
driver and connect/disconnect the interrupt in the child driver.
I have no idea how to do that in WDF, because WDF will do that
automatically. My KMDF child driver never get any hardware resouces
when loaded.
I try this method below, but it can't work. The child report there is
no available resources and fail to load the driver.
May you hlep me? Thanks. ^_^
Step1:
Copy the CM_PARTIAL_RESOURCE_DESCRIPTOR about interrupt into the bus
driver's device extension.
Step2:
//----------------------------------------------------------------------
// When the bus driver create PDO for that child
//----------------------------------------------------------------------
WDF_PDO_EVENT_CALLBACKS_INIT(&pdoCallbacks);
pdoCallbacks.EvtDeviceResourceRequirementsQuery =
BusPdo_EvtDeviceResourceRequirementsQuery;
WdfPdoInitSetEventCallbacks(pDeviceInit, &pdoCallbacks);
Step3
In the BusPdo_EvtDeviceResourceRequirementsQuery function,
I try to copy the interrupt resource from step 2. Like this
//-----------------------------------------------------------------------
NTSTATUS status = STATUS_SUCCESS;
WDFIORESLIST logConfig;
IO_RESOURCE_DESCRIPTOR descriptor;
status = WdfIoResourceListCreate(
IoResourceRequirementsList,
WDF_NO_OBJECT_ATTRIBUTES,
&logConfig
);
if(!NT_SUCCESS(status)){
return status;
}
RtlZeroMemory(&descriptor, sizeof(descriptor));
descriptor.Option = 0;
descriptor.Type = CmResourceTypeInterrupt;
descriptor.ShareDisposition = CmResourceShareShared
descriptor.Flags= RESOURCE_INTERRUPT_LEVEL_SENSITIVE
descriptor.u.Interrupt.MinimumVector =
fdoData->InterruptDescriptor.u.Interrupt.Vector;
descriptor.u.Interrupt.MaximumVector =
fdoData->InterruptDescriptor.u.Interrupt.Vector;
descriptor.u.Interrupt.TargetedProcessors=
fdoData->InterruptDescriptor.u.Interrupt.Affinity;
descriptor.u.Interrupt.AffinityPolicy= IrqPolicyMachineDefault;
descriptor.u.Interrupt.PriorityPolicy = IrqPriorityUndefined;
status = WdfIoResourceListAppendDescriptor(logConfig, &descriptor);
if(!NT_SUCCESS(status)){
return status;
}
status = WdfIoResourceRequirementsListAppendIoResList(
IoResourceRequirementsList,
logConfig
);
status = WdfIoResourceListAppendDescriptor(logConfig, &descriptor);
if(!NT_SUCCESS(status)){
return status;
}
return status;
.
- Follow-Ups:
- Re: WDF - how to share interrupt between two driver those are in the same stack?
- From: Doron Holan [MSFT]
- Re: WDF - how to share interrupt between two driver those are in the same stack?
- From: Don Burn
- Re: WDF - how to share interrupt between two driver those are in the same stack?
- Prev by Date: Re: Never seen a driver that uses a KSEMAPHORE ???
- Next by Date: Re: WDF - how to share interrupt between two driver those are in the same stack?
- Previous by thread: Re: Windows WDK Download
- Next by thread: Re: WDF - how to share interrupt between two driver those are in the same stack?
- Index(es):
Relevant Pages
|