📄 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#a47">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#a43">SPIPutCharWithoutWaiting</a>(0xff); <span class="comment">/* send 0xff */</span>00020 <a class="code" href="board_8h.html#a41">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#a44">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#a48">00026</a> <span class="keywordtype">void</span> <a class="code" href="board_8h.html#a48">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#a43">SPIPutCharWithoutWaiting</a>(0xff);00029 <a class="code" href="board_8h.html#a41">SPIWait</a>();00030 }00031 }00032 00033 <a name="l00035"></a><a class="code" href="board_8h.html#a49">00035</a> <span class="keywordtype">void</span> <a class="code" href="board_8h.html#a49">Delay</a>(<span class="keywordtype">int</span> milliseconds){00036 <span class="keywordflow">for</span> (;milliseconds;milliseconds--){ <span class="comment">/* for n times do: */</span>00037 <a class="code" href="board_8h.html#a38">InitiateDelay</a> (1000);00038 <a class="code" href="board_8h.html#a39">WaitOutDelay</a>(); <span class="comment">/* 1 ms delay */</span>00039 }00040 }00041 <a name="l00043"></a><a class="code" href="board_8h.html#a50">00043</a> <span class="keywordtype">void</span> <a class="code" href="board_8c.html#a4">InitBoard</a>()00044 {00045 AUXR = 0x11; <span class="comment">/* Take full memory into use */</span>00046 <a class="code" href="board_8h.html#a0">MP3_XRESET</a> = 0; <span class="comment">/* Put the MP3 chip into reset */</span>00047 <a class="code" href="board_8h.html#a28">MMC_OFF</a> = 1; <span class="comment">/* Turn mmc power off */</span>00048 00049 00050 SPCON = 0xF2; <span class="comment">/* Set slow spi clock */</span>00051 CKCON0 = 0x01; <span class="comment">/* CPU x 2, timer2 x 1 */</span>00052 IEN0 = 0; <span class="comment">/* Disable all interrupts */</span>00053 00054 BDRCON = 0x1F; <span class="comment">/* Set uart for 115200,8n1 */</span>00055 PCON = 0x80; <span class="comment">/* Double Baud Rate */</span>00056 BRL = 248;00057 SCON = 0x50; <span class="comment">/* Serial Port Control Register */</span>00058 TI = 1;00059 00060 ConsoleWrite (<span class="stringliteral">"\r\r\rBoard: Console is up.\r"</span>);00061 00062 00063 TMOD = 1;00064 00065 00066 RCAP2H = 143; <span class="comment">/* Set timer2 for 128 interrupts in second */</span>00067 RCAP2L = 89;00068 TH2 = 143;00069 TL2 = 89;00070 T2CON = 0;00071 T2MOD = 0;00072 00073 TR2 = 1; <span class="comment">/* Start timer2 */</span>00074 <span class="comment">// ET2 = 1; /* Enable timer2 interrupts */</span>00075 00076 P2 = 0xEF;00077 P3 = 0xFF;00078 00079 <a class="code" href="board_8h.html#a38">InitiateDelay</a>(0); <span class="comment">/* Initialize the Delay System */</span>00080 00081 ConsoleWrite (<span class="stringliteral">"Init: Board; supports: AT89C51RD2, MMC, VS10xx, RS232\r"</span>);00082 00083 00084 <span class="comment">// EA = 1; /* Global enable for interrupts */</span>00085 }00086 00087 00088 </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 + -