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

Function details-7


8.2.7 Buffer input/output

Each buffer input/output function (extracting, erasing, writing, copying, and moving sector data) includes connector connection processing.
In other words, by issuing a single command, multiple processes such as connecting the device and selector, and inputting and outputting sectors are performed. Any connectors already connected to the partition output connector will be disconnected.
If the connector is disconnected by another device or selector during a buffer I/O operation, an error will occur. (See " 5.3.4 Notes on Selectors ")

 one
View
table
 Title

function specification

 Function

Setting sector length

 Function Name[SR]

CDC_SetSctLen

 No

7.1

Format
Sint32 CDC_SetSctLen(Sint32 getslen, Sint32 putslen)
input
 getslen
 :Sector length at time of extraction
 putslen
 : Sector length when writing
output
none
function value
Returns an error code. End flag ESEL flag
function
Set the length of one sector (sector length) in the following cases.
・ Extract sector data (CD buffer → host)
・ Write sector data (host → CD buffer)

(1) Sector length
 constant name
 explanation
 CDC_SLEN_2048
 2048 bytes (user data)...Initial value
When extracting, if mode 2 form 2, 2324 bytes
 CDC_SLEN_2336
 2336 bytes (up to subheader)
 CDC_SLEN_2340
 2340 bytes (up to header)
 CDC_SLEN_2352
 2352 bytes (whole sector)
 CDC_SLEN_NOCHG
 Do not change settings
remarks
The set "sector length when retrieving" is also reflected in the calculation of the actual data size ( CDC_CalActSiz ).
Do not change the sector length while calculating the actual data size or while transferring sector data (during the processing of CDC_GetSctData , CDC_GetdelSctData , and CDC_PutSctData functions).

 one
View
table
 Title

function specification

 Function

Extracting sector data

 Function Name[SR]

CDC_GetSctData

 No

7.2

Format
Sint32 CDC_GetSctData(Sint32 bufno, Sint32 spos, Sint32 snum)
input
 bufno
 :Buffer section number
 spos
 : Sector position ( CDC_SPOS_END : Indicates the last sector of the partition)
 snum
 : Number of sectors ( CDC_SNUM_END : Indicates the number of sectors from spos to the end of the partition)
output
none
function value
Returns an error code.
end flag
EHST flag (becomes 1 after executing CDC_DataEnd function)
function
Extracts sector data from the specified sector range of the buffer partition.
The length of one sector can be changed by setting the sector length (CDC_SetSctLen).
remarks
After the function executes, we need to transfer and retrieve the data.

 one
View
table
 Title

function specification

 Function

Erase sector data

 Function Name[SR]

CDC_DelSctData

 No

7.3

Format
Sint32 CDC_DelSctData(Sint32 bufno, Sint32 spos, Sint32 snum)
input
 bufno
 :Buffer section number
 spos
 : Sector position ( CDC_SPOS_END : Indicates the last sector of the partition)
 snum
 : Number of sectors ( CDC_SNUM_END : Indicates the number of sectors from spos to the end of the partition)
output
none
function value
Returns an error code.
end flag
EHST flag
function
Erases sector data from the specified sector range of the buffer partition.
remarks
When data is erased, subsequent sector positions are moved up sequentially.

 one
View
table
 Title

function specification

 Function

Extract and erase sector data

 Function Name[SR]

CDC_GetdelSctData

 No

7.4

Format
Sint32 CDC_GetdelSctData(Sint32 bufno, Sint32 spos, Sint32 snum)
input
 bufno
 :Buffer section number
 spos
 : Sector position ( CDC_SPOS_END : Indicates the last sector of the partition)
 snum
 : Number of sectors ( CDC_SNUM_END : Indicates the number of sectors from spos to the end of the partition)
output
none
function value
Returns an error code.
end flag
EHST flag (becomes 1 after executing CDC_DataEnd function)
function
Extracts and erases sector data from the specified sector range of the buffer partition.
The length of one sector can be changed by setting the sector length (CDC_SetSctLen).
remarks
After the function executes, we need to transfer and retrieve the data.
Even if the transfer ends without extracting all the data, all data in the specified sector range will be erased.

 one
View
table
 Title

function specification

 Function

Writing sector data

 Function Name[SR]

CDC_PutSctData

 No

7.5

Format
Sint32 CDC_PutSctData(Sint32 filtno, Sint32 snum)
input
 filtno
 : Aperture number
 snum
 : Number of sectors
output
none
function value
Returns an error code.
end flag
EHST flag (becomes 1 after executing CDC_DataEnd function)
function
Writes sector data to the specified aperture.
The length of one sector can be changed by setting the sector length (CDC_SetSctLen).
remarks
After the function executes, the data must be transferred and written.
Even if data transfer is interrupted midway, the specified number of sectors of data will be written. Values other than the transferred data are undefined.

《Incorporation of sector data》
Sector data is incorporated into the partition from the aperture after completing the data transfer (CDC_DataEnd). When all sectors have been embedded, the EHST flag becomes 1.

《Securing free space》
Returns WAIT if there is insufficient free space when issuing the command. (Free space< If free space cannot be secured after receiving the snum) command, the DRDY flag in the interrupt factor register remains 0 and the EHST flag becomes 1. (If free space is used by other device processes)


 one
View
table
 Title

function specification

 Function

Copying sector data

 Function Name[SR]

CDC_CopySctData

 No

7.6

Format
Sint32 CDC_CopySctData(Sint32 srcbn, Sint32 spos, Sint32 snum, Sint32 dstfln)
input
 srcbn
 :Copy source buffer section number
 spos
 : Sector position ( CDC_SPOS_END : Indicates the last sector of the partition)
 snum
 : Number of sectors ( CDC_SNUM_END : Indicates the number of sectors from spos to the end of the partition)
 dstfln
 :Destination aperture number
output
none
function value
Returns an error code.
end flag
ECPY flag
function
Copies sector data from the specified sector range of the buffer partition to the aperture. (Copying between selectors)
The length of one sector is fixed at 2352 bytes.
remarks
Returns WAIT if there is insufficient free space when issuing the command. (Free space< snum) If there is no free space during command processing, the copy process will be stopped at that point and an error will occur. (If free space is used by other device processes)
To obtain error information, execute sector data copy/movement error acquisition (CDC_GetCopyErr).

 one
View
table
 Title

function specification

 Function

Moving sector data

 Function Name[SR]

CDC_MoveSctData

 No

7.7

Format
Sint32 CDC_MoveSctData(Sint32 srcbn, Sint32 spos, Sint32 snum, Sint32 dstfln)
input
 srcbn
 : Source buffer section number
 spos
 : Sector position ( CDC_SPOS_END : Indicates the last sector of the partition)
 snum
 : Number of sectors ( CDC_SNUM_END : Indicates the number of sectors from spos to the end of the partition)
 dstfln
 : Destination aperture number
output
none
function value
Returns an error code.
end flag
ECPY flag
function
Moves sector data from the specified sector range of the buffer partition to the aperture. (move between selectors)
The length of one sector is fixed at 2352 bytes.
remarks
It can be executed even if the buffer is full.
To obtain error information, execute sector data copy/movement error acquisition (CDC_GetCopyErr).

 one
View
table
 Title

function specification

 Function

Sector data copy/move error acquisition

 Function Name[S-]

CDC_GetCopyErr

 No

7.8

Format
Sint32 CDC_GetCopyErr(Sint32 *cpyerr)
input
none
output
cpyerr: Copy/move error information
function value
Returns an error code.
function
Obtains error information when copying/moving sector data.
The previous error information is retained until the next copy/move (CDC_CopySctData, CDC_MoveSctData) is executed.

(1) Copy/move error information
 constant name
 explanation
 CDC_COPY_OK
 Normal end...Initial value
 CDC_COPY_NG
 Error occurred
・ Selector was detached during copy/move.
・ There is no free space in the buffer.
 CDC_COPY_BUSY
 Copy/move processing in progress


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