
This patch updates the doxygen for the drivers axicdma,axidma, axipcie,axietherent,axipmon to include .h files in the listof files provided in the index.html file. Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
195 lines
13 KiB
HTML
195 lines
13 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>
|
|
Xilinx Driver can v3_0: axicdma v3_0
|
|
</title>
|
|
<link href="doxygen_kalyanidocs/doc/css/driver_api_doxygen.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<h3 class="PageHeader">Xilinx Processor IP Library</h3>
|
|
<hl>Software Drivers</hl>
|
|
<hr class="whs1">
|
|
|
|
<!-- Generated by Doxygen 1.6.1 -->
|
|
<div class="navigation" id="top">
|
|
<div class="tabs">
|
|
<ul>
|
|
<li class="current"><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>axicdma v3_0</h1><p>This is the driver API for the AXI CDMA engine.</p>
|
|
<p>For a full description of the features of the AXI CDMA engine, please refer to the hardware specification. This driver supports the following features:</p>
|
|
<ul>
|
|
<li>Simple DMA transfer</li>
|
|
<li>Scatter gather (SG) DMA transfer</li>
|
|
<li>Interrupt for error or completion of transfers</li>
|
|
<li>For SG DMA transfer:<ul>
|
|
<li>Programmable interrupt coalescing</li>
|
|
<li>Programmable delay timer counter</li>
|
|
<li>Managing the buffer descriptors (BDs)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p><b>Two Hardware Building Modes</b></p>
|
|
<p>The hardware can be built in two modes:</p>
|
|
<ul>
|
|
<li><b>Simple only mode</b>, in this mode, only simple transfers are supported by the hardware. The functionality is similar to the XPS Central DMA, however, the driver API to do the transfer is slightly different.</li>
|
|
</ul>
|
|
<ul>
|
|
<li><b>Hybrid mode</b>, in this mode, the hardware supports both the simple transfer and the SG transfer. However, only one kind of transfer can be active at a time. If an SG transfer is ongoing in the hardware, a submission of a simple transfer fails. If a simple transfer is ongoing in the hardware, a submission of an SG transfer is successful, however the SG transfer will not start until the simple transfer is done.</li>
|
|
</ul>
|
|
<p><b>Transactions</b></p>
|
|
<p>The hardware supports two types of transfers, the simple DMA transfer and the scatter gather (SG) DMA transfer.</p>
|
|
<p>A simple DMA transfer only needs source buffer address, destination buffer address and transfer length to do a DMA transfer. Only one transfer can be submitted to the hardware at a time.</p>
|
|
<p>A SG DMA transfer requires setting up a buffer descriptor (BD), which keeps the transfer information, including source buffer address, destination buffer address, and transfer length. The hardware updates the BD for the completion status of the transfer. BDs that are connected to each other can be submitted to the hardware at once, therefore, the SG DMA transfer has better performance when the application is doing multiple transfers each time.</p>
|
|
<p><b>Callback Function</b></p>
|
|
<p>Each transfer, for which the application cares about its completion, should provide with the driver its callback function. The signature of the callback function is as the following:</p>
|
|
<p>void XAxiCdma_CallBackFn(void *CallBackRef, u32 IrqMask, int *NumPtr);</p>
|
|
<p>Where the CallBackRef is a reference pointer that the application passes to the driver along with the callback function. The driver passes IrqMask to the application when it calls this callback. The NumPtr is only used in SG mode to track how many BDs still left for this callback function.</p>
|
|
<p>The callback function is set upon transfer submission:</p>
|
|
<ul>
|
|
<li>Simple transfer callback function setup:</li>
|
|
</ul>
|
|
<p><b>Only set the callback function if in interrupt mode.</b></p>
|
|
<p>For simple transfers, the callback function along with the callback reference pointer is passed to the driver through the submission of the simple transfer:</p>
|
|
<p>XAxiCdma_SimpleTransfer(...)</p>
|
|
<ul>
|
|
<li>SG transfer callback function setup: For SG transfers, the callback function and the callback reference pointer are set through the transfer submission call:</li>
|
|
</ul>
|
|
<p>XAxiCdma_BdRingToHw(...)</p>
|
|
<p><b>Simple Transfers</b></p>
|
|
<p>For an application that only does one DMA transfer at a time, and the DMA engine is exclusively used by this application, simple DMA transfer is sufficient.</p>
|
|
<p>Using the simple DMA transfer has the advantage of ease of use comparing to SG DMA transfer. For an individual DMA transfer, simple DMA transfer is also faster because of simplicity in software and hardware.</p>
|
|
<p><b>Scatter Gather (SG) Transfers</b></p>
|
|
<p>For an application that has multiple DMA transfers sometimes, or the DMA engine is shared by multiple applications, using SG DMA transfer yields better performance over all applications.</p>
|
|
<p>The SG DMA transfer provides queuing of multiple transfers, therefore, it provides better performance because the hardware can continuously work on all submitted transfers without software intervention.</p>
|
|
<p>The down side of using the SG DMA transfer is that you have to manage the memory for the buffer descriptors (BD), and setup BDs for the transfers.</p>
|
|
<p><b>Interrupts</b></p>
|
|
<p>The driver handles the interrupts.</p>
|
|
<p>The completion of a transfer, that has a callback function associated with, will trigger the driver to call the callback function. The IrqMask that is passed through the callback function notifies the application about the completion status of the transfer.</p>
|
|
<p><b>Interrupt Coalescing for SG Transfers</b></p>
|
|
<p>For SG transfers, the application can program the interrupt coalescing threshold to reduce the frequency of interrupts. If the number of transfers does not match well with the interrupt coalescing threshold, the completion of the last transfer will not trigger the completion interrupt. However, after the specified delay count time, the delay interrupt will fire.</p>
|
|
<p>By default, the interrupt threshold for the hardware is one, which is one interrupt per BD completion.</p>
|
|
<p><b>Delay Interrupt for SG Transfers</b></p>
|
|
<p>Delay interrupt is to signal the application about inactivity of transfers. If the delay interrupt is enabled, the delay timer starts counting down once a transfer has started. If the interval between transfers is longer than the delay counter, the delay interrupt is fired.</p>
|
|
<p>By default, the delay counter is zero, which means the delay interrupt is disabled. To enable delay interrupt, the delay interrupt enable bit must be set and the delay counter must be set to a value between 1 to 255.</p>
|
|
<p><b>BD management for SG DMA Transfers </b></p>
|
|
<p>BD is shared by the software and the hardware. To use BD for SG DMA transfers, the application needs to use the driver API to do the following:</p>
|
|
<ul>
|
|
<li>Setup the BD ring:<ul>
|
|
<li>XAxiCdma_BdRingCreate(...)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p>Note that the memory for the BD ring is allocated and is later de-allocated by the application.</p>
|
|
<ul>
|
|
<li>Request BD from the BD ring, more than one BDs can be requested at once:<ul>
|
|
<li>XAxiCdma_BdRingAlloc(...)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Prepare BDs for the transfer, one BD at a time:<ul>
|
|
<li>XAxiCdma_BdSetSrcBufAddr(...)</li>
|
|
<li>XAxiCdma_BdSetDstBufAddr(...)</li>
|
|
<li>XAxiCdma_BdSetLength(...)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Submit all prepared BDs to the hardware:<ul>
|
|
<li>XAxiCdma_BdRingToHw(...)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Upon transfer completion, the application can request completed BDs from the hardware:<ul>
|
|
<li>XAxiCdma_BdRingFromHw(...)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>After the application has finished using the BDs, it should free the BDs back to the free pool:<ul>
|
|
<li>XAxiCdma_BdRingFree(...)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p>The driver also provides API functions to get the status of a completed BD, along with get functions for other fields in the BD.</p>
|
|
<p>The following two diagrams show the correct flow of BDs:</p>
|
|
<p>The first diagram shows a complete cycle for BDs, starting from requesting the BDs to freeing the BDs. </p>
|
|
<pre></pre><pre> <a class="el" href="xaxicdma_8h.html#a4b168a008bd2ea4a7797d60a716e29f6">XAxiCdma_BdRingAlloc()</a> <a class="el" href="xaxicdma_8h.html#a58faef3eda9fdbd9b368d66e55702258">XAxiCdma_BdRingToHw()</a>
|
|
Free ------------------------> Pre-process ----------------------> Hardware
|
|
|
|
|
/|\ |
|
|
| <a class="el" href="xaxicdma_8h.html#a2447d02b1d2c12ec812746b452ff53cc">XAxiCdma_BdRingFree()</a> <a class="el" href="xaxicdma_8h.html#ae94bad12ae7b26d63871a6ed5e8593c6">XAxiCdma_BdRingFromHw()</a> |
|
|
+--------------------------- Post-process <----------------------+</pre><pre> </pre><p>The second diagram shows when a DMA transfer is to be cancelled before enqueuing to the hardware, application can return the requested BDs to the free group using <a class="el" href="xaxicdma_8h.html#afa7e792362f65151e2f854731f3002c1">XAxiCdma_BdRingUnAlloc()</a>. </p>
|
|
<pre></pre><pre> <a class="el" href="xaxicdma_8h.html#afa7e792362f65151e2f854731f3002c1">XAxiCdma_BdRingUnAlloc()</a>
|
|
Free <----------------------- Pre-process</pre><pre> </pre><p><b>Physical/Virtual Addresses</b></p>
|
|
<p>Addresses for the transfer buffers are physical addresses.</p>
|
|
<p>For SG transfers, the next BD pointer in a BD is also a physical address.</p>
|
|
<p>However, application's reference to a BD and to the transfer buffers are through virtual addresses.</p>
|
|
<p>The application is responsible to translate the virtual addresses of its transfer buffers to physical addresses before handing them to the driver.</p>
|
|
<p>For systems where MMU is not used, or MMU is a direct mapping, then the physical address and the virtual address are the same.</p>
|
|
<p><b>Cache Coherency</b></p>
|
|
<p>To prevent cache and memory inconsistency:</p>
|
|
<ul>
|
|
<li>Flush the transmit buffer range before the transfer</li>
|
|
<li>Invalidate the receive buffer range before passing it to the hardware and before passing it to the application</li>
|
|
</ul>
|
|
<p>For SG transfers:</p>
|
|
<ul>
|
|
<li>Flush the BDs once the preparation setup is done</li>
|
|
<li>Invalidate the memory region for BDs when BDs are retrieved from the hardware.</li>
|
|
</ul>
|
|
<p><b>BD alignment for SG Transfers</b></p>
|
|
<p>The hardware has requirement for the minimum alignment of the BDs, XAXICDMA_BD_MINIMUM_ALIGNMENT. It is OK to have an alignment larger than the required minimum alignment, however, it must be multiple of the minimum alignment. The alignment is passed into <a class="el" href="xaxicdma_8h.html#a8c4e66e92f9739dd9de28d156e028c6b">XAxiCdma_BdRingCreate()</a>.</p>
|
|
<p><b>Error Handling</b></p>
|
|
<p>The hardware halts upon all error conditions. The driver will reset the hardware once the error occurs.</p>
|
|
<p>The IrqMask argument in the callback function notifies the application about error conditions for the transfer.</p>
|
|
<p><b>Mutual Exclusion</b></p>
|
|
<p>The driver does not provide mutual exclusion mechanisms, it is up to the upper layer to handle this.</p>
|
|
<p><b>Hardware Defaults & Exclusive Use</b></p>
|
|
<p>The hardware is in the following condition on start or after a reset:</p>
|
|
<ul>
|
|
<li>All interrupts are disabled.</li>
|
|
<li>The engine is in simple mode.</li>
|
|
<li>Interrupt coalescing counter is one.</li>
|
|
<li>Delay counter is 0.</li>
|
|
</ul>
|
|
<p>The driver has exclusive use of the hardware registers and BDs. Accessing the hardware registers or the BDs should always go through the driver API functions.</p>
|
|
<p><b>Hardware Features That User Should Be Aware of</b></p>
|
|
<p>For performance reasons, the driver does not check the submission of transfers during run time. It is the user's responsibility to submit approrpiate transfers to the hardware. The following hardware features should be considerred when submitting a transfer:</p>
|
|
<p>. Whether the hardware supports unaligned transfers, reflected through C_INCLUDE_DRE in system.mhs file. Submitting unaligned transfers while the hardware does not support it, causes errors upon transfer submission. Aligned transfer is in respect to word length, and word length is defined through the building parameter XPAR_AXI_CDMA_0_M_AXI_DATA_WIDTH.</p>
|
|
<p>. Memory range of the transfer addresses. Transfer data to executable memory can crash the system.</p>
|
|
<p>. Lite mode. To save hardware resources (drastically), you may select "lite" mode build of the hardware. However, with lite mode, the following features are _not_ supported:</p>
|
|
<ul>
|
|
<li>Cross page boundary transfer. Each transfer must be restrictly inside one page; otherwise, slave error occurs.</li>
|
|
<li>Unaligned transfer.</li>
|
|
<li>Data width larger than 64 bit</li>
|
|
<li>Maximum transfer length each time is limited to data_width * burst_len</li>
|
|
</ul>
|
|
<pre>
|
|
MODIFICATION HISTORY:</pre><pre> . Updated the debug print on type casting to avoid warnings on u32. Cast
|
|
u32 to (unsigned int) to use the x format.</pre><pre> Ver Who Date Changes
|
|
----- ---- -------- -------------------------------------------------------
|
|
1.00a jz 07/08/10 First release
|
|
2.01a rkv 01/25/11 Added TCL script to generate Test App code for peripheral
|
|
tests.
|
|
Replaced with "\r\n" in place on "\n\r" in printf
|
|
statements. Made some minor modifications for Doxygen
|
|
2.02a srt 01/18/13 Added support for Key Hole feature (CR: 687217).
|
|
Updated DDR base address for IPI designs (CR 703656).
|
|
2.03a srt 04/13/13 Removed Warnings (CR 705006).
|
|
Added logic to check if DDR is present in the test app
|
|
tcl file. (CR 700806)
|
|
3.0 adk 19/12/13 Updated as per the New Tcl API's
|
|
</pre> </div>
|
|
<p class="Copyright">
|
|
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.
|
|
</p>
|
|
</body>
|
|
</html>
|