📄 mmc_8c.html
字号:
<!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 Page</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related 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 "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="6,93,54,117" alt=""><area href="board_8h.html" shape="rect" coords="78,93,129,117" alt=""><area href="buffer_8h.html" shape="rect" coords="241,93,289,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 </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"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a1">MmcWaitForData</a> ()</td></tr><tr><td class="mdescLeft"> </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 </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"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a3">GetStorageInformation</a> ()</td></tr><tr><td class="mdescLeft"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a4">RebootMMC</a> ()</td></tr><tr><td class="mdescLeft"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a5">InitMMC</a> ()</td></tr><tr><td class="mdescLeft"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a6">PerformBlockRead</a> ()</td></tr><tr><td class="mdescLeft"> </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 </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"> </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 </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"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a9">ReadPhysicalSector</a> ()</td></tr><tr><td class="mdescLeft"> </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 </td><td class="memItemRight" valign=bottom><a class="el" href="mmc_8c.html#a10">WritePhysicalSector</a> ()</td></tr><tr><td class="mdescLeft"> </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">( </td> <td class="md" nowrap valign="top">unsigned char </td> <td class="mdname1" valign="top" nowrap> <em>c</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Print a human-readable R1 response to console. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00399">399</a> of file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<p>References <a class="el" href="board_8h-source.html#l00083">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>00399 {00400 00401 ConsoleWrite (<span class="stringliteral">"\rSeek failed, MMC returns "</span>);00402 ConsolePutHex8 (c);00403 ConsoleWrite (<span class="stringliteral">"h ("</span>);00404 00405 <span class="keywordflow">if</span> (c&128) ConsoleWrite(<span class="stringliteral">"which is NOT an R1 response!!"</span>);00406 <span class="keywordflow">else</span>{00407 <span class="keywordflow">if</span> (c&64) ConsoleWrite(<span class="stringliteral">"ParameterError "</span>);00408 <span class="keywordflow">if</span> (c&32) ConsoleWrite(<span class="stringliteral">"AddressError "</span>);00409 <span class="keywordflow">if</span> (c&16) ConsoleWrite(<span class="stringliteral">"EraseSequenceError "</span>);00410 <span class="keywordflow">if</span> (c&8) ConsoleWrite(<span class="stringliteral">"CommandCrcError "</span>);00411 <span class="keywordflow">if</span> (c&4) ConsoleWrite(<span class="stringliteral">"IllegalCommandCode "</span>);00412 <span class="keywordflow">if</span> (c&2) ConsoleWrite(<span class="stringliteral">"EraseCancelled "</span>);00413 <span class="keywordflow">if</span> (c&1) ConsoleWrite(<span class="stringliteral">"Idle "</span>);00414 }00415 00416 ConsoleWrite (<span class="stringliteral">") for sector "</span>);00417 ConsolePutUInt (<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00418 ConsoleWrite(<span class="stringliteral">".\rFurther reading data returns: \r"</span>);00419 <span class="keywordflow">for</span> (c=0; c<255; c++){00420 ConsolePutHex8(<a class="code" href="board_8c.html#a1">SPIGetChar</a>()); 00421 }00422 ConsolePutChar(13);00423 <span class="keywordflow">while</span> (!<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>);00424 00425 00426 }</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">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Returns MMC Card Identification Register in diskSect. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00181">181</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#l00169">MmcGetData()</a>, <a class="el" href="mmc_8c-source.html#l00102">MmcWaitForData()</a>, and <a class="el" href="unionDiskBlock.html#o1">DiskBlock::raw</a>.<p>Referenced by <a class="el" href="mmc_8c-source.html#l00249">InitMMC()</a>.<p><pre class="fragment"><div>00181 {00182 <span class="keywordflow">if</span> (<a class="code" href="mmc_8c.html#a0">MmcCommand</a>(0x4a,0,0,0,0)&0xfe)00183 <span class="keywordflow">return</span> 4; <span class="comment">/* no storage info */</span>00184 <a class="code" href="mmc_8c.html#a1">MmcWaitForData</a>();00185 <a class="code" href="mmc_8c.html#a2">MmcGetData</a>(30);00186 00187 ConsoleWrite(<span class="stringliteral">"\rMMC Manufacturer#: "</span>);00188 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]);00189 ConsoleWrite(<span class="stringliteral">"Product Name: "</span>);00190 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]);00191 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]);00192 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]);00193 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]);00194 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]);00195 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]);00196 ConsoleWrite(<span class="stringliteral">" Production date: "</span>);00197 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]>>4);00198 ConsoleWrite(<span class="stringliteral">"/ "</span>);00199 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]&0x0f)+1997);00200 ConsolePutChar(<span class="charliteral">'\r'</span>);00201 ConsoleWrite(<span class="stringliteral">"Media serial number: "</span>);00202 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]);00203 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]);00204 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]);00205 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]);00206 ConsolePutChar(<span class="charliteral">'\r'</span>);00207
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -