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 (sector data retrieval, erasure, write, copy, move) includes the processing of connector connection.
In other words, with a single command issuance, the combined processing of connecting the device and selector and inflowing and outflowing sectors is performed. The connector connected to the partition output connector is disconnected.
An error occurs if the connector is disconnected by another device or selector while buffer I / O is in operation. (See " 5.3.4 Notes on Selectors ")

 List
 Title

Function specifications

 Function

Sector length setting

 Function Name [SR]

CDC_SetSctLen

 No

7.1

Form
Sint32 CDC_SetSctLen (Sint32 getslen, Sint32 putslen)
input
 getslen
 : Sector length at the time of retrieval
 putslen
 : Sector length at the time of 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.
-Retrieve sector data (CD buffer → host)
-Write sector data (host → CD buffer)

(1) Sector length
 Constant name
 explanation
 CDC_SLEN_2048
 2048 bytes (user data) …… When fetching the initial value, 2324 bytes for 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
 Do not change settings
remarks
The set "Sector length at the time of retrieval" 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 transferring sector data ( while processing the CDC_GetSctData , CDC_GetdelSctData , CDC_PutSctData functions).

 List
 Title

Function specifications

 Function

Extract sector data

 Function Name [SR]

CDC_GetSctData

 No

7.2

Form
Sint32 CDC_GetSctData (Sint32 bufno, Sint32 spos, Sint32 snum)
input
 bufno
 : Buffer partition 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 (1 after executing the 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 executing the function, you need to transfer and retrieve the data.

 List
 Title

Function specifications

 Function

Erase sector data

 Function Name [SR]

CDC_DelSctData

 No

7.3

Form
Sint32 CDC_DelSctData (Sint32 bufno, Sint32 spos, Sint32 snum)
input
 bufno
 : Buffer partition 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 the data is erased, the sector positions after that are moved up in sequence.

 List
 Title

Function specifications

 Function

Extraction and deletion of sector data

 Function Name [SR]

CDC_GetdelSctData

 No

7.4.

Form
Sint32 CDC_GetdelSctData (Sint32 bufno, Sint32 spos, Sint32 snum)
input
 bufno
 : Buffer partition 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 (1 after executing the CDC_DataEnd function)
function
Extracts sector data from the specified sector range of the buffer partition and erases it.
The length of one sector can be changed by setting the sector length (CDC_SetSctLen).
remarks
After executing the function, you need to transfer and retrieve the data.
Even if the transfer is completed without extracting all the data, all the data in the specified sector range will be deleted.

 List
 Title

Function specifications

 Function

Writing sector data

 Function Name [SR]

CDC_PutSctData

 No

7.5 7.5

Form
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 (1 after executing the 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 executing the function, you need to transfer and write the data.
Even if the data transfer is interrupted in the middle, the specified number of sectors of data will be written. Values other than the transferred data are indefinite.

《Incorporation of sector data》
After executing the end of data transfer (CDC_DataEnd), the sector data is incorporated into the partition from the aperture. When all sectors have been included, the EHST flag will be 1.

《Securing free space》
If there is not enough free space when issuing the command, WAIT is returned. (Free space <snum) If free space cannot be secured after receiving the command, the DRDY flag of the interrupt cause register remains 0 and the EHST flag becomes 1. (When free space is used for other device processing)


 List
 Title

Function specifications

 Function

Copy sector data

 Function Name [SR]

CDC_CopySctData

 No

7.6

Form
Sint32 CDC_CopySctData (Sint32 srcbn, Sint32 spos, Sint32 snum, Sint32 dstfln)
input
 srcbn
 : Copy source buffer partition 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
 : Copy 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. (Copy between selectors)
The length of one sector is fixed at 2352 bytes.
remarks
If there is not enough free space when issuing the command, WAIT is returned. (Free space <snum) If there is no free space during command processing, copying processing will be stopped at that point and an error will occur. (When free space is used for other device processing)
To get the error information, execute sector data copy / move error acquisition (CDC_GetCopyErr).

 List
 Title

Function specifications

 Function

Moving sector data

 Function Name [SR]

CDC_MoveSctData

 No

7.7

Form
Sint32 CDC_MoveSctData (Sint32 srcbn, Sint32 spos, Sint32 snum, Sint32 dstfln)
input
 srcbn
 : Move source buffer partition 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 get the error information, execute sector data copy / move error acquisition (CDC_GetCopyErr).

 List
 Title

Function specifications

 Function

Sector data copy / move error acquisition

 Function Name [S-]

CDC_GetCopyErr

 No

7.8

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

(1) Copy / move error information
 Constant name
 explanation
 CDC_COPY_OK
 Normal termination …… Initial value
 CDC_COPY_NG
 Error occurred-The selector was disconnected during copying / moving.
-There is no free space in the buffer.
 CDC_COPY_BUSY
 Copying / moving


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