L
Lokesh Venkataramappa
Guest
Hello All
I am working on Intel E3900 apollo lake based processor. Where I am running a KMDF driver on Windows IOT Core OS.
Using KMDF I am trying to access Hardware resources using MmMapIoSpace(); APIs. However "wdfcmresourcelistgetcount" function call returning a ZERO. I have created a PnPCallback for PrepareHardware function and calling the wdfcmresourcelistgetcount function. Below is the code snippet, can someone point what I am doing wrong.
NTSTATUS
USBDriver1EvtDevicePrepareHardware(
_In_ WDFDEVICE Device,
_In_ WDFCMRESLIST ResourcesRaw,
_In_ WDFCMRESLIST ResourcesTranslated
)
{
NTSTATUS Status;
ULONG ResCount;
ULONG ResIndex;
PCONTROLLER_CONTEXT ControllerContext;
BOOLEAN MemoryResourceMapped;
PAGED_CODE();
// TraceEntry();
//TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");
ControllerContext = DeviceGetControllerContext(Device);
MemoryResourceMapped = FALSE;
ResCount = WdfCmResourceListGetCount(ResourcesRaw);
ResCount1 = WdfCmResourceListGetCount(ResourcesTranslated);
Status = STATUS_SUCCESS;
for (ResIndex = 0; ResIndex < ResCount; ResIndex++) {
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorRaw;
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorTranslated;
ResourceDescriptorRaw = WdfCmResourceListGetDescriptor(
ResourcesRaw,
ResIndex);
switch (ResourceDescriptorRaw->Type) {
case CmResourceTypeMemory:
if (MemoryResourceMapped == FALSE) {
MemoryResourceMapped = TRUE;
Status = RegistersCreate(Device, ResourceDescriptorRaw);
// CHK_NT_MSG(Status, "Failed to read the HW registers");
}
break;
case CmResourceTypeInterrupt:
ResourceDescriptorTranslated = WdfCmResourceListGetDescriptor(
ResourcesTranslated,
ResIndex);
/* Status = InterruptCreate(
Device,
ResourceDescriptorRaw,
ResourceDescriptorTranslated);*/
// CHK_NT_MSG(Status, "Failed to create WDFINTERRUPT object");
break;
default:
break;
}
}
NT_ASSERT(ControllerContext->DeviceInterrupt != NULL);
//End:
// TraceExit();
return STATUS_SUCCESS;
}
Looking forward to get the solution
Thank you & Regards
Lokesh
Continue reading...
I am working on Intel E3900 apollo lake based processor. Where I am running a KMDF driver on Windows IOT Core OS.
Using KMDF I am trying to access Hardware resources using MmMapIoSpace(); APIs. However "wdfcmresourcelistgetcount" function call returning a ZERO. I have created a PnPCallback for PrepareHardware function and calling the wdfcmresourcelistgetcount function. Below is the code snippet, can someone point what I am doing wrong.
NTSTATUS
USBDriver1EvtDevicePrepareHardware(
_In_ WDFDEVICE Device,
_In_ WDFCMRESLIST ResourcesRaw,
_In_ WDFCMRESLIST ResourcesTranslated
)
{
NTSTATUS Status;
ULONG ResCount;
ULONG ResIndex;
PCONTROLLER_CONTEXT ControllerContext;
BOOLEAN MemoryResourceMapped;
PAGED_CODE();
// TraceEntry();
//TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");
ControllerContext = DeviceGetControllerContext(Device);
MemoryResourceMapped = FALSE;
ResCount = WdfCmResourceListGetCount(ResourcesRaw);
ResCount1 = WdfCmResourceListGetCount(ResourcesTranslated);
Status = STATUS_SUCCESS;
for (ResIndex = 0; ResIndex < ResCount; ResIndex++) {
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorRaw;
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorTranslated;
ResourceDescriptorRaw = WdfCmResourceListGetDescriptor(
ResourcesRaw,
ResIndex);
switch (ResourceDescriptorRaw->Type) {
case CmResourceTypeMemory:
if (MemoryResourceMapped == FALSE) {
MemoryResourceMapped = TRUE;
Status = RegistersCreate(Device, ResourceDescriptorRaw);
// CHK_NT_MSG(Status, "Failed to read the HW registers");
}
break;
case CmResourceTypeInterrupt:
ResourceDescriptorTranslated = WdfCmResourceListGetDescriptor(
ResourcesTranslated,
ResIndex);
/* Status = InterruptCreate(
Device,
ResourceDescriptorRaw,
ResourceDescriptorTranslated);*/
// CHK_NT_MSG(Status, "Failed to create WDFINTERRUPT object");
break;
default:
break;
}
}
NT_ASSERT(ControllerContext->DeviceInterrupt != NULL);
//End:
// TraceExit();
return STATUS_SUCCESS;
}
Looking forward to get the solution
Thank you & Regards
Lokesh
Continue reading...