From d9b4e1fc1f428d5d1ada46410f28ea7d69599fce Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Sat, 5 Feb 2022 02:45:10 +0100 Subject: [PATCH] Support ICD (Atari ACSI) command semantics (#640) * Initial ICD support * Comment update * Comment update * Comment update * Update README.md --- README.md | 2 +- src/raspberrypi/gpiobus.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5676767f..5c7eb81a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # What is RaSCSI? -RaSCSI is a virtual SCSI device emulator that runs on a Raspberry Pi. It runs in userspace, and can emulate several SCSI devices at one time. There is a control interface to attach / detach drives during runtime, as well as insert and eject removable media. This project is aimed at users of vintage Macintosh computers and more (see [compatibility list](https://github.com/akuker/RASCSI/wiki/Compatibility)) from the 1980's and 1990's. +RaSCSI is a virtual SCSI device emulator that runs on a Raspberry Pi. It runs in userspace, and can emulate several SCSI devices at one time. There is a control interface to attach / detach drives during runtime, as well as insert and eject removable media. This project is aimed at users of vintage Macintosh and Atari computers and more (see [compatibility list](https://github.com/akuker/RASCSI/wiki/Compatibility)) from the 1980's and 1990's. Please check out the full story with much more detail on the [wiki](https://github.com/akuker/RASCSI/wiki)! diff --git a/src/raspberrypi/gpiobus.cpp b/src/raspberrypi/gpiobus.cpp index 10a6f985..f09372af 100644 --- a/src/raspberrypi/gpiobus.cpp +++ b/src/raspberrypi/gpiobus.cpp @@ -861,6 +861,38 @@ int GPIOBUS::CommandHandShake(BYTE *buf) goto irq_enable_exit; } + // The ICD AdSCSI ST, AdSCSI Plus ST and AdSCSI Micro ST host adapters allow SCSI devices to be connected + // to the ACSI bus of Atari ST/TT computers and some clones. ICD-aware drivers prepend a $1F byte in front + // of the CDB (effectively resulting in a custom SCSI command) in order to get access to the full SCSI + // command set. Native ACSI is limited to the low SCSI command classes with command bytes < $20. + // Most other host adapters (e.g. LINK96/97 and the one by Inventronik) and also several devices (e.g. + // UltraSatan or GigaFile) that can directly be connected to the Atari's ACSI port also support ICD + // semantics. I fact, these semantics have become a standard in the Atari world. + + // RaSCSI becomes ICD compatible by ignoring the prepended $1F byte before processing the CDB. + if (*buf == 0x1F) { + SetSignal(PIN_REQ, ON); + + ret = WaitSignal(PIN_ACK, TRUE); + + SysTimer::SleepNsec(SCSI_DELAY_BUS_SETTLE_DELAY_NS); + + // Get the actual SCSI command + *buf = GetDAT(); + + SetSignal(PIN_REQ, OFF); + + if (!ret) { + goto irq_enable_exit; + } + + WaitSignal(PIN_ACK, FALSE); + + if (!ret) { + goto irq_enable_exit; + } + } + count = GetCommandByteCount(*buf); // Increment buffer pointer