Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!samsung!mips!apple!portal!cup.portal.com!DrBob From: DrBob@cup.portal.com (Robert A Rethemeyer) Newsgroups: comp.sys.amiga.programmer Subject: Re: SCSI Direct Message-ID: <42517@cup.portal.com> Date: 20 May 91 08:54:48 GMT References: <5909@mindlink.bc.ca> Organization: The Portal System (TM) Lines: 86 Harvey Taylor writes... > I've been playing with SCSI Direct lately (without documentation) > & I have some questions. I am trying to talk to a TEAC scsi floppy from > a Xetec MiniFastCard. These are my results so far. First suggestion... get some documentation! :-) I recommend going directly to the source, the ANSI SCSI-1 document X3.131.1986. Computer book stores or suppliers should have it. You won't believe how much it will clear things up. You'll kick yourself for not getting it sooner. > Does anybody happen to know a mapping between the result codes > & more specific device info? ie. What do all those damn BadStatus results > mean? > HFERR_SelfUnit EQU $00000028 You tried to send a scsi command to yourself (usually ID=7) > HFERR_DMA EQU $00000029 Error transferring to memory > HFERR_Phase EQU $0000002A > HFERR_Parity EQU $0000002B > HFERR_SelTimeout EQU $0000002C All are SCSI bus protocol errors > HFERR_BadStatus EQU $0000002D Drive is unhappy > HFERR_NoBoard EQU $00000032 Nobody home at the adapter All the codes except BadStatus are problems detected by the scsi direct device driver in the Amiga. BadStatus indicates that the drive returned "Check Condition" (0x02) in scsi_Status. This is the drive's way of telling the programmer that it is unhappy about something. This includes errors in the drive hardware, the media, or the scsi command itself. Probably most of the BadStatus indications you are getting are due to unsupported commands or illegal bit combinations in the scsi command. To find out exactly what the drive is unhappy about, you MUST do a Sense command. In fact, the drive will usually reject all other commands until you do the Sense. Sense will return a 4-bit "sense key" that generally describes the error. The keys defined in the SCSI document are: 0 = No Sense 1 = Recovered error 2 = Not ready 3 = Medium error 4 = Hardware Error 5 = Illegal request - includes unknown command, illegal bits, etc. 6 = Unit Attention 7 = Data (write) protect 8 = Blank check (unformatted medium) .... other rare keys omitted A better breakdown of the error reason is also contained in other parts of the sense data, but it is vendor specific- refer to your drive programming documentation. Note- some of the commands you listed are 10-byte commands, not the usual 6 bytes. If you get this wrong in scsi_CmdLength, that might cause some of the scsi bus errors you are getting (depends on the adapter and drive). > In a .hdr file with the Xetec stuff they show their SCSI_CMD > structure as having a few more fields than the CBM version. > Is anybody else using these? GVP? MicroBotics? Has the CBM spec grown > or is it just Xetec? The extentions were defined by CBM, and they allegedly came out with 1.3, but didn't make it into the includes distributed with the compilers. They made it into the 2.0 includes. > Finally, in the SCSI_CMD structure, scsi_Flags field what is the > meaning of (particularly AutoSense): The write/read bit defines the direction of data transfer for commands that have a data phase. Read means the data is coming into the Amiga, write means it is going to the drive. The autosense bit, when one, will cause the scsi direct driver to automatically issue a Sense when it gets BadStatus/ Check Condition. scsi_SenseData is a pointer to the buffer to place the sense data, for up to scsi_SenseLength bytes, and the actual number of sense bytes is placed in scsi_SenseActual. Since you always need to do a Sense after getting BadStatus, this is a nice feature. Note, you ADD the autosense bit to the read/write bit. > Harvey Taylor Meta Media Productions =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Bob Rethemeyer // "My Sneaker-Phone keeps kicking my DrBob@cup.portal.com -or- // Football-Phone off the hook." ..!sun!portal!cup.portal.com!DrBob // - Jay Leno