Japanese
PROGRAMMER'S GUIDEDMA library
Back | ■
DMA library/2.Reference

2.4 Function specifications

[High level SCU]


 one
View
table
 Title

function specification

 Function

SCU DMA initialization

 Function name

DMA_ScuInit

 No

1

Format
void DMA_ScuMemCopy(void *dst, void *src, Uint32 cnt)
input
none
output
none
function value
none
function
Initialize SCU DMA.
Be sure to do this before executing DMA_ScuCopyMem() and DMA_ScuResult().

 Note
SCU DMA uses DMA mode 0 transfer end interrupt handling. Therefore, do not change the interrupt mask register for the transfer end interrupt in DMA mode 0.

 one
View
table
 Title

function specification

 Function

DMA data transfer

 Function name

DMA_ScuMemCopy

 No

2

Format
void DMA_ScuMemCopy(void *dst, void *src, Uint32 cnt)
input
 *dst
 :Destination address
 *src
 : source address
 cnt
 : Number of bytes transferred
output
none
function value
none
function
Performs DMA transfer using SCU's DMA mode 0 direct mode. Please refer to the SCU User's Manual for details. The operation differs depending on whether the destination address is work RAM or other than work RAM. The operation of each is shown below.
The transfer unit is basically a longword, but the source and destination addresses can be specified in bytes. However, if your device requires word boundaries, etc., follow them. Please see the SCU User's Manual for details.

 one
View
table
 Title

function specification

 Function

Data transfer completion check

 Function name

DMA_ScuResult

 No

3

Format
Uint32 DMA_ScuResult(void)
input
none
output
none
function value
Result of DMA_ScuMemCopy()
function
Checks the completion of DMA_ScuMemCopy(). The following values are returned.
Execution result constant name
 constant name
 explanation
 DMA_SCU_END
 normal termination
 DMA_SCU_FAIL
 abnormal termination
 DMA_SCU_BUSY
 Running

remarks
If CPU_Bus is specified as the source or destination in DMA_ScuMemCopy(), the CPU cannot operate while DMA is running. Therefore, the execution result at this time will not be running (DMA_SCU_BUSY).

[High level CPU]


 one
View
table
 Title

function specification

 Function

Data transfer (in bytes)

 Function name

DMA_CpuMemCopy1

 No

4

Format
void DMA_CpuMemCopy1(void *dst, void *src, Uint32 cnt)
input
 *dst
 ;destination address
 *src
 ;source address
 cnt
 ;Transfer count (0-16777215)
0x00000001 1 time
0x00ffffff 16777215 times
0x00000000 16777216 times
output
none
function value
none
function
Transfers byte data from the src address to the dst address cnt times. Transfer amount is cnt bytes. Channel 0, cycle steal mode, transferring without end interrupt. When the destination address is work RAM, the destination area is purged after the transfer to eliminate inconsistencies with the cache. There are no restrictions on addresses.

 one
View
table
 Title

function specification

 Function

Data transfer (word unit)

 Function name

DMA_CpuMemCopy2

 No

5

Format
void DMA_CpuMemCopy2(void *dst, void *src, Uint32 cnt)
input
 *dst
 ;destination address
 *src
 ;source address
 cnt
 ;Transfer count (0-16777215)
0x00000001 1 time
0x00ffffff 16777215 times
0x00000000 16777216 times
output
none
function value
none
function
Transfer word data from src address to dst address cnt times. Transfer amount is cnt*2 bytes. Channel 0, cycle steal mode, transferring without end interrupt. When the destination address is work RAM, the destination area is purged after the transfer to eliminate inconsistencies with the cache. Addresses must be word boundaries.

 one
View
table
 Title

function specification

 Function

Data transfer (longword unit)

 Function name

DMA_CpuMemCopy4

 No

6

Format
void DMA_CpuMemCopy4(void *dst, void *src, Uint32 cnt)
input
 *dst
 ;destination address
 *src
 ;source address
 cnt
 ;Transfer count (0-16777215)
0x00000001 1 time
0x00ffffff 16777215 times
0x00000000 16777216 times
output
none
function value
none
function
Transfers longword data from the src address to the dst address cnt times. Transfer amount is cnt*4 bytes. Channel 0, cycle steal mode, transferring without end interrupt. When the destination address is work RAM, the destination area is purged after the transfer to eliminate inconsistencies with the cache. Addresses must be longword boundaries.

 one
View
table
 Title

function specification

 Function

Data transfer (16 byte units)

 Function name

DMA_CpuMemCopy16

 No

7

Format
void DMA_CpuMemCopy16(void *dst, void *src, Uint32 cnt)
input
 *dst
 ; destination address
 *src
 ; source address
 cnt
 ; Transfer count (0-16777215) (longword unit)
0x00000001 1 time
0x00ffffff 16777215 times
0x00000000 16777216 times
output
none
function value
none
function
Transfers longword data from the src address to the dst address cnt times. Transfer amount is cnt x 4 bytes. Channel 0, cycle steal mode, transferring without end interrupt. When the destination address is work RAM, the destination area is purged after the transfer to eliminate inconsistencies with the cache. Addresses must be longword boundaries.

 one
View
table
 Title

function specification

 Function

Data transfer completion check

 Function name

DMA_CpuResult

 No

8

Format
Uint32 DMA_CpuResult(void)
input
none
output
none
function value
Result of DMA_CpuMemCopy1,2,4,16()
function
Check the completion of DMA_CpuMemCopy1,2,4,16(). The following values are returned.
Execution result constant name
 constant name
 explanation
 DMA_CPU_END
 normal termination
 DMA_CPU_BUSY
 Running


[Low level SCU]


 one
View
table
 Title

function specification

 Function

DMA transfer parameter settings

 Function name

DMA_ScuSetPrm

 No

9

Format
void DMA_ScuSetPrm(DmaScuPrm *prm, Uint32 ch)
input
 prm
 :Transfer parameters
 ch
 :DMA channel
output
none
function value
none
function
Sets the transfer parameter values for the specified DMA channel.

 one
View
table
 Title

function specification

 Function

DMA transfer start

 Function name

DMA_ScuStart

 No

10

Format
void DMA_ScuStart(Uint32 ch)
input
ch: DMA channel
output
none
function value
none
function
Starts a DMA transfer on the specified DMA channel.

 one
View
table
 Title

function specification

 Function

Get DMA status

 Function name

DMA_ScuGetStatus

 No

11

Format
void DMA_ScuGetStatus(DmaScuStatus *status,Uint32 ch)
input
ch: input channel
output
status: status pointer
function value
none
function
Gets the status of the specified DMA channel.
!!Note!!
The members of the DmaScuStatus structure, dxbk (DMA suspended flag) and dxwt (DMA waiting flag), have been deleted.

[Low level CPU]


 one
View
table
 Title

function specification

 Function

DMA common transfer parameter settings

 Function name

DMA_CpuSetComPrm

 No

12

Format
void DMA_CpuSetComPrm(DmaCpuComPrm *com_prm)
input
com_prm: Common transfer parameters
output
none
function value
none
function
Sets the specified common transfer parameters. However, parameters masked by DmaCpuComPrm.msk are not set.
remarks
If DMA_CPU_M_AE was not masked in DmaCpuComPrm.msk, clear the address error flag. If you did not mask DMA_CPU_M_NMIF, clear the NMI flag.

 one
View
table
 Title

function specification

 Function

DMA transfer parameter settings

 Function name

DMA_CpuSetPrm

 No

13

Format
void DMA_CpuSetPrm(DmaCpuPrm *prm Uint32 ch)
input
 prm
 :Transfer parameters
 ch
 :DMA channel
output
none
function value
none
function
Sets transfer parameters to the specified DMA channel. However, parameters masked by DmaCpuPrm.msk are not set.
remarks
If you did not mask DMA_CPU_TE in DmaCpuPrm.msk, clear the transfer end flag bit.

 one
View
table
 Title

function specification

 Function

DMA transfer start

 Function name

DMA_CpuStart

 No

14

Format
Uint32 DMA_CpuStart(Uint32 ch)
input
ch: DMA channel
output
none
function value
none
function
Starts a DMA transfer on the specified DMA channel.

 one
View
table
 Title

function specification

 Function

DMA transfer aborted

 Function name

DMA_CpuStop

 No

15

Format
void DMA_CpuStop(Uint32 ch)
input
ch: DMA channel
output
none
function value
none
function
Terminates DMA transfer for the specified DMA channel.

 one
View
table
 Title

function specification

 Function

DMA all channel transfer cancellation

 Function name

DMA_CpuAllStop

 No

16

Format
void DMA_CpuAllStop(void)
input
none
output
none
function value
none
function
Aborts DMA transfers for all DMA channels.

 one
View
table
 Title

function specification

 Function

DMA common status acquisition

 Function name

DMA_CpuGetComStatus

 No

17

Format
void DMA_CpuGetComStatus(DmaCpuComStatus *status)
input
none
output
status: status pointer
function value
none
function
Gets the specified common status.

 one
View
table
 Title

function specification

 Function

Get DMA status

 Function name

DMA_CpuGetStatus

 No

18

Format
void DMA_CpuGetStatus(DmaCpuStatus *status, Uint32 ch)
input
ch: DMA channel
output
status: status pointer
function value
none
function
Gets the status of the specified DMA channel.

Back | ■
PROGRAMMER'S GUIDEDMA library
Copyright SEGA ENTERPRISES, LTD., 1997