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

2.4 Function specifications

[High standard SCU]


 List
 Title

Function specifications

 Function

SCU DMA initialization

 Function name

DMA_ScuInit

 No

1

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

 caution
SCU DMA uses DMA mode 0 transfer termination interrupt processing. Therefore, do not change the interrupt mask register of the transfer end interrupt in DMA mode 0.

 List
 Title

Function specifications

 Function

DMA data transfer

 Function name

DMA_ScuMemCopy

 No

2

Form
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
DMA transfer is performed in the direct mode of DMA mode 0 of the SCU. For details, refer to the SCU User's Manual. The operation differs depending on whether the destination address is work RAM or other than work RAM. Each operation is shown below.
The transfer unit is basically longword units, but the source and destination addresses can be specified in bytes. However, if your device requires a word boundary, etc., follow it. See the SCU User's Manual for details.

 List
 Title

Function specifications

 Function

Data transfer end check

 Function name

DMA_ScuResult

 No

3

Form
Uint32 DMA_ScuResult (void)
input
none
output
none
Function value
Result of DMA_ScuMemCopy ()
function
Checks the end of DMA_ScuMemCopy (). The values to be returned are as follows.
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 for the source or destination in DMA_ScuMemCopy (), the CPU cannot operate while DMA is being executed. Therefore, the execution result at this time will not be running (DMA_SCU_BUSY).

[High level CPU]


 List
 Title

Function specifications

 Function

Data transfer (in bytes)

 Function name

DMA_CpuMemCopy1

 No

Four

Form
void DMA_CpuMemCopy1 (void * dst, void * src, Uint32 cnt)
input
 * dst
 Destination address
 * src
 Source address
 cnt
 Number of transfers (0-16777215)
0x00000001 1 time 0x00ffffff 16777215 times 0x00000000 16777216 times
output
none
Function value
none
function
Byte data is transferred from the src address to the dst address for the number of cnt times. The transfer amount is cnt bytes. Transferring without channel 0, cycle stealing mode, end interrupt. When the destination address is work RAM, the destination area is purged after transfer to eliminate inconsistency with the cache. There are no restrictions on addresses.

 List
 Title

Function specifications

 Function

Data transfer (word unit)

 Function name

DMA_CpuMemCopy2

 No

Five

Form
void DMA_CpuMemCopy2 (void * dst, void * src, Uint32 cnt)
input
 * dst
 Destination address
 * src
 Source address
 cnt
 Number of transfers (0-16777215)
0x00000001 1 time 0x00ffffff 16777215 times 0x00000000 16777216 times
output
none
Function value
none
function
Transfers word data from the src address to the dst address for the number of cnt times. The transfer amount is cnt * 2 bytes. Transferring without channel 0, cycle stealing mode, end interrupt. When the destination address is work RAM, the destination area is purged after transfer to eliminate inconsistency with the cache. The address must be word boundary.

 List
 Title

Function specifications

 Function

Data transfer (long word unit)

 Function name

DMA_CpuMemCopy4

 No

6

Form
void DMA_CpuMemCopy4 (void * dst, void * src, Uint32 cnt)
input
 * dst
 Destination address
 * src
 Source address
 cnt
 Number of transfers (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 for the number of cnt times. The transfer amount is cnt * 4 bytes. Transferring without channel 0, cycle stealing mode, end interrupt. When the destination address is work RAM, the destination area is purged after transfer to eliminate inconsistency with the cache. The address must be a longword boundary.

 List
 Title

Function specifications

 Function

Data transfer (in 16-byte units)

 Function name

DMA_CpuMemCopy16

 No

7

Form
void DMA_CpuMemCopy16 (void * dst, void * src, Uint32 cnt)
input
 * dst
 Destination address
 * src
 Source address
 cnt
 Number of transfers (0-16777215) (in longword units)
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 for the number of cnt times. The transfer amount is cnt x 4 bytes. Transferring without channel 0, cycle stealing mode, end interrupt. When the destination address is work RAM, the destination area is purged after transfer to eliminate inconsistency with the cache. The address must be a longword boundary.

 List
 Title

Function specifications

 Function

Data transfer end check

 Function name

DMA_CpuResult

 No

8

Form
Uint32 DMA_CpuResult (void)
input
none
output
none
Function value
Results of DMA_CpuMemCopy1,2,4,16 ()
function
Checks the end of DMA_CpuMemCopy1,2,4,16 (). The values to be returned are as follows.
Execution result constant name
 Constant name
 explanation
 DMA_CPU_END
 normal termination
 DMA_CPU_BUSY
 Running


[Low level SCU]


 List
 Title

Function specifications

 Function

DMA transfer parameter setting

 Function name

DMA_ScuSetPrm

 No

9

Form
void DMA_ScuSetPrm (DmaScuPrm * prm, Uint32 ch)
input
 prm
 : Transfer parameters
 ch
 : DMA channel
output
none
Function value
none
function
Sets the value of the transfer parameter to the specified DMA channel.

 List
 Title

Function specifications

 Function

DMA transfer start

 Function name

DMA_ScuStart

 No

Ten

Form
void DMA_ScuStart (Uint32 ch)
input
ch: DMA channel
output
none
Function value
none
function
Starts DMA transfer for the specified DMA channel.

 List
 Title

Function specifications

 Function

Get DMA status

 Function name

DMA_ScuGetStatus

 No

11

Form
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.
!!caution!!
The members of the DmaScuStatus structure, dxbk (DMA suspended flag) and dxwt (DMA waiting flag) have been deleted.

[Low level CPU]


 List
 Title

Function specifications

 Function

DMA common transfer parameter setting

 Function name

DMA_CpuSetComPrm

 No

12

Form
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, it does not set the parameters masked by DmaCpuComPrm.msk.
remarks
If you did not mask DMA_CPU_M_AE in DmaCpuComPrm.msk, the address error flag will be cleared. If you did not mask DMA_CPU_M_NMIF, clear the NMI flag.

 List
 Title

Function specifications

 Function

DMA transfer parameter setting

 Function name

DMA_CpuSetPrm

 No

13

Form
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, it does not set the parameters masked by DmaCpuPrm.msk.
remarks
If you did not want DmaCpuPrm.msk to mask DMA_CPU_TE, clear the transfer end flag bit.

 List
 Title

Function specifications

 Function

DMA transfer start

 Function name

DMA_CpuStart

 No

14

Form
Uint32 DMA_CpuStart (Uint32 ch)
input
ch: DMA channel
output
none
Function value
none
function
Starts DMA transfer for the specified DMA channel.

 List
 Title

Function specifications

 Function

DMA transfer canceled

 Function name

DMA_CpuStop

 No

15

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

 List
 Title

Function specifications

 Function

DMA all channel transfer canceled

 Function name

DMA_CpuAllStop

 No

16

Form
void DMA_CpuAllStop (void)
input
none
output
none
Function value
none
function
Cancels DMA transfer on all DMA channels.

 List
 Title

Function specifications

 Function

Obtain DMA common status

 Function name

DMA_CpuGetComStatus

 No

17

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

 List
 Title

Function specifications

 Function

Get DMA status

 Function name

DMA_CpuGetStatus

 No

18

Form
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