When using this document, keep the following in mind:ntialGeneral Notice

1. This document is confidential. By accepting this document you acknowledge that you are boundby the terms set forth in the non-disclosure and confidentiality agreement signed separately and /inthe possession of SEGA. If you have not signed such a non-disclosure agreement, please contact
SEGA immediately and return this document to SEGA.

de2. This document may include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new versions of the
document. SEGA may make improvements and/or changes in the product(s) and/or the
program(s) described in this document at any time.

nfi

3. No one is permitted to reproduce or duplicate, in any form, the whole or part of this document
without SEGA’S written permission. Request for copies of this document and for technicalinformation about SEGA products must be made to your authorized SEGA Technical Services
representative.

Co

4. No license is granted by implication or otherwise under any patents, copyrights, trademarks, orother intellectual property rights of SEGA Enterprises, Ltd., SEGA of America, Inc., or any third
party.
5. Software, circuitry, and other examples described herein are meant merely to indicate the characteristics and performance of SEGA’s products. SEGA assumes no responsibility for any intellectual
property claims or other problems that may result from applications based on the examples
describe herein.

GA

6. It is possible that this document may contain reference to, or information about, SEGA products(development hardware/software) or services that are not provided in countries other than Japan.
Such references/information must not be construed to mean that SEGA intends to provide such
SEGA products or services in countries other than Japan. Any reference of a SEGA licensed product/program in this document is not intended to state or simply that you can use only SEGA’slicensed products/programs. Any functionally equivalent hardware/software can be used instead.
7. SEGA will not be held responsible for any damage to the user that may result from accidents or any
other reasons during operation of the user’s equipment, or programs according to this document.

SE

NOTE: A reader's comment/correction form is provided with thisdocument. Please address comments to :(6/27/95- 002)

SEGA of America, Inc., Developer Technical Support (att. Evelyn Merritt)
150 Shoreline Drive, Redwood City, CA 94065
SEGA may use or distribute whatever information you supply in any way
it believes appropriate without incurring any obligation to you.

SE

GA

Co

nfi

de

nti
al

TM

System Library
User's Guide
Doc. # ST-162-062094

CONTENTS
System Program User’s Manual .......................... 1
SMPC I/F User’s Manual ..................................... 7
CD Communication Interface User’s Manual ..... 21© 1994 SEGA. All Rights Reserved.

nti
al

READER CORRECTION/COMMENT SHEETKeep us updated!
If you should come across any incorrect or outdated information while reading through the attacheddocument, or come up with any questions or comments, please let us know so that we can make therequired changes in subsequent revisions. Simply fill out all information below and return this form to
the Developer Technical Support Manager at the address below. Please make more copies of this form if
more space is needed. Thank you.
General Information:

Phone

Document number
Document nameDate

ST-162-062094
System Library User's Guide

Corrections:
Correction

nfi

pg. #

GA

Co

Chpt.

de

Your NameSE

Questions/comments:

Fax:

Where to send your corrections:(415) 802-3963
Attn: Manager,
Developer Technical Support

Mail:

SEGA OF AMERICA
Attn: Manager,
Developer Technical Support
275 Shoreline Dr. Ste 500
Redwood City, CA 94065

nti
al

REFERENCES

KenKyusha New Japanese-English Dictionary
1974 Edition

2.

Nelson’s Japanese-English Character Dictionary
2nd revised version

3.

Microsoft Computer Dictionary

4.

Japanese-English Computer Terms Dictionary
Nichigai Associates
4th version

SE

GA

Co

nfi

1.

de

In translating/creating this document, certain technical words and/or phrases were interpretedwith the assistance of the technical literature listed below.

SE

GA

Co

nfi

de

nti
al

(This page is blank in the original Japanese document.)

ii

nti
al

Table of Contents
SYSTEM PROGRAM USER’S MANUAL ............................................. 1
1.0

GUIDE .............................................................................................. 1
1.1 Explanation ............................................................................ 1

2.0

REFERENCE .................................................................................... 3
2.1 List of Functions .................................................................... 3
2.2 Function Specifications ......................................................... 3

deSMPC I/F USER’S MANUAL ................................................................. 7
GUIDE .............................................................................................. 7
1.1 Objective ................................................................................. 7
1.2 Overview ................................................................................ 7
1.3 System Management System ............................................... 7
1.4 Peripheral Control System ................................................... 8

2.0

REFERENCE .................................................................................. 11
2.1 Data Specification List ........................................................ 11
2.2 Data Specifications .............................................................. 11
2.3 List of Function Specifications .......................................... 15
2.4 Function Specifications ....................................................... 16

nfi

1.0

Co

CD COMMUNICATION INTERFACE USER’S MANUAL ............. 21
OVERVIEW .................................................................................... 21
1.1 Library Configuration ........................................................ 21
1.2 System Configuration ......................................................... 22
1.3 Functions and Characteristics ........................................... 23

2.0BASIC FACTS ................................................................................ 24
2.1 Terminology and Symbols ................................................. 24
2.2 Disk Layout .......................................................................... 26

3.0

COMMUNICATION WITH THE CD BLOCK ......................... 27
3.1 Communication Register ................................................... 27
3.2 Communication Method .................................................... 29
3.3 Response ............................................................................... 31
3.4 Data Transfer ........................................................................ 32

SE

GA

1.0

iii

CD DRIVE ......................................................................... 33
4.1 CD Drive Status Change ....................................... 33
4.2 CD Drive Operation ............................................... 37
4.3 Subcodes .................................................................. 39

5.0

CD BLOCK CONFIGURATION .................................... 41
5.1 Data Flow ................................................................ 41
5.2 Stream Process Mechanism................................... 42
5.3 Selector Configuration........................................... 43
5.4 Sector Data Format................................................. 48
5.5 CD Block Initialization .......................................... 49

6.0

CD BLOCK FILE SYSTEM .............................................. 50
6.1 File Management in CD-ROM (ISO9660) ........... 50
6.2 CD Block File System Functions .......................... 51

7.0

DATA SPECIFICATIONS................................................ 55
7.1 Data List................................................................... 55
7.2 Data Detailed .......................................................... 56

8.0

FUNCTION SPECIFICATIONS ..................................... 73
8.1 List of Functions ..................................................... 74
8.2 Function Details...................................................... 76

nfi

de

nti
al

4.0

SE

GA

Co

Index .......................................................................................... 104

iv

nti
al

Pages 1-20 of this document have beendearchived. The revised pages of the“System Program User’s Manual” andnfi

the “SMPC I/F User’s Manual” can beCofound in ST-162-R1-092994 entitled“SATURN System Library User’s

SE

GA

Guide ver.1.0”.

nti
al

CD Communication Interface User’s Manual
1.0 OVERVIEWThis document is a collection of CD block functions and CD communication interface external specifications. Functions of CD blocks are classified in Table 1.1 below.
Table 1.1 Classification of CD Block Functions
Classification

Communication format, CD drive related, CD buffer
relatedde

CD PartDescription

CD block file system related
MPEG Part

MPEG Related

1.1 Library Configurationnfi

CD block functions can be used by a common software interface through the CDcommunication interface.

The library configuration of CD relationships is shown in Figure 1.1.

Co

Application

Branch Animation Play Library

MPEG Library(MPG)

File System
Library (GFS)CD Communication Interface (CDC)GA

SoftwareStream System
Library (STM)................................................................................

Hardware

CD Block

SIMM, SCSI

SE

Figure 1.1 Library Structure of CD Relationships

System Library User's Guide21

1.2 System Configuration

Host Program (File system, Application, etc.)

H OST

ReturnCD Communication Interface

Command

Response

Fetch data

Write datanfi

Communication
with CD Block(DMA, etc., Data Transfer Module)

deFunction Callntial

The system configuration of CD relationships is shown in Figure 1.2.

[Command Input/Output Register][Data Transfer Register]Co

CD Block Program (Host Communication Interface, BIOS, etc.)
Communication with CD Drive
CD DriveC D B L O CK

Hardware Interface

GA

In interfacing with the CD block, the main system is called the host.
Moreover, The CD block is one subsystem.
Figure 1.2 System Structure of CD Relationships

1) Communication with the CD Block
The host and CD block communicate (command/response, data transfer) using
registers on the hardware interface. A command issued from the host to the CD
block is called a CD block command; however, this is normally shortened tocommand.

SE

2) CD Drive
The CD block periodically communicates with the CD drive controlling the CD
drive with respect to commands from the host. The CD drive accommodates the
CD-ROM XA standard and multi-session. It is able to switch between the standard speed as well as double the standard speed. (Standard speed is automatically set when playing CD-DA.)22

1.3 Functions and Characteristics

nti
alNumbers “1” to “3” below are functions of the CD communication interface, and “4”
to “7” are CD block functions.
1. CD Block Communication Functions(a) Communicates between the host and CD block and is the C Language
interface function set.
(b) Issues commands to the CD block and receives the response.
(c) Corresponds one to one with the CD block command.

nfi

de

2. Data Transfer Auxiliary Functions
Supports auxiliary functions concerning data transfer such as data transfer
setup and termination as well as data transfer register address acquisition.
Data that is fetched and written in the CD block is sent through the CD block
data transfer register. The transfer itself is not through the CD communicationinterface but is through the DMA data transfer module. (Software transfer, SH-2
DMA, and SCU DMA can be done through the CPU.)
3. Register Access Function
Supports functions that access the CD block register.

Co

4. CD Drive Function
Playing music (CD-DA) and sector read (CD-ROM) are handled by a common
command such as CD play. Stop and pause CD play are seek commands.
Resume CD play (cancel pause) is executed by the CD play command.
5. Subcode R ~ W Decode Function
Subcode R ~ W is decoded when playing CD-DA. There is a pack buffer of 23
pack segments for storing decoded pack data.

GA

6. Stream Select Function
CD-ROM XA standard sectors and the stream of every type of device (host,
MPEG, etc.) are processed uniformly.
(a) There are 200 sectors (about 460 Kbytes) of CD buffer for storingstreams.
(b) There are 24 independent selectors for selecting (separating, storing,
fetching) streams.

SE

7. CD Block File System Function (ISO9660)
Directory information is held in the CD block so that files that conform to theISO9660 standard can be easily accessed.

System Library User's Guide23

2.1 Terminology and Symbols
Definition of Terms

Terms used are defined in Table 2.1 below.
Table 2.1 Definition of T
erms
Term

Meaningnti
al

2.0 BASIC FACTS

Basic units of data handled by a CD block (2352 bytes fixed). The
sector size and configuration follows the CD-ROM format.

StreamDistinguished by sector headers and subheaders. Flow of logicallycontinuous data.

CD Buffer

Buffer within the CD block that stores sector data.

CD Buffer Size

Size of CD buffer sector units.

Buffer Partition

Segments CD buffer into multiple logical partitions. (Can beconsidered logical elements getting and storing streams.)

Buffer Partition Size

Size of buffer partition sector units.

Sector Location

Sector locations within buffer partition (location of sector units).
Takes the value of 0 to (buffer partition size -1). Sectors of thebuffer partition key-in the sector location and accesses.

Filter

Logical element that separates streams by set conditions.

Selector

Composed from the filter and buffer partition, logical element that
selects streams. The selector enables the construction of a stream
select circuit.

DeviceLogical apparatus that causes and absorbs streams such as a CDROM and MPEG. The stream select process is enabled byconnecting a device to the circuit mentioned above.

Connector

Terminal for connecting a filter, buffer partition, or device.

Frame Address (FAD)

Continually adds numbers in frame units with the absolute time
00:00:00 on the CD as 0. Corresponds 1 to 1 with absolute time.
The CD block accesses the frame address as a key and not
absolute time. (both CD-ROM, CD-DA)

GA

Co

nfi

de

Sector

Logic Sector No. (LSN)

Continually adds numbers in sector (frame) units with the absolute
time 00:02:00 on the CD as 0. Logic sector number = frame
address - 150 (2 seconds). Used for information within the
directory code (ISO9660).

File Information

Directory record information maintained for accessing files. There
are the file lead FAD, file size, unit size, gap size, file number, andattributes.

SE

File Identifier

24

Directly sequence number for identifying files. Takes a value of 0
to (directory record number -1).
0: Own directory, 1: Parent directory.

List of Symbols and CodesntialSymbols and codes used are defined in Table 2.1 below.
Table 2.2 List of Symbols and Codes

Numeric Notation

Meaning

Description

address
binary decimal number
buffer partition number
total number of buffer partitions
coding information
channel number
controlcopy and move destination
frame address
frame address sector numbers
file identifierfilter number
file number
least significant bit
most significant bit
play parameters
position parameters
submodesectorsession information
session number(when specifying sector range of partition)(when specifying sector range of partition)
copy / move source
CD status information
subheader condition for filter
track number (music number)
TOC information(data transfer size in word units)
index number
units 2 bytes (16 bits) in length

nfi

address
binary coded decimal
buffer no.
buffer numbers
coding information
channel no.
control
destination
frame address
fad sector numbers
file identifierfilter no.
file no.
least significant bit
most significant bit
play parameter
position parameter
submodesectorsession information
session no.
sector numbers
sector position
sourceCD status information
subheader condition
track no.
TOC informationtransfer word numbers
index
word

Co

Adr
BCD
bn.bufno
bufnum
CI
CN
Ctrl
dst
fad
fasnumfid
fln, filtno
FN
LSB
MSB
ply
pos
SM
sct
ses
sesno
snum
sp. spos
src
stat
subh
TNO
toc
txwnum
X, idxword

deSymbol or CodeGA

B is added to the end of a binary number. (Ex: 5 is 101B.)
H is added to the end of a hexadecimal number. (Ex: 255 is FFH.)
A hexadecimal number in a C language program is noted by C language specification (0x).
Handling BCD

BCD should not be used in parameters. Numbers recorded as BCD on a CD tracknumber, for instance, are all converted to binary values.
C Language IdentifierSE

Use identifiers that begin with CD or Cd in the CD communication interface.

System Library User's Guide25

Track Layoutnti
al

2.2 Disk Layout
Figure 2.1 shows the relationship of the track configuration with the access key thatindicates the position on the disk.
Information Area
Lead inArea

Q CodeData
00

Control
TON
Index

Lead Out
Area

Program Area00
≥ 2 sec.

01~

Audio
AA
01

de

00
2 sec.

Audio
03

Data
02
01

Data
01
01

Time
Absolute Time
ATime
Header(minute, second, frame)

nfi

Logic Sector(LSN)
Frame Address(FAD)

TOC Information

Track start FAD

FAD=0 Track start FAD

Multi Session Layout

TNO

00

Session 1

Session 2

01

04

2 sec.

Absolute Time
ATime

Co

Figure 2.1 Relationship of rackT
Configuration andAccess Key←→

02

03 AA 00

05

06

Session 3

AA 00

2 sec.

07

08

09 AA

2 sec.

←→←→GA

Header(minute, second, frame
Logic Sector Number(LSN)
Frame Address(FAD)

TOC Information

Track start FAD

SE

Session Information Session start FAD

26

Track start FAD
Session start FAD

Track start FAD

Session start FAD . . ..Index is 00

Figure 2.2 Multi Session Layout

COMMUNICATION WITH THE CD BLOCK

3.1 Communication Register

nti
al

3.0

Table 3.1 shows the CD block and communication registers and corresponding
access functions.
Table 3.1 Communication Registers
R/W

Description

Access Function

DATATRNS

R/W

Data Transfer Register

CDC_GetDataPtr

HIRQREQ

R/W

Interrupt Factor Register

CDC_GetHirqReq,
CDC_ClrHirqReq

HIRQMSK

R/W

Interrupt Mask Register

CDC_GetHirqMsk,
CDC_SetHirqMsk

MPEGRGBR

MPEG Register (RGB data)

CDC_GetMpegPtr

deRegister Name

* All access widths are 16 bits (1 word)nfi

See below for more information about the communication register.
In the figure, a reserve bit is shown by “ - “ The reserve bit must be specified with a
0. The bit configuration is 15 for the most significant bit and 0 for the least significant bit.

Co

Data Transfer Register (DATATRNS)

When transferring data, this register inputs and outputs data between the host andCD block. The inner part of the register is FIFO.
R/W

DATATRNS

R/W

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

SE

GA

Register Name

System Library User's Guide

27

Interrupt Factor Register (HIRQREQ)

Register Name

R/W

15

14

HIRQREQ

R/W

—

—

7

6

5

4

EHST

ESEL

DCHG

PEND

:

11

10

9

8

SCDQ

EFLS

ECPY

3

2

1

0

BFUL

CSCT

DRDY

CMOK

de

1 = command can be issued (response set complete)
1 = data transfer setup is complete.
1 = 1 CD-ROM sector is stored or discarded in partition
1 = CD buffer is full
1 = CD play has ended (current FAD is outside play range)
1 = Disk has been exchanged (tray has been opened)
1 = soft reset, stop execution of selector set
1 = stop execution of host input/output
1 = stop execution of copy and move between buffer
1 = stop execution of CD block file system
1 = subcode Q renewal complete(CD drive communication timing)

MPEG related interrupt factor (see MPEG part for the meaning of each bit)Co

bit 11 ~ bit 13

12

nfi

CMOK (bit 0) : Issueable command
DRDY (bit 1) : Data transfer ready
CSCT (bit 2) : 1 sector stored
BFUL (bit 3) : CD buffer full
PEND (bit 4) : CD play end
DCHG (bit 5) : Disk exchange
ESEL (bit 6): Selector set end
EHST (bit 7) : Host I/O end
ECPY (bit 8) : Copy end
partition
EFLS (bit 9): File system end
SCDQ (bit10) : Subcode Q

13

nti
al

This is the interrupt factor register from the CD block to the host.

(a) Bit write can only be done at 0 (clear), not at 1.
(b) The IRQ output to the host is OR output of all factors.
Clears corresponding factor bits during interrupt process.
(c) Names the command end flag of each bit ESEL, EHST, ECPY, EFLS.
Reports the end of execution of commands belonging to each flag.
Interrupt Mask Register (HIRQMSK)GAThis register is for masking interrupt from the CD block to the host.
R/W

15

14

HIRQMSK

R/W

—

—

7

6

5

4

EHST

ESEL

DCHG

PEND

SE

Register Name

13

12

11

10

9

8

SCDQ

EFLS

ECPY

3

2

1

0

BFUL

CSCT

DRDY

CMOK

(a) Bit content is the same as the HIRQREQ register.
(1 = interrupt enable, 0 = same mask)(b) This occurs if interrupt is masked (corresponding bit = 0) when interrupt occurs.
• not reflected in IRQ output.
• reflected in the HIRQREQ register. (Polling process possible)

28

MPEG Register (MPEGRGB)

Register NameR/W

MPEGRGB

R

15

14

13

12

7

6

5

4

nti
al

This register is for transferring in the RGB format MPEG frame buffer image datathat is in the RGB format to the host.
11

10

9

8

3

2

1

0

3.2 Communication Method
Communication Timede

bit 0 ~ bit 15 : RGB data (See MPEG part for the meaning of each bit.)

Communication Errornfi

All interrupts are prohibited during the response time of command/response. Response time may be delayed when commands are continuously issued.
A communication time out error occurs when the CD block does not respond (command is not returned) within the prescribed time after a command is issued.

Co

Command Issue Provisions

GA

Command issue must obey the following provisions.
(a) A maximum of 30 commands can be issued within 6.7 ms.
(b) A maximum of 60 commands can be issued within 16.7 ms.
(c) When acquiring a subcode, a maximum of 34 commands can be issued within
13.3 ms. (subcode R~W is 16 commands + subcode Q is 1 command)(d) Commands belonging to the same command end flag wait for execution to
end and are issued.

SE<Program Guide>The polling process by continuously issuing commands is prohibited.
Regular response and the interrupt factor register are used in the polling of condition changes. Use of timing through the CSCT and SCDQ flags, and VSYNC issues
commands.

System Library User's Guide

29

Command End Flag

Table 3.2 Commands belonging to the Command End Flag

Flag
ESEL

Command• Set CD device connection source• Set filter frame address range• Set filter subheader conditions• Set filter mode

• Set filter connection destination• Reset selector• Calculate actual data size

• Execute frame address find

• Set sector length• Fetch sector data

• Cancel sector data

• Cancel sector data fetch• Write sector data

ECPY

• Copy sector data

• Move sector data

EFLS

• Move directory• Read file

• Save file information

The ESEL flag also posts the end of soft reset execution.
The EFLS flag is 1 when opening the tray and when stopping file access.

nfi

(a)
(b)

de

EHST

nti
al

The end of execution of each command listed below is posted.

Command End Flag Process in CD Communication Interface

Co

When commands belonging to the command end flag are issued, the CD communication interface function does the following.
(a) Checks the command end flag, and if 0, does not issue a command.
(b) If 1, the command end flag is cleared to 0 and a command is issued.

SE

GA

The command end flag is processed when the following commands are issued.
• Soft reset
Clears ESEL flag to 0 (no check)• Gets actual data size
Checks ESEL flag (not cleared to 0)• Gets frame address find results
Checks ESEL flag (not cleared to 0)• Stop file access
Clears EFLS flag to 0 (no check)30

3.3 Response
Response Contents

Status

The following information returns to status.
:• WAIT (hold execute):Command itself is invalid due tomistake in command format.
Cannot be executed under current
conditions, therefore command can
not be received.
Shows that data transfer is necessary.
Shows whether a periodic response or
response to a command.
Shows the logical condition of the
CD drive seen from the host.

de• REJECT (improper command)ntialResponse is composed of a 1 byte status and 7 byte report. The status are common
but the report depends on the command. This most basic of reports is the CD report.

• Data transfer request• Periodic response

:
:
:

nfi

• CD drive condition(a) Response during REJECT is invalid.
(b) Status during WAIT and CD report are effective but other reports are ineffective.
Periodic Response

Co

Periodic response is a response that returns with the communication timing of the
CD block with the CD drive. The host can obtain information (status and CD report)
without issuing a command. It is periodically updated by the communication cyclewith the CD drive. (Same as the SCDQ flag update timing.)

GA

Periodic response update cycle

At standard playing speed : 13.3 ms: 6.7 ms
At double playing speed: 16.7 ms
When not playing

SE

Update is not done during command/response. After response is read by command, it is updated according to the next CD drive communication timing.

System Library User's Guide31

3.4 Data Transfer

ntialData Transfer Procedure

When using commands to transfer data, the host must do the data transfer process
after the command/response. This procedure is listed below.
(a) The command needed for transferring data is executed (data fetch/write).
(b) Data transfer setup wait is executed. (Wait until the DRDY flag is 1).
(c) Data is input and output through the data transfer register (DATATRNS).
Get Data transfer register pointer is executed when getting the address.
(d) Data transfer end is executed when the necessary data is transferred.

deData Transfer End

Data Transfer Errors

nfi

When there is a data transfer request by status, end data transfer must be executedeven when no data is actually transferred. This is not necessary for REJECT and
WAIT. When an error occurs with the data transfer setup wait, the application does
not need to execute data transfer end. Execution is automatically done within the
setup wait function.
Table 3.3 shows errors that occur while waiting for the setup of data transfer.
Table 3.3

Data Transfer Errors

Data transfer time out

Description

CD block does not complete data transfer
setup within the prescribed time.

Co

Data Transfer Error(DRDY flag remains at 0 and does not change
to 1)

Write sectors cannot be secured

Empty sectors could not be reserved by writing
sector data.

SE

GA(With the DRDY flag at 0 the EHST flag is 1.)

32

CD DRIVE

4.1 CD Drive Status Change
CD Drive Status
Table 4.1 CD Drive Status
Status

nti
al

4.0

Explanation

Status change in progress<PAUSE>

Temporarily stopped<STANDBY>

Drive stop status<PLAY>CD play in progress<SEEK>

Seekingde<BUSY>

Scanning<OPEN>

Tray is open

<NODISC>

There is no disc

<RETRY>

Read retry in progress<ERROR>

Read data error occurred<FATAL>

Fatal error occurred (hard reset required)

Types of Drive Commands

nfi<SCAN>Co

Table 4.2 shows the types of commands (drive commands) that change the CD drive
status.
Table 4.2 Types of Drive Commands
Drive Commands

GA

Initialize CD block
Open tray
Play
Seek
Pause
Stop
Scan

Corresponding Functions
CDC_CdInit
CDC_CdOpen
CDC_CdPlay
CDC_CdSeek
CDC_CdSeekd
CDC_CdSeek
CDC_CdScan(a) When doing a soft reset, CD block initialization does not operate as a drivecommand.
(b) Drive commands other than tray open can be done concurrently with the tray
close command.

SE

Issuing Drive Commands(a) Drive command response must return the <BUSY> status as long as there is
no REJECT.
(b) As a rule, command issued afterwards are issued by priority.

System Library User's Guide33

4.1.1Illustrations of CD Drive Status Change

Status Change Illustration of a Normal System.
Figure 4.1 illustrates the status change of a CD drive in a normal system.

START

Tray Close Command
Manual Close

Hard Reset

Tray Open Command
Manual Open
OpenedOPEN

Tray is closed

All Drive Command

Stop CommanddeNo

NODISCntial1)

CD Block Initialize Command
Pause Command

Disc

Yes

TOC ReadStandby Time Elapsed

PAUSE

nfi

STANDBY

Automatic

PLAY

Co

Play Command

SCAN

SEEK

Scan command

Seek Command

GA

Figure 4.1 Illustration of CD Drive Status Change (Normal System)(a) <PAUSE> occurs two seconds after TOC read at frame 0 (FAD=150=96H).
(b) The <BUSY> status indicates that a status change is in progress (on arrow line).
(c) The tray close command specifies drive commands other than tray open. The
status corresponding to every command changes after the tray is closed.
Play command in the <OPEN> status changes to the <PLAY> status after the
tray is closed.

SE

Example:34

Status Change Illustration of an Error System.
Figure 4.2 illustrates the status change of a CD drive in an error system.
Statuses are explained in Table 4.3.

nti
al

2)

START

Tray Close Command
Manual Close

Hard Reset

Tray Open Command
Manual Open
OpenedOPEN

Tray is closed

All Drive Command
No

Disc

de

NODISC

CD Block Initialize Command
Pause Command

Stop Command

Yes

TOC ReadStandby Time Elapsed

PAUSE

nfi

STANDBY

Each Command

Automatic

Retry

PLAY

Retry Succeeded

Co

Read Data Error

SCAN

SEEK

Each Command

RETRY

Retry Failed

ERROR
FATAL

Fatal Error

Figure 4.2 Illustration of CD Drive Status Change (Error System)GA

Table 4.3 Error Relationship Status
StatusExplanation

Internal Status<RETRY><PLAY> if retry succeeds and <ERROR> if retry fails.

<ERROR>

Status does not change until the next drive command <PAUSE>
is issued.

<FATAL>

Stops the disc motor rotation. Hard reset is required.

<SEEK><STANDBY>

SE

Internal conditions indicate equal conditions as CD block internal operations.

System Library User's Guide35

4.1.2

Table of CD Drive Status Changes

Table 4.4 Table of CD Drive Status Changes
Operation

Commands

nti
al

Table 4.4 lists status changes of the CD drive. For example, if the pause command isissued during <PLAY>, <PAUSE> will be displayed.

Automatic

Initialize

Tray Open

Play

Seek

Pause

Stop

Scan

<BUSY><PAUSE><STANDBY><PLAY><SEEK><SCAN><OPEN><NODISC><RETRY><ERROR><FATAL>changes<STANDBY>—<PAUSE><PAUSE><PAUSE>——changes——<PAUSE><PAUSE><PAUSE><PAUSE><PAUSE><PAUSE><PAUSE><OPEN><PAUSE><PAUSE><OPEN><OPEN><OPEN><OPEN><OPEN><OPEN><OPEN><OPEN><OPEN><OPEN><PLAY><PLAY><PLAY><PLAY><PLAY><PLAY><PLAY><OPEN><PLAY><PLAY><SEEK><SEEK><SEEK><SEEK><SEEK><SEEK><SEEK><OPEN><SEEK><SEEK><PAUSE><PAUSE><PAUSE><PAUSE><PAUSE><PAUSE><PAUSE><OPEN><PAUSE><PAUSE><STANDBY><STANDBY><STANDBY><STANDBY><STANDBY><STANDBY><STANDBY><OPEN><STANDBY><STANDBY><SCAN><SCAN><SCAN><SCAN><SCAN><SCAN><SCAN><OPEN><SCAN><SCAN>

undefined

undefined

undefined

undefined

undefined

undefined

undefinenfi“–” indicates no change.

de& Status

Co1) Commands issued in the <BUSY> status.
Commands issued in the <BUSY> status can be received but there is noguaranteeof immediate execution. For example, While the tray is being opened or closed, acommand is not executed until that operation is over. (However, the tray open
command is executed immediately.)GA2) Tray Open/Close.
(a) As a rule, the tray open command is executed immediately in any mode.
(b) The tray open/close command when not using the automatic open/close
format is <BUSY> until executed manually.
(c) Commands in the <OPEN> status (except for tray open) change to eachstatus after the tray close process.
(d) When the tray is closed, <NODISC> occurs if TOC read cannot be done.
(Even if there is a disc).
3) Status Routings.
(a) Everything goes though the <BUSY> status when done by command.
(b) In some cases the routing is by way of <SEEK> when changing to the<PLAY> and <SCAN> statuses.

SE4) In the case of Multi Sessions.
(a) Reads the final session of TOC.
(b) After TOC is read, the <PAUSE> status is at the 0 frame, 2 seconds
from the start position of the final session.

36

<PLAY> Status Frame Addressnti
al

4.2 CD Drive Operation
The frame address (currently FAD) posted while a CD is playing indicates the sector
during the read process. The current FAD sector is not stored in the CD buffer andcannot be retrieved. The host can access up to one sector before the current FAD. (Inthe case of a CD-ROM).
FAD-1

↓

de

↓

Current FAD

Store in CD buffer During Read process(retrievable)(not retrievable)

Figure 4.3 Sectors that the current FAD indicatesnfi

When play has ended, FAD = play end position + 1. (The read out area is indicatedwhen the play end position concludes at the end of the disc.)
Change from <PLA
Y> Status and Sector Storage

Co

When changing from <PLAY> to a different status, whether the sector during theread process can be store is undefined. If changing to any status other than <BUSY>
the sector that should be stored is defined. When the pause command is issued in
the <PLAY> status and the status changes from <PLAY> to <PAUSE>, the storage
sector + 1 FAD is posted the same as with 1).
Play Range and FrameAddressGA

By changing play end, seek, and the play range, <PAUSE> occurs when FAD is
outside the play range and the PEND flag of the interrupt factor register becomes 1.
When FAD is outside the play range, the <PAUSE> status cannot be canceled (restartplay). Canceling <PAUSE> when FAD is within the play range changes the status to<PLAY>.
CD Play Repeat Process

Both the repeat post frequency (0H~EH) and maximum indication frequency(0H~FH) are shown by 4 bits. After the frame of the play end position is played(FAD = play end position + 1), the following process is performed.
If the repeat frequency is less than maximum repeat frequency, CD play will be
repeated (return to the start position and continue playing). If the repeat
frequency is <EH(14 times)> at that time, the repeat frequency is increased by 1.

SE

(a)

(b)

If the repeat frequency is greater than or equal to the maximum repeat
frequency, CD play will not repeat (play end position + 1 and pause).

System Library User's Guide

37

nti
al

If the play range or maximum repeat frequency changes, the repeat frequency clears
to 0. Neither the repeat frequency nor play range rely on the tray open/close or theseek operation while play is in progress.
Seek the Home Position (Stop)• Moving from the <PAUSE> status:• When seeking the home position:

CD Read in a Full CD Buffer

Current position (report also remains
unchanged).
Standby position inside the circumference(report is an invalid value).

nfi

Pickup Position in the <ST
ANDBY> statusde

The following operations are done by seeking the home position.
(a) The disc motor rotation stops and pickup is moved to the standby position
inside the circumference.
(b) The CD drive status changes to <STANDBY> and report is an invalid value(FFH line).
(c) When the status changes from <STANDBY> in the home position to <PAUSE>,
seek moves to the start of the disc.
(d) The play range, maximum repeat frequency, and repeat notification frequency
which have been saved cannot be changed.

SE

GA

Co

If the CD buffer becomes full, a <PAUSE> will occur and the BFUL flag of the interrupt factor register becomes 1. When there is space in the CD buffer, play automatically starts where it left off.

38

4.3 SubcodesntialSubcode Update and SCDQ Flag

The subcode Q is updated for each frame (one sector). The SCDQ flag becomes one
every time subcode Q is updated (same as update timing of periodic response).
Subcode R~W can update four packs (one packet) with one frame and be stored in
the pack buffer. There is a 23 pack (short of six packets) segment in the CD block.
<Standard Speed when playing CD-DA>

Subcode Q Update↓

SCDQ Flag
01 23

↓

↓

↓

45 67

89 A BC DE F

nfi

Pack Data Aquisition(Subcode R ~W)

de13.3 ms

Pack Data Update(Subcode R ~W Decode Completion)0

1 2 3 45 6 7 8Co

The SCDQ flag clears the host to 0. The CD block is only 1. Subcode R~W begins the
decode process when data fetch starts and if 8 packs have been collected.
Figure 4.4 Subcode Update and SCDQ Flagiming
T

Subcode Get TimingGA

The host issues the Get command by a timing with the SCDQ flag at 1 and gets
subcode Q and R~W data. (Polling is prevented by continuously issuing commands.)
Getting Subcode Q

The Get command can be executed any time regardless of the CD drive status. But
when in the <OPEN> status, ineffective values may return depending on the CD
drive status.
Getting Subcode R~W

SE

Pack data reissues the Get command and gets data until the pack buffer is empty.
However, exceeding 16 packs within the time of one frame (13.3 ms) is not allowed.
WAIT is returned if the pack buffer is empty and pack data disappears.

System Library User's Guide

39

Subcode R~W Decode

Decode start and end
Decode On/Off are set by the initialize command of the CD block.
To start decoding, set decode to ON then execute CD-DA play.

(b)

Decode Start Timing
Start decode during <PLAY>.
Data actually begins to be retrieved two frames before <PLAY>.

(c)

Pack Buffer Clear Timing
Clear is done when decode begins.
The pack buffer content is saved even when doing seek and pause.

de

nti
al

(a)

(d) Decode Conditions
Decode is done only when playing CD-DA.
Decode is not done in other cases (while scanning or playing the CD- ROM
area)

nfi

Subcode R~W Error

Over Run Error
If a pack is not fetched in time, the pack buffer is overwritten and an over run
error occurs. After data transfer has ended, the get pointer advances to theextent that the pack is without an overrun error. The host must finish transferring data within the decode time of 1 pack (3.2 ms).

(b)

Pack Data Error
Pack data checks CRC and corrects the data if an error is detected. A pack data
error occurs if the data cannot be corrected.

SE

GA

Co

(a)

40

CD BLOCK CONFIGURATION

nti
al

5.0

The characteristics and logical configuration of the CD block as seen from the host is
shown below.
Data Format

The basic unit of the stream handled by the CD buffer is a fixed size (2352 bytes)
sector no matter what the device is.
Stream Select CircuitdeThe functions that separate and store streams are attained by a filter and buffer
partition design. These functions are considered to be logical elements (selector).
The circuit that selects the necessary streams is constructed by combining selectors.
Devicenfi

The CD and MPEG are considered to be logical devices that produce and absorb
streams. The flow of a stream is controlled by connecting a device to the stream
select circuit.
5.1 Data FlowCo

Figure 5.1 shows the entire data flow for a CD block.

CD-ROM[CD Play]

MPEG Buffer

Read

GA

Decode

Write
Write

CD Read

Display

VDP2

CD Buffer(Buffer
Partition)

Copy, Move

MPEG Decoder

Read

RGB888MPEG Frame
BufferWrite

CD BlockSE

Host

Data Transfer
Register

MPEG Register
(RGB)

Get

Get

Put

RGB555

Host

Figure 5.1 CD Block Entire Data Flow

System Library User's Guide41

5.2 Stream Process Mechanism

ntialFigure 5.2 shows the overall configuration of the CD block from the viewpoint of
stream flow.
.
There are 24 selectors numbered 0 to 23.
Selector
Stream outflow device

FilterBuffer partition

Stream inflow device
Host

CD-ROM

MPEG frame bufferdeMPEG decoder (A)MPEG buffer

MPEG decoder (V)

Host

MPEG frame buffer

nfi

Copy / Move

MPEG buffer

Device output connector

Filter input connector

Co

Device input connector

Partition output connector

False output connector

Figure 5.2 CD Block Overall Configuration

GA[What each part does](a) Device: Produces and absorbs streams (stream inflow and outflow device.)(b) Selector: Composed of a filter and buffer partition, used for selecting streams.
(c) Filter:
Separates streams by set conditions (conforms to Yes/No conditions.)(d) Buffer Partition:
Stores streams, releases or cancels data through outside
requests.
There are connectors for connecting every device to a selector. The device and selector
input/output connectors are 1 to 1. Connections can be made between selectors as well.

SE

Connections flow regularly in streams by connecting connectors that don’t passthrough partitions and stop when entering a partition. Sectors that are output froman output connector that is not connected will be canceled.
Devices must be connected through a selector. A device output connector can only
connect to a filter input connector, and a device input connector can only connect to apartition output connector.

42

5.3 Selector Configuration

FilterBuffer partition

True output
connector

Filter input connectorntial

The selector process function does not rely on the parts connection destination or
device. It separates and stores the input stream and only outputs by request. Figure
5.3 shows the selector configuration.

Partition input Partition output
connector
connector

deFalse output
connector

Figure 5.3 Selector Configuration (Initial condition)

5.3.1

nfi

In the initial condition of the selector, the filter and partition with the same number
are connected through the true output connector and partition input connector.
Other connectors are not connected.
Filter

Co

Conditions (FAD range, subheader) of the sector that should pass are set in the filter.
Sectors that match with the conditions are output to the true output connector andstored in buffer partition of the connection destination. All other sectors are output
to false output connectors.
False output connectors can be connected to other filter input connectors andachieve in secession similar selection processes. Sectors output from unconnected
output connectors will be deleted.
Decide conditions

Store

Yes

SE

GA

StreamSystem Library User's Guide

No
Yes
No
Yes
No
Clear

Figure 5.4 Type of Stream Select Process

435.3.2

→

2

No -1

1

N1 -1

2

1

0

→
Last partition→

1

First partition

Sector postion
2

Np -1

1

0

→

Buffer partition size (sector units) Np→

Buffer partition number
0

0

→

→

nti
al

Buffer Partition Configuration
The CD buffer is divided into several buffer partitions. Figure 5.5 shows theconfiguration of a buffer partition.

de1)

Buffer Partition

N23 -1

2

1

0

→

P

23

23

∑ Np ≤ CD buffer sizenfi

Np: buffer partition size, P: buffer partition number,

p=20

Co

Contents of each partition are not fixed; data can be stored as long as there is space in thewhole CD buffer.
Figure 5.5 Buffer Partition Configuration

Storing Sectors to the Buffer Partition
Sectors entered in partitions are stored in the last partition. The last sector
position of the partition is equal to the buffer partition size minus 1.

3)

Discharging and Canceling Sectors from the Buffer Partition
Two ways to discharge sectors from partitions are to keep the sectors at thepartition discharge source or clear the sectors (clear only can also be selected.)
For example, get to the host corresponds to “Get” and “Get and Clear.”
Flowing in and out between selectors corresponds to “Copy” and “Move.”4)

CD 1 Sector Interrupt and Store Destination
One sector interrupt in CD read occurs in each sector at the time the sector isstored in the partition. The CD block stores the partition number of the store
destination. The store destination partition number of the sector read last canbe retrieved from the host.

SE

GA

2)

44

5.3.3Connection from Buffer Partition to Filter (Sector Data Copy/Move)
The partition output connector is connected to the filter input connector and theflow of sector data allows sector data to be copied and moved. The connection
and flow I/O process are executed by executing one command.

nti
al

1)

Connectors

deBecause only the selected number of sectors
flow, loop does no continue indefinitely.
(a) Copy/Move for different selector (b) Copy/Move for self

Selector Connections by OR Condition (multi to one connection)
True output connectors of several filters can be connected to the same partition
input connector. This enables a sector to be stored in whichever of several
conditions it coincides with.
(OR condition: logical add).

Co

2)

nfi

Figure 5.6 Copy/Move Sector DataA

A or BGA

B

SE

Figure 5.7 Selector Connection by OR Conditions

System Library User's Guide

45

3)

Types of Connectors and Connection Destination

Output/Input

Filter Input

Partition Input

Device Output

O

X

True Output

X∆

False Output

O

X

Partition Output

OX

connectable (1 to 1),∆:

connectable (multi to 1),

X:

not connectable

Device Input
X
X
X

O

only 1 output connector can connect
to 1 input connector.
several output connectors canconnect to the same input connector.
(OR condition)

de

O:

nti
al

Table 5.1 Types of Connectors and Connection Destination

SE

GA

Co

nfi

Whether to do a simple process of connecting (disconnecting) by one commandor a complex process collecting connections and flow in/out processes depends
on each device. The CD-ROM and MPEG decoder are single processes. Others(host, copy/move, etc.) are complex processes.

46

5.3.4

Selector Precautions

Error in the Stream Process
Except with the CD device, error in the stream process occurs in the following
cases.
• Connection separates during operation.
• CD buffer becomes full while reading or writing to the buffer partition.

2)

Selector Set Effective Timing
FAD with selector settings made effective while a CD is playing is within
one FAD from response of the selector set command. The host considers themargin and issues the set command before 10 or more sectors of the target FAD.
When the selector setting has ended, the ESEL flag of theinterrupt factor registerbecomes 1.

3)

Sector Data when Changing Connections
When the CD is being read, data is not omitted even if the connection changes
during the sector data sequence. In short, the flow of data is guaranteed when
temporarily interrupted while switching connections.

4)

General Access to the Buffer Partition (general command specifying sector
position and sector range)
Returns to WAIT when the specified sector range doesn’t exist like the data
number within the partition is exceeded. Always returns to WAIT when thedata number within the partition is 0.

5)

Clear Discharge from Buffer Partition
When a sector is cleared and discharged from a partition, all data of the selected
sector range is cleared (get and clear or move sector data) even if the process
stops because of an error etc.

SE

GA

Co

nfi

de

nti
al

1)

System Library User's Guide

47

Sector Data Format

1)

Basic Format
Sector data format basically conforms to the CD-ROM XA sector format.

nti
al

5.4

2352 bytes
2340 bytes
2336 bytes
2048

288 bytes

Sectorsynch

HeaderUser Data

EDC/ECC, etc.

12

4

8

HeaderSub
header12

4

8

Sectorsynch

HeaderSub
header

CD-ROM XA
Mode 2
SectorForm 1synch

User DataFNMIN SEC FRAME MODE

EDC/ECC

4 bytes

User Data

EDC,
etc.

CN

SM

CI

FN: File Number
CN: Channel NumberGA

1 byte280 bytes

2324

Co

CD-ROM XA
Mode 2Form 2

2048

de

4

nfi

CD-ROM
Mode 112

4 bytes repeat
FN

CN

SM

CI

SM: Sub Mode
CI: Coding Information

Figure 5.8 CD-ROM XA Sector Format

SE2) Handling Sub header and User Data (2048 bytes)(a) Sub header except for Mode 2 (mode part within header is 02H) is handled
as 0.
(b) There is user data immediately after the header only for Mode 1 (mode partwithin header is 01H). Otherwise, user data is considered to exist in thesame position as mode 2 form 1.
(c) Storing user data within a buffer partition, except data from a CD device, isthe same as mode 2 form 1. The first 24 bytes is 0, and data after the user
data is undefined.

48

5.5 CD Block Initialization

nti
al

TOC/Session Information

Initialized when the tray is opened, and information is in a non-input condition.
Reads TOC when tray is closed (unrelated to the reset of software.)File Information

Initialized if tray is opened or software is reset, and information is in a non-input
condition. The host explicitly commands the reading of file information.
Host InformationdeInitialized if software is reset (unrelated to opening the tray.)nfi[Host Information] . . . . . . mostly host set information and buffer data
• Initialization information (CD block initialization parameters)• Play information (play range, maximum number of repeats, current repeat
notification number)• Selector information (filter, buffer partition, etc., host setting for selector)• Data within buffer, buffer partition size, space size
• Actual data size retained, setting of sector length• Data transfer control register (initializing ends transfer of data)• MPEG related information

SE

GA

Co

If the CD block is initialized without resetting the software, information in the TOC/
Session and Host is not initialized.

System Library User's Guide49

6.0 CD BLOCK FILE SYSTEM

nti
al

6.1 File Management in CD-ROM (ISO9660)

The CD block file system supports a logic format that conforms to ISO9660.

Volume Identifier

Directory block(Directory file)

Pass table

1

2
Pass table size
Pass table address
Root directory code3of Root directory

Root directory

Root directory
Self

Sub directory

Parent=Self

File

f1

f2
Pass table code

~
~

~

~
Sub directorynDirectory block address
Parent directory number
Directory name

f2

nfi

ParentDirectory number

de

f1

f3

f3

Sub directoryCo

Sub directory

ParentDirectory code

• Volume identifier :Arranged from CD 00:02:16 (FAD = 166 = A6H)
A collection of pass table records. Pass table size andaddress are recorded in the volume identifier.
Corresponds to one directory (root, sub)Record position is the directory number (1 ~ n)Directory information is listed in the directory book.
A collection of directory records. A directory block is
considered to be one file. (directory file)
Corresponds to one file (includes directory).

GA• Pass table :• Pass table record :• Directory block :• Directory record :File lead sector address
File size
File name
System information for mode 2(file number, form information)

SE

Figure 6.1 File Management Data Configuration in CD-ROM (ISO9660)

50

6.2 CD Block File System Functions

nti
al

The CD block file system (referred to “file system” hereafter) has the following
functions.

Moves directories and holds file information
Moves to the specified directory and holds in the CD block file information
within that directory.

2)

Gets file information
Transfers held file information in response to a request from the host.

3)

Reads files
Reads file sector data originating from held file information to the CD buffer.
The host is able to extract read sector data by data transfer.

4)

Stop Accessing Files
CD play stops by moving a directory, holding file information, and reading afile. If file access is stopped, the CD block pauses the CD drive.

nfi

de

1)

<on the CD-ROM>

Directory block (for directory record)0

Root directory1

Parent=Self

Co

File 1

2

~

~

0

Self

1

Parent

2

~

GA

i
1+i

~
File

i

File

i+1

Holds fileinformation...

~ File j ~...
~~i+n -1File i+n-1~

Move directory(Hold file information in directory move destination)

File Information Table
....

0

Self

1

Parent

2

File

i

3

File

i+1

~
~
255

...
File

j

...
File i+n-1

File information of the current directory self

← Held identifier of first file (i)Held file information number (n)~ ← fid = j~~
File identifier (fid)SE

Directory record sequence number

File

j

Reading file

Buffer partition

Figure 6.2 CD Block File System Configuration

System Library User's Guide51

6.2.1File Information Holder Methodntial

The CD block provides 256 file information tables that hold file information foraccessing. The first two parts in this table always holds current directory (self) andparent directory information. Up to 254 parts of ordinary file information can beheld. (The number cannot be designated.)
Directory Move
If a directory is moved, the directory record is read, and file information is
extracted and held in a table. The range that is held is from the start of thedirectory block.

2)

Holding File Information (specifying the hold range)
Specifies a file identifier and can hold file information from any position
within the current directory. In this case also, self and parent information isheld in the first two parts of the table.

6.2.2

File Access Procedurede1)Moving to the Root Directory
In using the file system, first move to the root directory and create a file information table. This is the same when file information is cleared when starting up orchanging disks. Neither a table can be created nor the file system used if thedisk is not in the ISO9660 format. (REJECT occurs if getting the holding fileinformation range.)2)

Holding File Information
The file system can access only files inside the file information table. When
accessing a file, the file information must be held beforehand. When moving
directories, the target directory must be held.

3)

Reading Files
File identifier and offset (sector units) are selected and the file read. The readdestination selector is selected by the filter number.

4)

Getting Sector Data
Files read to the buffer partition transfer and fetch data by fetching sector data.
Data can be fetched while reading ,and there is no waiting for read to end.
Pause occurs if the CD buffer becomes full while reading files. If a space can becreated, pause is canceled and the remaining files read.

5)

Ending File Read
When file read has ended, the EFLS flag of the interrupt factor register becomes“1”. Executing the file access stop command stops file read. (Accessing a file isdone in the same by moving a directory and holding file information.)

SE

GA

Co

nfi

1)

52

6.2.3File System Precautions

Work Selector Designation
When reading file information from the CD-ROM, the CD block requires a work
selector. One selector can be designated to move a directory and hold fileinformation. At least one empty sector is required at this time. The selector
used is canceled after the process ends.

2)

Selector Settings
When accessing to a file, the file system does the following settings for theselector.

nti
al

1)

Table 6.1 Set Filter Condition
Actionnfi(b) Filter conditionsde(a) Connection conditions of indicated filter• filter input connector: connects with a CD device.
• true output connector : connects with buffer partition with the same
number.
• false output connector : cuts off other selectors.

Filter Condition• Sets filter frame address range (FAD range)

Hold File Information• Makes effective the frame address range of the filter mode

Co

Move Directory• Sets filter frame address range.

Read Files• Sets the file number of the filter subheader conditions• Makes effective the filter mode FAD range and file number selection(c) Filter and connected buffer partition
The buffer partition sectors are cleared before files are accessed.

File Access End and Stop
When file access ends or is stopped, the EFLS flag becomes 1. File access also
stops if the tray is open. (But before the <OPEN> status, EFLS = 1.) While
directory move and file information hold are being executed, the file informationtable is destroyed if file access stops.

SE

4)

CD Play Range and Drive Command
When accessing a file, the play range becomes the default value (disk first tolast). The drive command (CD play, pause, etc.) is executed unchanged evenwith the file system in operation. Be aware that operation of the file system
can be obstructed. Auto pause/cancel-pause operate normally when the buffer
is full.

GA

3)

System Library User's Guide

53

Multi Session
In multi session cases, the file system refers to the volume descriptor of the lastsession.

SE

GA

Co

nfi

de

nti
al

5)

54

DATA SPECIFICATIONS

nti
al

7.0

This chapter lists the constants, data types, access macros, etc. used by the CD communication interface.
• FormatIn the figures, the reserved regions are shown by the “–” mark. A 0 must be
specified in the reserve regions.
7.1

Data List

Table 7.1

Data List
Data

Constants

Data
Name

nfi

Basic datadeTable 7.1 is the CD communication interface data list.

Number
1.0
2.0
3.0

Status and Report

4.0

Subcode information

5.0

Data Types

6.0

Co

TOC information & Session information

CdcRet

6.1

CD status information

CdcStat

6.2

Hardware information

CdcHw

6.3

CD position parameters

CdcPos6.4

CD play parameters

CdcPly6.5

Sub header conditions

CdcSubh

6.6

Sector information

CdcSct6.7

File information

CdcFile

6.8

SE

GA

CD communication function return code

System Library User's Guide

55

Data Detailed

7.2.1

Basic Data

Title

Data

Data Specification

Basic Data

1)

Data Name

Basic Data Types

Description
1 byte integer without code

Sint 8

1 byte integer with code

Uint 16

2 byte integer without code

Sint 16

2 byte integer with codedeUint 8

4 byte integer without code

Sint 32

4 byte integer with code

Boo 1

logical type 4 byte integer (assumes logic constant asvalue)

Logic Constants
Used1) value.
value.
Used asas aa logic
logic (Boo(Bool)

Value

OFF
ON

Additional0

Indicates that logic value is false

1

Indicates that logic value is true0

Indicates switch is off (false)

1

Indicates switch is on (true)

Value

NULL

((void *)0)

GA

Constant Name

SE
56

Description

Co

FALSE
TRUE

nfi

Uint 32

Constant Name

3)

No

1.0

Type Name

2)

nti
al

7.2

Description

NULL pointerConstants

Title

Data

Data Specification

Constants

2.0

Bit Names of interrupt factor register relationship(HIRQREQ, HIRQMSK).
Constant Name

Description

CDC_HIRQ_CMOK

Enable commands to be issued

CDC_HIRQ_DRDY

Prepare data transfer

CDC_HIRQ_CSCTStore 1 sector

CDC_HIRQ_BFULCD buffer is full

CDC_HIRQ_PEND

CD play end

CDC_HIRQ_DCHG

Disk change

CDC_HIRQ_ESELEnd Selector set

CDC_HIRQ_EHSTEnd host input/output

CDC_HIRQ_ECPY

End copy

CDC_HIRQ_EFLS

End file system

CDC_HIRQ_SCDQ

Subcode Q

nfi

2)

No

de

1)

Data Name

nti
al

7.2.2

Special designation of buffer partition sector range(sector location and sector number).
Constant Name

Description

Indicates sector location of last partition
Same as (sector no. in partition - 1) designatedSector number from designated sector location SP
to last partition.
Same as designated (sector no. in partition - SP)Co

CDC_SPOS_END
CDC_SNUM_END

Effective with functions that correspond to the buffer partitions below.
CDC_CalActSiz,
CDC_DelSctData,

CDC_ExeFadSearch,
CDC_GetdelSctData,

CDC_GetSctInfo,
CDC_CopySctData,

CDC_GetSctData,
CDC_MoveSctData

CDC_SNUM_END

GA

FilterStream3)

Buffer Partitions
N-1

SP

2

1

0

Designated Sector Location SP
CDC_SPOS_END

Other

SE

Constant Name
CDC_NUL_SEL
CDC_NUL_FID

Description
Special value of selector no. (filter number, buffer
partition number)Special value of file identifier

System Library User's Guide

57

1)

TOC and Session Information
Title

Data

Data Name

Data Specification

TOC and Session Information

3.0

TOC Information
4 BytesnTrack 2 Information

Ctrl Adr

Track 3 Information~

Track n + 1 Information~

Track start frame address

Tracks not existing on TOC is FFFFFFFFH~<First/Last Track Information>
byte 0
1
2
3
POINT=A0
Value
Ctrl Adr First tracknumber PSEC PFRAME
track POINT=A1 Value
Ctrl Adr Last
number PSEC PFRAME~
Track 99 Information
First Track Information (A0)Last Track Information (A1)
Read Out Information (A2)

nfi

98
99
100
101

<Track Location Information>
byte 0
1
2
3

Track 1 InformationdeLocation
informationof every track(99 tracks)

0
1
2

No

nti
al

7.2.3

First/Last track numbers are PMIN binary values

4 byte unit offsets<Read Out Information>
0
1
2

3

Ctrl Adr Read out start frame address

2)

Session Information

Co

Indicates final session value for multi sessions

Session Number<Total Session Information>
byte 01
2
3GA

4 Bytes01
2

Total Session Information
Session 1 Information~

Session n Information

~

SE

98
99

58

Session 98 Information
Session 99 Information

External read out start frame
address

Equal to TOC read out start FAD in single
sessions

Session 2 Informationn

SessionTotal No.

~~

<Session Location Information>
0
1
2
3
Start TNO
withinSession start frame address
sessionTNO (track no.) is a binary value
Non-existing sessions are FFFFFFFFH(when session number exceeds session total)

1)

Status and Report
Title

Data

Data Name

Data Specification

Status and Report (1/2)

No

nti
al

7.2.4

4.0

Response Format
Command response is in the format below. Whether CD report returns as areport depends on the command. Periodic response absolutely returns CD
report.
byte 01

2

34Report

Rep

Ctrl

Cnt

Adr

Flg

7

TNO

X

FAD

nfi

CD Report

6

deStatus5

Combined status and CD reports are called CD status information.
Status
A status of FFH indicates REJECT (abnormal command)
The status code is valid when WAIT (bit 7 = 1). Other bits (bit 4 to bit 6) are 0.
bit 7

6

Co

2)

5

4

3

2

1

0

Status code (CD drive status)

SE

GA

Value

StatusExplanation

00H
01H
02H

<BUSY><PAUSE><STANDBY>

03H
04H
05H
06H
07H
08H
09H
0AH

<PLAY><SEEK><SCAN><OPEN><NODISC><RETRY><ERROR><FATAL>

Status currently changing
Currently pausedStandby (drive in suspended
status)Playing CD
Seeking
Scanning
Tray is opened
No discCurrently retrying read
Read data error occurred
Fatal error occurred

1: Periodic Response
0: Command Responce
1: Data Transfer Request 0: Not the same
1: WAIT (execute reserve) 0: ACK (command normal recieve)

System Library User's Guide

59

Data Name

Data Specification

Status and Report (2/2)

2

3

Rep

Ctrl

Cnt

Adr

Flg

CD Report

FLG

:

bit 7

6

4
TNO

5

FAD

4 bit flag
5

4

7

0 : CD-DA (or when seeking or scanning)nfi: 4 bit repeat frequency. Notification range 0H ~ EH (0 ~ 14 times): CONTROL/ADR byte of subcode Q: Track number of subcode Q (binary value, not BCD)
: Index number of subcode Q (binary value, not BCD)
: Frame address (in header information when CD-ROM,otherwise, based on subcode Q)

Co

Rep Cnt
Ctrl Adr
TNO
X
FAD

6

X

1 : CD-ROM

4)

4.0

CD Report
byte 1

No

nti
al

Data

de

3)

Title

CD Report content in every status
CD Report is invalid for REJECT and valid for WAIT.
CD drive status and CD report contents are shown below. The FFH rows mean
invalid values.

Status

CD flag/repeat Control/ADR

Track No.

Index No.

Frame address<BUSY><PAUSE><STANDBY>

O / FFH
O
value at pause
FFH
O
O
O
FFH
FFH
O
FFH
undefined

O / FFH
O
value at pause
FFH
O
target position
O
FFH
FFH
O
FFH
undefined

O / FFH
O
value at pause
FFH
O
target position
O
FFH
FFH
O
FFH
undefined

O / FFFFFFH
O
value at pause
FFFFFFH
Otarget positionO
FFFFFFH
FFFFFFHOFFFFFFH
undefined

SE<PLAY><SEEK><SCAN><OPEN><NODISC><RETRY><ERROR><FATAL>GA(when seek home)

O / FFH
O
value at pause
FFH
O
target position
O
FFH
FFH
O
FFH
undefined

O: Current value.
Seek Home: seek (stop) against home position.
When the standby time expires and the status changes from <PAUSE> to<STANDBY>, the value when paused is saved.

60

When CD report content is an ineffective value

nti
al

5)

SE

GA

Co

nfi

de

(a) The value immediately before the repeat frequency is saved. If changing toa different status, returns to the retaind value.
(b) Moves to the start (FAD = 150) of the disk if the status changes from Seek
Home to <PAUSE>.
(c) The value immediately before <ERROR> is retained. If changing to the<PAUSE> status, returns to the retained value.
(d) Midway during the <BUSY> status, the ineffective value returns in somecases when changing to a different status.

System Library User's Guide

61

1)

Subcode Information
Title

Data

Data Name

Data Specification

Subcode Information

5.0

Subcode Q Information(a) When Adr = 1
byte 1

2

3

4

5

6

7

8

Ctrl
TNO

P_FAD

X

00

9

10

Q_FAD

Adr

CRC

: CONTROL/ADR byte
: Track No. (binary value not BCD)
: Index No. (binary value not BCD)
: Time within track (frame address format with track lead at 0): Absolute time (frame address format with 00:00:00 at 0)deCtrl Adr
TNO
X
P_FAD
Q_FAD

No

nti
al

7.2.5

nfi

The content in each status is the same as for the CD report.
Values in read in and read out are shown in the table below.
(Can be acquired by multi-session)
X

P_FAD

01H ~ 63H (1 ~ 99)
AAH (Read Out)
00H (Read In)

01H ~ 63H
01H ~ 63H
01H ~ 63H, A0H, A1H, A2H

Elapsed FAD within track
Elapsed FAD within track
000000HCo

TNO

Read in of the first session is Q_FAD = 000000H.
(Normally cannot be acquired).
(b) In other cases: the subcode Q value unchanged (10 bytes except CRC)
Subcode R~W Information

R S T U V W
6 5 4 3 2 1 0

GA

2)

bit

7

Pack
Pack

SE

Pack
Pack

24↑bytes↓
24↑bytes↓
24↑bytes↓
24↑bytes↓

Packet (corresponds
to1 frame = 1 sector)
96 bytes

unused (padded by 0)

Subcode R~W is decoded in 1 pack units (24 bytes = 12 words).
The CD block has an internal pack buffer of 23 packs (short of 6 packets).

62

TitleData

Data Name

Data Specification

CD Communication Function Return
Code

No

CdcRet6.1

Return Code
CdcRet ret . . . . . . Be sure ret is not the pointer.
Access Macro

Type

CDC_RET_ERR (ret)Sint 16

Error Code

CDC_RET_STATUS (ret)Uint 8

Status2) Error Code
Constant Name
CDC_ERR_OK
CDC_ERR_CMDBUSY

Explanation

Normal (process continuation)
Command end flag is not 1

CMOK flag is not 1 when command isissuedTime out (wait for response, wait for datatransfer ready)

CDC_ERR_PUT

Data transfer read wait by sector data
write. Could not reserve empty sectors.

CDC_ERR_REJECTREJECT for command response

CDC_ERR_WAIT

WAIT for command response

CDC_ERR_TRNS

Abnormal data transfer size

CDC_ERR_PERI

Not a periodic response

CDC_ERR_PTYPE

Abnormal play, seek position type

Status
The retaining status of the CD communication interface is substituted in the
return code status together with all functions. Response status returnswhen
response is acquired by acquiring periodic response or issuing commands.
The holding status returns unchanged when a response cannot be acquired by
not issuing a command or error.

SE

GA

3)

CDC_ERR_TMOUT

Co

nfi

CDC_ERR_CMDNG

Explanationde1)

Data Type

nti
al

7.2.6

System Library User's Guide

63

Data

Data NameNo

Data Specification

CD Status Information

CdcStat

6.2

nti
al

Title

Combine the CD block status and CD report to create CD status information.
CD Status Information
CdcStatAccess Macro

Type

Explanation

CDC_STAT_STATUS (stat)

Uint 8

Status

CDC_STAT_FLGREP (stat)

Uint 8CD report CD flag and repeat no.

CDC_STAT_CTLADR (stat)

Uint 8CD report CONTROL/ADR byte

CDC_STAT_TNO (stat)

Uint 8CD report track no. (binary value)

CDC_STAT_IDX (stat)

Uint 8CD report index no. (binary value)

CDC_STAT_FAD (stat)

Sint 32

CD report frame address

de

2)

*stat

CD Report CD flag and Repeat Count
bit 7

6

5

nfi

1)

4

3

2

1

0

Repeat number (0H ~ EH: repeat 14 times)

1)

Title

Data

Data Specification

Hardware Information

Hardware Information
CdcHw *hw

Data Name

No

CdcHw

6.3

Explanation

CDC_HW_HFLAG (hw)

Uint 8Hardware flag

CDC_HW_VER (hw)

Uint 8CD block version information

CDC_HW_MPVER (hw)

Uint 8MPEG version information

CDC_HW_DRV (hw)

Uint 8CD drive information

CDC_HW_REV (hw)

Uint 8CD block revision information

SE

Hardware Flag
bit 7

64

Type

GA

Access Macro2)

0: CD-DA (or when seeking or scanningCo

1: CD-ROM

6

5

4

3

2

1

0
1 : MPEG exists
0: not the same
1 : Hardware error occurs 0: Normal

Data

Data NameNo

Data Specification

CD Position Parameters (1/2)

CdcPos

6.4

nti
al

Title

Designates the CD range of play (start and end positions) and is used in designating
the seek position.
1)

Position TypeDefault value, frame address, track/index, and no change can be designated at
position parameters. The constants (position type) below are used to select theparameter.
Constant Name

Explanation

CDC_PTYPE_FAD
CDC_PTYPE_TNO
CDC_PTYPE_NOCHG

Designates default values
For CD play : indicates disk start and end.
For seek: indicates home position.
Designates frame address
Designates track/index
Designates no change (no change in set values)deCDC_PTYPE_DFL

Access Macro

Type

Explanation

CDC_POS_PTYPE (pos)
CDC_POS_FAD (pos)
CDC_POS_TNO (pos)
CDC_POS_IDX (pos)Sint 32
Sint 32
Uint 8
Uint 8

Position type
Frame address, FAD sector no.
Track number
Index number

Setting Method(a) Designating the default value
CdcPos pos;
CDC_POS_PTYPE (&pos) = CDC_PTYPE_DFL;(b) Designating the frame address
CDC_POS_PTYPE (&pos) = CDC_PTYPE_FAD;
CDC_POS_FAD (&pos)= fad;/* frame address */The end position is designated by sector number (FAD sector
number) from the starting FAD(c) Designating the Track/Index
CDC_POS_PTYPE (&pos) = CDC_PTYPE_TNO;
CDC_POS_TNO (&pos)= tno;/* track number */CDC_POS_IDX (&pos)= x;/* index number */(d) Designating No Change
CDC_POS_PTYPE (&pos) = CDC_PTYPE_NOCHG;

SE

GA

3)

Position Paramters
CdcPos *pos

Co

2)

nfi

Beginning of disc: FAD = 150(96H) position (2 seconds, 0 frame with absolute time)
End of disc:
FAD = readout start frame address (TOC information) - 1 position.

System Library User's Guide

65

Data

Data NameNo

Data Specification

CD Position Parameters (2/2)

CdcPos

6.4

Execptions to Frame Address
The frame address is explained by the conditions below.
Condition

Start and Seek Positions

nti
al

4)

Title

End Position

FAD < disc start

FAD = disc start (150)

FAD = 150+FAD sector no. - 1(when starting FAD <150)

FAD > disc end

FAD = disc end + 1(equal to read out)

FAD = disc end

deRelationship of start and end positions:
End FAD = Start FAD + FAD sector number - 1(The held contents of the play range are the Start FAD and End FAD.)

Condition
TNO = 0 (track default
value)
X = 0 (index default
value)TNO < disc start track
TNO > disc end track
X does not exist

nfi

Execptions to Track/Index
The track/index is explained by the conditions below.
Start and Seek
Positions
TNO = disc start track

TNO = disc last track

X =1

X = 99(63H)

TNO = disc start track
X = 1 (same as X = 0)
TNO = disc end track
X = 1 (same as X = 0)
(from the next track)

End Position

TNO = disc start track
X = 99 (same as X = 0 )TNO = disc end track
X = 99 (same as X = 0 )(until track ends)

Co

5)

TNO: track number, X: index numberGA

X = 0 means designation of the track only. (track start/last index)
TNO = X = 0 is the default value of the position parameter.
(Start position: start of disc, End position: end of disc, Seek postion: homepostion)Exceptions to the Play Range
The play range is retained if the end postion is smaller than the start position,
but the CD will not play. (For designating both frame address and track/index)

7)

Meanings of Special Designations• Specifies seek position default value:SE

6)• Specifies seek position no change:• Specifies play range no change:

66

used as a stop command.
(seeks home position)used as a pause command.
used with pause cancel (retry CD play).

Data

Data NameNo

Data Specification

CD Play Parameters

CdcPly

6.5

nti
al

Title

Used to designate the play range and play mode when playing a CD.

Play Mode
When playing a CD, the maximum repeat count of the play segment and theexistence of pickup movement (play position) to the start position are
designated. The designation range of the maximum repeat count is 4 bits.
The default value is 0.
bit 7

6

5

4

3

2

1

0

de

1)

Maximum Repeat Count

nfi

Value
Explanation
00H
No repeat (plays only one time)
01H ~ 0EH Repeat designation count (repeat 1 ~ 14times)
0FH
Infinite repetitions
7FH
Does not change maximum repeat countCo

1: Does not move pickup to start position
Constant Name

0: Same movement

Explanation

CDC_PM_DFL

Play mode default value (no repeat, moves pickup)

CDC_PM_REP_NOCHG

No change in maximum repeat countDoes not move pickup to start position(<PAUSE> status when current position is outside play range)
Play mode does not change (can change play range only)
Equal to (CDC_PM_REP_NOCHG : CDC_PM_PIC_NOMOV)CDC_PM_PIC_NOMOVSEGA

CDC_PM_NOCHG

System Library User's Guide

67

Play Parameters
CdcPly *ply
Access Macro

Explanation

CdcPosPlay start position parameters

CDC_PLY_STYPE (ply)Sint 32

Start position type

CDC_PLY_SFAD (ply)Sint 32

Start position frame address

CDC_PLY_STNO (ply)Uint 8Start position track number

CDC_PLY_SIDX (ply)Uint 8Start position index number

CdcPosPlay end position parameters

CDC_PLY_ETYPE (ply)Sint 32

End position type

CDC_PLY_EFAS (ply)Sint 32

End position frame address sector
number

CDC_PLY_ETNO (ply)Uint 8End position track number

CDC_PLY_EIDX (ply)Uint 8End position index number

CDC_PLY_PMODE(ply)Uint 8Play mode (repeat designation,
pickup movement)

SE

GA

Co

nfi

CDC_PLY_END (ply)deCDC_PLY_START (ply)

Type

nti
al

2)

68

Method for setting play parameters
Play parameters designate the play range and play mode. Play range isdesignated by a combination of the position parameters of the start and end
positions.

nti
al

3)

Examples of settings are shown below.
N o . Play Method

Start Position

1

Track designationtno 1, x1

2

Frame address
designation

fad

3

Play from first of discde(a) Track designation and frame address designation cannot be combined in theplay range. In such cases, REJECT is returned. All other play range combinations are possible.
(b) All play range and play mode combinations are possible.
(c) The play range and maximum repeat count is held within the CD block andare effective until reset.
(d) Default value: start of disc to end of disc, no repeat, moves pickup.

End Position

Comments

tno 2, x2

nfi

fasnumCDC_PTYPE_DFL

note: 1

tno 2, x2
fasnum4

Play until end of disctno 1, x1

CDC_PTYPE_DFL

fad6

tno 1, x1

CDC_PTYPE_NOCHG

Play is retried from thecurrent position withoutchanging the play range
and play mode.

CDC_PTYPE_NOCHG<KEY>

note: 2

tno 2, x2

note: 2

fad: frame address
tno 1: start track number
x1: start index number

fasnumCDC_PTYPE_NOCHG

CDC_PM_NOC
HG isdesignated in
the Play mode.

fasnum: frame address sector number
tno 2: end track number
x2: end index number

fad + fasnum -1 is retained as the end postion.
Track and frame address designation cannot be combined even if there is no change on
the one hand.

SE

Note 1:
Note 2:

CDC_PTYPE_NOCHG

fad

Start position does notchange. (only the end
position changes)

GA

7

End position does notchange. (only the start
position changes)

Co

5

4)

Execptions to the Play Range
No play if the end postion is less than the start position. Becomes <PAUSE>
status same as play range exterior. The play range is held and the play mode isalso effective. (Pickup moves to the start position.)

System Library User's Guide

69

Data

Data NameNo

Data Specification

Sub header Conditions

CdcSubh

6.6

Used when setting/getting sub header conditions for a filter.
1)

Sub header Conditions
dcSubh *subh

nti
al

Title

Type

CDC_SUBH_FN (subh)

Uint 8File Number

CDC_SUBH_CN (subh)

Uint 8Channel Number

CDC_SUBH_SMMSK (subh)

Uint 8Sub mode mask pattern

CDC_SUBH_SMVAL (subh)

Uint 8Sub mode comparison value

CDC_SUBH_CIMSK (subh)

Uint 8

Coding information mask pattern

CDC_SUBH_CIVAL (subh)

Uint 8

Coding information comparison value

:
:

nfi

• Mask pattern• Comparision Value

ExplanationdeAccess Macro

Comparison object bit pattern.
Comparison value of the bit designatedby the mask pattern.

Co

Whether the submode and coding information is equal to the comparison value isdecided after the logical product of their repective mask patterns are taken.

Condition equation(sm & SMMSK) == SMVAL

SE

GA(ci & CIMSK) == CIVAL

70

Sub Mode

bit 7

6

5

4

3

2

1

nti
al

2)

0

(Same as CD-ROM XA sub mode byte)

CDC_SM_EOR
CDC_SM_VIDEO
CDC_SM_AUDIOCDC_SM_DATA
CDC_SM_TRIG
CDC_SM_RT

Record end sector
Video sector
Audio sector
Data sector
Trigger ON
Form 2, 0: Form 1
Real time sector
File end sector

Explanation

01H

Record end sector

02H

Video sector

04H

Audio sector

08H

Data sector

10H

Trigger bit

20H

Form bit (0: Form 1, 1: Form 2)

Co

CDC_SM_FORM

Type

1:
1:
1:
1:
1:
1:
1:
1:

nfi

Constant Name(End OF Record)(Video)(Audio)(Data)(Trigger)(Form)(Real Time Sector)(End Of File)

de

EOR
V
A
D
T
F
RT
EOF

40H

Real time sector

80H

File end sector

SE

GA

CDC_SM_EOF

System Library User's Guide

71

Data

Data NameNo

Data Specification

Sector Information

CdcSct

6.7

nti
al

1)

Title

Sector Information
CdcSct *sct

1)

Title

Data

Data Specification

File Information

File Information
CdcFile *file
Access Macro

Frame address
File Number
Channel Number
Sub mode
Coding information

Data NameNo

CdcFile6.8

Type

Sint 32
Sint 32
Uint 8
Uint 8
Uint 8
Uint 8

Explanation

File start frame address
File size (byte number)File unit size
Gapsize
File number *File attributes

Co

CDC_FILE_FAD (file)
CDC_FILE_SIZE (file)
CDC_FILE_UNIT (file)
CDC_FILE_GAP (file)
CDC_FILE_FN (file)
CDC_FILE_ATR (file)Sint 32
Uint 8
Uint 8
Uint 8
Uint 8

Explanationde

CDC_SCT_FAD (sct)
CDC_SCT_FN (sct)
CDC_SCT_CN (sct)
CDC_SCT_SM (sct)
CDC_SCT_CI (sct)

Type

nfi

Access Macro

2)

File Attributes

6

5

4

3

2

SE

bit 7

GA

*
When there is no directory record system information, the filenumber becomes 0.

Note 1:
Note 2:72

1

0

1 : Yes directory
0 : no directory (note 1)
1 : Form 1 sector included
0 : not included
1 : Form 2 sector included
0 : not included
1 : Interleave sector included 0 : non-interleave
1 : CD-DA file
0 : CD-ROM file
1 : Yes d irectory file
0 : no directory file

Valid at CD-ROM
XA standard
Note 2

bit 1 is a directory bit of the file flag within the directory record and valid when there
is no system information (discriminant gives bit 7 priority)
bits 3 to 7 is attribute information conforming to CD-ROM XA standards, and bits 3 to
7 are 0 when there is no system information.

nti
al

8.0 Function Specifications
Function specifications of the CD Communication Interface are described.

FormatReserved areas with the figure are indicated by a “–” mark. Reserved areas
must be designated with a 0.

2)

Initial Values of Parameters
Initial values of parameters held in the CD block are equal to the default
values designated by the host as long as they are not specially specified.

3)

CD Status Information (Status and CD Report) HoldThe CD communication interface holds status and CD reports when a CD
block command is issued. Information is not held by a periodic response.
The intial value of all holding contents is 0. The functions that change theholding status/CD report are listed below by symbol.

Title

:
:
:

changes status and CD reportchanges status only
no changes (no command issued)

Co

[SR]
[S-]
[--]

nfi

de

1)

Data

Function Specification CD Play

Function Name[SR]

CDC_CdPlay

No
2.1

Nothing changes when there is an error (When the error code is not CDC_ERR_OK).
Data Transfer Inside Functions
Among the information get functions, data transfered by the function interior
enters the function name as Tget. The method of data transfer is softwaretransfer by the CPU.

GA

4)

Example: Get TOC information (CDC_TgetToc)

SE

These functions call the following functions internally.
• Data transfer waiting for start(CDC_DataReady)• Data transfer end(CDC_DataEnd)

System Library User's Guide73

8.1 List of Functions

nti
alTable 8.1 is a list of functions of the CD communication interface.
Table 8.1 List of CD Communication Interface Functions (1)FunctionName

CD Block Common

1.0

Get current CD status information

CDC_GetCurStat

Get previous CD status information

CDC_GetLastStat

Get periodic CD status information

CDC_GetPeriStat

Get hardware information

CDC_GetHwInfo

Get TOC information

CDC_TgetToc

Get session information

CDC_GetSes

1.6

Initialize CD block

CDC_CdInit

1.7

Open tray

CDC_CdOpen

1.8

Data transfer ready

CDC_DataReady

1.9

Data transfer end

CDC_DataEnd

1.10

1.1

1.2

1.3

1.4

de

1.5

2.0

nfi

CD Drive
CD play
Seek play position
Scan
SubcodeCDC_CdPlay

2.1

CDC_CdSeek

2.2

CDC_CdScan

2.3
3.0

Get Subcode R ~ W
CD-ROM Device

CDC_TgetScdQchCo

Get subcode Q

CDC_TgetScdRwch

3.1
3.2
4.0

Set connection point of CD device

CDC_CdSetCon

4.1

Get connection point of CD device

CDC_CdGetCon

4.2

Get buffer partition of last read sector

CDC_CdGetLastBuf

Selector

4.3
5.0

CDC_SetFiltRange

5.1

Get filter frame address range

CDC_GetFiltRange

5.2

Set filter subheader conditions

CDC_SetFiltSubh

5.3

Get filter subheader conditions

CDC_GetFiltSubh

5.4

Set filter mode

CDC_SetFiltMode

5.5

Get filter mode

CDC_GetFiltMode

5.6

Set filter connection point

CDC_SetFiltCon

5.7

Get filter connection point

CDC_GetFiltCon

5.8

Reset selector (filter, partition)

CDC_ResetSelector

5.9

GA

Set filter frame address range

SE
74

NumberTable 8.1 List of CD Communication Interface Functions (2)Function

Name

6.0

nti
al

Buffer Information

NumberGet CD buffer size

CDC_GetBufSiz6.1

Get buffer partition sector number

CDC_GetSctNum

6.2

Calculate actual data size

CDC_CalActSiz

6.3

Get actual data size

CDC_GetActSiz

6.4

Get sector information

CDC_GetSctInfo

6.5

Execute frame address search

CDC_ExeFadSearch

6.6

Get frame address search results

CDC_GetFadSearch

6.7

7.0

Set sector length
Get sector data
Delete sector data
Get and delete sector data
Write sector data
Move sector data

Get sector data copy/move error
CD Block File System
Change directory

7.1

CDC_GetSctData

7.2

CDC_DelSctData

7.3

CDC_GetdelSctData

7.4

CDC_PutSctData

7.5

CDC_CopySctData

7.6

nfi

Copy sector data

CDC_SetSctLendeBuffer Input/Output

CDC_MoveSctData
CDC_GetCopyErr

7.7
7.8
8.0

CDC_ChgDir

8.1

CDC_ReadDir

8.2

Get holding file information range

CDC_GetFileScope

8.3

Get holding file information

CDC_TgetFileInfo

8.4

Co

Hold file information

Read file

CDC_ReadFile

8.5

Stop file access

CDC_AbortFile

8.6

Register Access

9.0

Get data transfer register pointer

CDC_GetDataPtr

9.1

Get interrupt factor register value

CDC_GetHirqReq

9.2

CDC_ClrHirqReq

9.3

Get interrupt mask register value

CDC_GetHirqMsk

9.4

Set interrupt mask register

CDC_SetHirqMsk

9.5

Get MPEG register pointer

CDC_GetMpegPtr

9.6

SE

GA

Clear interrupt factor register

System Library User's Guide75

8.2 Function Details

Title
Function
Specifications

Format:Input:
Output:Function value:
Function:
Remarks:

Title
Function
Specifications

FunctionGet previous CD status information

Function Name
CDC_GetLastStat[ -- ]

No.
1.2

CdcRet CDC_GetLastStat (CdcStat *stat)

None
stat
: CD status information
Returns the return code.
Gets CD status information for the previous CD block command.
If the CD communication interface issues a CD blockcommand, the status and CD report of that response is held.
This function returns the value being held.
FunctionGet periodic CD status information

Function Name
CDC_GetPeriStat[ -- ]

CdcRet CDC_GetPeriStat (CdcStat *stat)
None
stat
: CD status information
Returns the return code.
Gets CD status information through periodic response.
Since the command for CD block is not issued, the load issmall and the polling process is possible.

SE
76[SR] No.
1.1

CdcRet CDC_GetCurStat (CdcStat *stat)
None
stat
: CD status information
Returns the return code
Issues the get command of CD status information for the
CD block and gets current CD status information (status
and CD report).

GA

Format:Input:
Output:Function value:
Function:
Remarks:

Function Name
CDC_GetCurStatdeFormat:Input:
Output:Function value:
Function:

Function
Get current CD status information

nfi

Title
Function
Specificationsntial

CD Block Common

Co

8.2.1

No.
1.3

Format:
Input:
Output:Function value:
Function:
Example:Title
Function
Specifications

nti
al

No.
1.4

CdcRet CDC_GetHwInfo (CdcHw *hw)

Nonehw
: hardware information
Returns the return code.
Gets CD block hardware information.
Function
Get TOC information

Function Name
CDC_TgetToc

[S- ]

No.
1.5

CdcRet CDC_TgetToc (Uint32 *toc)

None
toc
: TOC information (204 words)
Returns the return code.
Gets all TOC information (102 peices, 408 bytes)
Waits in the <OPEN> status and <NODISC> status
Uint 32 toc [102];/* reserves TOC information store region */ret = CDC_TgetToc(toc); /* get TOC information*/
Function
Get session information

Function Name
CDC_GetSes

[S- ]

No.
1.6

CdcRet CDC_GetSes (Sint32 sesno, Uint32 *ses)
sesno : session number (0 ~ 99)ses: session information (2 words)
Returns the return code.
Gets session information (4 bytes) of the designed session.
Waits in the <OPEN> status and <NODISC> status.

SE

GA

Format:Input:
Output:Function value:
Function:

[S- ]

de

Title
Function
Specifications

Function Name
CDC_GetHwInfo

nfi

Format:Input:
Output:Function value:
Function:

Function
Get hardware information

Co

Title
Function
Specifications

System Library User's Guide

77

Function
Initialize CDblock (1/2)

Function Name
CDC_CdInit

Format:CdcRet CDC_CdInit

Input:

iflag : initializing flag
stnby : standby timeecc
: ECC frequency
retry : retry frequency
none
Returns the return code.
Initial setting of CD block.

(Sint32 iflag, Sint32 stnby, Sint32 ecc,
Sint32 retry)(insignificant 8 bits are effective)(insignificant 8 bits are effective)(insignificant 8 bits are effective)(insignificant 8 bits are effective)

Initializing flag
Designates each type of setting flag (8 bits) to the CD block.
When software is reset, all other initialized parameters are ignored and thisbecomes the initial value.

bit 7

6

5

4

3

2

1

nfi

1)

No.
1.7

de

Output:Function value:
Function:

[SR]

nti
al

Title
Function
Specifications

0

Co

Initial value : 00H
1 : Reset CD block software
0 : not the same
1 : Decode of RW subcode
0 : not the same
1 : Doesn't confirm Mode 2 subheader 0 : the same
1 : Retry Form 2 read
0 : not the same
1 : CD-ROM data read standard speed 0 : 2X standard speed
1 : No change
0 : ChangeInterrupt factor register ESEL flag becomes 1 when reset of software ends.
Recognition of the Mode 2 subheader is used only in the correcting processduring CD-ROM decode. The selector always recognizes the subheader.
(decides conditions of the filter, selector length, etc.)(c) Data is output even if there is an error when Form 2 read is not retried.
(d) CD-ROM data read speed switches when changing to the <PAUSE> status.
When the CD-DA area is played, it automatically plays at standard speed.
The prior speed returns if the CD-ROM area is entered.
2)

GA

(a)
(b)

Standby Time
Designates the transition time from <PAUSE> to <STANDBY>.
Changes to <STANDBY> when the standby time of <PAUSE> expires.

SE

Set Value

78

Description

0000H

180 seconds ......initial value

0001H ~ FFFEH

Transition time (in seconds)

FFFFH

No change in settings

3)

Function
Initialize CD block (2/2)

Function Name
CDC_CdInit

No.
1.7

ECC Frequency
Designates the number of repetitions of the ECC process (PQ once each) during
CD-ROM decode.
Set Value

Description

ECC is processed a maximum of only 1 time in real time .....
initial value.

01H ~ 05H

When an error exists after the ECC process, maximum numberof repetitions (total of 2 to 6 times).

de

00H

80H

No ECC process

FFH

No change in settings

Retry Frequency
Designates the number of retries of the same sector if an error occurs during
CD-ROM decode.

nfi

4)

[SR]

nti
al

Title
Function
Specifications

Set Value

Description

Without retrying, stops data output (becomes <ERROR>) .....
initial value.

00H

40H

80H

Retries designated number of times, data is output even if
there is an error.
No change in settings

4

3

2

1

GA

5

)

Infinite number of retries

FFH

6

Retries designated number of times, data output stops if there
is an error (becomes <ERROR>).
Data is output without retrying

41H ~ 4FH (

bit 7

)

Co

01H ~ 0FH (0Frequency indicated by insignificant 4 bits.

Frequency (0 ~ 15 times)
0 : Stops output
0 : Definte number

Tray Open/Close
Closes the Tray when in the <OPEN> status.
• When automatic format (front loading) : CD block automatically closes tray.
• When manual format (top loading) : <BUSY> status until closed by manual.
Tray open when in the <NODISC> status. (See Tray Open)
Tray open and close operates the same for CD play, seek play position, and scan.

SE

5)

1 : Data output even if error occurs
1 : Infinite number of retrys

Remarks:

All command issues are prohibited while the software is being reset.

System Library User's Guide

79

Function
Open tray

Format:Input:
Output:Function value:
Function:

CdcRet CDC_CdOpen (void)

de

[S-]

No.
1.9

Co

dtype
: transfer ready typenone
Returns the return code.
Waits until data transfer ready is enabled. Data can be transferedafter ready is finished. If data is transfered, data transfer end must be
executed.

Transfer Ready Type

Description

Designated when getting data. (CD block → host)

CDC_DRDY_PUT

Designated when writing data. (host → CD block)GA

CDC_DRDY_GETTransfer Ready Process
Waits until DRDY of the interrupt factor register becomes 1, and clears 0 if it
becomes 1. If empty sectors can not be reserved when writing, the EHST flag of
the interrupt factor register becomes 1. In this case, CDC_ERR_PUT error isreturned.
When an error is caused by ready, there is no need to execute datatransfer end. It will be automatically executed inside the ready function.

SE

Remarks:80

Function Name
CDC_DataReady

CdcRet CDC_DataReady (Sint32 dtype)

Value

2)

No.
1.8

nfi

Function
Data transfer readyFormat:Input:
Output:Function value:
Function:

1)

[SR]

none
none
Returns the return code.
Stops the CD drive and opens the tray
• When automatic format (front loading) : CD block automatically
opens tray.
• When manual format (top loading) : <BUSY> status until openedby manual.
When the tray is opened, DCHG of the interrupt factor registerand EFLS flag become 1. The timing is before the <OPEN>status.
(Same for when opening manually.)

Remarks:

Title
Function
Specifications

Function Name
CDC_CdOpen

nti
al

Title
Function
Specifications

Format:
Input:
Output:Function value:
Function:

Function Name
CDC_DataEnd

No.
1.10

CdcRet CDC_DataEnd (Sint32 *cdwnum)none
cdwnum: CD block transfer word number
Returns the return code.
Instructs the end of data transfer for the CD block. Data transfer
can be stopped while in process.

CD Block Transfer Word Number
Returns the word number of effective data transfered by the CD block.The
normal word number can not be exceeded (entire number of words that shouldbe transfered).
Constant Name

Description

Error occurred by data transfer
Data transfer end is executed even though it isn't time fortransfer.

nfi

CDC_DEND_ERR

Relationship of Transfer Word Number
Data transfer conditions can be checked by comparing the host transfer word
number (word number transfered by the host until data transfer end is
executed) and the CD block transfer word number.

Transfer Conditions

Co

2)

[S-]

de

1)

Function
Data transfer end

nti
al

Title
Function
Specifications

Host Transfer Word Number(Host Word Number)

CD Block Transfer Word Number (cdwnum)
When gettng (CD → host)

When writing (host → CD)
cdwnum = host word number

Transfer interrupt

host word no. < normal word no.

cdwnum > host word number

Transfer all

host word no. = normal word no.

cdwnum = normal word number = host word number

Excess transfer

host word no. > normal word no.

cdwnum = normal word number < host word number

Stops data transfer while in progress.
: All data is transfered.
: Normal word number is exceeded andtransfered (Excess part is transfered asdummy data).

SE

GA• Transfer interrupt :• Transfer all• Excess transfer

System Library User's Guide81

8.2.2

CD Drive

Function
CD playFormat:Input:
Output:Function value:
Function:

Remarks:

Function Name
CDC_CdPlay

CdcRet CDC_CdPlay (CdcPly *ply)

[SR]

No.
2.1

ply
: play parameters
none
Returns the return code.
Plays CDs according to the designated play parameters.
Plays music in the CD-DA area. Reads sector data in the
CD-ROM area.
In playing CD-DA, mute is canceled 4 frames prior to the start
position to prevent the start of a song from being cut off.

de

Title
Function
Specifications

ntial

For tray open/close in the <OPEN> and <NODISC> statuses see Initialize CD block.

nfi

Example:(1) Frame Address Designation
CdcPlyply;/* definition of play parameter variable */CDC_PTYPE_FAD;
fad;/* start frame address
CDC_PTYPE_FAD;
fasnum;/* frame address sector number
pmode;/* play mode/* play startCo

CDC_PLY_STYPE (&ply) =CDC_PLY_SFAD (&ply)=
CDC_PLY_ETYPE (&ply) =CDC_PLY_EFAS (&ply)=
CDC_PLY_PMODE (&ply) =ret = CDC_CdPlay (&ply);

*/
*/
*/
*/

(2) Track/Index DesignationGA

CDC_PLY_STYPE (&ply) =CDC_PLY_STNO (&ply)=
CDC_PLY_SIDX (&ply)=
CDC_PLY_ETYPE (&ply) =CDC_PLY_ETNO (&ply)=
CDC _PLY_EIDX (&ply)=
CDC _PLY_PMODE (&ply) =CDC_PTYPE_TNO;
tno1;/* start track number
x1;/* start index number
CDC_PTYPE TNO;
tno2;/* end track number
x2;/* end index number
pmode;/* play mode

*/
*/
*/
*/
*/

(3) Default Value Designation= CDC_PTYPE_DFL; /* start position is first of disc*/

CDC_PLY_ETYPE (&ply) = CDC_PTYPE_DFL; /* end position is end of disc
CDC_PLY_PMODE (&ply) = CDC_PM_DFL;/* no repeat, move pickup

*/
*/

SE

CDC_PLY_STYPE (&ply)(4) CD Play Restart (unchanged selection: play from current position).... cancel pause
CDC_PLY_STYPE (&ply)= CDC_PTYPE_NOCHG;

CDC_PLY_ETYPE (&ply)= CDC_PTYPE_NOCHG;

CDC_PLY_PMODE (&ply) = CDC_PM_NOCHG;

82

Function
Seek play position

Function Name
CDC_CdSeek

Example:Frame Address Designationpos;/* definition of position parameter variable */deCdcPos

CDC_POS_PTYPE (&pos) =CDC_PTYPE_FAD;
CDC_POS_FAD (&pos )= fad;/* frame address
ret = CDC_CdSeek (&pos);/* seek start2.

Track/Index Designation===

CDC_PTYPE_TNO;
tno;/* track numberx;/* index number

nfi

CDC_POS_PTYPE (&pos)
CDC_POS_TNO (&pos)
CDC_POS_IDX (&pos);

3.

No.
2.2

CdcRet CDC_CdSeek (CdcPos *pos)pos: position parameters
none
Returns the return code.
Moves (seeks) the play position (pickup) according to the designatedposition parameters.

Format:Input:
Output:Function value:
Function:

1.

[SR]

nti
al

Title
Function
Specifications

*/
*/

*/
*/

CD Play Stop (Default vlaue designation: Seek home position)...... Stop
CDC_POS_PTYPE (&pos) = CDC_PTYPE_DFL;

Pause CD Play (No changed selection: seek current position) ......Pause

Co

4.

SE

GA

CDC_POS_PTYPE (&pos) = CDC_PTYPE_NOCHG;

System Library User's Guide

83Format:
Input:
Output:Function value:
Function:No.
2.3

scandir: Scan directionnone
Returns the return code.
Scans the CD.
Scanning continues until a CD drive command (CD play, seek, etc.) isissued. Scan is canceled and a pause occurs if the play range is
exceeded. The pause position at that time is undefined.

Scan Direction
Constant Name

Description

CDC_SCAN_FWD

Fast forward scan (forward direction)

CDC_SCAN_RVS

Fast reverse scan (reverse direction)

Sound Output
If scanning from the <PLAY> status, -12 dB sounds are output in the CDDA region. Sound is muted if scanning in the CD-ROM area or in the <PAUSE>
status. If the scan direction in near the play range boundary is reversed, thesound may not be output.
When the CD-ROM area is scanned, sector data will not be read.

SE

GA

Remarks:

84

[SR]

nfi

2)

CdcRet CDC_CdScan (Sint32 scandir)

Co

1)

Function Name
CDC_CdScanntialFunction
Scan

de

Title
Function
Specifications

Subcode
[S-]

No.
3.1

Function Name[S-]
CDC_TgetScdRwch

No.
3.2

CdcRet CDC_TgetScdQch (Uint16 *qcode)

Format:Input:
Output:Function value:
Function:

Title
Function
Specifications

Function Name
CDC_TgetScdQchntialFunction
Get subcode Q

none
qcode
: Subcode Q information (5 words)
Returns the return code.
Gets subcode Q channel information(10 bytes other than CRC)

de

Title
Function
Specifications

Function
Get subcode R ~ W

Format:Input:
Output:Function value:
Function:

CdcRet CDC_TgetScdRwch (Uint16 *rwcode, Sint32 *scdflag)none
rwcode: Subcode R ~ W information (12 words)
scdflag: Subcode flag (effective bits are insignificant)Returns the return code.
Gets subcode R~W channel information (1 pack of 24 bytes).

nfi

8.2.3

6

5

4

3

2

1

0

1 : Pack data error
1 : Overrun error

0 : Normal
0 : Normal

GA

bit 7

Co

(1) Subcode Flag
Shows error conditions of retrieved subcode R ~ W information (packdata).

Pack data can not exceed retrieval of 16 packs in one time frame(13.3 ms). Returns to WAIT if the pack buffer is empty and there isno pack data.

SE

Remarks:

System Library User's Guide

85

CD-ROM Device

Output:Function value:
Function:

Title
Function
Specifications

[SR]

No.
4.1

CdcRet CDC_CdSetCon (Sint32 filtno)
filtno: Connection destination filter number(CDC_NUL_SEL : display non-connection)
none
Returns the return code.
Sets the connection destination (filter) of the CD device.
Connection is separated if CDC_NUL_SEL is selected.
Function
Get connection destination of CD device

Function Name
CDC_CdGetCon

[S-]

No.
4.2

CdcRet CDC_CdGetCon (Sint32 *filtno)

Function value:
Function:

Title
Function
Specifications

Format:Input:
Output:FunctionGet buffer partition of last read sector

Function Name[S-]
CDC_CdGetLastBuf

No.
4.3

CdcRet CDC_CdGetLastBuf (Sint32 *bufno)
none
bufno : Storage destination buffer partition number(CDC_NUL_SEL : displays non-storage)
Returns the return code.
Gets the buffer partition number of the storage destination of thesector last read from the CD.

SE

GA

Function value:
Function:none
filtno: Connection destination filter number(CDC_NUL_SEL : displays non-connection)
Returns the return code.
Gets the connection destination (filter) of the CD device.
Returns CDC_NUL_SEL if there is no connection.

nfi

Format:Input:
Output:86

Function Name
CDC_CdSetCon

nti
alFormat:Input:

FunctionSet connection destination of CD device

de

Title
Function
Specifications

Co

8.2.4

8.2.5

Selector

Title
Function
Function Specs Set filter frame address range

Input:

Output:Function value:
Function:SE

Function Name
CDC_SetFiltSubh

[SR]

No.
5.3

CdcRet CDC_SetFiltSubh (Sint32 filtno, CdcSubh *subh)filtno: filter number
subh: subheader conditions
none
Returns the return code.
Sets subheader conditions for the filter.

Title
Function
Function Specs Get filter subheader conditions

Format:Input:
Output:Function value:
Function:No.
5.2

Sint32 *fasnum)
filtno: filter number
fad: starting frame address
fasnum : frame address sector number
Returns the return code.
Gets the frame address range for the filter.

GA

Output:Function value:
Function:[S-]

CdcRet CDC_GetFiltRange (Sint32 filtno, Sint32 *fad,

Title
Function
Function Specs Set filter subheader conditions

Format:Input:

Function Name
CDC_GetFiltRange

nfi

Function value:
Function:No.
5.1

Sint32 fasnum)
filtno: filter number
fad: starting frame address
fasnum : frame address sector number(0: effective FAD range does not exist)
none
Returns the return code.
Sets the frame address range for the filter. When fasnum = 0, allsectors are output to false output connectors if the FAD range ofthe filter mode is effective.

Co

Input:
Output:[SR]

CdcRet CDC_SetFiltRange (Sint32 filtno, Sint32 fad,

Title
Function
Function Specs Get filter frame address range

Format:Function Name
CDC_SetFiltRangedeFormat:nti
alSee selector reset for the initial value of the selector set parameters.

Function Name
CDC_GetFiltSubh

[S-]

No.
5.4

CdcRet CDC_GetFiltSubh (Sint32 filtno, CdcSubh *subh)filtno: filter number
subh: subheader conditions
Returns the return code.
Gets subheader conditions for the filter.

System Library User's Guide

87

[SR]

No.
5.5

CdcRet CDC_SetFiltMode (Sint32 filtno, Sint32 fmode)

Format:Input:

filtno: filter number
fmode: filter mode (insignificant 8 bits are effective)none
Returns the return code.
Sets the filter mode for the filter.

Output:Function value:
Function:

Filter mode
bit 7

6

5

4

3

2

1

0

de

1)

Function Name
CDC_SetFiltMode

nti
al

Title
Function
Function Specs Set filter mode•

Output to true output connector:•

Output to false output connector:

•
•
•

88

filter FAD range coincides andsubheader conditions do not coincide.
filter FAD range does not coincideor subheader conditions coincide.

Initialing Filter Conditions
When filter conditions are initialized, other bit selections are ignored and theinitial values below are set.

SE

3)

Reverse Subheader Conditions
If subheader conditions are reversed, the output destination will be the oppositeof what is normal for subheader conditions. In short, sectors that correspond to
subheader conditions are output to false output connectors, and sectors that do
not correspond to subheader conditions are output to true output connectors(conditions below.)

GA

2)

Co

nfi

1 : Select file number (FN)
0 : not the same
1 : Select channel number (CN)
0 : not the same
1 : Select submode (SM)0 : not the same
1 : Select coding information (CI)0 : not the same
1 : Reverse subheader conditions
0 : not the same reversal
1 : Select frame address range
0 : not the same
1 : Initialize filter conditions (return to intial values)
0 : not the same initialization

Frame address range : Starting FAD = 0, FAD sector number = 0
Subheader conditions : FN, CN, SMMSK, SMVAL, CIMSK, CIVAL are all 0
Filter mode
: All bits = 0

Function
Get filter mode

Function Name
CDC_GetFiltMode

5

4

3

2

1

0

de

Filter mode

6

No.
5.6

CdcRet CDC_GetFiltMode (Sint32 filtno, Sint32 *fmode)
filtno: filter number
fmode : filter mode (insignificant 8 bits are effective)
Returns the return code.
Gets the filter mode for the filter.

Format:Input:
Output:Function value:
Function:

bit 7

[S-]

nti
al

Title
Function
Specifications

SE

GA

Co

nfi

1 : Select file number (FN)
0 : not the same
1 : Select channel number (CN)
0 : not the same
1 : Select submode (SM)0 : not the same
1 : Select coding information (CI)0 : not the same
1 : Reverse subheader conditions
0 : not the same reversal
1 : Select frame address range
0 : not the same

System Library User's Guide

89Format:
Input:

No.
5.7

de

: filter number: filter connection flag (insignificant 8 bits are effective): buffer partition no.of true output connector connection
destination (CDC_NUL_SEL : disconnected)
flnout: filter number of false output connector connection
destination (CDC_NUL_SEL : disconnected)
none
Returns the return code.
Sets the connection destination below for the filter. Connections are
disconnected if CDC_NUL_SEL is specified.
• true output connector and buffer partition input connector• false output connector and other filter input connectors

bit 7

6

5

4

3

2

1

→ bn

false output connector↓
flnoutTrue output connector set flag
0 : No change in connection conditions
1 : Change the same (connect/disconnect tobuffer partition)Cofilter fintrue output connector0nfi

Filter Connection Flag

False output connector set flag
0 : No change in connection conditions
1 : Change the same (connect/disconnect to filter)

Title
Function
Function Specs Get filter connection destination

Function Name
CDC_GetFiltCon

[S-]

No.
5.8

GA

CdcRet CDC_GetFiltCon (Sint32 filtno, Sint32 *bufno, Sint32 flnout)

filtnobufno: filter number: buffer partition no. of true output connector connection
destination (CDC_NUL_SEL : not connected)
flnout: filter number of false output connector connection
destination (CDC_NUL_SEL : not connected)
Returns the return code.
Gets the filter connection destination. When not connected returns
CDC_NUL_SEL.

SEFunction value:
Function:

90

[SR]

CdcRet CDC_SetFiltCon (Sint32 filtno, Sint32 cflag, Sint32 bufno, Sint32 flnout)

filtnocflag
bufno

Output:Function value:
Function:

Format:Input:
Output:Function Name
CDC_SetFiltCon

nti
al

Title
Function
Function Specs Set filter connection destination

Format:
Input:
Output:Function value:
Function:

CdcRet CDC_ResetSelector (Sint32 rflag, Sint32 bufno)
rflag: reset flag (insignificant 8 bits are effective)bufno: buffer partition number
none
Returns the return code.
Initializes selector set conditions according to the reset flag value.
•When reset flag = 0: All specified buffer partition data is cleared•When reset flag ≠ 0: Buffer partition number is ignored

Reset Flag

bit 7

No.
5.9

6

5

4

3

2

1

de

1)

Function Name[SR]
CDC_ResetSelector

nti
al

Title
Function
Function Specs Resert selector (filter, partition)

0nfi

1 : Initializes data of all buffer partitions
0 : not the same initialization
1 : Initializes all partition output connectors
0 : not the same initialization

Co

1 : Initializes all filter conditions
0 : not the same initialization
1 : Initializes all filter input connectors
0 : not the same initialization
1 : Initializes true output connector of all filters
0 : not the same initialization
1 : Initializes false output connector of all filters
0 : not the same initialization

SEGA

2) Initial Values
The following initial values are set for all selectors by initialization.
• Buffer partition data
: All cleared (all data within the CD buffer iscleared)• Partition output connector: Status: All unconnected• Filter conditions: Similar to initialization by “set filter mode”• Filter input connector: Status: All unconnected• True output connector: buffer partition and same number companion
filters are connected• False output connector: Status: All unconnected

System Library User's Guide

91

Buffer Information

Format:Input:
Output:Function
Get CD buffer size

[S-]

No.
6.1

CdcRet CDC_GetBufSiz (Sint32 *totalsiz, Sint32 *bufnum, Sint32 *freesiz)

Title
Function
Specifications

FunctionGet buffer partiton sector numberdeRemarks:none
totalsiz: total buffer size (sector units, 200 sectors = C8H)
bufnum : total buffer partition number (24 partitions = 18H)
freesiz: empty buffer size (sector units)
Returns the return code.
Gets the Cd buffer total size and buffer partition number (both are
fixed values), also the current space size. The selector number (orfilter number) is equal to the total buffer partiton number.
Even if the space size is 0, the buffer does not need to be full since
there are sectors being used by the system.
Function Name
CDC_GetSctNum

nfi

Function value:
Function:

[S-]

No.
6.2

CdcRet CDC_GetSctNum (Sint32 bufno, Sint32 *snum)

Format:Input:
Output:

bufno
snum

: buffer partition number: sector number within buffer partition(buffer partition size)
Returns the return code.
Gets current sector number (buffer partition size) of buffer partition.

SE

GA

Function value:
Function:

92

Function Name
CDC_GetBufSiz

nti
al

Title
Function
Specifications

Co

8.2.6

Format:
Input:
Output:Function value:
Function:
Title
Function
Specifications

Function
Get actual data size

Function Name
CDC_GetActSiz

[S-]

No.
6.4

CdcRet CDC_GetActSiz (Sint32 *actwsiz)

none
actwsiz: actual data size (word units)
Returns the return code.
Gets the actual data size (initial value of 0) held by the CD block.

Function
Get sector information

Function Name
CDC_GetSctInfo

[S-]

No.
6.5

CdcRet CDC_GetSctInfo (Sint32 bufno, Sint32 spos, CdcSct *sct)
bufno : buffer partition number
spos: sector position (CDC_SPOS_END : shows thepartition’s last sector)
sct: sector information
Returns the return code.
Gets header information (FAD) and subheader information of buffer
partition designated sectors.

GA

Format:Input:

none
Returns the return code.
Calculates the actual data size (word number when fetched to host) of
the buffer partition designated sector range, and holds that result.
Executes the setting of the sector length to set the length of 1 sector.
Connectors already connected to the partition output are disconnected.
Executes “get actual data size” to get the calculation result of the actual
data size.

nfi

Title
Function
Specifications

No.
6.3

: buffer partition number: sector postion (CDC_SPOS_END : shows thepartition’s last sector): sector number (CDC_SNUM_END : shows thesector number from spos to the last partition)

Co

Remarks:[SR]

CdcRet CDC_CalActSiz (Sint32 bufno, Sint32 spos, Sint32 snum)

bufno
spos
snum

Output:Function value:
Function:

Function Name
CDC_CalActSizntialFormat:Input:

Function
Calculation of actual data size

de

Title
Function
Specifications

SE

Output:Function value:
Function:

System Library User's Guide

93

Function Name[SR]
CDC_ExeFadSearch

No.
6.6

nti
al

Title
Function
Function Specs Execute frame address search

CdcRet CDC_ExeFadSearch (Sint32 bufno, Sint32 spos, Sint32 fad)

Format:Input:

bufno
spos

buffer partition number
sector position (CDC_SPOS_END : shows thepartition’s last sector)
frame address

fad
:
none
Returns the return code.
Starting at the designated sector position in the buffer partition, withthe frame address as the key, the sector is retrieved and the result
retained.

deOutput:Function value:
Function:

:
:

Co

nfi

1) Direction of retrieval
Retrieves in the direction of the buffer partition (from thesmaller to larger sector position.)
2) Retrieval result
Contents to be held as retrieval results include the buffer
partition number, retrieved sector position, and the frame
address of that sector.
3) Retrieval conditions
When a FAD that coincides does not exist, the nearest
sector not exceeding the designated FAD is used. Therefore,
retrieval resultant FAD is the greatest FAD that satisfies FAD≤
designated FAD. When there is no sector that satisfies this condition or when retrieval can not be done because of an error, thesector position of the retrieval results is CDC_SOPS_END.
Connector that is already connected to the partition output isdisconnected. The retrieval result executes to get the frame address
retrieval result.

Remarks:

Format:Input:
Output:GA

Title
Function
Function Specs Get frame address search results

94

No.
6.7

CdcRet CDC_GetFadSearch (Sint32 *bufno, Sint32 *spos, Sint32 *fad)

none
bufno
spos

buffer partition number
sector position (CDC_SPOS_END : no applicablesector shown)fad: frame address
Returns the return code.
Gets frame address search results (initial values all 0) held by the CD
block.

SE

Function value:
Function:

Function Name[S-]
CDC_GetFadSearch::

8.2.7

Buffer Input/Output

Output:Function value:
Function:

Function Name
CDC_SetSctLen

No.
7.1

CdcRet CDC_SetSctLen (Sint32 getslen, Sint32 putslen)

getslen: sector length when fetching
putslen: sector length when writing
none
Returns the return code.
Sets the length of one sector in the next cases.
• Gets sector data (CD buffer to host)• Writes sector data (host to CD buffer)
Sector Length

Constant Name

Description

2048 bytes (user data) ....... initial value
when fetched, 2324 bytes if mode 2 form 2

CDC_SLEN_2336

2336 bytes (up to subheader)

CDC_SLEN_2340

2340 bytes (up to header)

CDC_SLEN_2352

2352 bytes (entire sector)

CDC_SLEN_NOCHG

No change

Co

CDC_SLEN_2048

The set “sector length when fetching” is also reflected in “Calculationof actual data size.”

SE

GA

Remarks:[SR]

deFormat:Input:

Function
Set sector length

nfi

Title
Function
SpecificationsntialEach buffer input/output function (get sector data, delete, write, copy, move) includes the connector connection process. In other words, by issuing 1 command, thedevice and selector connections and flow in and out complex processes are done.
Connectors connected to the partition output connector are disconnected.

System Library User's Guide95

Format:
Input:

Function Name
CDC_GetSctData

buffer partition number
sector position (CDC_SPOS_END : shows thepartition’s last sector)
sector number (CDC_SNUM_END : shows the sector
number from spos to the last partition)

none
Returns the return code.
Gets sector data from the designated sector range of the buffer partition.
After executing the function, data must be transferred and fetched.

deOutput:Function value:
Function:
Remarks:

Title
Function
Function Specs Delete sector data

Format:Input:

Function Name
CDC_DelSctData

[SR]

No.
7.3

CdcRet CDC_DelSctData (Sint32 bufno, Sint32 spos, Sint 32 snum)

buffer partition number
sector position (CDC_SPOS_END : shows thepartition’s last sector)
sector number (CDC_SNUM_END : shows thesector number from spos to the last partition)nfibufno :
spos :
snum :

none
Returns the return code.
Deletes sector data of the designated sector range of the buffer partition.
Sector positions after data is deleted advance in order.

Co

Output:Function value:
Function:
Remarks:

Title
Function
Function Specs Get and delete sector data

Format:Input:

Function Name[SR]
CDC_GetdelSctData

No.
7.4

CdcRet CDC_GetdelSctData (Sint32 bufno, Sint32 spos, Sint 32 snum)

bufno
spos

:
:

snum

:

buffer partition number
sector position (CDC_SPOS_END : shows thepartition’s last sector)
sector number (CDC_SNUM_END : shows thesector number from spos to the last partition)GA

Output:Function value:
Function:none
Returns the return code.
Gets data from the designaed sector range of the buffer partition.
Sector data of the designated sector range is deleted from the buffer
partition.
After the function is executed, data must be transferred and fetched.
Even if all data is transferred without being fetched, all data of thedesignated sector range is deleted.

SE
96

No.
7.2

CdcRet CDC_GetSctData (Sint32 bufno, Sint32 spos, Sint 32 snum)

bufno :
spos :
snum :

Remarks:

[SR]

nti
al

Title
Function
Function Specs Get sector dataOutput:
Function value:
Function:
Remarks:

Title
Function
Function Specs Copy sector data

No.
7.6

srcbn
spos

:
:

snum

:

copy source buffer partition number
sector postion (CDC_SPOS_END : shows thepartition’s last sector)
sector number (CDC_SNUM_END : shows thesector number from spos to the last partition)
copy destination filter number

dstfln :none
Returns the return code.
Copies sector data from designated sector range of the buffer
partition. (Copies in between selectors.)
Function Name
CDC_MoveSctData

[SR]

No.
7.7

CdcRet CDC_MoveSctData (Sint32 srcbn, Sint32 spos, Sint32 snum, Sint32 dstfln)

:
:

snum

:

GA

srcbn
spos

move source buffer partition number
sector postion (CDC_SPOS_END : shows thepartition’s last sector)
sector number (CDC_SNUM_END : shows thesector number from spos to the last partition)
copy destination filter number

dstfln :none
Returns the return code.
Moves sector data from designated sector range of the buffer
partition. (Moves in between selectors.)

SE

Output:Function value:
Function:[SR]

CdcRet CDC_CopySctData (Sint32 srcbn, Sint32 spos, Sint32 snum, Sint32 dstfln)

Title
Function
Function Specs Move sector data

Format:Input:

No.
7.5

nfi

Output:Function value:
Function:

Function Name
CDC_CopySctData

Co

Format:Input:[S- ]CdcRet CDC_PutSctData (Sint32 filtno, Sint32 snum)
filtno :filter number
snum :
sector number
none
Returns the return code.
Writes sector data to the designated filter.
Data must be transferred and written after the function is executed.
Data of the designated sector number is written even if data transfer
is interrupted. Values except for transferred data are not fixed.

deFormat:Input:

Function Name
CDC_PutSctData

nti
al

Title
Function
Function Specs Write sector data

System Library User's Guide

97

Format:
Input:
Output:Function value:
Function:

Function
Get sector data copy/move error

Function Name
CDC_GetCopyErr

No.
7.8

CdcRet CDC_GetCopyErr (Sint32 *cpyerr)none
cpyerr : copy/move error information
Returns the return code.
Gets sector data copy/move error information.
Copy/Move Error Information
Constant Name

Description

Normal end ...... initial value

CDC_COPY_NG

Error is caused• Selector is disconnected during copy/move• No more space in buffer

CDC_COPY_BUSY

Copy/Move process is in progress

GA

Co

nfi

de

CDC_COPY_OK

SE
98

[SR]

nti
al

Title
Function
Specifications

CD Block File System

Remarks:

Title
Function
Specifications

Format:Input:
Output:Function value:
Function:none
Returns the return code.
Moves the current directory to the directory shown by thedesignated file identifier. Moves to the root directory if
CDC_NUL_FID is specified in the file identifier.
When moved, it reads directory record, and retains a maximum of
254 files worth of data from the start (256 files if including parent
and own). Returns REJECT when directory is not designated by
the file identifier.
The CD block file system uses the selector in the operation. The
operation selector designates through the filter number.

Function
Hold file information

SE

Function Name
CDC_ReadDir

[SR]

No.
8.2

CdcRet CDC_ReadDir (Sint32 filtno, Sint32 fid)
filtno : filter number
fid: file identifier
none
Returns the return code.
Reads the directory record of the current directory and holds up
to 254 pieces of file information after the designated file identifier(own and parent are always retained).
The CD block file system uses the selector in the operation. The
operation selector designates through the filter number.

GA

Remarks:

:
:

No.
8.1

(Sint32 filtno, Sint32 fid)
filter number
file identifier of the directory file
(CDC_NUL_FID : root directory)

CdcRet CDC_ChgDirfiltno
fid

[SR]

nti
al

Output:Function value:
Function:

Function Name
CDC_ChgDirdeFormat:Input:

Function
Change directory

nfi

Title
Function
Specifications

Co

8.2.8

Format:
Input:
Output:Function value:
Function:
Remarks:
Title
Function
Specifications

Function Name
CDC_TgetFileInfo

No.
8.4

nfi

Co

Example:[S-](Sint32 fid, CdcFile *file): file identifier (CDC_NUL_FID : shows entire fileinformation)
file : file information
Returns the return code.
Obtains file information (12 bytes) of the indicated file
identifier. Obtains all file information (up to 254 pieces) held in
the CD block if CDC_NUL_FID is designated in the file
identifier.
CdcFile file;/* Reserves information storage area of 1 file*/
ret = CDC_TgetFileInfo (fid, &file) ;CdcRet CDC_TgetFileInfo

fid

Output:Function value:
Function:No.
8.3

CdcRet CDC_GetFileScope(Sint32 *fid, Sint32 *infnum)none
fid: first file identifier being held
infnum : number of file information being held
Returns the return code.
Returns the file information range held by the current CD block.
Since the self and parent directories are always held, they are notincluded in the file information number.
Function
Get holding file information

Format:Input:

Function Name[S-]
CDC_GetFileScopentialFunction
Get holding file information range

de

Title
Function
Specifications

CdcFile file[256];/* Reserves information storage area of all files */ret = CDC_TgetFileInfo (CDC_NUL_FID, file) ;Format:Input:

Function
Read file

GA

Title
Function
Specifications

[SR]

No.
8.5

CdcRet CDC_ReadFile (Sint32 filtno, Sint32 fid, Sint32 offset)
filtno : filter number
fid: file identifier
offset : logical offset from first of file (sector units)
none
Returns the return code.
Reads the designated file. The read destination selector isdesignated by the filter number.

SE

Output:Function value:
Function:

Function Name
CDC_ReadFile

Format:
Input:
Output:Function value:
Function:

Function Name
CDC_AbortFile

nfi
Co
GA
SE

[SR]

No.
8.6

CdcRet CDC_AbortFile(void)
none
none
Returns the return code.
Stops file access by each function (directory move, fileinformation hold, and file read) of the CD block file system.
Pauses the CD drive, and the EFLS flag of the interrupt factor
register becomes 1.
Even if file access is stopped, the buffer partition is not cleared
and the selector is not initialized. File information being held isdestroyed if directory-move and file-information-hold are
stopped. File access is also stopped when the tray is opened.

deRemarks:

Function
Stop file access

nti
al

Title
Function
Specifications

8.2.9Register Access

Format:Input:
Output:Function value:
Function:

Function Name
CDC_GetDataPtr

GAde
Function Name
CDC_ClrHirqReq

nfi

Title
Function
Function Specs Get interrupt mask register value

Function Name
CDC_GetHirqMsk

Uint 16 CDC_GetHirqMsk (void)
none
none
register value
Gets the interrupt mask register (HIRQMSK) value.

SE

Format:Input:
Output:Function value:
Function:[ -- ]

No.
9.2[ -- ]

No.
9.3

void CDC_ClrHirqReq (Uint16 bitpat)
bitpat : cleared bit pattern (bit to clear is 0, other bits are 1)
none
none
Clears the interrupt factor by the designated bit pattern.
(Only 0 is written.)Since the CD communication interface uses the interrupt factor
register CMOK flag, clearing by the application program isprohibited.

Co

Remarks:

Function Name
CDC_GetHirqReq

Uint16 CDC_GetHirqReq (void)
none
none
Register value
Gets the interrupt factor register (HIRQREQ) value.

Title
Function
Function Specs Clear interrupt factor register

Format:Input:
Output:Function value:
Function:No.
9.1

Uint16 *CDC_GetDataPtr (void)
none
none
Register pointerGets the data transfer register (DATATRNS) pointer.

Title
Function
Function Specs Get interrupt factor register value

Format:Input:
Output:Function value:
Function:[ -- ]

nti
al

Title
Function
Function Specs Get data transfer register pointer[ -- ]

No.
9.4

Function
Get MPEG register pointer

Function Name
CDC_GetMpegPtr

Uint 16 *CDC_GetMpegPtr (void)
none
none
register pointerGets MPEG register (MPEGRGB) pointer.

GA
SE

No.
9.5

void CDC_SetHirqMsk (Uint 16 bitpat)
bitpat : mask bit pattern (bit to mask is 0, other bits are 1)
none
none
Masks interrupt factor by designated bit pattern.

Co

Format:Input:
Output:Function value:
Function:[ -- ]

nti
al

Title
Function
Specifications

Function Name
CDC_SetHirqMsk

deFormat:Input:
Output:Function value:
Function:

Function
Set interrupt mask register

nfi

Title
Function
Specifications[ -- ]

No.
9.6