Re: WDF - how to share interrupt between two driver those are in the same stack?
- From: "Doron Holan [MSFT]" <doronh@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 20 Feb 2008 10:38:26 -0800
1) if you want to control the interrupts connected state, you can do this. do not create a WDFINTERRUPT and then you can connect/disconnect however you choose
2) you can assign your own resources to child devices. this requires internal interfaces which are not exposed to KMDF or though KMDF. instead you need to create a private interface to query for the interrupt resources and assign them through this private interface, this article http://blogs.msdn.com/doronh/archive/2007/10/24/how-to-share-hw-resources-with-another-driver-not-in-the-same-pnp-hierarchy.aspx talks about the basic principles, although there are things you do not need to worry about like the interrupt resource going away before the child
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"?????" <ZivHuang@xxxxxxxxx> wrote in message news:cd6eec86-218b-4fac-999f-211ff514c11a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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:
- References:
- Prev by Date: Re: Windows WDK Download
- Next by Date: Re: Windows WDK Download
- Previous by thread: Re: WDF - how to share interrupt between two driver those are in the same stack?
- Next by thread: Re: WDF - how to share interrupt between two driver those are in the same stack?
- Index(es):
Relevant Pages
|