E-10
DINK32 PowerPC ISA Debugger User’s Manual
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
MPC8240 DMA Memory Controller
E.1.6
Function Descriptions of DMA Driver Library
Internals
The API function DMA_direct_transfer (described above) accepts predefined parameter
values to initialize a DMA transfer. These parameters are used by the DMA driver library
functions to set up the Kahlua DMA status and mode registers so that the application does
not have to interface to the Kahlua processor on such a low level. A description of the
processing performed in the DMA_direct_transfer function and descriptions of the lower
level DMA driver library functions follow.
This is a description of the DMA_direct_transfer processing, which initiates a simple direct
transfer:
1. Read the mode register (MR) by calling DMA_Get_Mode
2. Set the values in the mode register as follows:
IRSQ is set from the int_steer parameter
if steering DMA interrupts to PCI, set EIE and EOTIE
the other mode controls are currently hard coded:
PDE cleared
DAHS = 3; however this is ignored because DAHE is cleared
SAHS = 3; however this is ignored because SAHE is cleared
PRC is cleared
DL is cleared
CTM is set (direct mode)
CC is cleared
3. Validate the length of transfer value, report error and return if too large
4. Read the current descriptor address register by calling DMA_Poke_Desp
5. Set the values in the CDAR as follows:
SNEN is set from the snoop parameter
CTT is set from the type parameter
6. Write the CDAR by calling DMA_Bld_Desp, which checks the channel status to
ensure it is free
7. Write the source and destination address registers (SAR and DAR) and the byte
count register (BCR) by calling DMA_Bld_Curr, which maps them according to
channel and host and ensure the channel is free
8. Write the mode register by calling DMA_Set_Mode
9. Begin the DMA transfer by calling DMA_Start, which ensures the channel is free
and then clears and sets the mode register channel start (CS) bit
10.The proceeding steps 6 through 9 are done in a sequence so that each call must
return a successful status prior to executing the following step. The status is
checked and error conditions are reported at this point if all did not execute
successfully.
F
n
.