home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
disk
/
misc
/
scsiutil
/
scsiutil.doc
< prev
next >
Wrap
Text File
|
1995-02-27
|
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
inability to access a certain block directly - it might start
reading +- n sectors before/after the requested block).
-D<l|r> sec blks : Read 8 bit raw digital audio(left or right channel)(*3*)
Does basically the same as the '-d' option, only divides every
16 bit word by 256 before sending it to stdout, which makes
for a cheap (and suboptimal) conversion to 8 bit. The warning
about SCSI bus lockups applies also to this command. A better way
to scale to 8 bit would be to find the min/max values in the
digital data and scale accordingly. Obviously you'd need another
program to do this job, as otherwise you'd have to keep the
whole sample in memory to perform this operation.
-e <0|1> : Change medium (0=eject, 1=load)
By using this command you can eject a removable medium via
software, e.g. SCSIutil 2 -e 0 ejects the CD-ROM currently in
the drive with SCSI id 2.
-i[r] : Inquiry [raw]
This command sends the INQUIRY command to the specified
device. This can be used to get all kinds of information about
the device. With the 'r' parameter SCSIUtil will not try to
interpret the information returned.
-h[r] blk : Read CD-ROM data block address header
This will read the address header information of a particular
CD-ROM block, e.g. SCSIutil 2 -h 100 reads block 100 from SCSI
device 2 and returns the header information.
-l <0|1> : Allow/Prevent medium removal
This command sends a PREVENT ALLOW MEDIUM REMOVAL to the SCSI
device.
-m <0|1> : Stop/Start motor {0=stop, 1=start}
Start or stop the device motor of the specified device.
SCSIutil 2 -m 0 stops a CD that is playing in SCSI device 2.
-o[r] contr page : Mode sense (contr = 0-3)) (*4*)
Reads MODE SENSE control pages from a SCSI device. The contr
parameter decides what pages to return:
contr 0: current values
1: changeable values (not interpreted correctly by SCSIUtil)
2: default values
3: saved values
The page value must be in the range of 0-63. Page 63 usually
returns all the available MODE SENSE pages. With the 'r'
option SCSIUtil will not interpret the returned data.
-p st si et ei : Play audio CD track (1-99), index (1-99)
Allows the playing of a series of audio tracks. Can use index
marks as well e.g. SCSIutil 2 -p 1 1 8 1 plays an Audio CD in
SCSI device 5 from Track 1 to Track 8.
Track and Index should be in the range of 1-99 (according to
the ANSI SCSI 2 specs). The Apple CD-300 accepts an index of 0
as play whole track, therefore I allowed the selection of 0 as
an index, even though the online help states otherwise. To
play a whole CD type: scsiutil 2 -p 1 0 99 0. To play only
track 3: scsiutil 2 -p 3 1 3 1.
-r[t] sec_no : Read sectors [use trackdisk.device]
Read data sector off a SCSI device. In case of an audio CD use
the -d or -D commands to read digital audio data.
-s sec_no : Seek to sector (*5*)
Seek the head of a device to the specified sector.
-t[r|l] : Display TOC of an audio CD [raw|long]
Reads the table of contents of a CD. The TOC can contain
entries for data/audio tracks. With the 'r' option SCSIUtil
won't interpret the returned data. With the 'l' option
SCSIUtil will display the TOC in a longer form.
-u[r] chan fmt track: Read CD sub-channel information [raw] (*6*)
Reads information from the specified sub-channel of a CD.
Chan = 64 = Q-Sub-channel
Fmt 0: read Q-sub-channel
Doesn't work with the Apple CD-300 drive
Fmt 1: read current position data
Track must be 0
Fmt 2: read media catalog number (UPC/Bar Code)
Track must be 0
Fmt 3: read track international standard recording code (ISRC)
Track must be a valid track
With the 'r' option SCSIUtil doesn't try to interpret the
returned data.
-v [vl0 vl1 vl2 vl3] : Set output volume channels 0-3 (7)
Allows you to set the volume of the CD-ROM audio channels.
Values in the range of 0-255 are allowed. If you use -1 this
channel won't be affected. If -v is issued without additional
parameter, SCSIUtil will display the current volume settings.
The future:
===========
There are several things that I'd like to implement, take a look at
the TODO file. If you have a need for some additional features you
can always try to talk me into implementing them (hint: I can be
bribed ;-)
Acknowledgements:
=================
Fred Fish for his work for the Amiga community
Gary Duncan (gduncan@philips.oz.au) for having written the original
version and releasing the source to the public
Dave Hassal (dave@ainfo.equinox.gen.nz) for bugging me with questions
and pushing me into finishing SCSIUtil.
Stefan Becker (stefanb@yello.adsp.sub.org) for supplying patches to allow
reading of digital audio with the Toshiba XM3401 and DICE-support.
Ralph Babel for some _very useful_ hints/tips/tricks.
Franz-Josef Reichert for his Jukebox.
Frank Munkert (ln_fmu@pki-nbg.philips.de) for AmiCDROM, PlayCDDA
and some good suggestions.
Free Software Foundation, Inc. for the no warranty text and use at
your own risk texts. Also thanks for some high quality SW.
My fellow Software Brewers (Christian Balzer & Armin Sparr) for
support.