⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmc_8c.html

📁 MP3播放器源代码, VS1003B
💻 HTML
📖 第 1 页 / 共 5 页
字号:
00127     <span class="comment">// Flush any data that might be pending from the MMC.</span>00128 <span class="preprocessor">#ifdef MMCLONGDEBUG    </span>00129 <span class="preprocessor"></span>    {00130       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;00131       ConsoleWrite(<span class="stringliteral">"\rMMCWaitForData failed. "</span>);00132       ConsoleWrite(<span class="stringliteral">"Expected 0xFE token, received: "</span>);00133       <span class="keywordflow">for</span> (i=0;i&lt;550;i++){00134         ConsolePutHex8(c);00135         c=<a class="code" href="board_8c.html#a1">SPIGetChar</a>();00136       }00137     }00138 <span class="preprocessor">#else</span>00139 <span class="preprocessor"></span>    ConsoleWrite(<span class="stringliteral">" NoData "</span>);00140     <a class="code" href="board_8h.html#a50">SPI8Clocks</a>(200); <span class="comment">/* Flush MMC by sending lots of FF's to it */</span>00141     <a class="code" href="board_8h.html#a50">SPI8Clocks</a>(200);00142     <a class="code" href="board_8h.html#a50">SPI8Clocks</a>(200);00143 <span class="preprocessor">#endif</span>00144 <span class="preprocessor"></span>00145     <a class="code" href="board_8h.html#a33">MMCDeselect</a>();00146     DebugMessage(<span class="stringliteral">"!t&gt;"</span>);00147     <span class="keywordflow">return</span> 5; <span class="comment">//Return error</span>00148   }00149   DebugMessage(<span class="stringliteral">"t&gt;"</span>); <span class="comment">//Exit Token Wait</span>00150   <span class="keywordflow">return</span> 0;00151 }</div></pre><p>Here is the call graph for this function:<p><center><img src="mmc_8c_a1_cgraph.png" border="0" usemap="#mmc_8c_a1_cgraph_map" alt=""></center><map name="mmc_8c_a1_cgraph_map"><area href="board_8h.html#a50" shape="rect" coords="180,7,254,31" alt=""><area href="board_8c.html#a1" shape="rect" coords="178,54,256,78" alt=""></map>    </td>  </tr></table><a class="anchor" name="a6" doxytag="mmc.c::PerformBlockRead" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> void PerformBlockRead           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Perform the actual reading of 512 octets from MMC. <p>Note: This is the fast routine to read complete disk block If you have DMA, write this to use it! <p>Definition at line <a class="el" href="mmc_8c-source.html#l00330">330</a> of file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<p>References <a class="el" href="buffer_8h-source.html#l00107">DiskBlock::Raw::buf</a>, <a class="el" href="buffer_8c-source.html#l00013">dataBufPtr</a>, <a class="el" href="buffer_8c-source.html#l00010">diskSect</a>, <a class="el" href="unionDiskBlock.html#o1">DiskBlock::raw</a>, <a class="el" href="board_8h-source.html#l00241">SPI_RESULT_BYTE</a>, <a class="el" href="board_8h-source.html#l00238">SPIPutCharWithoutWaiting</a>, and <a class="el" href="board_8h-source.html#l00232">SPIWait</a>.<p>Referenced by <a class="el" href="mmc_8c-source.html#l00463">ReadPhysicalSector()</a>.<p><pre class="fragment"><div>00330                        {00331 00332 <span class="preprocessor">#ifdef MMCDEBUG</span>00333 <span class="preprocessor"></span>  ConsoleWrite(<span class="stringliteral">"&lt;R"</span>); <span class="comment">//Actual Read</span>00334 <span class="preprocessor">#endif</span>00335 <span class="preprocessor"></span>00336   <span class="comment">/* Use shared global buffer pointer for speed*/</span>00337   <span class="comment">/* Loop unrolled 16 times for SPEED! :) */</span>00338   <a class="code" href="buffer_8c.html#a1">dataBufPtr</a> = <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>;00339   <span class="keywordflow">while</span> (<a class="code" href="buffer_8c.html#a1">dataBufPtr</a> &lt; <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>+512){00340     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00341     <a class="code" href="board_8h.html#a43">SPIWait</a>();00342     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00343     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00344     <a class="code" href="board_8h.html#a43">SPIWait</a>();00345     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00346     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00347     <a class="code" href="board_8h.html#a43">SPIWait</a>();00348     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00349     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00350     <a class="code" href="board_8h.html#a43">SPIWait</a>();00351     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00352     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00353     <a class="code" href="board_8h.html#a43">SPIWait</a>();00354     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00355     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00356     <a class="code" href="board_8h.html#a43">SPIWait</a>();00357     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00358     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00359     <a class="code" href="board_8h.html#a43">SPIWait</a>();00360     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00361     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00362     <a class="code" href="board_8h.html#a43">SPIWait</a>();00363     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00364     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00365     <a class="code" href="board_8h.html#a43">SPIWait</a>();00366     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00367     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00368     <a class="code" href="board_8h.html#a43">SPIWait</a>();00369     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00370     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00371     <a class="code" href="board_8h.html#a43">SPIWait</a>();00372     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00373     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00374     <a class="code" href="board_8h.html#a43">SPIWait</a>();00375     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00376     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00377     <a class="code" href="board_8h.html#a43">SPIWait</a>();00378     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00379     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00380     <a class="code" href="board_8h.html#a43">SPIWait</a>();00381     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00382     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00383     <a class="code" href="board_8h.html#a43">SPIWait</a>();00384     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00385     <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00386     <a class="code" href="board_8h.html#a43">SPIWait</a>();00387     *<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++=<a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>;00388   }00389 00390 <span class="preprocessor">#ifdef MMCDEBUG</span>00391 <span class="preprocessor"></span>    ConsoleWrite(<span class="stringliteral">"R&gt;"</span>);00392 <span class="preprocessor">#endif</span>00393 <span class="preprocessor"></span>00394 }</div></pre>    </td>  </tr></table><a class="anchor" name="a9" doxytag="mmc.c::ReadPhysicalSector" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> Public unsigned char ReadPhysicalSector           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Perform block read of previously sought sector to diskSect. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00463">463</a> of file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<p>References <a class="el" href="board_8h-source.html#l00178">MMCDeselect</a>, <a class="el" href="board_8h-source.html#l00175">MMCSelect</a>, <a class="el" href="mmc_8c-source.html#l00105">MmcWaitForData()</a>, <a class="el" href="mmc_8c-source.html#l00330">PerformBlockRead()</a>, <a class="el" href="board_8h-source.html#l00280">Public</a>, and <a class="el" href="board_8c-source.html#l00026">SPI8Clocks()</a>.<p>Referenced by <a class="el" href="mmc_8c-source.html#l00246">InitMMC()</a>, and <a class="el" href="storage_8c-source.html#l00110">ReadDiskSector()</a>.<p><pre class="fragment"><div>00463                                          {00464 00465   <span class="comment">// RED_LED = LED_ON; /* Disk Read LED on */</span>00466 00467   <a class="code" href="board_8h.html#a32">MMCSelect</a>();00468   <a class="code" href="mmc_8c.html#a1">MmcWaitForData</a>();00469   <a class="code" href="mmc_8c.html#a6">PerformBlockRead</a>();00470 00471   <span class="comment">/* generate SPI clock edges to finish up the command */</span>00472 00473   <a class="code" href="board_8h.html#a50">SPI8Clocks</a>(4); <span class="comment">//Send 8*4=32 clocks (4 ff's) to MMC to be nice.</span>00474   <a class="code" href="board_8h.html#a33">MMCDeselect</a>();00475   <a class="code" href="board_8h.html#a50">SPI8Clocks</a>(4); <span class="comment">//Again, give the poor MMC some clocks, it likes them.</span>00476 00477   <span class="comment">//RED_LED = LED_OFF; /* Disk Read LED off */</span>00478 00479   <span class="keywordflow">return</span> 0; <span class="comment">//ok return</span>00480 }</div></pre><p>Here is the call graph for this function:<p><center><img src="mmc_8c_a9_cgraph.png" border="0" usemap="#mmc_8c_a9_cgraph_map" alt=""></center><map name="mmc_8c_a9_cgraph_map"><area href="mmc_8c.html#a1" shape="rect" coords="197,57,306,81" alt=""><area href="board_8h.html#a50" shape="rect" coords="361,9,435,33" alt=""><area href="mmc_8c.html#a6" shape="rect" coords="194,105,309,129" alt=""><area href="board_8c.html#a1" shape="rect" coords="359,57,437,81" alt=""></map>    </td>  </tr></table><a class="anchor" name="a4" doxytag="mmc.c::RebootMMC" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -