Есть драйвер PCI устройства (под WIN2000) работает без проблем. А под XP на некоторых материнках не хочет писать в регистры PCI.
Причем когда только проинсталируешь драйвер все работает. Только перегрузишь машину все уже не работает. (Удалишь драйвер из системы заново поставишь все ОК работает. А если Отключить включить не помогает) На машине 256М ОЗУ. Добовляешь до 512 тоже все ОК. Не могу понять в чем может быть дело.
Вот куски кода (Подключения ресурсов Numega сгенерила):
irpStack = IoGetCurrentIrpStackLocation(Irp);
// Do whatever initialization needed when starting the device:
// gather information about it, update the registry, etc.
// At this point, the lower level drivers completed the IRP
if ((irpStack->Parameters.StartDevice.AllocatedResources != NULL) &&
(irpStack->Parameters.StartDevice.AllocatedResourcesTranslated != NULL))
{
// Parameters.StartDevice.AllocatedResources points to a
// CM_RESOURCE_LIST describing the hardware resources that
// the PnP Manager assigned to the device. This list contains
// the resources in raw form. Use the raw resources to program
// the device.
partialResourceList =
&irpStack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList;
resource = &partialResourceList->PartialDescriptors[0];
// Parameters.StartDevice.AllocatedResourcesTranslated points
// to a CM_RESOURCE_LIST describing the hardware resources that
// the PnP Manager assigned to the device. This list contains
// the resources in translated form. Use the translated resources
// to connect the interrupt vector, map I/O space, and map memory.
partialResourceListTranslated =
&irpStack->Parameters.StartDevice.AllocatedResourcesTranslated->List[0].PartialResourceList;
resourceTrans = &partialResourceListTranslated->PartialDescriptors[0];
// reset the total memory range count
memCount = 0;
// search the resources
for (ii = 0;
ii < partialResourceList->Count;
++ii, ++resource, ++resourceTrans)
{
switch (resource->Type)
{
case CmResourceTypePort:
DebugPrint(DBG_PNP, DBG_INFO, "Resource Type Port");
DebugPrint(DBG_PNP, DBG_INFO, "Port.Start %I64x", resource->u.Port.Start.QuadPart);
DebugPrint(DBG_PNP, DBG_INFO, "Port.Length %x", resource->u.Port.Length);
break;
case CmResourceTypeMemory:
DebugPrint(DBG_PNP, DBG_TRACE, "Resource Type Memory");
DebugPrint(DBG_PNP, DBG_TRACE, "Memory.Start %I64x", resource->u.Memory.Start.QuadPart);
DebugPrint(DBG_PNP, DBG_TRACE, "Memory.Length %x", resource->u.Memory.Length);
switch (memCount)
{
case 0:
if (resourceTrans->Type == CmResourceTypeMemory)
{
DeviceExtension->bm_MemoryRangeIsIo = FALSE;
DeviceExtension->bm_MemoryRangeMapped = TRUE;
DeviceExtension->m_MemoryRangeLength = resourceTrans->u.Memory.Length;
DeviceExtension->m_MemoryRangeBase = (PUCHAR)MmMapIoSpace(
resourceTrans->u.Memory.Start,
resourceTrans->u.Memory.Length,
MmNonCached
);
}
else
{
ASSERT(resourceTrans->Type == CmResourceTypePort);
DeviceExtension->bm_MemoryRangeIsIo = TRUE;
DeviceExtension->m_MemoryRangeLength = resourceTrans->u.Port.Length;
DeviceExtension->bm_MemoryRangeMapped = (resourceTrans->Flags & CM_RESOURCE_PORT_IO) == 0;
if (DeviceExtension->bm_MemoryRangeMapped)
{
DeviceExtension->m_MemoryRangeBase = (PUCHAR)MmMapIoSpace(
resourceTrans->u.Port.Start,
resourceTrans->u.Port.Length,
MmNonCached
);
}
else
{
DeviceExtension->m_MemoryRangeBase = (PUCHAR)resourceTrans->u.Port.Start.QuadPart;
}
}
break;
default:
DebugPrint(DBG_PNP, DBG_INFO, "Extra Memory Range");
break;
}
++memCount;
break;
case CmResourceTypeInterrupt:
DebugPrint(DBG_PNP, DBG_TRACE, "Resource Type Interrupt");
DebugPrint(DBG_PNP, DBG_TRACE, "Interrupt.Level %x", resourceTrans->u.Interrupt.Level);
DebugPrint(DBG_PNP, DBG_TRACE, "Interrupt.Vector %x", resourceTrans->u.Interrupt.Vector);
DebugPrint(DBG_PNP, DBG_TRACE, "Interrupt.Affinity %x\n", resourceTrans->u.Interrupt.Affinity);
DeviceExtension->InterruptVector = resourceTrans->u.Interrupt.Vector;
DeviceExtension->InterruptLevel = (KIRQL)resourceTrans->u.Interrupt.Level;
DeviceExtension->InterruptAffinity = resourceTrans->u.Interrupt.Affinity;
DeviceExtension->bInterruptShared = resourceTrans->ShareDisposition == CmResourceShareShared;
DeviceExtension->InterruptMode =
(resourceTrans->Flags == CM_RESOURCE_INTERRUPT_LATCHED) ? Latched : LevelSensitive;
break;
default:
DebugPrint(DBG_PNP, DBG_TRACE, "Unknown Resource Type %x", resourceTrans->Type);
break;
}
}
}
Таким образом пишу:
if (DeviceExtension->bm_MemoryRangeIsIo) {
WRITE_PORT_ULONG((PULONG)(DeviceExtension->m_MemoryRangeBase+MyAddr),Value);
} else {
WRITE_REGISTER_ULONG((PULONG)(DeviceExtension->m_MemoryRangeBase+MyAddr),Value);
}
Помогите пожалуйста