[comp.sys.mac.programmer] HELP! PLEASE! SCSI

Eliot.Henry@samba.acs.unc.edu (BBS Account) (09/22/90)

I need three things:

	1) Pointers to titles of books on programming scsi devices AND sources
            where i can get those books!

	2) (related to above) A nice refrence sheet or file to tell me what
	   the various command bytes and parameters for scsi devices are

	3) The answer to why I am getting a scPhaseError when trying to read
            a block from my CMS 20 hard dr (i have two pieces of sample source              code that someone generously sent but they don't give the precise
	    values of the command bytes i need to send) I do a scsiget, then
            a scsiselect, scsiccmd,scsiread, scsicomplete. I am on a mac plus.
            Also, I am using pascal. How long is a reasonable delay before calling SCSIcomplete (my sample says 10) 

THANKS FOR ANY HELP!!!


--

minow@mountn.dec.com (Martin Minow) (09/24/90)

In article <1126@beguine.UUCP> Eliot.Henry@samba.acs.unc.edu (BBS Account)
writes:
>I need three things:
>
>	1) Pointers to titles of books on programming scsi devices AND sources
>            where i can get those books!

Ansi Draft SCSI-II Standard.  Global Engineering Documents (they have an
800-number).  About $75 (but, I'm guessing).  This is a draft, but the
latest published draft looks pretty good.

There is a somewhat overpriced book by NCR that gives an overview of SCSI,
and a two-issue article in a recent Byte (Jan Feb 90 or maybe Feb Mar 90)
that also serves as an overview.  There was also an overview in MacUser
within the last year or so.

>	2) (related to above) A nice refrence sheet or file to tell me what
>	   the various command bytes and parameters for scsi devices are

You need the Draft Standard or the manual for the device you're trying
to talk to.

>
>	3) The answer to why I am getting a scPhaseError when trying to read
>            a block from my CMS 20 hard dr (i have two pieces of sample
>		source
>              code that someone generously sent but they don't give the precise
>	    values of the command bytes i need to send) I do a scsiget, then
>            a scsiselect, scsiccmd,scsiread, scsicomplete. I am on a mac plus.

This depends on what you are doing when you get a scPhase error.  scPhaseError
means that the drive was in one bus phase when the Mac expected it to be
in another.  The reason is that the byte count you gave to scsiGet (in the
transfer block) differed from the drive's byte count. (Or the drive is sick,
of course.)

Assume you are reading parameter information from the drive (mode sense,
identify, extended sense) as opposed to reading actual "disk data":
If you ask for, say, 128 bytes of information and the drive only has 47 to
give you, it will change to status phase and the Mac will give you an
scPhaseError (which you can ignore).  On the other hand, if you ask for
47 bytes and the drive tries to send 128, you will also get an scPhaseError
(I think) which you probably have to deal with.  You can get the current bus
phase by issuing SCSIStat(). The MSG, I/O, and C/D bits define the phase.
(This is a simplification: you should also check that REQ and BSY are
also asserted.)

In any case, scPhaseErr is a problem on writes and data reads, but might
be ignorable on parameter reads (mode sense, etc.).

>            Also, I am using pascal. How long is a reasonable delay before
>		calling SCSIcomplete (my sample says 10) 
>

Dunno.  Why are you doing a delay at all?

Martin Minow
minow@bolt.enet.dec.com