📄 record_8h.html
字号:
00258 <span class="keywordflow">if</span> (blockNumber==2){ <span class="comment">//2 blocks (512 bytes) received, write to disk...</span>00259 00260 <span class="comment">//If we update the SPI_DECODE_TIME, it will show on player screen :)</span>00261 <span class="comment">//we can do it, no problem. Here is the calculation for 16khz;</span>00262 <span class="comment">//for 16kHz sample rate, 505 samples/block, 8 disk sectors are</span>00263 <span class="comment">//exactly 505 milliseconds. </span>00264 <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o2">l</a> = (sectorCount/8) * 505;00265 <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o2">l</a> /= 1000;00266 <a class="code" href="vs10xx_8h.html#a32">Mp3WriteRegister</a>(SPI_DECODE_TIME,<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o7">b</a>.b1,<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o7">b</a>.b0);00267 <a class="code" href="board_8h.html#a5">Mp3DeselectControl</a>();00268 00269 blockNumber = 0;00270 sectorCount++;00271 <a class="code" href="storage_8h.html#a4">WriteDiskSector</a>(<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00272 lastSector = <a class="code" href="filesys_8c.html#a10">freeSector</a>;00273 <a class="code" href="filesys_8c.html#a17">ScanForFreeSector</a>(); <span class="comment">//this would be the proper way to go...</span>00274 <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a> = <a class="code" href="filesys_8c.html#a10">freeSector</a>; <span class="comment">//keep all variables in proper values</span>00275 <a class="code" href="buffer_8c.html#a1">dataBufPtr</a> = <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>; <span class="comment">//reset data buffer pointer</span>00276 <span class="keywordflow">if</span> (<a class="code" href="filesys_8c.html#a10">freeSector</a>!=(lastSector+1)){ <span class="comment">//end of continuous space, must break!</span>00277 stopRecording = 1;00278 ConsoleWrite(<span class="stringliteral">"\nFragment end - can't continue recording!\n"</span>);00279 <a class="code" href="display_8h.html#a14">InitDisplay</a>(DS_STATIC,<span class="stringliteral">"FRAGMENT"</span>,<span class="stringliteral">" LIMIT!!"</span>,0);00280 continueRecording = 1;00281 }00282 }00283 00284 <a class="code" href="display_8c.html#a5">displayValue</a> = 0;00285 00286 }<span class="comment">//while not button - stop recording when BUTTON is pressed</span>00287 <a class="code" href="filesys_8c.html#a6">fragment</a>[0].<a class="code" href="structfragmentEntry.html#o1">length</a> = sectorCount;00288 00289 00290 <span class="comment">//Enter size information to RIFF header..</span>00291 {00292 xdata <a class="code" href="unionAddress.html">addressType</a> size;00293 00294 <a class="code" href="storage_8h.html#a2">ReadDiskSector</a>(fragment[0].start);00295 00296 <span class="comment">//Patch in number of samples</span>00297 size.l = (sectorCount-1)*1010;00298 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[48] = size.b.b0;00299 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[49] = size.b.b1;00300 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[50] = size.b.b2;00301 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[51] = size.b.b3;00302 00303 <span class="comment">//Patch in size of RIFF chunk...</span>00304 size.l = (sectorCount*512)-8;00305 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[4] = size.b.b0;00306 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[5] = size.b.b1;00307 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[6] = size.b.b2;00308 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[7] = size.b.b3;00309 00310 <span class="comment">//Patch in size of DATA chunk...</span>00311 size.l = (sectorCount*512)-512;00312 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[508] = size.b.b0;00313 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[509] = size.b.b1;00314 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[510] = size.b.b2;00315 <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[511] = size.b.b3;00316 00317 <a class="code" href="storage_8h.html#a4">WriteDiskSector</a>(<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00318 }00319 00320 ConsoleWrite(<span class="stringliteral">"Registering... FStart:"</span>);00321 ConsolePutUInt(fragment[0].start);00322 ConsoleWrite(<span class="stringliteral">"Registering... Size:"</span>);00323 ConsolePutUInt(fragment[0].length);00324 00325 <span class="comment">//Create FAT records.</span>00326 <a class="code" href="filesys_8c.html#a6">fragment</a>[1].<a class="code" href="structfragmentEntry.html#o0">start</a> = 0x0fffffff; <span class="comment">//fragment 0 is the only fragment</span>00327 <a class="code" href="filesys_8c.html#a16">WriteClusterChain</a>(); <span class="comment">//register newly created file in FAT FS</span>00328 00331 <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a> = 0; <span class="comment">//force sector reload for next access</span>00332 00333 <a class="code" href="vs10xx_8c.html#a3">Mp3Reset</a>();00334 <span class="keywordflow">if</span> (continueRecording) <span class="keywordflow">return</span> <a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>;00335 <span class="keywordflow">return</span> <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00336 00337 }</div></pre><p>Here is the call graph for this function:<p><center><img src="record_8h_a0_cgraph.png" border="0" usemap="#record_8h_a0_cgraph_map" alt=""></center><map name="record_8h_a0_cgraph_map"><area href="player_8c.html#a12" shape="rect" coords="116,177,265,201" alt=""><area href="vs10xx_8h.html#a38" shape="rect" coords="516,252,628,276" alt=""><area href="board_8h.html#a49" shape="rect" coords="552,403,592,427" alt=""><area href="display_8h.html#a14" shape="rect" coords="157,79,224,103" alt=""><area href="vs10xx_8c.html#a3" shape="rect" coords="157,428,224,452" alt=""><area href="storage_8h.html#a2" shape="rect" coords="521,624,622,648" alt=""><area href="filesys_8c.html#a17" shape="rect" coords="129,574,252,598" alt=""><area href="filesys_8c.html#a16" shape="rect" coords="133,696,248,720" alt=""><area href="storage_8h.html#a4" shape="rect" coords="520,794,624,818" alt=""><area href="lcd_8c.html#a4" shape="rect" coords="360,55,421,79" alt=""><area href="lcd_8h.html#a5" shape="rect" coords="526,104,617,128" alt=""><area href="player_8c.html#a11" shape="rect" coords="329,252,452,276" alt=""><area href="display_8c.html#a7" shape="rect" coords="345,103,436,127" alt=""><area href="lcd_8h.html#a9" shape="rect" coords="349,7,432,31" alt=""><area href="vs10xx_8c.html#a2" shape="rect" coords="345,452,436,476" alt=""><area href="mmc_8c.html#a9" shape="rect" coords="677,600,802,624" alt=""><area href="mmc_8h.html#a2" shape="rect" coords="701,648,778,672" alt=""><area href="filesys_8c.html#a15" shape="rect" coords="352,550,429,574" alt=""><area href="filesys_8c.html#a14" shape="rect" coords="315,598,466,622" alt=""><area href="filesys_8c.html#a13" shape="rect" coords="315,646,466,670" alt=""><area href="filesys_8h.html#a8" shape="rect" coords="361,745,420,769" alt=""></map> </td> </tr></table><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 + -