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

📄 mmc_8c.html

📁 MP3 Player Source Code
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<area href="mmc_8c.html#a1" shape="rect" coords="197,57,306,81" alt=""><area href="board_8h.html#a48" 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>          <td class="md" nowrap valign="top"> unsigned char RebootMMC           </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>Try to switch on the MMC. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00221">221</a> of file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<p>References <a class="el" href="board_8c-source.html#l00035">Delay()</a>, and <a class="el" href="mmc_8c-source.html#l00019">MmcCommand()</a>.<p>Referenced by <a class="el" href="mmc_8c-source.html#l00249">InitMMC()</a>, and <a class="el" href="mmc_8c-source.html#l00431">SeekSector()</a>.<p><pre class="fragment"><div>00221                          {00222   <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c;00223 00224   <span class="comment">//Try (indefinitely) to switch on the MMC card</span>00225   <span class="keywordflow">do</span>{00226     <span class="comment">/* MMC Don't use CRC - seems to be required by some MMC cards? */</span>00227     <a class="code" href="mmc_8c.html#a0">MmcCommand</a>(0x7B,0,0,0,0);00228     <span class="comment">/* MMC Init, command 0x40 should return 0x01 (idle) if all is ok. */</span>00229   }<span class="keywordflow">while</span> (<a class="code" href="mmc_8c.html#a0">MmcCommand</a>(0x40,0,0,0,0)!=0x01);00230   <span class="comment">// 0x01(idle) response detected.</span>00231   00232   ConsoleWrite(<span class="stringliteral">"Card found, starting... "</span>);00233   <span class="comment">/*Try max 255 times MMC Wake-up call: set to Not Idle (mmc returns 0x00)*/</span>00234   c=255;00235   <span class="keywordflow">while</span> ((c--)&amp;&amp;(<a class="code" href="mmc_8c.html#a0">MmcCommand</a>(0x41,0,0,0,16))){00236     <a class="code" href="board_8h.html#a49">Delay</a>(10);00237     <span class="keywordflow">if</span> (c==1){00238       <span class="comment">//timeout</span>00239       ConsoleWrite(<span class="stringliteral">"Failed.\r"</span>);00240       <span class="keywordflow">return</span> 2; <span class="comment">/* Not able to power up mmc */</span>00241     }00242   }00243 00244   ConsoleWrite(<span class="stringliteral">"Ok.\r"</span>);00245   <span class="keywordflow">return</span> 0;00246 }</div></pre><p>Here is the call graph for this function:<p><center><img src="mmc_8c_a4_cgraph.png" border="0" usemap="#mmc_8c_a4_cgraph_map" alt=""></center><map name="mmc_8c_a4_cgraph_map"><area href="board_8h.html#a49" shape="rect" coords="173,7,213,31" alt=""><area href="mmc_8c.html#a0" shape="rect" coords="145,55,241,78" alt=""><area href="board_8h.html#a48" shape="rect" coords="292,31,366,55" alt=""><area href="board_8c.html#a1" shape="rect" coords="290,78,368,102" alt=""></map>    </td>  </tr></table><a class="anchor" name="a8" doxytag="mmc.c::SeekSector" ></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 SeekSector           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">unsigned long&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>sectorN</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>Perform MMC Seek Command for offset sectorN*512. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00431">431</a> of file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<p>References <a class="el" href="unionAddress.html#o1">Address::b</a>, <a class="el" href="buffer_8h-source.html#l00131">Address::B::b0</a>, <a class="el" href="buffer_8h-source.html#l00132">Address::B::b1</a>, <a class="el" href="buffer_8h-source.html#l00133">Address::B::b2</a>, <a class="el" href="mmc_8c-source.html#l00399">ConsoleDecipherMMCResponse()</a>, <a class="el" href="buffer_8h-source.html#l00129">Address::l</a>, <a class="el" href="board_8h-source.html#l00159">MMC_NOT_SELECTED</a>, <a class="el" href="board_8h-source.html#l00153">MMC_XCS</a>, <a class="el" href="mmc_8c-source.html#l00019">MmcCommand()</a>, <a class="el" href="board_8h-source.html#l00262">Public</a>, <a class="el" href="mmc_8c-source.html#l00221">RebootMMC()</a>, and <a class="el" href="buffer_8c-source.html#l00015">sectorAddress</a>.<p>Referenced by <a class="el" href="mmc_8c-source.html#l00249">InitMMC()</a>, <a class="el" href="storage_8c-source.html#l00071">PrepareToReadDiskSector()</a>, and <a class="el" href="storage_8c-source.html#l00110">ReadDiskSector()</a>.<p><pre class="fragment"><div>00431                                                       {00432   00433   <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c;00434   00435 <span class="preprocessor">#ifdef MMCDEBUG    </span>00436 <span class="preprocessor"></span>  ConsoleWrite(<span class="stringliteral">"{s"</span>); <span class="comment">//Seek called</span>00437 <span class="preprocessor">#endif</span>00438 <span class="preprocessor"></span>00439   <span class="keywordflow">do</span>{00440     <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a> = sectorN * 2; <span class="comment">//convert to bytes (combined with 8bit shift)</span>00441     c=<a class="code" href="mmc_8c.html#a0">MmcCommand</a>(0x51,<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o2">b2</a>,<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o1">b1</a>,00442                  <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o0">b0</a>, 0);00443     <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a> = <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a> &gt;&gt; 1; <span class="comment">//convert back to blocks</span>00444 00445     <span class="comment">//if MMC returs "nothing" (0xff) or 0x81(busy), </span>00446     <span class="comment">//toggle chip select and retry</span>00447     <span class="keywordflow">if</span> ((c==0xff)||(c==0x81)){00448       c=0xff;00449       <a class="code" href="mmc_8c.html#a4">RebootMMC</a>();00450     }00451     <span class="keywordflow">if</span> (c==0x01){ <span class="comment">//MMC says "busy"</span>00452       c=0xff; <span class="comment">//try again</span>00453     }00454 00455   }<span class="keywordflow">while</span>(c==0xff); <span class="comment">//repeat until we get signal from MMC.</span>00456   00457   <span class="keywordflow">if</span> ((c &amp; 0xfe)){ <span class="comment">//MMC returns something else than idle or busy signal</span>00458     <a class="code" href="mmc_8c.html#a7">ConsoleDecipherMMCResponse</a>(c);00459     <a class="code" href="board_8h.html#a29">MMC_XCS</a> = <a class="code" href="board_8h.html#a31">MMC_NOT_SELECTED</a>;00460 00461 <span class="preprocessor">#ifdef MMCDEBUG</span>00462 <span class="preprocessor"></span>    ConsoleWrite(<span class="stringliteral">"!s}"</span>);00463 <span class="preprocessor">#endif</span>00464 <span class="preprocessor"></span>    <span class="keywordflow">return</span> 7; <span class="comment">/* failed to execute mmc command */</span>00465   }00466   00467   <a class="code" href="board_8h.html#a29">MMC_XCS</a> = <a class="code" href="board_8h.html#a31">MMC_NOT_SELECTED</a>;00468   00469 <span class="preprocessor">#ifdef MMCDEBUG</span>00470 <span class="preprocessor"></span>  ConsoleWrite(<span class="stringliteral">"s}"</span>);00471 <span class="preprocessor">#endif</span>00472 <span class="preprocessor"></span>  <span class="keywordflow">return</span> 0; <span class="comment">//ok return</span>00473 }</div></pre><p>Here is the call graph for this function:<p><center><img src="mmc_8c_a8_cgraph.png" border="0" usemap="#mmc_8c_a8_cgraph_map" alt=""></center><map name="mmc_8c_a8_cgraph_map"><area href="mmc_8c.html#a7" shape="rect" coords="142,8,337,32" alt=""><area href="mmc_8c.html#a0" shape="rect" coords="385,57,481,81" alt=""><area href="mmc_8c.html#a4" shape="rect" coords="200,106,280,130" alt=""><area href="board_8c.html#a1" shape="rect" coords="530,9,608,33" alt=""><area href="board_8h.html#a48" shape="rect" coords="532,57,606,81" alt=""><area href="board_8h.html#a49" shape="rect" coords="413,106,453,130" alt=""></map>    </td>  </tr></table><a class="anchor" name="a10" doxytag="mmc.c::WritePhysicalSector" ></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 WritePhysicalSector           </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 MMC block write from <b>*dataBufPtr</b> to sector sectorAddress.l. <p><p>Definition at line <a class="el" href="mmc_8c-source.html#l00502">502</a> of file <a class="el" href="mmc_8c-source.html">mmc.c</a>.<p>References <a class="el" href="unionAddress.html#o1">Address::b</a>, <a class="el" href="buffer_8h-source.html#l00131">Address::B::b0</a>, <a class="el" href="buffer_8h-source.html#l00132">Address::B::b1</a>, <a class="el" href="buffer_8h-source.html#l00133">Address::B::b2</a>, <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="buffer_8h-source.html#l00129">Address::l</a>, <a class="el" href="board_8h-source.html#l00075">LED_OFF</a>, <a class="el" href="board_8h-source.html#l00072">LED_ON</a>, <a class="el" href="board_8h-source.html#l00159">MMC_NOT_SELECTED</a>, <a class="el" href="board_8h-source.html#l00156">MMC_SELECTED</a>, <a class="el" href="board_8h-source.html#l00153">MMC_XCS</a>, <a class="el" href="mmc_8c-source.html#l00019">MmcCommand()</a>, <a class="el" href="mmc_8c-source.html#l00102">MmcWaitForData()</a>, <a class="el" href="unionDiskBlock.html#o1">DiskBlock::raw</a>, <a class="el" href="board_8h-source.html#l00066">RED_LED</a>, <a class="el" href="buffer_8c-source.html#l00015">sectorAddress</a>, <a class="el" href="board_8c-source.html#l00026">SPI8Clocks()</a>, <a class="el" href="board_8c-source.html#l00018">SPIGetChar()</a>, <a class="el" href="board_8h-source.html#l00220">SPIPutCharWithoutWaiting</a>, a

⌨️ 快捷键说明

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