📄 player_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>player.c</h1><a href="player_8c.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 00191 <span class="preprocessor">#include "<a class="code" href="board_8h.html">board.h</a>"</span>00192 <span class="preprocessor">#include "<a class="code" href="lcd_8h.html">lcd.h</a>"</span>00193 <span class="preprocessor">#include "<a class="code" href="filesys_8h.html">filesys.h</a>"</span>00194 <span class="preprocessor">#include "<a class="code" href="vs10xx_8h.html">vs10xx.h</a>"</span>00195 <span class="preprocessor">#include "<a class="code" href="storage_8h.html">storage.h</a>"</span>00196 <span class="preprocessor">#include "<a class="code" href="display_8h.html">display.h</a>"</span>00197 <span class="preprocessor">#include "string.h"</span>00198 <span class="preprocessor">#include "<a class="code" href="ui_8h.html">ui.h</a>"</span>00199 <span class="preprocessor">#include "<a class="code" href="mmc_8h.html">mmc.h</a>"</span>00200 <span class="preprocessor">#include "<a class="code" href="record_8h.html">record.h</a>"</span>00201 00202 <a name="l00204"></a><a class="code" href="player_8c.html#a0">00204</a> <span class="preprocessor">#define u_int8 code unsigned char </span>00205 <span class="preprocessor"></span><a name="l00206"></a><a class="code" href="player_8c.html#a1">00206</a> <span class="preprocessor">#define u_int16 code unsigned int </span>00207 <span class="preprocessor"></span>00208 <span class="comment">//include a patch code module</span>00209 <span class="preprocessor">#ifdef VS1003</span>00210 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="spec__rew_8c.html">spec_rew.c</a>"</span>00211 <span class="preprocessor">#else</span>00212 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="loud__sa_8c.html">loud_sa.c</a>"</span>00213 <span class="preprocessor">#endif</span>00214 <span class="preprocessor"></span>00215 00216 <a name="l00218"></a><a class="code" href="player_8c.html#a2">00218</a> <span class="preprocessor">#define UI_RETURN_DELAY 150</span>00219 <span class="preprocessor"></span><a name="l00221"></a><a class="code" href="player_8c.html#a3">00221</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>;00222 <a name="l00224"></a><a class="code" href="player_8c.html#a4">00224</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="player_8c.html#a4">intlevel</a> = 0;00225 <a name="l00228"></a><a class="code" href="player_8c.html#a5">00228</a> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a> = 0;00229 <a name="l00231"></a><a class="code" href="player_8c.html#a6">00231</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>;00232 <a name="l00233"></a><a class="code" href="player_8c.html#a7">00233</a> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="player_8c.html#a7">SPMax</a>=0;00234 00235 00236 <a name="l00241"></a><a class="code" href="player_8c.html#a8">00241</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a8">timer0_interrupt</a>(<span class="keywordtype">void</span>) interrupt 1{00242 <span class="keyword">static</span> <span class="keywordtype">char</span> displayDelay;00243 <a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a> = 1;00244 <span class="keywordflow">if</span> (++displayDelay==12){00245 displayDelay = 0;00246 <a class="code" href="display_8c.html#a0">displayPosition</a>++;00247 <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){00248 <a class="code" href="display_8c.html#a0">displayPosition</a> = -7;00249 }00250 }00251 <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;00252 00253 00254 }00255 00256 00257 00258 <a name="l00260"></a><a class="code" href="player_8c.html#a9">00260</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a9">LoadPatch</a>(){00261 ConsoleWrite (<span class="stringliteral">"Loading patch.\r"</span>);00262 <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>++) { 00263 <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);00264 }00265 <a class="code" href="board_8h.html#a49">Delay</a>(10);00266 }00267 <a name="l00269"></a><a class="code" href="player_8c.html#a10">00269</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a10">StartPatch</a>()00270 {00271 00272 <span class="preprocessor">#ifdef VS1003</span>00273 <span class="preprocessor"></span> <span class="comment">// Mp3WriteRegister(SPI_AIADDR, 0x00, 0x50); </span>00274 <span class="preprocessor">#else</span>00275 <span class="preprocessor"></span> <span class="comment">//Mp3WriteRegister(SPI_AIADDR, 0x02, 0x00); </span>00276 <span class="comment">//Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x00);</span>00277 <span class="comment">//Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x01);</span>00278 <span class="preprocessor">#endif</span>00279 <span class="preprocessor"></span>}00280 00281 00282 00283 <a name="l00285"></a><a class="code" href="player_8c.html#a11">00285</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a11">ScreenSetPlayTime</a>(){00286 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> playTime;00287 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> minutes, seconds;00288 00289 playTime = <a class="code" href="vs10xx_8h.html#a38">Mp3ReadRegister</a>(<a class="code" href="vs10xx_8h.html#a6">SPI_DECODE_TIME</a>);00290 minutes = playTime/60;00291 seconds = playTime%60;00292 <a class="code" href="display_8c.html#a1">displayTitle</a>[0]=(<span class="charliteral">'0'</span>+minutes/10);00293 <a class="code" href="display_8c.html#a1">displayTitle</a>[1]=(<span class="charliteral">'0'</span>+minutes%10);00294 <a class="code" href="display_8c.html#a1">displayTitle</a>[2]=(<span class="charliteral">':'</span>);00295 <a class="code" href="display_8c.html#a1">displayTitle</a>[3]=(<span class="charliteral">'0'</span>+seconds/10);00296 <a class="code" href="display_8c.html#a1">displayTitle</a>[4]=(<span class="charliteral">'0'</span>+seconds%10);00297 <a class="code" href="display_8c.html#a1">displayTitle</a>[5]=(<span class="charliteral">' '</span>);00298 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]=(<span class="charliteral">' '</span>);00299 <a class="code" href="display_8c.html#a1">displayTitle</a>[7]=(<span class="charliteral">' '</span>);00300 00301 <span class="keywordflow">if</span> (seconds&1){00302 <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>){00303 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]=<span class="charliteral">'o'</span>;00304 }<span class="keywordflow">else</span>{00305 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]='\x7e';00306 }00307 00308 }00309 00310 <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>)){00311 <a class="code" href="display_8c.html#a1">displayTitle</a>[6]='\xdb';00312 }00313 00314 00315 00316 }00317 00318 00319 00320 00321 00322 00323 <a name="l00327"></a><a class="code" href="vs10xx_8h.html#a41">00327</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a12">AvailableProcessorTime</a>(){00328 00332 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> volume = 20;00333 00335 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> bass = 0;00336 00338 <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>00339 00341 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> reclevel = 50;00342 00343 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i; <span class="comment">//temp variable</span>00344 00345 <span class="keyword">static</span> bit bassUpdateNeeded;00346 00350 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> uiReturnDelay=0;00351 00352 <span class="keywordflow">if</span> (!<a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a>){00353 <span class="keywordflow">return</span>; <span class="comment">/* Not yet time to do user interface stuff */</span>00354 }00355 00356 <a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a> = 0;00357 00358 00359 <span class="comment">// User Interface Modes</span>00360 <span class="comment">// Return to UI_TITLE after long period of button inactivity</span>00361 00362 <span class="keywordflow">if</span> (uiReturnDelay == 0){00363 <span class="keywordflow">if</span> ((<a class="code" href="player_8c.html#a6">uiMode</a> != <a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>)&&(<a class="code" href="player_8c.html#a6">uiMode</a> != <a class="code" href="ui_8h.html#a24a7">UI_CUE</a>))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -