1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.1.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<TITLE>New DMA: Overview</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">New DMA: Overview <IMG src="../../image/TWL.gif" width="24" height="12" border="0" align=middle></H1> 12<P>In addition to the four DMA channels that were available with NITRO, the TWL hardware has four new DMA channels. The new DMA allows more precise configuration than was possible with the legacy DMA. This section describes the new DMA.</P> 13<H2>MINDmaConfig Structure</H2> 14<P>The new DMA uses the members of the <A href="MINDmaConfig.html"><CODE>MINDmaConfig</CODE> structure</A> as parameters when it is running. This structure contains information that is not likely to change for each DMA operation. It does not contain values that will change on a case-by-case basis, such as the overall transfer size or the source/destination addresses for the transfer.</P> 15<P>Specifically, the structure contains the following values. 16</P> 17 18<TABLE border="1"> 19 <TBODY> 20 <TR> 21<TH>Member Name</TH> 22<TH>Description</TH> 23<TH>Related Register</TH> 24<TH>Initial Value</TH> 25 </TR> 26 <TR> 27<TD><CODE>intervalTimer</CODE></TD> 28<TD>Interval timer for block transfers.</TD> 29<TD>d15-0 in DMAxBCNT</TD> 30<TD><CODE>MI_NDMA_NO_INTERVAL</CODE></TD> 31 </TR> 32 <TR> 33<TD><CODE>prescaler</CODE></TD> 34<TD>Prescaler of interval timer for block transfers.</TD> 35<TD>d17-16 in DMAxBCNT</TD> 36<TD><CODE>MI_NDMA_INTERVAL_PS_1</CODE></TD> 37 </TR> 38 <TR> 39<TD><CODE>blockWord</CODE></TD> 40<TD>Number of words in the block transfer.</TD> 41<TD>d19-16 in DMAx_CNT</TD> 42<TD><CODE>MI_NDMA_BWORD_1</CODE></TD> 43 </TR> 44 <TR> 45<TD><CODE>wordCount</CODE></TD> 46<TD>Number of words in the transfer.</TD> 47<TD>DMAxWCNT</TD> 48<TD><CODE>MI_NDMA_AT_A_TIME</CODE></TD> 49 </TR> 50 </TBODY> 51</TABLE> 52<P><BR> 53</P> 54<P>Separate structures are provided for each of the four new DMA channels within the library, so DMA transfers can be performed using different settings for each channel.</P> 55<P><IMG src="image_ndma-eachConfig.gif" width="517" height="192" border="0"></P> 56<P>Call the <A href="MI_InitNDmaConfig.html"><CODE>MI_InitNDmaConfig</CODE></A> function to initialize the <A href="MINDmaConfig.html"><CODE>MINDmaConfig</CODE> structure</A> members for all NDMA channels. You do not have to call this function directly because it is called from the <CODE>MI_InitNDma</CODE> function (which in turn is called from the <A href="../../os/init/OS_Init.html"><CODE>OS_Init</CODE></A> function).</P> 57<P><IMG src="image_ndma-init.gif" width="549" height="260" border="0"></P> 58<P>Call the <A href="MI_GetNDmaConfig.html"><CODE>MI_GetNDmaConfig</CODE></A> function to copy the <A href="MINDmaConfig.html"><CODE>MINDmaConfig</CODE> structure</A> set for the current new DMA channel to a <A href="MINDmaConfig.html"><CODE>MINDmaConfig</CODE> structure</A> prepared by the user (developer). Call the <A href="MI_GetNDmaConfig.html"><CODE>MI_SetNDmaConfig</CODE></A> function to copy a <A href="MINDmaConfig.html"><CODE>MINDmaConfig</CODE> structure</A> prepared by the user (developer) to the <A href="MINDmaConfig.html"><CODE>MINDmaConfig</CODE> structure</A> set for the new DMA channel.</P> 59<P><IMG src="image_ndma-getput.gif" width="557" height="352" border="0"></P> 60<P>The <A href="MI_SetNDmaInterval.html"><CODE>MI_SetNDmaInterval</CODE></A>, <A href="MI_GetNDmaIntervalTimer.html"><CODE>MI_GetNDmaIntervalTimer</CODE></A>, <A href="MI_GetNDmaIntervalPrescaler.html"><CODE>MI_GetNDmaIntervalPrescaler</CODE></A>, <A href="MI_SetNDmaBlockWord.html"><CODE>MI_SetNDmaBlockWord</CODE></A>, <A href="MI_GetNDmaBlockWord.html"><CODE>MI_GetNDmaBlockWord</CODE></A>, <A href="MI_SetNDmaWordCount.html">MI_SetNDmaWordCount</A>, and <A href="MI_GetNDmaWordCount.html"><CODE>MI_GetNDmaWordCount</CODE></A> functions overwrite or get some of the members of the <A href="MINDmaConfig.html"><CODE>MINDmaConfig</CODE> structure</A> set for the new DMA.</P> 61<P><IMG src="image_ndma-rewritePartial.gif" width="546" height="347" border="0"></P> 62<P>To initialize settings that have been overwritten, use the <A href="MI_InitNDmaConfig.html"><CODE>MI_InitNDmaConfig</CODE></A> function described earlier.</P> 63<H2>DMA Operation Instructions</H2> 64<P>The following instructions exist for the new DMA.</P> 65<P><A href="MI_NDmaCopy.html"><CODE>MI_NDmaCopy*</CODE></A> Uses the new DMA to copy.<BR><A href="MI_NDmaFill.html"><CODE>MI_NDmaFill*</CODE></A> Uses the new DMA to fill with the specified data.<BR><A href="MI_NDmaClear.html"><CODE>MI_NDmaClear*</CODE></A> Uses the new DMA to fill with 0s.<BR><A href="MI_NDmaSend.html"><CODE>MI_NDmaSend*</CODE></A></CODE> Uses the new DMA to send data to a fixed address.<BR><A href="MI_NDmaRecv.html"><CODE>MI_NDmaRecv*</CODE></A> Uses the new DMA to reads data from a fixed address.<BR><A href="MI_NDmaPipe.html"><CODE>MI_NDmaPipe*</CODE></A> Uses the new DMA to send data from a fixed address to another fixed address.</P> 66<P>Reading or writing data from a fixed address makes frequent use of operations on the I/O registers.</P> 67<BLOCKQUOTE><IMG src="image_ndma-functions.gif" width="356" height="184" border="0"></BLOCKQUOTE> 68<P>For each of these, there are derivative functions that have minor differences in terms of their operation. Below is an example that explains the <A href="MI_NDmaCopy.html"><CODE>MI_NDmaCopy*</CODE></A> functions, but the naming conventions shown below apply to other functions as well.</P> 69<H3>(1) MI_NDmaCopy and MI_NDmaCopyAsync</H3> 70<P>Functions that end in <CODE>Async</CODE> are asynchronous functions. Conversely, functions that do not are synchronous functions. Synchronous functions are guaranteed to wait for new DMA operations to complete, but control leaves asynchronous functions without waiting for completion. Asynchronous functions can find out that a DMA operation has completed, either by setting a callback function that is called when the operation completes, or by using the <A href="MI_IsNDmaBusy.html"><CODE>MI_IsNDmaBusy</CODE></A> function, which determines whether the given new DMA channel is in use. The <A href="MI_WaitNDma.html"><CODE>MI_WaitNDma</CODE></A> function waits until the given new DMA channel becomes usable.</P> 71<H3>(2) MI_NDmaCopy and MI_NDmaCopyEx</H3> 72<P>Functions that include <CODE>Ex</CODE> are provided with an external <CODE>MINDmaConfig</CODE> structure. Conversely, functions without "<CODE>Ex</CODE>" use the <CODE>MINDmaConfig</CODE> structures that are maintained by the library and already configured. Functions with <CODE>Ex</CODE> are effective for initiating temporary DMA operations using different parameters from those that are normally used.</P> 73<H3>(3) MI_NDmaCopy and MI_NDmaCopy_Dev</H3> 74<P>Functions that end in <CODE>_Dev</CODE> synchronize the start of DMA operations with an interrupt from a peripheral device. Conversely, functions without "<CODE>_Dev</CODE>" start operations immediately. See <B>DMA Start Timing</B> for the values that can be set as peripheral devices.</P> 75<H3>(4) MI_NDmaCopy and MI_NDmaCopy_SetUp</H3> 76<P>Functions that end in <CODE>_SetUp</CODE> only perform configuration, and do not start DMA operations. The actual DMA operations start after <A href="MI_NDmaRestart.html"><CODE>MI_NDmaRestart</CODE></A> is called.</P> 77<P><BR> These four specifiers yield a total of 16 variants of the <CODE><A href="MI_NDmaCopy.html">MI_NDmaCopy*</A></CODE> function. 78</P> 79<TABLE border=1> 80<TBODY> 81<TR> 82<TH>Functions</TH> 83<TH>Synchronous/Asynchronous</TH> 84<TH>MINDmaConfig</TH> 85<TH>Start DMA</TH> 86 </TR> 87<TR> 88<TD colspan="4" style="background-color:#e0d0f0;">No <CODE>_SetUp</CODE> (Run DMA)</TD> 89 </TR> 90<TR> 91<TD><CODE>MI_NDmaCopy</CODE></TD> 92<TD>Synchronous</TD> 93<TD>Stored in the library</TD> 94<TD>Immediately</TD> 95 </TR> 96<TR> 97<TD><CODE>MI_NDmaCopyAsync</CODE></TD> 98<TD>Asynchronous</TD> 99<TD>Stored in the library</TD> 100<TD>Immediately</TD> 101 </TR> 102<TR> 103<TD><CODE>MI_NDmaCopyEx</CODE></TD> 104<TD>Synchronous</TD> 105<TD>User-defined</TD> 106<TD>Immediately</TD> 107 </TR> 108<TR> 109<TD><CODE>MI_NDmaCopyExAsync</CODE></TD> 110<TD>Asynchronous</TD> 111<TD>User-defined</TD> 112<TD>Immediately</TD> 113 </TR> 114<TR> 115<TD><CODE>MI_NDmaCopy_Dev</CODE></TD> 116<TD>Synchronous</TD> 117<TD>Stored in the library</TD> 118<TD>Interrupt from peripheral device</TD> 119 </TR> 120<TR> 121<TD><CODE>MI_NDmaCopyAsync_Dev</CODE></TD> 122<TD>Asynchronous</TD> 123<TD>Stored in the library</TD> 124<TD>Interrupt from peripheral device</TD> 125 </TR> 126<TR> 127<TD><CODE>MI_NDmaCopyEx_Dev</CODE></TD> 128<TD>Synchronous</TD> 129<TD>User-defined</TD> 130<TD>Interrupt from peripheral device</TD> 131 </TR> 132<TR> 133<TD><CODE>MI_NDmaCopyExAsync_Dev</CODE></TD> 134<TD>Asynchronous</TD> 135<TD>User-defined</TD> 136<TD>Interrupt from peripheral device</TD> 137 </TR> 138<TR> 139<TD colspan="4" style="background-color:#e0d0f0;">With <CODE>_SetUp</CODE> (Only perform configuration for running DMA)</TD> 140 </TR> 141 <TR> 142<TD><CODE>MI_NDmaCopy_SetUp</CODE></TD> 143<TD>Synchronous</TD> 144<TD>Stored in the library</TD> 145<TD>Immediately</TD> 146 </TR> 147 <TR> 148<TD><CODE>MI_NDmaCopyAsync_SetUp</CODE></TD> 149<TD>Asynchronous</TD> 150<TD>Stored in the library</TD> 151<TD>Immediately</TD> 152 </TR> 153 <TR> 154<TD><CODE>MI_NDmaCopyEx_SetUp</CODE></TD> 155<TD>Synchronous</TD> 156<TD>User-defined</TD> 157<TD>Immediately</TD> 158 </TR> 159 <TR> 160<TD><CODE>MI_NDmaCopyExAsync_SetUp</CODE></TD> 161<TD>Asynchronous</TD> 162<TD>User-defined</TD> 163<TD>Immediately</TD> 164 </TR> 165 <TR> 166<TD><CODE>MI_NDmaCopy_Dev_SetUp</CODE></TD> 167<TD>Synchronous</TD> 168<TD>Stored in the library</TD> 169<TD>Interrupt from peripheral device</TD> 170 </TR> 171 <TR> 172<TD><CODE>MI_NDmaCopyAsync_Dev_SetUp</CODE></TD> 173<TD>Asynchronous</TD> 174<TD>Stored in the library</TD> 175<TD>Interrupt from peripheral device</TD> 176 </TR> 177 <TR> 178<TD><CODE>MI_NDmaCopyEx_Dev_SetUp</CODE></TD> 179<TD>Synchronous</TD> 180<TD>User-defined</TD> 181<TD>Interrupt from peripheral device</TD> 182 </TR> 183 <TR> 184<TD><CODE>MI_NDmaCopyExAsync_Dev_SetUp</CODE></TD> 185<TD>Asynchronous</TD> 186<TD>User-defined</TD> 187<TD>Interrupt from peripheral device</TD> 188 </TR> 189 </TBODY> 190</TABLE> 191<H2>Stopping New DMA</H2> 192<P>Call <A href="MI_StopNDma.html"><CODE>MI_StopNDma</CODE></A> to stop the specified new DMA channel.</P> 193<P>Call <A href="MI_StopAllNDma.html"><CODE>MI_StopAllNDma</CODE></A> to stop all new DMA channels. This function calls <A href="MI_StopNDma.html"><CODE>MI_StopNDma</CODE></A> for the new DMA channels 0-3 in order.</P> 194<H2>Arbitration Method</H2> 195<P>You can select the the arbitration method used between the new DMA channels. Two options are available: the fixed method and the round-robin method.</P> 196<P>With the fixed method, fixed priorities are set. If a request for a DMA channel is issued whose priority is higher than the DMA channel that is currently running, the current request is paused once the block transfer has completed for the number of words specified in <CODE>WORDCNT</CODE>, and the DMA transfer for the higher-priority DMA channel is run. Conversely, if a request is issued for a DMA channel that is lower in priority than the one currently running, the incoming request is put on hold.</P> 197<P>With the round-robin method, the MI library looks up the DMA channel during the startup request, and once the block transfer has completed for <CODE>WORDCNT</CODE> words (this number is specified for each general-purpose DMA channel), the ownership rights to the AHB bus alternates in round-robin fashion in the order <EM>DMA0, DMA1, DMA2, DMA3, DSP or ARM9, DMA0, DMA1, DMA2, ...</EM> (including all DMA channels for which there are DMA transfer requests).</P> 198<P>When using the round-robin method, you can set the number of cycles for which access is possible during requests for the AHB bus of the DSP or ARM9.</P> 199<P>The following function is used to configure the arbitration method and the number of cycles that are accessible when the round-robin method is used. <A href="MI_SetNDmaArbitrament.html"><CODE>MI_SetNDmaArbitrament</CODE></A></P> 200<P>The following functions are used to get the values that are currently set.<BR><A href="MI_GetNDmaArbitrament.html"><CODE>MI_GetNDmaArbitrament</CODE></A><BR> <A href="MI_GetNDmaArbitramentRoundRobinCycle.html"><CODE>MI_GetNDmaArbitramentRoundRobinCycle</CODE></A></P> 201<H2>Priority</H2> 202<P>The priorities for the AHB bus are shown below.</P> 203<P><B>If using the fixed method for DMA arbitration:</B></P> 204<P> Old DMAC0 > Old DMAC1 > Old DMAC2 > Old DMAC3 > New DMAC0 > New DMAC1 > New DMAC2 > New DMA3 > DSP > ARM9</P> 205<P><B>If using the round-robin method for DMA arbitration:</B></P> 206<P>The new DMA priorities are removed, and the bus ownership is passed around in the following order:<BR><BR>Old DMAC0 > Old DMAC1 > Old DMAC2 > Old DMAC3 > (New DMAC0 = New DMAC1 = New DMAC2 = New DMA3) > DSP > ARM9</P> 207 208<A NAME="MINDmaDevice"></a> 209<H2>DMA Start Timing</H2> 210<P>Among the new DMA functions, functions that end in <CODE>_Dev</CODE>, such as <A href="MI_NDmaCopy.html"><CODE>MI_NDmaCopy_Dev</CODE></A>, can make the timing of starting DMA dependent on a startup request based on an interrupt from a peripheral device. Functions that do not end in <CODE>_Dev</CODE> start immediately.</P> 211<P>You can specify this by passing the <CODE>MINDmaDevice</CODE> type value (<CODE>u32 typedef</CODE>) as an argument of a function. The following table shows the values and start timings.<BR> 212</P> 213<TABLE border=1> 214 <TBODY> 215 <TR> 216<TH><CODE>MINDmaDevice</CODE> Type Value</TH> 217<TH>New DMA Start Timing</TH> 218 </TR> 219 <TR> 220<TD><CODE>MI_NDMA_TIMING_TIMER0</CODE></TD> 221<TD>DMA startup request from Timer 0</TD> 222 </TR> 223 <TR> 224<TD><CODE>MI_NDMA_TIMING_TIMER1</CODE></TD> 225<TD>DMA startup request from Timer 1</TD> 226 </TR> 227 <TR> 228<TD><CODE>MI_NDMA_TIMING_TIMER2</CODE></TD> 229<TD>DMA startup request from Timer 2</TD> 230 </TR> 231 <TR> 232<TD><CODE>MI_NDMA_TIMING_TIMER3</CODE></TD> 233<TD>DMA startup request from Timer 3</TD> 234 </TR> 235 <TR> 236<TD><CODE>MI_NDMA_TIMING_CARD</CODE></TD> 237<TD>DMA startup request from Card</TD> 238 </TR> 239 <TR> 240<TD><CODE>MI_NDMA_TIMING_V_BLANK</CODE></TD> 241<TD>DMA startup request from V-Blank</TD> 242 </TR> 243 <TR> 244<TD><CODE>MI_NDMA_TIMING_H_BLANK</CODE></TD> 245<TD>DMA startup request from H-Blank</TD> 246 </TR> 247 <TR> 248<TD><CODE>MI_NDMA_TIMING_DISP</CODE></TD> 249<TD>DMA startup request synchronized with display</TD> 250 </TR> 251 <TR> 252<TD><CODE>MI_NDMA_TIMING_DISP_MMEM</CODE></TD> 253<TD>DMA startup request synchronized with the work RAM display</TD> 254 </TR> 255 <TR> 256<TD><CODE>MI_NDMA_TIMING_GXFIFO</CODE></TD> 257<TD>DMA startup request from the geometry command FIFO</TD> 258 </TR> 259 <TR> 260<TD><CODE>MI_NDMA_TIMING_CAMERA</CODE></TD> 261<TD>DMA startup request from camera transfer</TD> 262 </TR> 263 </TBODY> 264</TABLE> 265<H2>Revision History</H2> 266<P>2008/11/19 Added startup timing information. <BR> 2008/09/11 Initial version.</P> 267<hr><p>CONFIDENTIAL</p></body> 268</HTML>