mirror of
https://github.com/reactos/reactos.git
synced 2024-08-29 22:58:34 +00:00
Issue SPECIFY command upon initialization.
svn path=/trunk/; revision=6529
This commit is contained in:
parent
f1259f48fe
commit
3911ce2391
|
@ -185,6 +185,16 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
|
|||
// point we should get the bios disk parameters passed in to the kernel at boot
|
||||
// and stored in the HARDWARE registry key for us to pick up here.
|
||||
|
||||
// Issue SPECIFY command
|
||||
FloppyWriteDATA (ControllerExtension->PortBase, FLOPPY_CMD_SPEC_CHARS);
|
||||
KeStallExecutionProcessor (100);
|
||||
FloppyWriteDATA (ControllerExtension->PortBase, 0xD1);
|
||||
KeStallExecutionProcessor (100);
|
||||
FloppyWriteDATA (ControllerExtension->PortBase, 0x02);
|
||||
KeStallExecutionProcessor (10000);
|
||||
FloppyWriteMSTAT (ControllerExtension->PortBase, 0x00);
|
||||
|
||||
|
||||
// turn on motor, wait for spinup time, and recalibrate the drive
|
||||
FloppyWriteDOR( ControllerExtension->PortBase, FLOPPY_DRIVE0_ON );
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINUP_TIME;
|
||||
|
@ -292,15 +302,16 @@ FloppyExecuteReadWrite(PDEVICE_OBJECT DeviceObject,
|
|||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)DeviceExtension->Controller->ControllerExtension;
|
||||
LARGE_INTEGER Timeout;
|
||||
BOOLEAN WriteToDevice;
|
||||
DWORD Cyl, Sector, Head;
|
||||
ULONG Cyl, Sector, Head;
|
||||
PIO_STACK_LOCATION Stk;
|
||||
DWORD Length;
|
||||
ULONG Length;
|
||||
|
||||
DPRINT( "FloppyExecuteReadWrite()\n" );
|
||||
|
||||
ControllerExtension->Irp = Irp = (PIRP)Context;
|
||||
Stk = IoGetCurrentIrpStackLocation( Irp );
|
||||
ControllerExtension->Device = DeviceObject;
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINUP_TIME;
|
||||
DPRINT( "FloppyExecuteReadWrite()\n" );
|
||||
CHECKPOINT;
|
||||
WriteToDevice = Stk->MajorFunction == IRP_MJ_WRITE ? TRUE : FALSE;
|
||||
// verify drive is spun up and selected
|
||||
|
@ -319,7 +330,8 @@ FloppyExecuteReadWrite(PDEVICE_OBJECT DeviceObject,
|
|||
&ControllerExtension->MotorSpinupDpc );
|
||||
return KeepObject;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Timeout.QuadPart = FLOPPY_MOTOR_SPINDOWN_TIME;
|
||||
// motor is already spinning, so reset the spindown timer
|
||||
KeCancelTimer( &ControllerExtension->SpinupTimer );
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
//
|
||||
#define FloppyWriteDOR(A, V) (WRITE_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DOR, (V)))
|
||||
#define FloppyReadMSTAT(A) (READ_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_MSTAT))
|
||||
#define FloppyWriteMSTAT(A, V) (WRITE_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_MSTAT, (V)))
|
||||
#define FloppyReadDATA(A) (READ_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DATA))
|
||||
#define FloppyWriteDATA(A, V) (WRITE_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DATA, (V)))
|
||||
#define FloppyReadDIR(A) (READ_PORT_UCHAR((PVOID)(A) + FLOPPY_REG_DIR))
|
||||
|
|
|
@ -49,6 +49,9 @@ BOOLEAN FloppyIsrDetectMedia( PCONTROLLER_OBJECT Controller )
|
|||
{
|
||||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
BYTE SectorSize;
|
||||
|
||||
DPRINT("FloppyIsrDetectMedia() called\n");
|
||||
|
||||
// media detect in progress, read ID command already issued
|
||||
// first, read result registers
|
||||
KeStallExecutionProcessor( 1000 );
|
||||
|
@ -81,6 +84,8 @@ BOOLEAN FloppyIsrRecal( PCONTROLLER_OBJECT Controller )
|
|||
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension = (PFLOPPY_CONTROLLER_EXTENSION)Controller->ControllerExtension;
|
||||
// issue sense interrupt status, and read St0 and cyl
|
||||
|
||||
DPRINT("FloppyIsrRecal() called\n");
|
||||
|
||||
FloppyWriteDATA( ControllerExtension->PortBase, FLOPPY_CMD_SNS_INTR );
|
||||
KeStallExecutionProcessor( 1000 );
|
||||
ControllerExtension->St0 = FloppyReadDATA( ControllerExtension->PortBase );
|
||||
|
@ -105,7 +110,8 @@ BOOLEAN FloppyIsrRecal( PCONTROLLER_OBJECT Controller )
|
|||
ControllerExtension->Irp,
|
||||
Controller );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// issue first read id, FloppyIsrDetectMedia will handle
|
||||
DPRINT( "Recalibrate worked, issuing read ID mark command\n" );
|
||||
ControllerExtension->IsrState = FloppyIsrDetectMedia;
|
||||
|
|
Loading…
Reference in a new issue