Japanese
PROGRAMMER'S GUIDEStream system library
BackForward
stream system library

7.Function specification-4


7.4 Transfer settings


 one
View
table
 Title

function specification

 Function

Transfer area settings

 Function name

STM_SetTrBuf

 No

4.1

Format
void STM_SetTrBuf(StmHn stm, void *buffer, Sint32 nunit,Sint32 unitsize)
input
 stm
 :Stream handle
 buffer
 :Transfer area
 nunit
 : Transfer area size (transfer unit 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, give priority to the transfer function.

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


 one
View
table
 Title

function specification

 Function

Registering a transfer function

 Function name

STM_SetTrFunc

 No

4.2

Format
void STM_SetTrFunc(StmHn stm, StmTrFunc func, void *obj)
input
 stm
 :Stream handle
 func
 : Transfer function (STM_TR_NULLFUNC when canceling)
 obj
 :Registered object
output
none
function value
none
function
Registers a transfer function for the specified stream.
The registration function is called during stream transfer processing.
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 up to nsct sectors.

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


 one
View
table
 Title

function specification

 Function

Transfer start in transfer function

 Function name

STM_StartTrans

 No

4.3

Format
Uint32 *STM_StartTrans(StmHn stm, Sint32 *dadr)
input
stm: stream handle
output
dadr: Longword Change in source address for each word transfer
function value
Transfer source address
function
Starts data transfer processing in the transfer function.

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

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

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

 one
View
table
 Title

function specification

 Function

Opening/closing the transfer gate

 Function name

STM_SetTrGate

 No

4.4

Format
void STM_SetTrGate(StmHn stm, Sint32 gate)
input
 stm
 :Stream handle
 gate
 : Transfer gate status
output
none
function value
none
function
Opens/closes the transfer gate for the specified stream.

(1) Transfer gate status
 constant name
 Transfer gate status
 STM_GATE_OPEN
 open state
 STM_GATE_CLOSE
 closed state

remarks
Default is STM_GATE_OPEN.

 one
View
table
 Title

function specification

 Function

Setting the maximum number of transferred sectors

 Function name

STM_SetTrPara

 No

4.5

Format
void STM_SetTrPara(StmHn stm, Sint32 tsct)
input
 stm
 :Stream handle
 tsct
 : Maximum number of transferred 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 section to the transfer area at one time.
remarks

  1. Divide the data read into the CD buffer section into less than this number of sectors and transfer.

  2. The default is 1 sector.


 one
View
table
 Title

function specification

 Function

Transfer start FAD settings

 Function name

STM_SetTrFad

 No

4.6

Format
void STM_SetTrFad(StmHn stm, Sint32 fad)
input
 stm
 :Stream handle
 fad
 : Transfer start FAD
output
none
function value
none
function
Sets the FAD to begin transferring data in the CD buffer partition.
remarks
Default is STM_FAD_CDTOP.

 one
View
table
 Title

function specification

 Function

Transfer mode settings

 Function name

STM_SetTrMode

 No

4.7

Format
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 section to the transfer area.

(1) Transfer mode
 constant name
 Transfer method
 Load on CPU
 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 decreases
 STM_TR_SDMA1
 CPU DMA channel 1
 CPU processing power decreases
 STM_TR_CPU
 Software
 CPU is occupied, but interrupt processing is possible

remarks
The default is STM_TR_CPU.

 one
View
table
 Title

function specification

 Function

Transfer area reset

 Function name

STM_ResetTrBuf

 No

4.8

Format
void STM_ResetTrBuf(StmHn stm)
input
stm: stream handle
output
none
function value
none
function
Initialize the destination pointer.
remarks
It is also possible to change the transfer area by specifying another area using STM_SetTrBuf.

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