home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 10
/
Fresh_Fish_10_2352.bin
/
useful
/
disk
/
cdrom
/
scsiutil
/
scsiutil.doc
< prev
next >
Wrap
Text File
|
1994-01-04
|
13KB
|
347 lines
SCSIUtil V2.0 - an utility for doing SCSI low level operations
SCSIUtil (c) 1991,92,93,94 by Gary Duncan and Heiko Rath
Gary Duncan
Philips PTS
23 Lakeside Dr
Tally-Ho Technology Park
Burwood East Vic 3151
Australia
EMail: gduncan@philips.oz.au
The Software Brewery
Dipl. Inform. (FH) Heiko Rath
Raiffeisenstr.10a
D-64331 Weiterstadt
Germany
EMail: hr@brewhr.swb.de
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE
OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
When redistributing this program ALWAYS redistribute the WHOLE
archive consisting of:
- DMakefile
- HISTORY
- o/SCSIutil.o
- SCSI_priv.h
- SCSIutil.c
- TODO
- SCSIutil.doc
- smakefile
The source is provided, therefore you can make changes yourself. The
only thing I'm asking is that if you do make changes, please get in
touch with me (hr@brewhr.swb.de), so that we can coordinate any
further development.
What is SCSIUtil?
=================
It is a little utility to do some low level stuff with SCSI devices.
As I currently don't have too much time to work on it (I finished my
thesis and am now wasting most of my time with a full time job)
I release it to the public as it is. It is far from being perfect,
but it is useful to me. In it's current incarnation it has
the following features:
- read the capacity of a SCSI device
- read 16 bit raw digital audio off an audio CD (works with Sony CDU
561 & 8003 & Toshiba 3401) (left/right channel and stereo
reading supported)
- read 16 bit raw digital audio off an audio CD and convert to 8 bit
(left/right channel supported)
- eject/insert a medium via software control
- display the Inquiry data of a SCSI device
- read & interpret a CD-ROM data block address header
- start/stop the motor on a device
- read pages via MODE SENSE
- play audio on a CD-ROM drive (tested with Sony CDU 561 = Apple CD-300
and Tosiba 3401)
- read sectors
- seek to a specified sector
- display table of contents (TOC) of a CD
- read subchannel information of a CD (tested with Sony CDU 561)
- allow/prevent medium removal
- change the output channel volume of a CD-ROM drive
Why SCSIUtil?
=============
I needed some software to explore my new CD-ROM drive.
Here is what SCSIUtil displays, if you invoke it without parameters:
SCSIutil V2.0 [Jan 4 1994 : 16:59:03] - written by Gary Duncan
(gduncan@philips.oz.au) and Heiko Rath (hr@brewhr.swb.de)
Usage: SCSIutil [-dscsi_dev] <scsi_id> <command>
-c[r] : Read capacity [raw]
-d<l|r|s> sec blks sc : Read 16 bit digital audio(start sector/# blocks)(2)
-D<l|r> sec blks : Read 8 bit digital audio(left or right channel)(3)
-e <0|1> : Change medium (0=eject, 1=load)
-i[r] : Inquiry [raw]
-h[r] blk : Read CD-ROM data block address header
-l <0|1> : Allow/Prevent medium removal
-m <0|1> : Stop/Start motor {0=stop, 1=start}
-o[r] contr page : Mode sense (contr = 0-3))
-p st si et ei : Play audio CD track (1-99), index (1-99)
-r[t] sec_no : Read sectors [use trackdisk.device]
-s sec_no : Seek to sector (5)
-t[r|l] : Display TOC of an audio CD [raw|long]
-u[r] chan fmt track : Read CD sub-channel information [raw] (6)
-v [vl0 vl1 vl2 vl3] : Set output volume channels 0-3 (7)
Note 1: usually scsi_id = (BOARD * 100) + (LUN * 10) + SCSI_TARGET_ID
2: with 's' returns LRLRLR pairs of stereo audio, 2352 bytes per block
sc = Apple subcode (0=2352, 1=2368, 2=2448, 3=96 byte/block)
3: converted to 8 bit audio (-d and -D work with Sony CDU 561 & 8003)
4: contr 0: current, 1: changeable, 2: default, 3: saved values
5: to park heads, try sec_no of -1
6: Q-channel = 64, fmt: 0=Sub-Q Channel data,1=current CD-ROM pos.,
2=Media Catalog Number (UPC/Bar Code),3=Track ISRC
7: use -1 to leave volume of channel as it is, without argument shows
current volume settings
Documentation on the options of SCSIUtil:
=========================================
-c[r] : Read capacity [raw]
This will issue a READ CAPACITY to the device to get the
highest sector available, the sector size and the capacity
(= sector size * max sector). With the 'r' option SCSIUtil
will not try to interpret the returned data.
BTW, the Apple CD-300 returns different sector sizes,
depending on the last read size (that means sometimes it is
96, 2048 or 2352).
-d<l|r|s> sec blks sc : Read 16 bit digital audio(start sector/# blocks)(2)
This will read data directly from the specified CD-ROM drive,
interpreting the information as raw digital input. A value for
the sector to start reading from is required as well as the
number of sectors to read. The data will be in 16-bit format
e.g. SCSIutil 2 -ds 2 100 0 reads the first 100 blocks
starting from sector 2 as Stereo 16 bit data. One sector
corresponds to 1/75 of a second. The data will be output to
stdout. This works with the Sony CDU-8003/541/561 (Apple uses
the CDU-561 in their Apple CD-300).
The sc parameter was tested with the Apple CD-300 and tells
the drive to return 2352/2368/2448/96 bytes/block. If you're
only interested in digital audio use sc=0 which just delivers
588 * 16 bit stereo samples per block = 2352 bytes. If you use
sc=1 the last 16 bytes contain information about the current
track/index and timeposition of the sample. Sc = 2 adds 96
bytes to the raw samples which supposedly contain all the
subchannels except the Q-subchannel. Usually there won't be
any useful data in these 96 bytes, but on CD+Graphics and
CD+Midi CDs (pretty rare) the graphics/midi information is
encoded. If anybody has some information regarding the
encoding of CD+G / CD+Midi please get in touch with me!
The digital audio data sent to stdout looks like this (in case
of sc = 0):
struct cdda_sector {
struct cdda_sample {
char left_channel_lsb;
char left_channel_msb;
char right_channel_lsb;
char right_channel_msb;
} samples[588];
};
With mono, either the left or right channel is skipped.
BEWARE: sometimes I get SCSI bus lockups while using this
command. I'm pretty sure that it's not SCSIUtil's fault, but
either a problem of the WD SCSI chip 33C93A 00-04-PROTO in my
Amiga 3000 or a firmware bug in the Apple CD-300 (my firmware
is release 1.8d). The lockups usually occur only if I read
more than about 150 sectors. When a lockup occurs, don't
panic! I usually power cycle the Apple CD-300 and everything
reverts to normal. BTW, the Apple CD-300 sometimes returns
the following MODE SENSE errors for no obvious reason:
SENSE_DATA: 70 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 00 00 00
Error : err=45 , No error
Since V1.905b SCSIUtil reschedules the failed SCSI command and
tries to reread the missing sectors, thus you shouldn't lose
any data. (When this happens you might notice a little glitch
in the digital data, this is caused by the CD-ROM drive's
i