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

Function details-6


8.2.6 Buffer information


 List
 Title

Function specifications

 Function

Get CD buffer size

 Function Name [S-]

CDC_GetBufSiz

 No

6.1

Form
Sint32 CDC_GetBufSiz (Sint32 * totalsiz, Sint32 * bufnum, Sint32 * freesiz)
input
none
output
 totalsiz
 : Total buffer size (sector unit, 200 sectors = C8H)
 bufnum
 : Total number of buffer partitions (24 partitions = 18H)
 freesiz
 : Free buffer size (in sector units)
Function value
Returns an error code.
function
Gets the size of the entire CD buffer, the number of buffer partitions (both are fixed values), and the current free size.
The number of selectors (or the number of apertures) is equal to the total number of buffer partitions.
remarks
Even if the free size is 0, it does not necessarily mean that the buffer is full because there are sectors used by the system.

 List
 Title

Function specifications

 Function

Get the number of sectors in the CD buffer partition

 Function Name [S-]

CDC_GetSctNum

 No

6.2.

Form
Sint32 CDC_GetSctNum (Sint32 bufno, Sint32 * snum)
input
bufno: Buffer partition number
output
snum: Number of sectors in the buffer partition (buffer partition size)
Function value
Returns an error code.
function
Gets the current number of sectors in the buffer partition (buffer partition size).

 List
 Title

Function specifications

 Function

Calculation of actual data size

 Function Name [SR]

CDC_CalActSiz

 No

6.3

Form
Sint32 CDC_CalActSiz (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
ESEL flag
function
Calculates the actual data size (the number of words to retrieve to the host) from the specified sector range of the buffer partition. To get the calculation result, execute Get Actual Data Size (CDC_GetActSiz).
In case of error, the actual data size will be as follows.
 Constant name
 explanation
 CDC_ACTSIZ_ERR
 The calculation could not be performed.
The length of one sector can be changed by setting the sector length (CDC_SetSctLen).
remarks
The connector connected to the partition output connector is disconnected.

 List
 Title

Function specifications

 Function

Get the actual data size

 Function Name [S-]

CDC_GetActSiz

 No

6.4

Form
Sint32 CDC_GetActSiz (Sint32 * actwnum)
input
none
output
actwnum: Actual data size (number of words)
Function value
Returns an error code.
End flag
ESEL flag (only checked)
function
Acquires the calculation result (initial value 0) of the actual data size.
The result of the previous calculation is retained until the next calculation (CDC_CalActSiz).

 List
 Title

Function specifications

 Function

Acquisition of sector information

 Function Name [S-]

CDC_GetSctInfo

 No

6.5 6.5

Form
Sint32 CDC_GetSctInfo (Sint32 bufno, Sint32 spos, CdcSct * sct)
input
 bufno
 : Buffer partition number
 spos
 : Sector position ( CDC_SPOS_END: Indicates the last sector of the partition)
output
sct: Sector information
Function value
Returns an error code.
function
Acquires the header information (FAD) and subheader information of the specified sector of the buffer partition.

 List
 Title

Function specifications

 Function

Performing a frame address search

 Function Name [SR]

CDC_ExeFadSearch

 No

6.6

Form
Sint32 CDC_ExeFadSearch (Sint32 bufno, Sint32 spos, Sint32 fad)
input
 bufno
 : Buffer partition number
 spos
 : Sector position ( CDC_SPOS_END: Indicates the last sector of the partition)
 fad
 : Frame address
output
none
Function value
Returns an error code.
End flag
ESEL flag
function
Searches the sector from the specified sector position of the buffer partition using the frame address as a key. To get the search results, run Get Frame Address Search Results (CDC_GetFadSearch).

(1) Search direction
Search backwards in the buffer partition. (From the smaller sector position to the larger sector position)

(2) Search results
The contents to be retained as a search result are the buffer partition number, the sector position obtained by the search, and the frame address of that sector.

(3) Search conditions
If no matching FAD exists, search for the closest sector that does not exceed the specified FAD. In other words, the FAD of the search result is the maximum FAD that satisfies FAD ≤ specified FAD.
In case of error, the sector position and FAD of the search result will be the following values.
 Sector position
 Frame address
 explanation
 CDC_SPOS_ERR
 0
 There is no sector that meets the search conditions.
 CDC_FAD_ERR
 The search could not be performed.
remarks
The connector connected to the partition output connector is disconnected.

 List
 Title

Function specifications

 Function

Get frame address search results

 Function Name [S-]

CDC_GetFadSearch

 No

6.7

Form
Sint32 CDC_GetFadSearch (Sint32 * bufno, Sint32 * spos, Sint32 * fad)
input
none
output
 bufno
 : Buffer partition number
 spos
 : Sector position
 fad
 : Frame address
Function value
Returns an error code.
End flag
ESEL flag (only checked)
function
The execution result of the frame address search (initial value is all 0) is acquired.
The previous search results are retained until the next search (CDC_ExeFadSearch).

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