This message is from the T13 list server.

On Thu, 24 Jan 2002 17:13:44 -0500, Mark Sawyer wrote:
>I apologize in advance if this question is inappropriate for
>this forum ...

This is probably as good a place as any (to get a bunch of
conflicting answers).

>I am involved with the development of a hardware driver which interfaces to
>several ATA/ATAPI devices (i.e. HDD's, CDROM's, compact flash, etc...)
>My problem is determining the correct sector size for CDROM's when
>performing DMA.

The "correct sector size" (actually that should be "correct block
size" because we
are talking about a SCSI device) is determined in a very simple way:
The contents of 
the SCSI command (CDB) tell you exactly how much data will be
transferred.

>In the case of PIO, this is not a problem since the device tells me how many
>bytes to expect.

Yes, the device tells the host how big each DRQ data block is and a
single data transfer commands might use many (10s or even 100s) of
these DRQ data blocks to move the data. Checking the total number of
bytes in all the DRQ data blocks against the expected number of bytes
the SCSI CDB should transfer is probably a good idea (if you are
building a host that cares about data integrity). But only a poorly
designed host would use the total number of bytes in the DRQ data
blocks as the "correct" amount of data for any given SCSI CDB. The
host has created the SCSI CDB therefore the host needs to allocate an
I/O buffer of the correct size for the expected data transfer
therefore the host knows the amount of data that should be
transferred therefore the host knows the "block size" for the
command.

>The platform (it's custom) I am working on requires support for both data
>CD's (ISO9660 - 2048 byte sectors) and audio CD's (Redbook - 2352 byte
>sectors) ...
>I realize that this is an issue of the media present in the device but what
>is the preferred method of determining sector size?

Not just the media currently in the device but what part of the media
you are currently accessing. A host like yours needs to know what
parts of the media are audio data (CD-DA, aka mode 0) and which parts
are "data" (mode 1 or mode 2). The Table of Contents on the media
will give you that information.

Mode 1 data on CD discs are 2048 bytes and are normally read using
the Read 10 or Read 12 command. Reading CD-DA (mode 0) or mode 2 data
requires the use of the Read CD command. Notice that the Read CD
command has many options to determine how much of the data in each
block is returned. So each Read CD command has its own "block size"
based on what is in the Read CD CDB. Please note that bascially all
CD read commands, like Read 10 or Read Subshannel are nothing more
that a short-cut ways of executing some form of a Read CD command
(Read TOC is special because it reads a part of the CD disc media
that Read CD can not read).



*** Hale Landis *** www.ata-atapi.com ***



Subscribe/Unsubscribe instructions can be found at www.t13.org.

Reply via email to