Files
MPIonCell/documentation/developer/html/d6/dca/imoc__dma-test__spu_8c-source.html
2017-10-26 19:57:24 +02:00

54 lines
5.1 KiB
HTML
Executable File

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>MPI On Cell (Documentation): src/spu/internal/dma/imoc_dma-test_spu.c Source File</title>
<link href="../../doxygen.css" rel="stylesheet" type="text/css">
<link href="../../tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="../../main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="../../modules.html"><span>Modules</span></a></li>
<li><a href="../../annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li class="current"><a href="../../files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>src/spu/internal/dma/imoc_dma-test_spu.c</h1><a href="../../d1/dc4/imoc__dma-test__spu_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;free_align.h&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;spu_mfcio.h&gt;</span>
<a name="l00005"></a>00005
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;<a class="code" href="../../d0/d3a/spu_2moc_8h.html">moc.h</a>&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;<a class="code" href="../../d4/dce/imoc__dma__spu_8h.html">internal/spu/imoc_dma_spu.h</a>&gt;</span>
<a name="l00008"></a>00008
<a name="l00009"></a><a class="code" href="../../d2/de2/group__internal__p2p__dma.html#gdc3d91a083a9dc3aa539aee4d56616f0">00009</a> <span class="keywordtype">int</span> <a class="code" href="../../d2/de2/group__internal__p2p__dma.html#gdc3d91a083a9dc3aa539aee4d56616f0" title="Tests if a IMOC_iget_data or IMOC_iput_data is completed.">IMOC_test_dma</a>(<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html">imoc_dma_request</a>* request, <span class="keywordtype">int</span> *flag)
<a name="l00010"></a>00010 {
<a name="l00011"></a>00011 uint32_t ret;
<a name="l00012"></a>00012 mfc_write_tag_mask(1 &lt;&lt; request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#93345f8438f78d7a0309b4b0b0670476">tag_id</a>);
<a name="l00013"></a>00013 mfc_write_tag_update(MFC_TAG_UPDATE_IMMEDIATE);
<a name="l00014"></a>00014 ret = mfc_read_tag_status();
<a name="l00015"></a>00015
<a name="l00016"></a>00016 <span class="keywordflow">if</span> ((ret &amp; (1 &lt;&lt; request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#93345f8438f78d7a0309b4b0b0670476">tag_id</a>)) == 0) <span class="comment">// dma transfer not finished</span>
<a name="l00017"></a>00017 *flag = 0;
<a name="l00018"></a>00018 <span class="keywordflow">else</span> <span class="comment">// dma transfer finished</span>
<a name="l00019"></a>00019 {
<a name="l00020"></a>00020 <span class="keywordflow">if</span> (request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#e9940544a153813fd1284eaa8883a1f2">remainder</a> != 0) <span class="comment">// check if buffer was used and copy back data from there to target</span>
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022 memcpy(request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#aab928f79935740e686706a1296b01a9">target</a> + request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#8322ab9ff0dbd0be788bf765f3e85e94">size</a>, request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#efdb405d93fc52fbe483551e3bbaafac">buffer</a>,
<a name="l00023"></a>00023 request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#e9940544a153813fd1284eaa8883a1f2">remainder</a>);
<a name="l00024"></a>00024 free(request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#efdb405d93fc52fbe483551e3bbaafac">buffer</a>);
<a name="l00025"></a>00025 }
<a name="l00026"></a>00026 mfc_tag_release(request-&gt;<a class="code" href="../../d4/da3/structimoc__dma__request__struct.html#93345f8438f78d7a0309b4b0b0670476">tag_id</a>);
<a name="l00027"></a>00027 *flag = 1;
<a name="l00028"></a>00028 }
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="keywordflow">return</span> <a class="code" href="../../d8/da1/group__environment__error.html#g8a73ed6676bcf0c0607d98482ca1aca4" title="No error.">MOC_SUCCESS</a>;
<a name="l00031"></a>00031 }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Feb 12 13:49:47 2009 for MPI On Cell (Documentation) by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="../../doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>