diff --git a/cpp/hal/gpiobus.cpp b/cpp/hal/gpiobus.cpp index c862015d9b..010d894ad5 100644 --- a/cpp/hal/gpiobus.cpp +++ b/cpp/hal/gpiobus.cpp @@ -40,6 +40,11 @@ int GPIOBUS::CommandHandShake(vector &buf) bool ack = WaitACK(true); +#ifdef NO_DELAY + // Wait until the signal line stabilizes + SysTimer::SleepNsec(SCSI_DELAY_BUS_SETTLE_DELAY_NS); +#endif + buf[0] = GetDAT(); SetREQ(false); @@ -64,6 +69,11 @@ int GPIOBUS::CommandHandShake(vector &buf) ack = WaitACK(true); +#ifdef NO_DELAY + SysTimer::SleepNsec(SCSI_DELAY_BUS_SETTLE_DELAY_NS); +#endif + + // Get the actual SCSI command buf[0] = GetDAT(); SetREQ(false); @@ -93,6 +103,11 @@ int GPIOBUS::CommandHandShake(vector &buf) ack = WaitACK(true); +#ifdef NO_DELAY + // Wait until the signal line stabilizes + SysTimer::SleepNsec(SCSI_DELAY_BUS_SETTLE_DELAY_NS); +#endif + buf[offset] = GetDAT(); SetREQ(false); @@ -121,6 +136,11 @@ int GPIOBUS::ReceiveHandShake(uint8_t *buf, int count) const bool ack = WaitACK(true); +#ifdef NO_DELAY + // Wait until the signal line stabilizes + SysTimer::SleepNsec(SCSI_DELAY_BUS_SETTLE_DELAY_NS); +#endif + *buf = GetDAT(); SetREQ(false); @@ -148,6 +168,11 @@ int GPIOBUS::ReceiveHandShake(uint8_t *buf, int count) break; } +#ifdef NO_DELAY + // Wait until the signal line stabilizes + SysTimer::SleepNsec(SCSI_DELAY_BUS_SETTLE_DELAY_NS); +#endif + *buf = GetDAT(); SetACK(true);