WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
-
+
/* Stage 1: Coarse calibration */
-
+
WaitFor8254Wraparound();
-
+
delay_count = 1;
-
+
do {
delay_count <<= 1; /* Next delay count to try */
WaitFor8254Wraparound();
-
+
__StallExecutionProcessor(delay_count); /* Do the delay */
-
+
CurCount = Read8254Timer();
} while (CurCount > LATCH / 2);
-
+
delay_count >>= 1; /* Get bottom value for delay */
-
+
/* Stage 2: Fine calibration */
-
+
calib_bit = delay_count; /* Which bit are we going to test */
-
+
for(i=0;i<PRECISION;i++) {
calib_bit >>= 1; /* Next bit to calibrate */
if(!calib_bit) break; /* If we have done all bits, stop */
-
+
delay_count |= calib_bit; /* Set the bit in delay_count */
-
+
WaitFor8254Wraparound();
-
+
__StallExecutionProcessor(delay_count); /* Do the delay */
-
+
CurCount = Read8254Timer();
if (CurCount <= LATCH / 2) /* If a tick has passed, turn the */
delay_count &= ~calib_bit; /* calibrated bit back off */
}
-
+
/* We're finished: Do the finishing touches */
delay_count /= (MILLISEC / 2); /* Calculate delay_count for 1ms */
}
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition =
CmResourceShareUndetermined;
- Ptr = (char *)(((PVOID)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[0]) +
+ Ptr = (char *)(((ULONG_PTR)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[0]) +
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
/* Set instalation check data */
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
/* Get pointer to geometry data */
- DiskGeometry = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+ DiskGeometry = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
/* Get the disk geometry */
ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
Identifier[17] = '-';
Identifier[18] = 'A';
Identifier[19] = 0;
- DbgPrint((DPRINT_HWDETECT, "Identifier: %xsn", Identifier));
+ DbgPrint((DPRINT_HWDETECT, "Identifier: %x\n", Identifier));
/* Set identifier */
Error = RegSetValue(DiskKey,
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
/* Get harddisk Int13 geometry data */
- Int13Drives = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+ Int13Drives = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
for (i = 0; i < DiskCount; i++)
{
if (MachDiskGetDriveGeometry(0x80 + i, &Geometry))
PUSHORT SegPtr = (PUSHORT)0x7A;
PUSHORT OfsPtr = (PUSHORT)0x78;
- return (PVOID)(((ULONG)(*SegPtr)) << 4) + (ULONG)(*OfsPtr);
+ return (PVOID)((ULONG_PTR)(((ULONG)(*SegPtr)) << 4) + (ULONG)(*OfsPtr));
}
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_FLOPPY_DEVICE_DATA);
- FloppyData = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+ FloppyData = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
FloppyData->Version = 2;
FloppyData->Revision = 0;
FloppyData->MaxDensity = MaxDensity[FloppyType];
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
- KeyboardData = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+ KeyboardData = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
KeyboardData->Version = 0;
KeyboardData->Revision = 0;
KeyboardData->Type = 4;
/* Set 'Identifier' value */
strcpy(Buffer,
"PCAT_ENHANCED");
- Error = RegSetValue(ControllerKey,
+ Error = RegSetValue(PeripheralKey,
"Identifier",
REG_SZ,
Buffer,