?? player_8c-source.html
字號(hào):
<!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>player.c</h1><a href="player_8c.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 00196 <span class="preprocessor">#include "<a class="code" href="board_8h.html">board.h</a>"</span>00197 <span class="preprocessor">#include "<a class="code" href="lcd_8h.html">lcd.h</a>"</span>00198 <span class="preprocessor">#include "<a class="code" href="filesys_8h.html">filesys.h</a>"</span>00199 <span class="preprocessor">#include "<a class="code" href="vs10xx_8h.html">vs10xx.h</a>"</span>00200 <span class="preprocessor">#include "<a class="code" href="storage_8h.html">storage.h</a>"</span>00201 <span class="preprocessor">#include "<a class="code" href="display_8h.html">display.h</a>"</span>00202 <span class="preprocessor">#include "string.h"</span>00203 <span class="preprocessor">#include "<a class="code" href="ui_8h.html">ui.h</a>"</span>00204 <span class="preprocessor">#include "<a class="code" href="mmc_8h.html">mmc.h</a>"</span>00205 <span class="preprocessor">#include "<a class="code" href="record_8h.html">record.h</a>"</span>00206 00207 <a name="l00209"></a><a class="code" href="player_8c.html#a0">00209</a> <span class="preprocessor">#define u_int8 code unsigned char </span>00210 <span class="preprocessor"></span><a name="l00211"></a><a class="code" href="player_8c.html#a1">00211</a> <span class="preprocessor">#define u_int16 code unsigned int </span>00212 <span class="preprocessor"></span>00213 <span class="comment">//include a patch code module</span>00214 <span class="preprocessor">#ifdef VS1003</span>00215 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="spec__rew_8c.html">spec_rew.c</a>"</span>00216 <span class="preprocessor">#else</span>00217 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="loud__sa_8c.html">loud_sa.c</a>"</span>00218 <span class="preprocessor">#endif</span>00219 <span class="preprocessor"></span>00220 00221 <a name="l00223"></a><a class="code" href="player_8c.html#a2">00223</a> <span class="preprocessor">#define UI_RETURN_DELAY 150</span>00224 <span class="preprocessor"></span><a name="l00226"></a><a class="code" href="player_8c.html#a3">00226</a> xdata <a class="code" href="ui_8h.html#a25">playingstatetype</a> <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a12">PS_NORMAL</a>;00227 <a name="l00229"></a><a class="code" href="player_8c.html#a4">00229</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="player_8c.html#a4">intlevel</a> = 0;00230 <a name="l00233"></a><a class="code" href="player_8c.html#a5">00233</a> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a> = 0;00234 <a name="l00236"></a><a class="code" href="player_8c.html#a6">00236</a> xdata <a class="code" href="ui_8h.html#a24">uimodetype</a> <a class="code" href="player_8c.html#a6">uiMode</a> = <a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>;00237 <a name="l00238"></a><a class="code" href="player_8c.html#a7">00238</a> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="player_8c.html#a7">SPMax</a>=0;00239 00240 00241 <a name="l00246"></a><a class="code" href="player_8c.html#a8">00246</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a8">timer0_interrupt</a>(<span class="keywordtype">void</span>) interrupt 1{00247 <span class="keyword">static</span> <span class="keywordtype">char</span> displayDelay;00248 <a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a> = 1;00249 <span class="keywordflow">if</span> (++displayDelay==12){00250 displayDelay = 0;00251 <a class="code" href="display_8c.html#a0">displayPosition</a>++;00252 <span class="keywordflow">if</span> (<a class="code" href="display_8c.html#a0">displayPosition</a>><a class="code" href="display_8c.html#a3">displayLength</a>+7){00253 <a class="code" href="display_8c.html#a0">displayPosition</a> = -7;00254 }00255 }00256 <span class="keywordflow">if</span> (SP><a class="code" href="player_8c.html#a7">SPMax</a>) <a class="code" href="player_8c.html#a7">SPMax</a> = SP;00257 00258 00259 }00260 00261 00262 00263 <a name="l00265"></a><a class="code" href="player_8c.html#a9">00265</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a9">LoadPatch</a>(){00266 ConsoleWrite (<span class="stringliteral">"Loading patch.\r"</span>);00267 <span class="keywordflow">for</span> (<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>=0; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a> < <a class="code" href="loud__sa_8c.html#a0">CODELEN</a>; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>++) { 00268 <a class="code" href="vs10xx_8h.html#a32">Mp3WriteRegister</a>(<a class="code" href="loud__sa_8c.html#a1">atab</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>], <a class="code" href="loud__sa_8c.html#a2">dtab</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>]>>8, <a class="code" href="loud__sa_8c.html#a2">dtab</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>]&0xff);00269 }00270 <a class="code" href="board_8h.html#a51">Delay</a>(10);00271 }00272 <a name="l00274"></a><a class="code" href="player_8c.html#a10">00274</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a10">StartPatch</a>()00275 {00276 00277 <span class="preprocessor">#ifdef VS1003</span>00278 <span class="preprocessor"></span> <span class="comment">// Mp3WriteRegister(SPI_AIADDR, 0x00, 0x50); </span>00279 <span class="preprocessor">#else</span>00280 <span class="preprocessor"></span> <span class="comment">//Mp3WriteRegister(SPI_AIADDR, 0x02, 0x00); </span>00281 <span class="comment">//Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x00);</span>00282 <span class="comment">//Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x01);</span>00283 <span class="preprocessor">#endif</span>00284 <span class="preprocessor"></span>}00285 00286 00287 00288 <a name="l00290"></a><a class="code" href="player_8c.html#a11">00290</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a11">ScreenSetPlayTime</a>(){00291 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> playTime;00292 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> minutes, seconds;00293 00294 playTime = <a class="code" href="vs10xx_8h.html#a38">Mp3ReadRegister</a>(<a class="code" href="vs10xx_8h.html#a6">SPI_DECODE_TIME</a>);00295 minutes = playTime/60;00296 seconds = playTime%60;00297 <a class="code" href="display_8c.html#a1">displayTitle</a>[0]=(<span class="charliteral">'0'</span>+minutes/10);00298 <a class="code" href="display_8c.html#a1">displayTitle</a>[1]=(<span class="charliteral">'0'</span>+minutes%10);00299 <a class="code" href="display_8c.html#a1">displayTitle</a>[2]=(<span class="charliteral">':'</span>);00300 <a class="code" href="display_8c.html#a1">displayTitle</a>[3]=(<span class="charliteral">'0'</span>+seconds/10);00301 <a class="code" href="display_8c.html#a1">displayTitle</a>[4]=(<span class="charliteral">'0'</span>+seconds%10);00302 <a class="code" href="display_8c.html#a1">displayTitle</a>[5]=(<span class="charliteral">' '</span>);00303 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]=(<span class="charliteral">' '</span>);00304 <a class="code" href="display_8c.html#a1">displayTitle</a>[7]=(<span class="charliteral">' '</span>);00305 00306 <span class="keywordflow">if</span> (seconds&1){00307 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>){00308 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]=<span class="charliteral">'o'</span>;00309 }<span class="keywordflow">else</span>{00310 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]='\x7e';00311 }00312 00313 }00314 00315 <span class="keywordflow">if</span> ((<a class="code" href="player_8c.html#a3">playingState</a> != <a class="code" href="ui_8h.html#a25a12">PS_NORMAL</a>)&&(<a class="code" href="player_8c.html#a3">playingState</a> != <a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>)){00316 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]='\xdb';00317 }00318 00319 00320 00321 }00322 00323 00324 00325 00326 00327 00328 <a name="l00332"></a><a class="code" href="vs10xx_8h.html#a41">00332</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a12">AvailableProcessorTime</a>(){00333 00337 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> volume = 20;00338 00340 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> bass = 0;00341 00343 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> treble = 64; <span class="comment">//middle setting = 0</span>00344 00346 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> reclevel = 50;00347 00348 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i; <span class="comment">//temp variable</span>00349 00350 <span class="keyword">static</span> bit bassUpdateNeeded;00351 00355 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> uiReturnDelay=0;00356 00357 00358 <span class="preprocessor">#if 0</span>00359 <span class="preprocessor"></span> <span class="comment">// Simple serial control demo: receiving 'N' advances to next song</span>00360 <span class="comment">// and 'P' to previous song</span>00361 00362 <span class="keywordflow">if</span> (RI) { <span class="comment">//Serial Data Received</span>00363 RI = 0; <span class="comment">//Clear received flag!!!</span>00364 00365 i = SBUF; <span class="comment">// read received character from uart buffer to temp i</span>00366 00367 <span class="keywordflow">if</span> (i==<span class="charliteral">'N'</span>){00368 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00369 }00370 <span class="keywordflow">if</span> (i==<span class="charliteral">'P'</span>){00371 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>;00372 }00373 }00374 <span class="preprocessor">#endif</span>00375 <span class="preprocessor"></span>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -