{
BusLogic_StatusRegister_T StatusRegister;
int TimeoutCounter;
// Issue a Hard Reset or Soft Reset Command to the Host Adapter. The Host// Adapter should respond by setting Diagnostic Active in the Status Register.if (HardReset)
BusLogic_HardReset(HostAdapter);
elseBusLogic_SoftReset(HostAdapter);
// Wait until Diagnostic Active is set in the Status Register.
TimeoutCounter = 100;
while (--TimeoutCounter >= 0)
{
StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
if (StatusRegister.Bits.DiagnosticActive)
break;
}
// if inspite of waiting for time out period , if it didn't et set, then something is wrong-- so just return.if (TimeoutCounter < 0)
returnFALSE;
//// Wait 100 microseconds to allow completion of any initial diagnostic// activity which might leave the contents of the Status Register// unpredictable.ScsiPortStallExecution(100);
// Wait until Diagnostic Active is reset in the Status Register.
TimeoutCounter = 10*10000;
while (--TimeoutCounter >= 0)
{
StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
if (!StatusRegister.Bits.DiagnosticActive)
break;
ScsiPortStallExecution(100);
}
if (TimeoutCounter < 0)
returnFALSE;
// Wait until at least one of the Diagnostic Failure, Host Adapter Ready,// or Data In Register Ready bits is set in the Status Register.
TimeoutCounter = 10000;
while (--TimeoutCounter >= 0)
{
StatusRegister.All = BusLogic_ReadStatusRegister(HostAdapter);
if (StatusRegister.Bits.DiagnosticFailure ||
StatusRegister.Bits.HostAdapterReady ||
StatusRegister.Bits.DataInRegisterReady)
{
break;
}
ScsiPortStallExecution(100);
}
//device didn't respond to resetif (TimeoutCounter < 0)
returnFALSE;
// If Diagnostic Failure is set or Host Adapter Ready is reset, then an// error occurred during the Host Adapter diagnostics. If Data In Register// Ready is set, then there is an Error Code available.if (StatusRegister.Bits.DiagnosticFailure || !StatusRegister.Bits.HostAdapterReady)
{
DebugPrint((ERROR, "\n BusLogic - Failure - HOST ADAPTER STATUS REGISTER = %02X\n", StatusRegister.All));
if (StatusRegister.Bits.DataInRegisterReady)
{
DebugPrint((ERROR, "HOST ADAPTER ERROR CODE = %d\n", BusLogic_ReadDataInRegister(HostAdapter)));
}
returnFALSE;
}
// Indicate the Host Adapter Hard Reset completed successfully.returnTRUE;
}// end BusLogic_HardwareResetHostAdapter
Generated on Sat May 26 2012 05:25:43 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.