PROGRAMMER'S GUIDEStream system library
BackForward
Stream system library

7. Function specifications-4


7.4 Forwarding settings


 List
 Title

Function specifications

 Function

Transfer area settings

 Function Name

STM_SetTrBuf

 No

4.1

Form
void STM_SetTrBuf (StmHn stm, void * buffer, Sint32 nunit, Sint32 unit size)
input
 stm
 : Stream handle
 buffer
 : Transfer area
 nunit
 : Transfer area size (in transfer unit)
 unitsize
 : Transfer unit size
output
none
Function value
none
function
Sets the data transfer area for the specified stream.

(1) Transfer unit size
 Constant name
 Transfer unit size
 STM_UNIT_FORM1
 Mode1, Mode2 Form1 sector length (2048 bytes)
 STM_UNIT_FORM2
 Mode2, Form2 sector length (2324 bytes)
 STM_UNIT_WORD
 Word unit (2 bytes)
 STM_UNIT_BYTE
 Byte unit (1 byte)

remarks

  1. The default transfer mode is CPU.

  2. If a transfer function is set, the transfer function takes precedence.

  3. For software transfer and CPU DMA transfer, place the transfer area on the longword boundary.


 List
 Title

Function specifications

 Function

Transfer function registration

 Function Name

STM_SetTrFunc

 No

4.2

Form
void STM_SetTrFunc (StmHn stm, StmTrFunc func, void * obj)
input
 stm
 : Stream handle
 func
 : Transfer function (STM_TR_NULLFUNC to cancel)
 obj
 : Registered object
output
none
Function value
none
function
Registers the transfer function for the specified stream.
The registration function is called during the stream transfer process.
remarks

  1. The registration function has the following format:
    Sint32 (* StmTrFunc) (void * obj, StmHn stm, Sint32 nsct)
     obj
     : Registered object
     stm
     : Stream handle
     nsct
     : Number of transferable sectors

  2. The registration object is passed to the first argument of the registration function.

  3. The transfer function can transfer data in up to nsct sectors.

  4. The function value returns the number of sectors actually transferred.
    If the transfer function is being transferred at the end of the transfer function due to DMA, etc., it is necessary to return (-1).


 List
 Title

Function specifications

 Function

Start transfer in transfer function

 Function Name

STM_StartTrans

 No

4.3

Form
Uint32 * STM_StartTrans (StmHn stm, Sint32 * dadr)
input
stm: stream handle
output
dadr: Change in forwarding address for each longword transfer
Function value
Forwarding address
function
The data transfer process is started in the transfer function.

(1) Change in transfer source address (pointer to Uint32)
 File type
 Value of change in forwarding address
 CD-ROM file
 0
 Memory file, SCSI file
 1

remarks
When using STM_SctToWord or STM_WordToSct in the transfer function, call it before executing this function.
example
volatile Uint32 * src;

src = STM_StartTrans (stm, & dadr);
for (i = 0; i <n; i ++) {
	* dst = * src;
	src + = dadr;
	dst ++;

 List
 Title

Function specifications

 Function

Opening and closing the transfer gate

 Function Name

STM_SetTrGate

 No

4.4

Form
void STM_SetTrGate (StmHn stm, Sint32 gate)
input
 stm
 : Stream handle
 gate
 : Transfer gate status
output
none
Function value
none
function
Opens and closes the transfer gate of the specified stream.

(1) Transfer gate status
 Constant name
 Transfer gate status
 STM_GATE_OPEN
 Open state
 STM_GATE_CLOSE
 Closed state

remarks
The default is STM_GATE_OPEN.

 List
 Title

Function specifications

 Function

Setting the maximum number of transfer sectors

 Function Name

STM_SetTrPara

 No

4.5

Form
void STM_SetTrPara (StmHn stm, Sint32 tsct)
input
 stm
 : Stream handle
 tsct
 : Maximum number of transfer sectors (STM_TR_ALL for all read sectors)
output
none
Function value
none
function
Set the maximum number of sectors to be transferred from the CD buffer partition to the transfer area at one time.
remarks

  1. The data read into the CD buffer partition is divided into less than this number of sectors and transferred.

  2. The default is one sector.


 List
 Title

Function specifications

 Function

Transfer start FAD setting

 Function Name

STM_SetTrFad

 No

4.6

Form
void STM_SetTrFad (StmHn stm, Sint32 fad)
input
 stm
 : Stream handle
 fad
 : Transfer start FAD
output
none
Function value
none
function
Sets the FAD that initiates the transfer of data in the CD buffer partition.
remarks
The default is STM_FAD_CDTOP.

 List
 Title

Function specifications

 Function

Transfer mode setting

 Function Name

STM_SetTrMode

 No

4.7

Form
void STM_SetTrMode (StmHn stm, Sint32 tmode)
input
 stm
 : Stream handle
 tmode
 : Transfer mode
output
none
Function value
none
function
Set the transfer method from the CD buffer partition to the transfer area.

(1) Transfer mode
 Constant name
 Transfer method
 CPU load
 STM_TR_SCU
 SCU DMA
 If the transfer destination is on the B bus, the CPU operates completely independently
 STM_TR_SDMA0
 CPU DMA channel 0
 CPU processing power drops
 STM_TR_SDMA1
 CPU DMA channel 1
 CPU processing power drops
 STM_TR_CPU
 Software
 CPU is occupied, but interrupt processing is possible

remarks
The default is STM_TR_CPU.

 List
 Title

Function specifications

 Function

Reset transfer area

 Function Name

STM_ResetTrBuf

 No

4.8

Form
void STM_ResetTrBuf (StmHn stm)
input
stm: stream handle
output
none
Function value
none
function
Initializes the forwarding pointer.
remarks
It is also possible to specify another area with STM_SetTrBuf and change the transfer area.

BackForward
PROGRAMMER'S GUIDEStream system library
Copyright SEGA ENTERPRISES, LTD., 1997