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

📄 mmc_8c.html

📁 MP3播放器源代码, VS1003B
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>VLSI Solution Oy Evaluation MP3 Player Source Code Documentation</title><link href="doxygen.css" rel="stylesheet" type="text/css"><img src="vlsi_small.gif" hspace="20" bordercolor="#ffffff"  alt="VLSI Solution Oy"><b>VLSI Solution Oy Evaluation MP3 Player Source Code Documentation</b><p></p></head><body><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div><h1>mmc.c File Reference</h1>MMC interface routines for <a class="el" href="storage_8c.html">storage.c</a>.  <a href="#_details">More...</a><p><code>#include "<a class="el" href="mmc_8h-source.html">mmc.h</a>"</code><br><code>#include "<a class="el" href="board_8h-source.html">board.h</a>"</code><br><code>#include "<a class="el" href="storage_8h-source.html">storage.h</a>"</code><br><code>#include "console.h"</code><br><code>#include "<a class="el" href="buffer_8h-source.html">buffer.h</a>"</code><br><p>Include dependency graph for mmc.c:<p><center><img src="mmc_8c__incl.png" border="0" usemap="#mmc.c_map" alt="Include dependency graph"></center><map name="mmc.c_map"><area href="mmc_8h.html" shape="rect" coords="7,93,55,117" alt=""><area href="board_8h.html" shape="rect" coords="79,93,129,117" alt=""><area href="storage_8h.html" shape="rect" coords="153,93,214,117" alt=""><area href="buffer_8h.html" shape="rect" coords="326,93,374,117" alt=""></map><p><a href="mmc_8c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a0">MmcCommand</a> (unsigned char c1, unsigned char c2, unsigned char c3, unsigned char c4, unsigned char c5)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Do one MMC command and return the MMC SPI R1 response.  <a href="#a0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a1">MmcWaitForData</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">MMC Wait For Data start token 0xfe.  <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a2">MmcGetData</a> (unsigned int amountOctets)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read a Data Block from MMC.  <a href="#a2"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a3">GetStorageInformation</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns MMC Card Identification Register in diskSect.  <a href="#a3"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a4">RebootMMC</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Try to switch on the MMC.  <a href="#a4"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>Public unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a5">InitMMC</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start-up the MMC card.  <a href="#a5"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a6">PerformBlockRead</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform the actual reading of 512 octets from MMC.  <a href="#a6"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a7">ConsoleDecipherMMCResponse</a> (unsigned char c)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Print a human-readable R1 response to console.  <a href="#a7"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>Public unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a8">SeekSector</a> (unsigned long sectorN)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform MMC Seek Command for offset sectorN*512.  <a href="#a8"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>Public unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a9">ReadPhysicalSector</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform block read of previously sought sector to diskSect.  <a href="#a9"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a10">WritePhysicalSector</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform MMC block write from <b>*dataBufPtr</b> to sector sectorAddress.l.  <a href="#a10"></a><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>MMC interface routines for <a class="el" href="storage_8c.html">storage.c</a>. <p><p>Definition in file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<hr><h2>Function Documentation</h2><a class="anchor" name="a7" doxytag="mmc.c::ConsoleDecipherMMCResponse" ></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 ConsoleDecipherMMCResponse           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">unsigned char&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>c</em>          </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>Print a human-readable R1 response to console. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00397">397</a> of file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<p>References <a class="el" href="board_8h-source.html#l00095">KEY_BUTTON</a>, <a class="el" href="buffer_8h-source.html#l00129">Address::l</a>, <a class="el" href="buffer_8c-source.html#l00015">sectorAddress</a>, and <a class="el" href="board_8c-source.html#l00018">SPIGetChar()</a>.<p>Referenced by <a class="el" href="mmc_8c-source.html#l00431">SeekSector()</a>.<p><pre class="fragment"><div>00397                                                 {00398 00399     ConsoleWrite (<span class="stringliteral">"\rSeek failed, MMC returns "</span>);00400     ConsolePutHex8 (c);00401     ConsoleWrite (<span class="stringliteral">"h ("</span>);00402         00403     <span class="keywordflow">if</span> (c&amp;128) ConsoleWrite(<span class="stringliteral">"which is NOT an R1 response!!"</span>);00404     <span class="keywordflow">else</span>{00405       <span class="keywordflow">if</span> (c&amp;64) ConsoleWrite(<span class="stringliteral">"ParameterError "</span>);00406       <span class="keywordflow">if</span> (c&amp;32) ConsoleWrite(<span class="stringliteral">"AddressError "</span>);00407       <span class="keywordflow">if</span> (c&amp;16) ConsoleWrite(<span class="stringliteral">"EraseSequenceError "</span>);00408       <span class="keywordflow">if</span> (c&amp;8) ConsoleWrite(<span class="stringliteral">"CommandCrcError "</span>);00409       <span class="keywordflow">if</span> (c&amp;4) ConsoleWrite(<span class="stringliteral">"IllegalCommandCode "</span>);00410       <span class="keywordflow">if</span> (c&amp;2) ConsoleWrite(<span class="stringliteral">"EraseCancelled "</span>);00411       <span class="keywordflow">if</span> (c&amp;1) ConsoleWrite(<span class="stringliteral">"Idle "</span>);00412     }00413     00414     ConsoleWrite (<span class="stringliteral">") for sector "</span>);00415     ConsolePutUInt (<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00416     ConsoleWrite(<span class="stringliteral">".\rFurther reading data returns: \r"</span>);00417     <span class="keywordflow">for</span> (c=0; c&lt;255; c++){00418       ConsolePutHex8(<a class="code" href="board_8c.html#a1">SPIGetChar</a>());     00419     }00420     ConsolePutChar(13);00421     <span class="keywordflow">while</span> (!<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>);00422 00423 00424 }</div></pre><p>Here is the call graph for this function:<p><center><img src="mmc_8c_a7_cgraph.png" border="0" usemap="#mmc_8c_a7_cgraph_map" alt=""></center><map name="mmc_8c_a7_cgraph_map"><area href="board_8c.html#a1" shape="rect" coords="261,7,338,30" alt=""></map>    </td>  </tr></table><a class="anchor" name="a3" doxytag="mmc.c::GetStorageInformation" ></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"> unsigned char GetStorageInformation           </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>Returns MMC Card Identification Register in diskSect. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00171">171</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#l00010">diskSect</a>, <a class="el" href="mmc_8c-source.html#l00019">MmcCommand()</a>, <a class="el" href="mmc_8c-source.html#l00159">MmcGetData()</a>, <a class="el" href="mmc_8c-source.html#l00105">MmcWaitForData()</a>, and <a class="el" href="unionDiskBlock.html#o1">DiskBlock::raw</a>.<p>Referenced by <a class="el" href="mmc_8c-source.html#l00246">InitMMC()</a>.<p><pre class="fragment"><div>00171                                      {00172   <span class="keywordflow">if</span> (<a class="code" href="mmc_8c.html#a0">MmcCommand</a>(0x4a,0,0,0,0)&amp;0xfe)00173     <span class="keywordflow">return</span> 4; <span class="comment">/* no storage info */</span>00174   <a class="code" href="mmc_8c.html#a1">MmcWaitForData</a>();00175   <a class="code" href="mmc_8c.html#a2">MmcGetData</a>(30);00176 00177   ConsoleWrite(<span class="stringliteral">"\rMMC Manufacturer#: "</span>);00178   ConsolePutUInt(<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>[0]);00179   ConsoleWrite(<span class="stringliteral">"Product Name: "</span>);00180   ConsolePutChar(<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>[3]);00181   ConsolePutChar(<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>[4]);00182   ConsolePutChar(<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>[5]);00183   ConsolePutChar(<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>[6]);00184   ConsolePutChar(<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>[7]);00185   ConsolePutChar(<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>[8]);00186   ConsoleWrite(<span class="stringliteral">" Production date: "</span>);00187   ConsolePutUInt(<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>[14]&gt;&gt;4);00188   ConsoleWrite(<span class="stringliteral">"/ "</span>);00189   ConsolePutUInt((<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>[14]&amp;0x0f)+1997);00190   ConsolePutChar(<span class="charliteral">'\r'</span>);00191   ConsoleWrite(<span class="stringliteral">"Media serial number: "</span>);00192   ConsolePutHex8(<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>[10]);00193   ConsolePutHex8(<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>[11]);00194   ConsolePutHex8(<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>[12]);00195   ConsolePutHex8(<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>[13]);00196 00197   <span class="comment">//mediaSerialNumber[0] = diskSect.raw.buf[10];</span>

⌨️ 快捷键说明

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