Japanese
PROGRAMMER'S GUIDECD communication I/F (CD part)
BackForward
CD communication interface user's manual

CD drive


4.1 CD drive state transition

(1)CD drive status
Table 4.1 shows the status of the CD drive.

Table 4.1 CD drive status
 situation
 explanation
〈 BUSY〉
 State transition in progress
〈 PAUSE〉
 Pausing (pause)
〈 STANDBY〉
 Standby (drive stopped)
〈 PLAY〉
 CD playing
〈 SEEK〉
 Seeking in progress
〈 SCAN〉
 Scan playback in progress
〈 OPEN〉
 tray is open
〈 NODISC〉
 no disc
〈 RETRY〉
 Read retry processing in progress
〈 ERROR〉
 A read data error occurred
〈 FATAL〉
 A fatal error has occurred (stop command required)

(2) Types of drive commands
Table 4.2 shows the commands (drive commands) that change the status of the CD drive.

Table 4.2 Drive commands
 drive command
 Corresponding function
 CD block initialization
 CDC_CdInit
 opening the tray
 CDC_CdOpen
 play
 CDC_CdPlay
 seek
 CDC_CdSeek
 Pause
 CDC_CdSeek
 stop
 CDC_CdSeek
 scan
 CDC_CdScan

  1. During a soft reset, CD block initialization does not work as a drive command.〈 OPEN〉 ,〈 NODISC〉 Even if a soft reset is executed in the state, the state will not change.
    however〈 OPEN〉 ,〈 NODISC〉 Other than status, pauses the CD drive at the current position.

  2. Drive commands other than tray open also serve as tray close commands.

(3)Issuing drive commands
  1. The drive command response is always〈 BUSY〉 is returned.

  2. As a general rule, commands issued later are executed first. If issued consecutively, the previously issued command may be overwritten.
    To ensure that〈 BUSY〉 Please do not issue until the state transitions to a state other than

4.1.1 CD drive state transition diagram

(1) State transition diagram of normal system
Figure 4.1 shows the state transition diagram of the CD drive in a normal system.

Figure 4.1 CD drive state transition diagram (normal system)

  1. After TOC lead, at 2 seconds 0 frame (FAD=150=96H)〈 PAUSE〉 state.

  2. During state transition (on the arrow line)〈 BUSY〉 The condition will be.

  3. Tray close commands refer to drive commands other than tray open.
    After the tray is closed, it transitions to the state corresponding to each command.
    example:〈 OPEN〉 The play command in the state is after the tray is closed.〈 PLAY〉 state.

(2) State transition diagram of error system
Figure 4.2 shows the state transition diagram of the CD drive in error mode, and Table 4.3 shows the state explanations.

Figure 4.2 CD drive state transition diagram (error type)

Table 4.3 Error-related status description
 situation
 explanation
 internal state
〈 RETRY>
 If the retry is successful〈 PLAY〉 If you fail,〈 ERROR〉 become.
〈 SEEK〉
〈 ERROR〉
 The state remains unchanged until the next drive command is issued.
〈 PAUSE〉
〈 FATAL〉
 Please issue a stop command and try to return.
If I can come back〈 STANDBY〉 Transition to.
〈 STANDBY〉

Internal state refers to the state equivalent to the internal operation of the CD block.

4.1.2 CD drive state transition table

Table 4.4 shows the CD drive state transition table. for example,〈 PLAY〉 If you issue a pause command in the state,〈 PAUSE〉 It indicates that the condition will be reached.

Table 4.4 CD drive state transition table
 operation

situation
 automatic
 command
 Initialization
 tray
open
 play
 Seek
 Pause
 stop
 scan
〈 BUSY〉
 There are changes
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 PAUSE〉
〈 STANDBY〉
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 STANDBY〉
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 PLAY〉
〈 PAUSE〉
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 SEEK〉
〈 PAUSE〉
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 SCAN〉
〈 PAUSE〉
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 OPEN〉
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 NODISC〉
〈 OPEN〉
〈 OPEN〉
〈 OPEN〉
〈 OPEN〉
〈 OPEN〉
〈 OPEN〉
〈 OPEN〉
〈 RETRY〉
 There are changes
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 ERROR〉
〈 PAUSE〉
〈 OPEN〉
〈 PLAY〉
〈 SEEK〉
〈 PAUSE〉
〈 STANDBY〉
〈 SCAN〉
〈 FATAL〉
 Indeterminate
 Indeterminate
 Indeterminate
 Indeterminate
 Indeterminate
 Undefined*
 Indeterminate
"-" means no change.
*〈 FATAL〉 If you issue a stop command in the state,〈 STANDBY〉 There is a possibility that the condition can be restored.

(1)BUSYIssuing a command in a state
〈 BUSY〉 Commands are accepted even in this state, but they are not necessarily executed immediately. For example, if a tray is being opened or closed, it will not be executed until that operation is finished. (However, the tray open command is executed immediately.)

(2) Opening and closing the tray

  1. As a general rule, the tray open command is executed immediately in any state.

  2. If the tray is not automatically opened/closed, the tray open/close command will not be executed until manually executed.〈 BUSY〉 It becomes.

  3. 〈 OPEN〉 Commands in the state (excluding tray open) transition to each state after the tray is closed.

  4. If the TOC cannot be read when the tray is closed〈 NODISC〉 It will be. (Even if there is a disc included)

(3) Via the state
  1. By command, all〈 BUSY〉 Via the state.

  2. 〈 PLAY〉 ,〈 SCAN〉 When transitioning to the state,〈 SEEK〉 It may go through the state.

(4) For multi-session
  1. Lead the TOC for the final session.

  2. After TOC lead, at 2 seconds 0 frame from the start position of the final session〈 PAUSE〉 state.

(Five)FATALStatus recovery process
To perform recovery processing, wait until the SCDQ flag is updated twice after issuing the stop command. Until then, do not issue the next drive command.
Also, when opening and closing the tray,〈 FATAL〉 It is possible to recover from the condition.

4.2 CD drive operation

(1)PLAYstate frame address
The frame address (current FAD) notified during CD playback refers to the sector being read.
The current FAD sector is not stored in the CD buffer and cannot be retrieved.
The host can access up to one sector before the current FAD. (For CD-ROM)

Figure 4.3 Sector pointed to by current FAD

When playback ends, FAD = playback end position + 1.
(This also applies when the playback end position is the end of the disc, and FAD refers to the lead-out area.)

(2)PLAYTransition from state and storage of sectors
〈 PLAY〉 When transitioning from one state to another, it is undefined whether the sector being read is stored or not.〈 BUSY〉 If you transition to a state other than , the sector to be stored is determined.
〈 PLAY〉 Issue a pause command in the state〈 PAUSE〉 If the state changes, the FAD of the storage sector + 1 will be notified, similar to (1).

(3) Repeat processing for CD playback
As shown below, when the current position goes outside the playback range during CD playback, repeat processing is performed.

Both the number of repeat notifications (0H to EH) and the maximum specified number of times (0H to FH) are expressed in 4 bits.
The procedure for repeat processing (determining whether or not to repeat) is shown below.

  1. Repeat count< Repeat if it is the maximum number of repeats.
    Seek to the starting position and〈 PLAY〉 become a state.
    At that time, the number of repeats< If EH (14 times), increase the repeat count by 1.

  2. If the number of repeats ≧ the maximum number of repeats, it will not be repeated.
    at current location〈 PAUSE〉 state, and the PEND flag in the interrupt factor register becomes 1.

If the playback range or maximum repeat count is changed, the repeat count will be cleared to 0.
Neither the number of repeats nor the playback range depends on opening/closing the tray or seek operations during playback.

(4) Playback range and frame address
When playing a CD with the pickup position not changed, if the current position is within the new playback range,〈 PLAY〉 state.〈 PLAY〉 If you run it while it is running, the playback state will not be interrupted.

Figure 4.4 Relationship between playback range and current position

In the following operations, the FAD is outside the playback range (FAD< Starting position, FAD> end position).

Operation outside the playback range depends on whether repeat is present or not.
For example, if playback ends without repeat, FAD = end position + 1.〈 PAUSE〉 state and the PEND flag becomes 1.

Table 4.5 Operation outside the playback range
 Operation (command)
 No repeat
 With repeat
 situation
 PEND
 situation
 PEND
 CD playback ends
 FAD=end position+1〈 PAUSE〉
 1
 seek to start position〈 PLAY〉
(Repeat operation)
 0
 CD playback → Change playback range
→Cancel pause
 at current location〈 PAUSE〉
 seek
 at the target position〈 PAUSE〉
 1
 at the target position〈 PAUSE〉
 0
 scan playback
 in an undefined position〈 PAUSE〉
 1
 in an undefined position〈 PAUSE〉
 0
A PEND flag of 0 means no change.

A PEND flag of 0 means no change.

(5) Seek to home position (stop)
By seeking to the home position, the CD block will be in the following state.

  1. The disk motor stops rotating and the pickup moves to the inner standby position.

  2. CD drive status〈 STANDBY〉 , and the report becomes an invalid value (a sequence of FFH).

  3. at home position〈 PAUSE〉 When the state changes, the pickup moves to the beginning of the disc.

  4. The retained playback range, maximum repeat count, and repeat notification count will not be changed.

    (6)STANDBYPickup position in condition
    • 〈 PAUSE〉 When transitioning from the state: Current position (report remains unchanged)

    • When seeking to home position: Inner radius standby position (report is invalid value)

    (7)CD read operation when CD buffer is full
    When the CD buffer is full〈 PAUSE〉 The BFUL flag in the interrupt factor register becomes 1. When there is space in the CD buffer, the remaining playback will begin automatically.

    4.3 Subcode

    (1) Subcode update and SCDQ flag
    Subcode Q is updated every frame (1 sector). The SCDQ flag becomes 1 each time subcode Q is updated. (Same as update timing of regular response)
    Four packs (one packet) of subcodes R to W are updated in one frame and stored in the pack buffer. The CD block has a pack buffer for 24 packs (6 packets) with a ring buffer structure.

    《When playing CD-DA (standard speed)》

    Figure 4.5 Subcode update and SCDQ flag timing

    (2) Subcode extraction timing
    The host issues an acquisition command when the SCDQ flag becomes 1 and retrieves subcode Q and data from R to W. (To prevent polling due to continuous command issuing)

    (3) Obtaining subcode Q (CDC_TgetScdQch)
    The acquisition command can be executed at any time regardless of the CD drive status. however,〈 OPEN〉 An invalid value may be returned depending on the CD drive status.

    (4) Obtaining subcodes R to W (CDC_TgetScdRwch)
    Packed data is retrieved by repeatedly issuing retrieval commands until the pack buffer is empty. However, do not remove more than 16 packs during one frame time (13.3ms).
    After the host issues the acquisition command, it must complete the data transfer within the decoding time of one pack (3.2ms).
    Returns WAIT when the pack buffer is empty and there is no more packed data.

    (5) Decoding of subcodes R to W

    1. Start and end decoding
      Decoding ON/OFF is set using the CD block initialization command.
      To start decoding, set decode ON and then play the CD-DA.

    2. Decoding start timing
      〈 PLAY〉 Start decoding at the same time.
      in fact,〈 PLAY〉 Data begins to be captured two frames before the state is reached.

    3. Pack buffer clear timing
      Cleared when decoding starts.
      The contents of the pack buffer are retained even if you pause or seek.

    4. Decoding conditions
      It is decoded only when playing CD-DA.
      It is not decoded in other cases (during scan playback or CD-ROM area playback).

    Note: Just setting decode ON will not clear the pack buffer. Therefore,〈 PLAY〉 If you issue a retrieval command before the state is reached, pack data for the previous song may remain.
    surely〈 PLAY〉 Please issue the acquisition command after confirming the status.

    (6) Errors in subcodes R to W

    1. overrun error
      If the pack is not acquired in time, the pack buffer will be overwritten and an overrun error will occur. After data transfer is completed (when 23 packs have been accumulated without actually acquiring pack data), the acquisition pointer advances to the pack with no overrun error.

    2. pack data error
      The CD block performs a CRC check on the P and Q sequences of the packed data, and if an error is detected, the data is corrected.
      If correction is not possible, a pack data error will occur.


BackForward
PROGRAMMER'S GUIDECD communication I/F (CD part)
Copyright SEGA ENTERPRISES, LTD., 1997