📄 board_8c-source.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>board.c</h1><a href="board_8c.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 00005 <span class="preprocessor">#include "<a class="code" href="board_8h.html">board.h</a>"</span>00006 <span class="preprocessor">#include "<a class="code" href="lcd_8h.html">lcd.h</a>"</span>00007 00008 <a name="l00010"></a><a class="code" href="unionTemp.html">00010</a> <span class="keyword">union </span><a class="code" href="unionTemp.html">Temp</a> {00011 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="unionTemp.html#o0">c</a>;00012 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="unionTemp.html#o1">i</a>;00013 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="unionTemp.html#o2">l</a>;00014 } <a class="code" href="board_8c.html#a0">temp</a>;00015 00016 <a name="l00018"></a><a class="code" href="board_8h.html#a49">00018</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="board_8c.html#a1">SPIGetChar</a>(){00019 <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff); <span class="comment">/* send 0xff */</span>00020 <a class="code" href="board_8h.html#a43">SPIWait</a>(); <span class="comment">/* wait for the byte to transfer */</span>00021 <span class="keywordflow">return</span> <a class="code" href="board_8h.html#a46">SPI_RESULT_BYTE</a>; <span class="comment">/* Return the received byte */</span>00022 }00023 00024 <a name="l00026"></a><a class="code" href="board_8h.html#a50">00026</a> <span class="keywordtype">void</span> <a class="code" href="board_8h.html#a50">SPI8Clocks</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> nClocks){00027 <span class="keywordflow">while</span> (nClocks--){00028 <a class="code" href="board_8h.html#a45">SPIPutCharWithoutWaiting</a>(0xff);00029 <a class="code" href="board_8h.html#a43">SPIWait</a>();00030 }00031 }00032 00033 <a name="l00036"></a><a class="code" href="board_8h.html#a51">00036</a> <span class="keywordtype">void</span> <a class="code" href="board_8h.html#a51">Delay</a>(<span class="keywordtype">int</span> milliseconds){00037 <span class="keywordflow">for</span> (;milliseconds;milliseconds--){ <span class="comment">/* for n times do: */</span>00038 <a class="code" href="board_8h.html#a40">InitiateDelay</a> (1000);00039 <a class="code" href="board_8h.html#a41">WaitOutDelay</a>(); <span class="comment">/* 1 ms delay */</span>00040 }00041 }00042 <a name="l00044"></a><a class="code" href="board_8h.html#a52">00044</a> <span class="keywordtype">void</span> <a class="code" href="board_8c.html#a4">InitBoard</a>()00045 {00046 AUXR = 0x11; <span class="comment">/* Take full memory into use */</span>00047 00048 <a class="code" href="board_8h.html#a1">Mp3PutInReset</a>();00049 00050 <span class="comment">// MP3_XRESET = 0; /* Put the MP3 chip into reset */</span>00051 00052 <a class="code" href="board_8h.html#a28">MMC_OFF</a> = 1; <span class="comment">/* Turn mmc power off */</span>00053 00054 00055 SPCON = 0xF2; <span class="comment">/* Set slow spi clock */</span>00056 CKCON0 = 0x01; <span class="comment">/* CPU x 2, timer2 x 1 */</span>00057 IEN0 = 0; <span class="comment">/* Disable all interrupts */</span>00058 00059 BDRCON = 0x1F; <span class="comment">/* Set uart for 115200,8n1 */</span>00060 PCON = 0x80; <span class="comment">/* Double Baud Rate */</span>00061 BRL = 248; <span class="comment">/* 248 for 115200 */</span>00062 SCON = 0x50; <span class="comment">/* Serial Port Control Register */</span>00063 TI = 1;00064 00065 ConsoleWrite (<span class="stringliteral">"\r\r\rBoard: Console is up.\r"</span>);00066 00067 00068 TMOD = 1;00069 00070 00071 RCAP2H = 143; <span class="comment">/* Set timer2 for 128 interrupts in second */</span>00072 RCAP2L = 89;00073 TH2 = 143;00074 TL2 = 89;00075 T2CON = 0;00076 T2MOD = 0;00077 00078 TR2 = 1; <span class="comment">/* Start timer2 */</span>00079 <span class="comment">// ET2 = 1; /* Enable timer2 interrupts */</span>00080 00081 <span class="comment">// P2 = 0xEF;</span>00082 <span class="comment">//P3 = 0xFF;</span>00083 00084 <a class="code" href="board_8h.html#a40">InitiateDelay</a>(0); <span class="comment">/* Initialize the Delay System */</span>00085 00086 ConsoleWrite (<span class="stringliteral">"Init: Board; supports: AT89C51RD2, MMC, VS10xx, RS232\r"</span>);00087 00088 00089 <span class="comment">// EA = 1; /* Global enable for interrupts */</span>00090 }00091 00092 00093 </div></pre><hr><FONT SIZE="-1">All software copyright 2000-2004 <a href="http://www.vlsi.fi/"> VLSI Solution OY.</a>Redistribution of these software modules are limited to promotional use onlyand only with the VS1011 / VS1002 / VS1003 MP3-Evakit evaluation boards. Free orcommercial use of these software modules in MP3 players is ok if theproduct includes MP3 decoder chip(s) from VLSI. You can request the complete(compilable) package from mp3@vlsi.fi</FONT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -