IDE
devil: some description
Jookie - 2005
report made: 3.december 2005
| Project status: | on ice (temporarily inactive) because lack of time (school, work, etc.). |
| Last activity: | date: 20th september, 2005 description: fixing some bugs |
| Functionality: | about 85%. Supports all that it should, any
function should work normally, BUT when I tried to format or partition
the drive using HDDRUTIL, it has some trouble when reading the
boot-sector (the HDDRUTIL executes couple of commands, but the last one
[read sector 0] is not received by my device even though that HDDRUTIL
thinks it did and SCSI_MON says that it did). Actually I don't know
where the problem could be (this makes me depressive) and I don't have
any time to look on that now (and this makes me sad). The screenshots-in-time of the problem is here. |
| Some description of how it works: | This is how it works (ATARI vs. IDE DEVIL vs. IDE
drive):
HDDRIVER (or any other XHDI driver, like AHDI, ICD driver, and so on) after its start finds any available drives and stays resident for any other higher-level software as SCSI driver. There are two ways of how programs use it:
For the second group of SW it does the dirty work of accessing the Atari HW and getting the data into it and out of it. The Atari HW (DMA chip) is used in 3 steps:
The data in 2nd step is ALWAYS transfered in DMA mode, even if the data is 4 bytes long - this is how it goes on ACSI port. And because the DMA chip has a internal 16-byte, the data transfered in DMA mode must have length divisible by 16 (so this means the length should be 16, 32, 48, ..., 512 bytes long), i.e. If you would send in DMA mode 45 bytes from the device to the Atari, then the first 32 bytes will get to memory, but the rest (13 bytes) will be stuck in internal buffer of DMA chip. So when any SW from the second group sends a SCSI command to HDDRIVER and the SCSI command needs to transfer data with length other then a multiply of 16, the HDDRIVER will send another few commands just to make the length to be exactly multiply of 16. This means: HDDRUTIL or any other high-level SW sends one SCSI command through HDDRIVER and gets the data from the HDDRIVER. BUT the HDDRIVER may send any SCSI commands to the device just to align the data length to the multiply of 16. It will send mostly GET_DRIVE_STATUS (4 bytes of returned data) and INQUIRY (the length of data that is to be returned can be set to almost any values). [you may wonder why I wrote this here, but this is some useful information for anyone who wants to do anything with ACSI, or want to contribute to this or similar project.] ACSI COMMUNICATION LAYER is used for transfering the data from and to the IDE DEVIL device. Receiving of the command bytes is done in interrupt, because the data is valid only when CS is LOW. So the interrupt is controlled by CS line of ACSI port. I think that somewhere here could be the problem described in 'Functionality' section. SCSI EMULATION is used for understanding the SCSI commands and replying with correct values on any SCSI command that is supported, also for returning the correct 'Sense-Code', 'Additional Sense-Code' and 'Additional Sense-Code qualifier'. And yes, what we should emulate, is SCSI. This means that any command sent to the device will be SCSI command. Forget about the commands that are used in MegaFile drives - Atari HD command set. These 10 commands are just SCSI commands which has been slightly adjusted by Atari corporation. So forget about Atari HD command set (AHDCS) and start emulating SCSI because:
The first byte sent to the device is composed of:
But this works only for SCSI commands which are 6 bytes long. The SCSI command may be long 6,8,10 or 12 bytes (depending on the command), so SCSI commands with length other than 6 bytes has this first byte:
This is the way of letting the device to know that this wont be a 6-byte long command. It is called 'ICD communication protocol' and it is so only through ACSI port. On any other port (standard SCSI port of Falcon, TT or PC) the first byte will be normal first byte of command as described in SCSI-II technical manual. According to Uwe Seimet (author of HDDRIVER) these SCSI commands should be supported:
What these commands mean, what should be replied to them and so on you can read in SCSI-II specification, which is freely available over the internet in .PDF version. Not supported commands should be replied with 'Invalid command' Sense-code. IDE COMMUNICATION LAYER is layer used for communication with the IDE drive on a HW level using LBA mode (when supported) or CHS mode when LBA is not supported (this layer also does the LBA-to-CHS translation). Description of this layer (what to do on HW level, what commands are to be used, and so on) wont be documented here, because there are many good documents on the internet about IDE, also there is IDE (ATA-2) specification on the internet for free, and there are many successful IDE-to-MCU projects on the internet that are well described. Please refer to them for more info or read the source code of this project. |
| Why I used HDDRIVER for development: | I was thinking what SW should I use for testing
and developing of this device. I decided for HDDRIVER because:
But Uwe Seimet was not that excited about my project and questions:
Even thought he helped me a bit by letting me know what commands of SCSI-II should I support and that it should be only SCSI-II commands and not any AHDCS I should support. That is probably all the useful information I could get from about 20 e-mails between him and me. I think that in these times of Atari community getting smaller every day people should be more good-willing to contribute to the community to keep it going... |
| Source code of firmware: | Even if not very useful at all, not very functional too (has that bug which I was not able to solve when I had the time for it), but here it is, free for anyone. You may even find out the signal-to-pin connection from the source-files when it's not clear to you from the schematics. |