Japanese
PROGRAMMER'S GUIDECD communication I/F (CD part)
BackForward
CD Communication Interface User's Manual (CD Part)/Reference

Data details


7.2.1 Basic data

 one
View
table
 Title

data specifications

 Data

basic data

 Data Name

 No

1.0

(1) Basic data type
 Model name
 explanation
 Uint8
 unsigned 1-byte integer
 Sint8
 Signed 1-byte integer
 Uint16
 unsigned 2-byte integer
 Sint16
 signed 2-byte integer
 Uint32
 unsigned 4-byte integer
 Sint32
 signed 4-byte integer
 Boo1
 Logical type 4-byte integer (value is a logical constant)

(2) Logical constant
Use as a logical type (Bool) value.

 constant name
 value
 explanation
 FALSE
TRUE
 0
1
 Represents a logical false value.
Represents the truth of a logical value.
 OFF
ON
 0
1
 Represents switch off (false).
Represents switch on (true).

(3) Others
 constant name
 value
 explanation
 NULL
 ((void*)0)
 NULL pointer 

7.2.2 Constants

 one
View
table
 Title

data specifications

 Data

Constant (1/2)

 Data Name

Constant

 No

2.0

(1) Bit names related to interrupt factor registers (HIRQREQ, HIRQMSK)
bit  7  6  5  4  3  2  1  0
    [ ][ ][ ][ ][ ][ ][ ][ ]
     |  |  |  |  |  |  |  |
     |  |  |  |  |  |  |  +---- CDC_HIRQ_CMOK  1:Commands can be issued
     |  |  |  |  |  |  +------- CDC_HIRQ_DRDY  1:Ready for data transfer
     |  |  |  |  |  +---------- CDC_HIRQ_CSCT  1:1 sector read completed
     |  |  |  |  +------------- CDC_HIRQ_BFUL  1:CD buffer full
     |  |  |  +---------------- CDC_HIRQ_PEND  1:CD playback finished
     |  |  +------------------- CDC_HIRQ_DCHG  1:Disk replacement occurred
     |  +---------------------- CDC_HIRQ_ESEL  1:End of selector setting processing
     +------------------------- CDC_HIRQ_EHST  1:End of host input/output processing

bit 15 14 13 12 11 10  9  8
    [-][-][ ][ ][ ][ ][ ][ ]
           |  |  |  |  |  |
           |  |  |  |  |  +---- CDC_HIRQ_ECPY  1:End of copy/move processing
           |  |  |  |  +------- CDC_HIRQ_EFLS  1:End of file system processing
           |  |  |  +---------- CDC_HIRQ_SCDQ  1:Subcode Q update completed
           |  |  +------------- CDC_HIRQ_MPED  1:MPEG related processing completed
           |  +---------------- CDC_HIRQ_MPCM  1:End of MPEG malfunction section
           +------------------- CDC_HIRQ_MPST  1:Notification of MPEG interrupt status

(2) Error code
 constant name
 explanation
 CDC_ERR_OK
 The function completed normally.
 CDC_ERR_CMDBUSY
 The command end flag is not set to 1 when the command is issued.
Target: All functions that check the command end flag
 CDC_ERR_CMDNG
 The CMOK flag is not set to 1 when issuing the command.
Target: All functions that issue commands
 CDC_ERR_TMOUT
 Timed out. (Waiting for response, waiting for data transfer preparation)
Target: All functions that issue commands
CDC_GetPeriStat function, CDC_DataReady function
 CDC_ERR_PUT
 Empty while waiting for data transfer preparation by writing sector data.
could not secure a suitable sector.
Target: CDC_DataReady function after executing CDC_PutSctData function
 CDC_ERR_REJECT
 The response to the command was REJECT.
Target: All functions that issue commands
 CDC_ERR_WAIT
 The response to the command was WAIT.
Target: All functions that issue commands
 CDC_ERR_TRNS
 Data transfer size is abnormal.
Target: Functions that transfer data internally (functions starting with CDC_Tget)
 CDC_ERR_PERI
 A regular response could not be obtained.
Target: CDC_GetPeriStat function

(3)Special specification of the sector range (sector position and number of sectors) of the buffer partition
 constant name
 explanation
 CDC_SPOS_END
 Indicates the last sector position of the partition.
Same as specifying (number of sectors in partition - 1).
 CDC_SNUM_END
 Indicates the number of sectors from the specified sector position SP to the end of the partition.
Same as specifying (number of sectors in partition - SP).
Valid in the following functions for buffer partitions.

CDC_CalActSiz
CDC_GetSctInfo
CDC_ExeFadSearch
CDC_GetSctData
CDC_DelSctData
CDC_GetdelSctData
CDC_CopySctData
CDC_MoveSctData

Note
If the number of sectors in the partition is 0, WAIT is always returned regardless of the specification. Before executing these functions, be sure to get the number of sectors in the buffer partition (CDC_GetSctNum) and make sure that the number of sectors is not 0.

(4)Other special designations
 constant name
 explanation
 CDC_PARA_DFL
 Specifying default values for configuration parameters (0)
Can be used when specifying the default value as 0.
 CDC_PARA_NOCHG
 Setting parameters unchanged (-1)
When specifying unchanged as FFH, FFFFH, most significant bit = 1, etc.
Can be used for
 CDC_NUL_SEL
 Special values for selector numbers (aperture numbers, buffer section numbers)
 CDC_NUL_FID
 Special values for file identifiers 

7.2.3 TOC information/Session information

 one
View
table
 Title

data specifications

 Data

TOC information/Session information

 Data Name

TOC/SES

 No

3.0

(1)TOC information……CDC_TgetToc function

(2) Session information……CDC_GetSes function

7.2.4 Subcode information

 one
View
table
 Title

data specifications

 Data

Subcode information

 Data Name

Subcode

 No

4.0

(1) Subcode Q information...CDC_TgetScdQch function
(a) When Adr=1

byte
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
Ctrl
Adr
TNO X P_FAD 00 Q_FAD CRC

CtrlAdr :CONTROL/ADR byte
TNO : Track number (binary value, not BCD)
X : Index number (binary value, not BCD)
P_FAD : Track time (frame address format with track start set to 0)
Q_FAD : Absolute time (frame address format with 00:00:00 as 0)

The contents for each status are the same as for the CD report.
The values for each TNO are shown in the table below.
(Lead-in and lead-out can be obtained in multiple sessions)

 TNO
 X
 P_FAD
 01H~63H (1~99)
 01H~63H
 Elapsed FAD in the track
 AAH (Lead Out)
 01H~63H
 Elapsed FAD in the track
 00H (Lead-in)
 01H~63H,A0H,A1H,A2H
 000000H

The lead-in for the first session is Q_FAD=000000H.
(Normally not available)

(b) In case of other (ADR≠1):
Raw value of subcode Q (10 bytes excluding CRC)

(2) Subcode R~W information...CDC_TgetScdRwch function

Subcodes R to W are decoded in units of 1 pack (24 bytes = 12 words).
The CD block has an internal pack buffer for 24 packs (6 packets).

7.2.5 Status and Reports

 one
View
table
 Title

data specifications

 Data

Status and reports

 Data Name

Status & CD Report

 No

5.0

(1)Response format
The response consists of a status and a report. Whether or not to return CD Report as a report depends on the command. Periodic responses always return a CD report.
Together, the status and CD report are called CD status information.

(2)Status
When the status is FFH, it indicates REJECT (invalid command). The status code is always valid except when REJECT. Also, bit5 to bit7 are exclusive and cannot be 1 at the same time.

bit  7  6  5  4  3  2  1  0
    [ ][ ][ ][-][          ]
     |  |  |    Status code (CD drive status)
     |  |  |
     |  |  +------ CDC_ST_PERI 1: Periodic response         0: Response to command
     |  +--------- CDC_ST_TRNS 1: Data transfer request     0: No request
     +------------ CDC_ST_WAIT 1: WAIT (execution pending)  0: ACK (command successfully received)

(a) Status code (CD drive status)
 constant name
 value
 situation
 explanation
 CDC_ST_BUSY
 00H
〈 BUSY〉
 State transition in progress
 CDC_ST_PAUSE
 01H
〈 PAUSE〉
 Pausing (pause)
 CDC_ST_STANDBY
 02H
〈 STANDBY〉
 Standby (drive stopped)
 CDC_ST_PLAY
 03H
〈 PLAY〉
 CD playing
 CDC_ST_SEEK
 04H
〈 SEEK〉
 Seeking in progress
 CDC_ST_SCAN
 05H
〈 SCAN〉
 Scan playback in progress
 CDC_ST_OPEN
 06H
〈 OPEN〉
 tray is open
 CDC_ST_NODISC
 07H
〈 NODISC〉
 no disc
 CDC_ST_RETRY
 08H
〈 RETRY〉
 Read retry processing in progress
 CDC_ST_ERROR
 09H
〈 ERROR〉
 A read data error occurred
 CDC_ST_FATAL
 0AH
〈 FATAL〉
 a fatal error has occurred

(3)CD report
byte
 1
 2
 3
 4
 5
 6
 7
CD Report Flg Rep
Cnt
Ctrl
Adr
TNO X F.A.D.

Flg :CD flag (upper 4 bits)...〈 PLAY〉 Valid in state
RepCnt : Repeat count (lower 4 bits)...Notification range is 0H to EH
bit  7  6  5  4  3  2  1  0
    [ ][-][-][-][          ]
     |           Number of repeats
     |
     +------------ CDC_CDFLG_ROM   1:CD-ROM decoding
                                   0:CD-DA, seek, scan, etc.

CtrlAdr :CONTROL/ADR byte
TNO : Track number (binary value, not BCD) based on subcode Q
X : Index number (binary value, not BCD)
F.A.D. :Frame address (based on header information for CD-ROM, otherwise based on subcode Q)

(4)CD report contents for each status
The CD drive status and CD report contents are shown below. The sequence FFH means invalid values. (CD report is invalid during REJECT, valid during WAIT.)

 situation
 CD flag/repeat
 CONTROL/ADR
 track number
 index number
 frame address
〈 BUSY〉
 ○/FFH
 ○/FFH
 ○/FFH
 ○/FFH
 ○/FFFFFFH
〈 PAUSE〉
〈 STANDBY〉
 Value at pause
 Value at pause
 Value at pause
 Value at pause
 Value at pause
 When seeking home
 FFH
 FFH
 FFH
 FFH
 FFFFFFH
〈 PLAY〉
〈 SEEK〉
 Target position
 Target position
 Target position
 Target position
〈 SCAN〉
〈 OPEN〉
 FFH
 FFH
 FFH
 FFH
 FFFFFFH
〈 NODISC〉
 FFH
 FFH
 FFH
 FFH
 FFFFFFH
〈 RETRY〉
〈 ERROR〉
 FFH
 FFH
 FFH
 FFH
 FFFFFFH
〈 FATAL〉
 Indeterminate
 Indeterminate
 Indeterminate
 Indeterminate
 Indeterminate
○: Current value Seek home: Seek to home position (stop)
After standby time has elapsed〈 PAUSE〉 from〈 STANDBY〉 If the state is changed, the value at the time of pause is retained.

(5) If the CD report contents are invalid values

  1. The previous value for the repeat count is retained. Transitioning to another state reverts to the held value.

  2. From Seek Home〈 PAUSE〉 When the state changes, it moves to the beginning of the disk (FAD = 150).

  3. 〈 ERROR〉 The previous value is retained.<PAUSE> When transitioning to a state, it reverts to its retained value.

  4. When the state transitions, the<BUSY> The state may return an invalid value.
    surely〈 BUSY〉 Please refer to the CD report contents after confirming that the status is other than that.


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