Japanese

ListReference

function

slDMACopy


Memory transfer using DMA

Format

    #include "sgl.h"

    void *src_A;
    void *dest_A;
    Uint32 size;

    void slDMACopy( src_A, dest_A, size );

argument

    void *src_A - Address where the original data is located.
void *dest_A - Destination address.
Uint32 size - Size to transfer (in bytes).

Return number

    void - returns nothing.

function

Block transfers are performed using the CPU's built-in DMA.

example

    slDMACopy ( high_ram, vdp2, size );

Note

This function terminates immediately after starting DMA, so if you want to know when the transfer is complete, use the " slDMAWait " function.

reference

 slDMAWait 



ListReference

function

slDMAXCopy


Memory transfer using DMA

Format

    #include "sgl.h"

    void *src_A;
    void *dest_A;
    Uint32 size;
    Uint16 mode;

    void slDMAXCopy( src_A, dest_A, size, mode );

argument

    void *src_A - Address where the original data is located.
void *dest_A - Destination address.
Uint32 size - Size to transfer (in transfer size units).
Uint16 mode - Transfer mode (described later).

Return number

    void - returns nothing.

function

Block transfers are performed using the CPU's built-in DMA.
The arguments are the same as slDMACopy above, but mode is specified as follows.
    mode:
      In the format SourceMode_DestinationMode_Size,
      SourceMode :
        Sinc: Transfer while incrementing the source address.
Sdec: Transfer while decreasing the source address.
Sfix: Transfers with a fixed source address.
DestinationMode: Dinc: Transfer while increasing the destination address.
Ddec: Transfer while decreasing the destination address.
Dfix: Transfer with a fixed destination address.
Size : Byte: Transfer 1 byte at a time.
Word: Transfer every 2 bytes.
Long: Transfer every 4 bytes.

example

    Fill an area with 0.
Uint32 dest = 0; slDMAXCopy ( src, &dest, size, Sfix_Dinc_Long );

Note

Address changes are executed every time a transfer unit ends, so if you specify subtraction, Please note that the transfer will first be forwarded to the specified destination, the address will be reduced, and then the next transfer will be made.

reference

 slDMACopy
 slDMAWait
 DMASt_CPU0 



ListReference

function

slDMAWait


Waiting for DMA transfer

Format

    #include "sgl.h"

    void slDMAWait();

argument

    void - Pass nothing.

Return number

    void - returns nothing.

function

Waits for the DMA started with slDMACopy and slDMAXCopy to finish.

example

    slDMACopy ( src0, dst0, cnt0 ); /* First transfer request */
    slDMACopy ( src1, dst1, cnt1 ); /* Second transfer request */
                                    /* (Executed after the first one finishes) */
    slDMACopy ( src2, dst2, cnt2); /* Third transfer request (same as above) */

    slDMAWait (); /* Wait for third transfer to finish */

Note

slDMACopy and slDMAXCopy always use the same channel, and if a transfer is in progress, they wait for the transfer to end before starting a new transfer, so they can be executed continuously.

reference

 slDMACopy
 slDMAXCopy 



ListReference

function

slDMAStatus


DMA startup status

Format

    #include "sgl.h"

    Bool slDMAStatus();

argument

    void - Pass nothing.

Return number

    void - returns nothing.

function

Checks whether the above slDMACopy and slDMAXCopy are being executed and returns the status.
Returns ON if running, OFF if finished.

example

    slDMACopy ( src, dest, size );
    if ( slDMAStatus () == ON ) {
                    :
    } else {
                    :
    }

reference

 slDMACopy
 slDMAXCopy
 slDMAWait 



ListReference

function

slCashPurge


Initialize cache

Format

    #include "sgl.h"

    void slCashPurge();

argument

    void - Pass nothing.

Return number

    void - returns nothing.

function

Clears the CPU's built-in cache. This is used when the cache area is changed due to DMA transfer, etc.

example

    *( Uint32 * )( 0x26020000 ) = 0x25e09990;
              :
    slCashPurge ();
    test = *( Uint32 * )( 0x6020000 );

Note

For slDMACopy and slDMAXCopy , if the transfer destination is a cache area, the cache will be cleared.
Also, when viewing the memory of the master CPU from the slave CPU, on the slave CPU, ^^^^^^^^^^^^ Please run this function before viewing.

reference

 slSynch

return
Copyright SEGA ENTERPRISES, LTD., 1997