PROPOSAL FOR CD-ROM IN SCSI-2 DOCUMENT X3T9.2/87-106 R1 December 2, 1987 CD-ROM Devices Model of CD-ROM Device Type IMPLEMENTORS NOTE: The model described is based on CD-ROM technology, however the command set is designed to be usable by all read-only devices. The model is provided as a means to understand the implementation of the command set. As such the model description does not impose any mandatory requirements. CD-ROM drives are designed to work with any disk that meets the Sony-Philips "red-book" or "yellow-book" documents at the current revision level. Most drives will read CD-ROM data disks in mode one or mode two, digital audio disks, and combined-mode disks (i.e. some tracks are audio, some tracks are data). The CD-ROM disc has the same physical size and properties as the CD-AUDIO disc. The discs have two sizes, 120 millimeter diameter and 80 millimeter diameter. These correspond to 5-1/4 incd and 3-1/2 inch footprint drives. The disc is single sided containing approximately 600 megabytes of data or 74 minutes of audio in the larger diameter. The smaller diameter has a capacity of 200 megabytes of data or 23 minutes of audio. A disc may contain both audio and data, a so called combined mode disc. A disc contains from one to ninety-nine tracks. Each change in the type of information on the disc (audio or data) requires a change in track number. A disc containing both audio and data would have at least two tracks, one for audio and one for data. A track has a minumum length of four seconds or 300 sectors. The first track number on a disc may be any track number from one to ninety-nine. The following track numbers, if any, are in contiguous and ascending order. A transition area occurs between each track. Seek operations can be performed to the transition area. However read or play operations cannot be performed in the transition area. The transition area is structured and the logical addressing sequence continues to increment through the transition area. There also exits a lead-in and a lead-out area on the disc. This allows for overshoot during seek operations. These areas are outside of the user defined area as reported in the READ CAPACITY data. Each track can be subdivided by indexes. Every track has at least index one, and may have up to ninety-nine indexes. The user information starts at index one within a track. The index numbers are contiguous and ascending. Each disc has a table of contents (TOC). The TOC contains information on the number of tracks on a disc, and the starting location of the user information within the track. The starting location is given in MSF address format. The TOC also indicates which tracks are audio and which tracks are data. Note though, that the TOC does not contain information to distinguish between CD-ROM Mode one and CD-ROM Mode two data. The recovery of the TOC data is necessary before a drive is ready and data can be read from the disc. The TOC data is written several times in the area set up for TOC data. The exact number of repetitions depends on the number of tracks on a disc. The drive attempts to recover the TOC as soon as a caddy is successfully loaded. The time maximum time to recover a TOC that is read without error is approximately five seconds. The repeated TOC data can be up to two minutes long. A frame has 588 bits. A frame must be EFM decoded by the drive before the bit stream contains recognizable data. Fourteen bits are used to represent each eight-bit byte. Three merging bits are added to each fourteen bits. A block contains 98 frames. FRAME BITS ============================ 1 (24 + 3) Synchronization 1 (14 + 3) Sub-Channels --> 1 eight-bit sub-channel P,Q,R,S,T,U,V,W 24 (14 + 3) Data Symbols --> 24 eight-bit bytes of data 8 (14 + 3) CIRC Symbols Cross Interleaved Reed Solomon Code ----------- --------------- 588 bits total ============================ The sub-channel byte is assigned one bit for each sub-channel. One byte contains a bit for sub-channels P,Q,R,S,T,U,V,W. Sub-channel P is used for audio muting control. Sub-channels R,S,T,U,V,W are not used in CD-ROM. Sub- channel Q contains the following: 2 bits Sync 4 bits Control 4 bits ADR 72 bits Sub-channel Q data (9 bytes) 16 bits CRC -------------------------- 98 bits total (one bit from the sub-channel byte of each frame in a block). The Sub-channel Q data contains the following: 4 bits Reserved 4 bits Control Field 8 bits Track Number Field in bcd format 8 bits Index Number Field in bcd format 8 bits Relative Minute Field in bcd format 8 bits Relative Second Field in bcd format 8 bits Relative Frame Field in bcd format 8 bits Absolute Minute Field in bcd format 8 bits Absolute Second Field in bcd format 8 bits Absolute Frame Field in bcd format ------------------------------------------ 72 bits total sub-channel Q data The data symbols make up the block of data that is returned to the user during a read operation. A block of data is made up of 98 frames, so there are (98 x 24) 2352 bytes of data in a block. A block of data contains the following if the CD-ROM Mode field has a value of one: 12 bytes Synchronization 4 bytes CD-ROM data header Absolute Minute Field in bcd format Absolute Second Field in bcd format Absolute Frame Field in bcd format CD-ROM Mode Field 2048 bytes user defined data 4 bytes Error Detection Code 8 bytes zero 276 bytes Layered Error Correction Code A block of data contains the following if the CD-ROM Mode field has a value of two: 12 bytes Synchronization 4 bytes CD-ROM data header Absolute Minute Field in bcd format Absolute Second Field in bcd format Absolute Frame Field in bcd format CD-ROM Mode Field 2336 bytes user defined data NOTE: Many drives are capable of returning CD-ROM Mode one data in a CD- ROM Mode two format. This allows the user to investigate the error detection and error correction codes. However if the data is encoded as CD-ROM Mode two it cannot be read as CD-ROM mode one data. The address in the CD-ROM Header field is not usually the same as the address in the sub-channel Q data for a particular sector. This difference is the MSF address offset and is established when the master stamper is created. Ready Condition/Not Ready Condition The ready condition occurs after a caddy is inserted and the the table of contents has been recovered from the disk. A not ready condition occurs for the following reasons: 1) There is no caddy inserted. 2) The drive is unable to load or unload the caddy. 3) The drive is unable to recover the table of contents. 4) The controller cannot select drive. (This can only occur if the controller was previously able to select the drive). A check condition status will be returned for the drive not ready condition only for commands that require or imply a disk access. The following commands will not return a check condition status for the not ready condition: 1) INQUIRY 6) STOP UNIT with LoEj bit set to one 2) MODE SELECT 7) ALLOW MEDIUM REMOVAL 3) RESERVE 8) READ BUFFER 4) RELEASE 9) WRITE BUFFER 5) MODE SENSE 10) EJECT CADDY The following commands will return a check condition status for the not ready condition: 1) TEST UNIT READY 13) READ TOC 2) REZERO UNIT 14) READ Q SUBCODE 3) READ 15) READ HEADER 4) SEEK 16) PLAYBACK AUDIO 5) START UNIT (with Start bit set) 17) PLAY AUDIO TRACK 6) RECEIVE DIAGNOSTIC RESULTS 18) PAUSE 7) SEND DIAGNOSTIC 19) PLAYBACK STOP 8) PREVENT MEDIUM REMOVAL 20) PLAYBACK STATUS 9) READ CAPACITY 10) READ EXTENDED 11) SEEK EXTENDED 12) VERIFY Command Descriptions for CD-ROM Devices Summary of Commands for CD-ROM Devices ============================================================================== Operation Code Type Command Name Section ------------------------------------------------------------------------------ 00h M TEST UNIT READY 7 01h O REZERO UNIT 15 03h M REQUEST SENSE 7 08h O READ 15 0Bh O SEEK 15 12h M INQUIRY 7 15h O MODE SELECT 7 16h M RESERVE 15 17h M RELEASE 15 1Ah O MODE SENSE 7 1Bh O START/STOP UNIT 15 1Ch O RECEIVE DIAGNOSTIC RESULTS 7 1Dh M SEND DIAGNOSTIC 7 1Eh O PREVENT/ALLOW MEDIUM REMOVAL 15 1Fh O READ LOG 7 25h M READ CAPACITY 7 28h M READ EXTENDED 15 2Bh O SEEK EXTENDED 15 2Fh O VERIFY 15 3Bh O WRITE BUFFER 7 3Ch O READ BUFFER 7 41h O READ TOC 13 42h O READ Q SUBCODE 13 43h O READ HEADER 13 44h O PLAYBACK STATUS 13 45h O PAUSE 13 46h O PLAY TRACK 13 47h O PLAY MSF 13 48h O PLAY AUDIO 13 49h O PLAYBACK CONTROL 13 55h O MODE SELECT EXTENDED 7 5Ah O MODE SENSE EXTENDED 7 ============================================================================== READ Command Additions [Add the following paragraphs to the READ command in Section 15.] The READ command is terminated with a CHECK CONDITION status for a number of reasons. The error recovery parameter determines when and how the data errors are reported. The data transfer shall also be terminated with a CHECK CONDITION STATUS if any of the following events occur while a read operation is in progress. The sense key shall be set to ILLEGAL REQUEST. The additional sense code shall be set to END OF USER AREA ENCOUNTERED ON THIS TRACK. 1) A mode zero is detected (i.e. post-gap detected). 2) An index equal to 0 is detected (i.e. pre-gap detected). 3) A change in bit one of the control field is detected. If the logical block address requested is not within a data track the command shall be terminated with a CHECK CONDITION status. The sense key shall be set to ILLEGAL REQUEST. The additional sense code shall be set to ILLEGAL MODE FOR THIS TRACK. If the logical block address plus the transfer length exceeds the logical block address reported by the READ CAPACITY data the command shall be terminated with a CHECK CONDITION status. The sense key shall be set to ILLEGAL REQUEST. The additional sense code shall be set to LOGICAL BLOCK ADDRESS NOT VALID. SEEK Command Additions [Add the following paragraphs to the SEEK command in Section 15.] A seek operation to any logical block address that is less than or equal to that reported by a READ CAPACITY command is valid. IMPLEMENTORS NOTE: In the case of a CD-ROM the logical block address is converted to an absolute MSF address. The seek is made to the MSF address. The MSF address has a tolerance of +_ seventy-five logical blocks. Add to Power-on Condition If after the caddy is inserted it does not seat properly, or the drive is unable to focus, or the drive is unable to achieve spindle lock-up or the table of contents is not recovered the controller will return a CHECK CONDITION STATUS. Add to Unit Attention Condition The unit attention condition occurs following a the insertion of a caddy with the successful recovery of the table of contents. If an STOP UNIT command (with LoEj set) is received from an initiator with a pending unit attention condition the controller will perform the command and will not clear the unit attention condition. If an initiator issues a command other than INQUIRY, REQUEST SENSE, or STOP UNIT (with LoEj set) while a unit attention condition exists for that initiator, the controller will terminate the command with a CHECK CONDITION status. PAUSE Command Peripheral Device Type: CD-ROM Operation Code Type: Optional PAUSE Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (45h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Pause | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Reserved | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | Reserved | -----|-----------------------------------------------------------------------| 8 | Reserved | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The PAUSE command requests that the target start/stop the current audio play operation. A pause bit of one indicates the drive shall enter the hold track state with the audio output muted after the current audio block is played. A pause bit of zero indicates the drive shall release the pause and begin play at the block following the last block played. PLAY AUDIO Command Peripheral Device Type: CD-ROM Operation Code Type: Optional PLAY AUDIO Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (48h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | | -----|--- Logical Block Address ---| 4 | | -----|--- ---| 5 | (LSB) | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | (MSB) | -----|--- Transfer Length ---| 8 | (LSB) | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The PLAY AUDIO command requests that the target play audio starting at the specified logical block address for the specified transfer length. The audio is output as specified by the audio control parameters. This command returns the status byte when the address requested is found. If the address is not found , or if the ready condition does not exist, or if the address is not within an audio track, a CHECK CONDITION status shall be returned and the appropriate sense key set. [Paul - We still have to resolve the issue of when status is returned, and how it affects disconnect/reconnect parameters. ljl] PLAY MSF Command Peripheral Device Type: CD-ROM Operation Code Type: Optional PLAY MSF Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (47h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Starting Minutes | -----|-----------------------------------------------------------------------| 4 | Starting Seconds | -----|-----------------------------------------------------------------------| 5 | Starting Frame | -----|-----------------------------------------------------------------------| 6 | Ending Minutes | -----|-----------------------------------------------------------------------| 7 | Ending Seconds | -----|-----------------------------------------------------------------------| 8 | Ending Frame | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The PLAY MSF command requests that the target output the audio signals starting at the specified starting address and continue the audio play operation until the specified ending address is detected. The audio signals are output as specified by the audio control parameters. The Starting minutes, seconds, frame specify the starting address in absolute time. The Ending minutes, seconds, frame specify the ending address in absolute time. This command returns the status byte when the address requested is found. If the address is not found , or if the ready condition does not exist, or if the address is not within an audio track, a CHECK CONDITION status shall be returned and the appropriate sense key set. PLAY TRACK Command Peripheral Device Type: CD-ROM Operation Code Type: Optional PLAY TRACK Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (46h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Starting Track | -----|-----------------------------------------------------------------------| 5 | Starting Index | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | Reserved | -----|-----------------------------------------------------------------------| 8 | Number of Indexes | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The PLAY TRACK command requests that the target play audio starting at the specified starting track and index for the specified number of indexes. The audio is output as specified by the audio control parameters. The starting track field specifies the track number of the audio track. The starting index field specifies the index number within starting track to begin the audio play operation. The number of indexes specifies the duration of the audio play operation. If the value in the number of indexes field exceeds the number of indexes within the track the play operation shall continue until the end of the track request. A value of FFh requests that the play operation continue until the lead-out track or a non-audio track is detected. IMPLEMENTORS NOTE: A typical audio track for music has only one index number (i.e. the number of indexes is equal to one.) The number of indexes within a track in not obtainable from data in the table of contents. This command returns the status byte when the address requested is found. If the address is not found , or if the ready condition does not exist, or if the address is not within an audio track, a CHECK CONDITION status shall be returned and the appropriate sense key set. [Paul - We still have to resolve the issue of when status is returned, and how it affects disconnect/reconnect parameters. ljl] PLAYBACK CONTROL Command Peripheral Device Type: CD-ROM Operation Code Type: Optional PLAYBACK CONTROL Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (49h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Reserved | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | (MSB) | -----|--- Parameter Length ---| 8 | (LSB) | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The PLAYBACK CONTROL command requests that the target set the audio play as specified. If the drive is not in the ready condition the command shall be terminated with a CHECK CONDITION status. The sense key shall be set to NOT READY and the appropriate additional sense code set. The parameter length specifies the number of bytes of data to be sent during the data out phase. Audio Control Data Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Reserved | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | Reserved | -----|-----------------------------------------------------------------------| 8 | Reserved | -----|-----------------------------------------------------------------------| 9 | Resrved | -----|-----------------------------------------------------------------------| 10 | Reserved | Channel 0 Output Selection | -----|-----------------------------------------------------------------------| 11 | Channel 0 Volume | -----|-----------------------------------------------------------------------| 12 | Reserved | Channel 1 Output Selection | -----|-----------------------------------------------------------------------| 13 | Channel 1 Volume | -----|-----------------------------------------------------------------------| 14 | Reserved | Channel 2 Output Selection | -----|-----------------------------------------------------------------------| 15 | Channel 2 Volume | -----|-----------------------------------------------------------------------| 16 | Reserved | Channel 3 Output Selection | -----|-----------------------------------------------------------------------| 17 | Channel 3 Volume | ============================================================================== The channel output selection specifies where the audio for that channel shall be output. See Table _.__. A channel may be specified for output to more than one channel (i.e., channel one may be output to channels one and two). Channel Output Selection ============================================================================== 0000 muted 0001 output to channel 0 0010 output to channel 1 0100 output to channel 2 1000 output to channel 3 ============================================================================== The channel volume control specifies the relative volume level for the audio output. A value of zero indicates the output is muted, a value of FFh indicates maximum volume level. PLAYBACK STATUS Command Peripheral Device Type: CD-ROM Operation Code Type: Optional PLAYBACK STATUS Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (44h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Reserved | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | (MSB) | -----|--- Allocation Length ---| 8 | (LSB) | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The PLAYBACK STATUS command requests that the target return the status data of the current audio block. If the drive is not in the ready condition the command shall be terminated with a CHECK CONDITION status. The sense key shall be set to NOT READY and the appropriate additional sense code set. The allocation length specifies the number of bytes that the initiator has allocated for returned data. An allocation length of zero indicates that no data shall be transferred. Any other value indicates the maximum number of bytes that shall be transferred. The target terminates the DATA IN phase when allocation length bytes have been transferred or when all available data have been transferred, whichever is less. Audio Status Data Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | -----|-----------------------------------------------------------------------| 1 | Reserved | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- Audio Status Data Length ---| 3 | (LSB) | -----|-----------------------------------------------------------------------| 4 | Audio Status | -----|-----------------------------------------------------------------------| 5 | Reserved | Control | -----|-----------------------------------------------------------------------| 6 | | -----|--- ---| 7 | | -----|--- CD Address ---| 8 | | -----|--- ---| 9 | | -----|-----------------------------------------------------------------------| 10 | Reserved | Channel 0 Output Selection | -----|-----------------------------------------------------------------------| 11 | Channel 0 Volume | -----|-----------------------------------------------------------------------| 12 | Reserved | Channel 1 Output Selection | -----|-----------------------------------------------------------------------| 13 | Channel 1 Volume | -----|-----------------------------------------------------------------------| 14 | Reserved | Channel 2 Output Selection | -----|-----------------------------------------------------------------------| 15 | Channel 2 Volume | -----|-----------------------------------------------------------------------| 16 | Reserved | Channel 3 Output Selection | -----|-----------------------------------------------------------------------| 17 | Channel 3 Volume | ============================================================================== The audio status bits are defined in Table _-__. Audio Status ============================================================================== Status Description | ----------|------------------------------------------------------------------| 00h | Audio play operation in progress. | ----------|------------------------------------------------------------------| 01h | Audio pause operation in progress. | ----------|------------------------------------------------------------------| 02h | Audio muting on. | ----------|------------------------------------------------------------------| 03h | Audio play operation successfully completed. | ----------|------------------------------------------------------------------| 04h | Error occurred during audio play operation. | ----------|------------------------------------------------------------------| 03h | Audio play operation not requested. | ============================================================================== The control bits are defined in Table _-__. The CD Address field specifies the starting address of the next track. The format of the address is determined by the LBAMSF bit in the CD-ROM parameters. See Section _._._. The channel output selection indicates where the audio channel is output. See Table _.__. A channel may be output to more than one channel (i.e., channel one may be output to channels one and two). Channel Output Selection ============================================================================== 0000 muted 0001 output to channel 0 0010 output to channel 1 0100 output to channel 2 1000 output to channel 3 ============================================================================== The channel volume control indicates the relative volume level of the audio output. A value of zero indicates the output is muted, a value of FFh indicates maximum volume level. READ HEADER Command Peripheral Device Type: CD-ROM Operation Code Type: Optional READ HEADER Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (43h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | RelAdr | -----|-----------------------------------------------------------------------| 2 | (MSB) | -----|--- ---| 3 | | -----|--- Logical Block Address ---| 4 | | -----|--- ---| 5 | (LSB) | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | (MSB) | -----|--- Allocation Length ---| 8 | (LSB) | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The READ HEADER command requests that the target return the CD-ROM data header for the specified logical block. The allocation length specifies the number of bytes that the initiator has allocated for returned data. An allocation length of zero indicates that no data shall be transferred. Any other value indicates the maximum number of bytes that shall be transferred. The target terminates the DATA IN phase when allocation length bytes have been transferred or when all available data have been transferred, whichever is less. See the READ command for exception handling. If the logical block size is less than the physical block size the CD-ROM data header shall be returned for the physical block which contains the logical block requested. Header Data Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Absolute Minute | -----|-----------------------------------------------------------------------| 1 | Absolute Second | -----|-----------------------------------------------------------------------| 2 | Absolute Frame | -----|-----------------------------------------------------------------------| 3 | CD-ROM Mode | ============================================================================== The absolute minutes, seconds and frame fields specify the physical location from the beginning of the disk. The CD-ROM Mode field specifies the CD-ROM mode of the physical block. READ SUB-CHANNEL Command Peripheral Device Type: CD-ROM Operation Code Type: Optional READ SUB-CHANNEL Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (42h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 |Reserved| Sub Q | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Reserved | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | (MSB) | -----|--- Allocation Length ---| 8 | (LSB) | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The READ SUB-CHANNEL command requests that the target return the requested sub-channel data of the current block. The Sub Q bit set to one requests the target return the Q sub-channel data. The Sub Q bit set to zero requests that no data be returned. NOTE: The other bits in this byte are reserved for use in requesting other sub-channel data. The bits occur in the sub-channel in P Q R S T U V W order. At present returning data from the other sub-channels is not permitted by the medium standards. The allocation length specifies the number of bytes that the initiator has allocated for returned data. An allocation length of zero indicates that no data shall be transferred. Any other value indicates the maximum number of bytes that shall be transferred. The target terminates the DATA IN phase when allocation length bytes have been transferred or when all available data have been transferred, whichever is less. Sub-Channel Q Data Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | Control | -----|-----------------------------------------------------------------------| 1 | Track Number | -----|-----------------------------------------------------------------------| 2 | Index Number | -----|-----------------------------------------------------------------------| 3 | Relative Minute | -----|-----------------------------------------------------------------------| 4 | Relative Second | -----|-----------------------------------------------------------------------| 5 | Relative Frame | -----|-----------------------------------------------------------------------| 6 | Absolute Minute | -----|-----------------------------------------------------------------------| 7 | Absolute Second | -----|-----------------------------------------------------------------------| 8 | Absolute Frame | ============================================================================== [Paul - if we have a switch to go to logical address should this command then be not supported? Or, how does one report a relative logical address? - Larry] The control bits are defined in Table _-__. The Track Number specifies the current track number. The Index Number specifies the index number in the current track. The relative minutes, seconds and frame fields specify the relative physical location from the beginning of the current track. The absolute minutes, seconds and frame fields specify the absolute physical location from the beginning of the disk. READ TOC Command Peripheral Device Type: CD-ROM Operation Code Type: Optional READ TOC Command ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Operation Code (41h) | -----|-----------------------------------------------------------------------| 1 | Logical Unit Number | Reserved | -----|-----------------------------------------------------------------------| 2 | Reserved | -----|-----------------------------------------------------------------------| 3 | Reserved | -----|-----------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Track Number | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | (MSB) | -----|--- Allocation Length ---| 8 | (LSB) | -----|-----------------------------------------------------------------------| 9 | Control Byte | ============================================================================== The READ TOC command requests the transfer of the table of contents (TOC) data to the inititiator. The track number field specifies the first track number for which the TOC data shall be returned. The data is returned in contiguous ascending order. If the track number field is not valid for the disk inserted the command shall be terminated with a CHECK CONDITION status. The sense key shall be set to ILLEGAL REQUEST. The additional sense code shall be set to ILLEGAL VALUE IN CDB. The allocation length specifies the number of bytes that the initiator has allocated for returned data. An allocation length of zero indicates that no data shall be transferred. Any other value indicates the maximum number of bytes that shall be transferred. The target terminates the DATA IN phase when allocation length bytes have been transferred or when all available data have been transferred, whichever is less. TOC Data Format ============================================================================== 0 | (MSB) | -----|--- TOC Data Length ---| 1 | (LSB) | -----|-----------------------------------------------------------------------| 2 | First Track Number | -----|-----------------------------------------------------------------------| 3 | Last Track Number | ============================================================================== TOC Track Descriptor ============================================================================== 0 | Track Number | -----|-----------------------------------------------------------------------| 1 | Reserved | Control | -----|-----------------------------------------------------------------------| 2 | | -----|--- ---| 3 | | -----|--- CD Address ---| 4 | | -----|--- ---| 5 | | ============================================================================== The TOC data returned is a four byte header followed by one or more (up to 100) TOC track descriptors. The last track descriptor is for the lead-out area. The format of the CD Address is determined by the LBAMSF bit in the CD-ROM Parameters Page. See Section __.__.__. The TOC data length specifies the length in bytes of the available table of contents data. The value of TOC data length does not include itself. The maximum value is 502d (01F3h). The first track number field indicates the first track number in the table of contents. IMPLEMENTORS NOTE: A disk may start at any track number. The track numbers between the first track number and the last track number are in contiguous ascending order. The last track number field indicates the last track number in the table of contents before the lead-out track number. The track number field indicates the track number for the CD address that follows. The control field inidcates the attributes of the track. These are defined in Table _-__. Definition of Control Field Bits ============================================================================== Bit equal one equal zero ------ ------------------------- ------------------------- 0 With pre-emphasis Without pre-emphasis 1 Digital copy permitted Digital copy prohibited 2 Data track Audio track 3 Four channel Two channel ============================================================================== Page Descriptions for CD-ROM MODE SELECT Pages Page Codes ============================================================================== Page Code Description ---------- -------------------------------------------- 01h Read Error Recovery Parameters 02h Disconnect/Reconnect Control Parameters 07h Verify Error Recovery Parameters 08h CD-ROM Parameters 0Bh Medium Types Supported Parameters ============================================================================== Page Code One Page Code One: Read Error Recovery Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | Page Code (01h) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (06h) | -----|-----------------------------------------------------------------------| 2 | Error Recovery | -----|-----------------------------------------------------------------------| 3 | Read Retry Count | -----|-+---------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Reserved | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | Reserved | ============================================================================== The implementation of error recovery procedures for CD-ROM devices is markedly different than those used for magnetic medium disk drives. At least one level of error correction (i.e. CIRC) is required to unscramble the data stream. Therefore the performance of the drive may differ substantially from what would be expected by sending the same error recovery parameters to a magnetic medium device. The correlation of the error recovery parameter and the bit settings defined in CCS is given in Table 3-14. The error recovery parameter is defined in Tables 3-15, 3-16, 3-17 and 3-18. If the error recovery parameter is set to any other value the command will be terminated with a CHECK CONDITION status. The sense key will be set to ILLEGAL REQUEST and the additional sense code set to ILLEGAL VALUE IN PARAMETER LIST. The read retry count field specifies the number of times that the controller will attempt its read recovery algorithm. The default value is zero. Error Recovery Byte Bit Settings ======================================================= |value| Error Recovery | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | | | | TB | | EER | PER | DTE | DCR | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 00 | 0 0 0 0 0 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 01 | 0 0 0 0 1 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 04 | 0 0 1 0 0 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 05 | 0 0 1 0 1 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 06 | 0 0 1 1 0 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 07 | 0 0 1 1 1 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 20 | 1 0 0 0 0 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 21 | 1 0 0 0 1 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 26 | 1 0 1 1 0 | |-----+-----+-----+-----+-----+-----+-----+-----+-----| | 27 | 1 0 1 1 1 | ======================================================= A CIRC recovered data error is defined as a block for which the C2PO flag was set, but on a subsequent read operations it was not set. The number of subsequent read operations is limited to the read retry count. Layered error correction is not used. A CIRC unrecovered data error is defined as a block for which the C2PO flag was set on all read operations up to the read retry count. Only read retries are used, layered error correction is not used. An L-EC recovered data error is defined as a block for which the C2PO flag was asserted but the layered error correction was able to correct the block within the read retry count. An L-EC uncorrectable data error is defined as a block which could not be corrected by layered error correction within the read retry count. The error recovery procedures in Tables 3-15 and 3-16 are applicable only to CD-ROM mode one data. If one of the these error recovery parameters is specified and CD-ROM mode two data is detected the read operation will be terminated with a CHECK CONDITION status. The sense key will be set to ILLEGAL MODE FOR THIS TRACK. Error Recovery Procedures - CD-ROM Mode One Data ============================================================================== Error Recovery Description ------------------------------------------------------------------------------ 00h This is the default setting of the error recovery parameter on when a power-on or reset condition occurs. The maximum error recovery procedures are used. Only L-EC uncorrectable data errors are reported. If an L-EC uncorrectable data error occurs data transfer is terminated with a CHECK CONDITION status. The sense key is set to MEDIUM ERROR and the additional sense code is set to L-EC UNCORRECTABLE DATA ERROR. The information bytes are set to the address of the last block transferred to the initiator plus one. 04h The maximum error recovery procedures are used. L-EC recovered data errors are reported. If an L-EC recovered data error occurs data transfer is not terminated. However, when the data transfer has completed a CHECK CONDITION status is reported. The sense key is set to RECOVERED ERROR and the additional sense code is set to L-EC RECOVERED DATA ERROR. The information bytes are set to the address of the last block for which an L-EC recovered data error was detected. If an L-EC uncorrectable data error occurs data transfer is not terminated. However, when the data transfer has completed a CHECK CONDITION status is reported. The sense key is set to MEDIUM ERROR and the additional sense code is set to L-EC UNCORRECTABLE DATA ERROR. The information bytes are set to the address of the first block on which an L-EC uncorrectable error was detected. 06h The maximum error recovery procedures are used. L-EC recovered data errors are reported. If an L-EC recovered data error occurs data transfer is terminated with a CHECK CONDITION status. The sense key is set to RECOVERED ERROR and the additional sense code is set to L-EC RECOVERED DATA ERROR. The information bytes are set to the address of the last block transferred to the initiator plus one. If an L-EC uncorrectable data error occurs data transfer is terminated with a CHECK CONDITION status. The sense key is set to MEDIUM ERROR and the additional sense code is set to L-EC UNCORRECTABLE DATA ERROR. The information bytes are set to the address of the first block on which an L-EC uncorrectable error was detected. ============================================================================== Error Recovery Procedures - CD-ROM Mode One Data ============================================================================== Error Recovery Description ------------------------------------------------------------------------------ 20h The maximum error recovery procedures are used. Only L-EC uncorrectable data errors are reported. If an L-EC uncorrectable data error occurs data transfer is not terminated. However, when the data transfer has completed a CHECK CONDITION status is reported. The sense key is set to MEDIUM ERROR and the additional sense code is set to L-EC UNCORRECTABLE DATA ERROR. The information bytes are set to the address of the last block for which an L-EC uncorrectable data error was detected. 26h The maximum error recovery procedures are used. L-EC recovered data errors are reported. If an L-EC recovered data error occurs data transfer is terminated at the end of the first encountered L-ECC uncorrectable data block with a CHECK CONDITION status. The sense key is set to RECOVERED ERROR and the additional sense code is set to L-EC RECOVERED DATA ERROR. The information bytes are set to the address of the last block transferred. If an L-EC uncorrectable data error occurs data transfer is terminated with a CHECK CONDITION status after the L-EC uncorrectable block is transferred. The sense key is set to MEDIUM ERROR and the additional sense code is set to L-EC UNCORRECTABLE DATA ERROR. The information bytes are set to the address of the first block on which an L-EC uncorrectable error was detected. ============================================================================== Error Recovery Procedures - CD-ROM Mode One or Two Data ============================================================================== Error Recovery Description ------------------------------------------------------------------------------ 01h Only retries of the read operation are used (layer error correction is not used). Only CIRC unrecovered data errors are reported. If an CIRC unrecovered data error occurs data transfer is terminated with a CHECK CONDITION status. The sense key is set to MEDIUM ERROR and the additional sense code is set to CIRC UNRECOVERED DATA ERROR. The information bytes are set to the address of the last block transferred to the initiator plus one. 05h Only retries of the read operation are used (layer error correction is not used). CIRC recovered data errors are reported. If a CIRC recovered data error occurs data transfer is not terminated. However, when the data transfer has completed a CHECK CONDITION status is reported. The sense key is set to RECOVERED ERROR and the additional sense code is set to CIRC RECOVERED DATA ERROR. The information bytes are set to the address of the last block for which an CIRC recovered data error was detected. If an CIRC unrecovered data error occurs data transfer is not terminated. However, when the data transfer has completed a CHECK CONDITION status is reported. The sense key is set to MEDIUM ERROR and the additional sense code is set to CIRC UNRECOVERED DATA ERROR. The information bytes are set to the address of the first block on which an CIRC unrecovered error was detected. 07h Only retries of the read operation are used (layer error correction is not used). CIRC recovered data errors are reported. If a CIRC recovered data error occurs data transfer is terminated with a CHECK CONDITION status. The sense key is set to RECOVERED ERROR and the additional sense code is set to CIRC RECOVERED DATA ERROR. The information bytes are set to the address of the last block transferred to the initiator plus one. If an CIRC unrecovered data error occurs data transfer is terminated with a CHECK CONDITION status. The sense key is set to MEDIUM ERROR and the additional sense code is set to CIRC UNRECOVERED DATA ERROR. The information bytes are set to the address of the first block on which an CIRC unrecovered error was detected. ============================================================================== Error Recovery Procedures - CD-ROM Mode One or Two Data ============================================================================== Error Recovery Description ------------------------------------------------------------------------------ 21h Only retries of the read operation are used (layer error correction is not used). Only CIRC unrecovered data errors are reported. If a CIRC unrecovered data error occurs data transfer is not terminated. However, when the data transfer has completed a CHECK CONDITION status is reported. The sense key is set to MEDIUM ERROR and the additional sense code is set to CIRC UNRECOVERED DATA ERROR. The information bytes are set to the address of the last block for which a CIRC unrecovered data error was detected. 27h Only retries of the read operation are used (layer error correction is not used). CIRC recovered data errors are reported. If a CIRC recovered data error occurs data transfer is terminated at the end of the first encountered CIRC unrecovered data block with a CHECK CONDITION status. The sense key is set to RECOVERED ERROR and the additional sense code is set to CIRC RECOVERED DATA ERROR. The information bytes are set to the address of the last block transferred to the initiator. If an CIRC unrecovered data error occurs data transfer is terminated with a CHECK CONDITION status after the CIRC unrecovered block is transferred. The sense key is set to MEDIUM ERROR and the additional sense code is set to CIRC UNRECOVERED DATA ERROR. The information bytes are set to the address of the first block on which an CIRC unrecovered error was detected. ============================================================================== Page Code Seven Page Code Seven: Verify Error Recovery Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | Page Code (07h) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (06h) | -----|-----------------------------------------------------------------------| 2 | Error Recovery | -----|-----------------------------------------------------------------------| 3 | Verify Retry Count | -----|-+---------------------------------------------------------------------| 4 | Reserved | -----|-----------------------------------------------------------------------| 5 | Reserved | -----|-----------------------------------------------------------------------| 6 | Reserved | -----|-----------------------------------------------------------------------| 7 | Reserved | ============================================================================== The implementation of error recovery procedures for verification operations is the same as for read operations on CD-ROM devices. Page Code Eight Page Code Eight: CD-ROM Parameters ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | Page Code (08h) | -----|-----------------------------------------------------------------------| 1 | Parameter Length (02h) | -----|-----------------------------------------------------------------------| 2 | Reserved | LBAMSF | -----|-----------------------------------------------------------------------| 3 | Reserved | Inactivity Timer Multiplier | ============================================================================== The LBAMSF bit if zero indicates that the target will use the logical block addressing mode. The LBAMSF bit, if one, indicates that the target will use the minutes-seconds-frame addressing mode. The LBAMSF bit applies only to Group Two commands implemented for the CD-ROM device type. Logical Block Address Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | (MSB) | -----|--- ---| 1 | | -----|--- Logical Block Address ---| 2 | | -----|--- ---| 3 | (LSB) | ============================================================================== Minute Second Frame Format ============================================================================== Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Byte | | | | | | | | | ============================================================================== 0 | Reserved | -----|-----------------------------------------------------------------------| 1 | Absolute Minute | -----|-----------------------------------------------------------------------| 2 | Absolute Second | -----|-----------------------------------------------------------------------| 3 | Absolute Frame | ============================================================================== The Inactivity Timer Multiplier sets the length of time that the drive will remain in the hold track state after completion of a seek or read operation. Inactivity Times ============================================================================= Inactivity Timer Minimum Time in Inactivity Timer Minimum Time in Multiplier Hold Track State Multiplier Hold Track State ---------------- ---------------- ---------------- ---------------- 0h infinite 8h 16 minutes 1h 2 minutes 9h 18 minutes 2h 4 minutes Ah 20 minutes 3h 6 minutes Bh 22 minutes 4h 8 minutes Ch 24 minutes 5h 10 minutes Dh 26 minutes 6h 12 minutes Eh 28 minutes 7h 14 minutes Fh 30 minutes ============================================================================= MODE SENSE Pages Page Codes ============================================================================== Page Code Description ---------- -------------------------------------------- 01h Read Error Recovery Parameters 02h Disconnect/Reconnect Control Parameters 07h Verify Error Recovery Parameters 08h CD-ROM Parameters 0Bh Medium Types Supported Parameters 3Fh Return All Implemented Pages ============================================================================== SEND DIAGNOSTIC Pages RECEIVE DIAGNOSTIC Pages Additional Sense Code Descriptions Additional Sense Code Descriptions ============================================================================== | For Sense Key NO SENSE (0h): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 00 No additional sense information | | For Sense Key RECOVERED ERROR (1h): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 17 CIRC recovered data error | | 18 L-EC recovered data error | | For Sense Key NOT READY (2h): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 04 Unit off line | | x0 Caddy not inserted in drive | | x1 Unable to recover TOC | | x2 Caddy load/eject failed | | For Sense Key MEDIUM ERROR (3h): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 02 Error occurred during seek operation | | 11 L-EC uncorrectable data error (L-EC on) | | x3 CIRC unrecovered data error (L-EC off) | | For Sense Key HARDWARE ERROR (4h): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 08 Logical unit communication failure | | 09 Tracking servo failure | | 40 Controller data buffer failure | | 41 Data path failure (Sony bus data error) | | 42 Power on failure | | 44 Internal controller failure | | 47 Interface parity error | | x4 Focus servo failure | | x5 Spindle servo failure | ============================================================================== Additional Sense Code Descriptions ============================================================================== | For Sense Key ILLEGAL REQUEST (5h): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 20 Invalid command operation code | | 21 Logical block address not valid | | 22 Illegal function for CD-ROM | | 24 Illegal value in CDB field other than op-code or lba | | 25 Invalid logical unit number | | 26 Invalid field in parameter list | | x6 Prevent bit is set | | x7 Logical unit is reserved | | x8 End of user area encountered on this track | | x9 Illegal mode for this track | | For Sense Key UNIT ATTENTION (6h): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 28 Not ready to ready transition (caddy inserted) | | 29 Power on, reset or BUS DEVICE RESET occurred | | 2A Mode select parameters changed | | For Sense Key ABORTED COMMAND (Bh): | | | | Code Description | | ---- -------------------------------------------------------------------- | | 43 Unsuccessful message retry | | 45 Reselect failure | | 48 Initiator detected error | | 49 Message out error | | xA Overlapped commands attempted | ============================================================================== Glossary for CD-ROM devices CD-ROM - It stands for Compact Disc Read Only Memory. CD-ROM is standardized by N.V. Philips & Sony Corporation. The 'RED BOOK ' and 'YELLOW BOOK' standards describe the medium. SUB-Q - The compact disc has a main channel and a sub-channel. The sub- channel has eight parts called Sub-P, Sub-Q, Sub-Q, Sub-R, Sub-S, Sub-T, Sub-U, Sub-V, and Sub-W. The Sub-Q channel contains useful information, such as the control field and MSF address. TNO - Track Number. A disc has from one to ninety-nine tracks. The data within a track is always of the same type. A track can contain be either CD-ROM or CD-Audio. A disc can start at any track number. TOC - The Table Of Contents has information on the type of disc and the starting address of the tracks. This information is encoded in the Sub-Q channel. BCD - Binary Coded Decimal is the number system used with compact discs. Numbers that are use this notation have the 'bcd' suffix attached. A byte has two four-bit values each of which can have a value from 0 to 9. The maximum value is 99bcd (99 decimal). Hence the maximum number of tracks is 99bcd. Example: 00 01 02 03 04 05 06 07 08 09 10 11 ... 19 20 21 ... 98 99. HEX - Hexadecimal is a base sixteen number system used to express some values defined in this document. Numbers that use this notation have the 'h' suffix attached. This number system differs from 'bcd' in that the it uses the first five letters of the alpahabet. The maximum value is FFh (255 decimal). Example: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 ... FF MSF Address - The address on the disc in minutes, seconds, and frame number. All three must be specified to determine a physical location on the disc. Aminutes - The absolute time in minutes from the beginning of the disc in binary coded decimal notation. The value is from 00bcd to 74bcd. Aseconds - The absolute time in seconds from the beginning of the disc in binary coded decimal notation. The value is from 02bcd to 59bcd. Minutes - The relative time in minutes from the beginning of the track in binary coded decimal notation. The value is from 00bcd to 74bcd. Seconds - The relative time in seconds from the beginning of the track in binary coded decimal notation. The value is from 00bcd to 59bcd. Frame - The frame number in binary coded decimal notation within a one second duration of the track. The value is from 00bcd to 74bcd. One second of elapsed time equals 75 frames. Block - A block commonly refers to the data contained in one frame. However there are other meanings attached to this term within the world of compact disc. Hold Track State - When the drive enters the hold track state the optical pick-up of jumps one track towards the inside of the disc at the specified Sub-Q address. The optical pick-up traces the groove of the disc until detecting the address and again jumps one track towards the inside of the disc. ****************************************************************************** END OF DOCUMENT ****************************************************************************** 13_all.ws