📄 filesys_8c.html
字号:
00489 00490 <span class="keywordflow">if</span> (!<a class="code" href="filesys_8h.html#a0">IS_FAT_32</a>){00491 <span class="comment">//FAT16 get next cluster n</span>00492 next.<a class="code" href="unionAddress.html#o0">l</a> = <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o3">Fat16Table</a>[entryNumber]; 00493 <span class="keywordflow">if</span> ((next.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o1">b1</a>==0xff)&&(next.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o0">b0</a>==0xff)){00494 <span class="comment">//FAT16 end-of-file</span>00495 next.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o3">b3</a> = 0xff; <span class="comment">//mark end-of-file (FAT32 compatible)</span>00496 }00497 }<span class="keywordflow">else</span>{00498 <span class="comment">//FAT32 get next cluster n</span>00499 next.<a class="code" href="unionAddress.html#o0">l</a> = <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o4">Fat32Table</a>[entryNumber];00500 }00501 }<span class="comment">//This repeats until there is a discontinuity</span>00502 00503 <span class="comment">/* next.l now has the cluster entry for last cluster in fragment</span>00504 <span class="comment"> it has a high value if eof (see FAT spec) */</span>00505 00506 00507 ConsoleWrite(<span class="stringliteral">"Size: "</span>);00508 ConsolePutUInt(fragment[c].length);00509 ConsoleWrite(<span class="stringliteral">"sectors."</span>);00510 00511 <span class="comment">//EOF test</span>00512 <span class="keywordflow">if</span> ((next.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o3">b3</a>&0x08) <span class="comment">//Quick test</span>00513 && ((next.<a class="code" href="unionAddress.html#o0">l</a>>0x0ffffff0) | !<a class="code" href="filesys_8h.html#a0">IS_FAT_32</a>)){ <span class="comment">//Complete test</span>00514 <span class="comment">//EOF</span>00515 ConsoleWrite(<span class="stringliteral">" <EOF>\r"</span>);00516 <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o3">b3</a> = 0xff;00517 }<span class="keywordflow">else</span>{00518 00519 <span class="comment">//Determine next physical sector for next fragment</span>00520 <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a> = next.<a class="code" href="unionAddress.html#o0">l</a>;00521 <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#a5">fatSectorsPerCluster</a>;00522 <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#a4">dataStart</a>;00523 }00524 00525 c++; <span class="comment">//Advance to next fragment number</span>00526 00527 <span class="keywordflow">if</span> (c==<a class="code" href="filesys_8c.html#a0">MAX_NUMBER_FRAGMENTS</a>){00528 <span class="comment">//End of RAM space allocated for fragment table</span>00529 <span class="comment">//Force end-of-file</span>00530 <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o1">b</a>.<a class="code" href="structAddress_1_1B.html#o3">b3</a>=0xff;00531 }00532 00533 }<span class="comment">//break or continue to next cluster</span>00534 00535 <span class="keywordflow">return</span> c; <span class="comment">//Return number of fragments;</span>00536 }</div></pre><p>Here is the call graph for this function:<p><center><img src="filesys_8c_a19_cgraph.png" border="0" usemap="#filesys_8c_a19_cgraph_map" alt=""></center><map name="filesys_8c_a19_cgraph_map"><area href="storage_8h.html#a2" shape="rect" coords="189,31,290,54" alt=""><area href="mmc_8c.html#a9" shape="rect" coords="341,7,466,31" alt=""><area href="mmc_8h.html#a2" shape="rect" coords="365,54,442,78" alt=""></map> </td> </tr></table><a class="anchor" name="a23" doxytag="filesys.c::FatInitGlobals" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> unsigned char FatInitGlobals </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Decipher structure of FAT volume and set globals accordingly. <p><p>Definition at line <a class="el" href="filesys_8c-source.html#l00806">806</a> of file <a class="el" href="filesys_8c-source.html">filesys.c</a>.<p>References <a class="el" href="unionDiskBlock_1_1Fat_1_1Extensions.html#o0">DiskBlock::Fat::Extensions::_16</a>, <a class="el" href="unionDiskBlock_1_1Fat_1_1Extensions.html#o1">DiskBlock::Fat::Extensions::_32</a>, <a class="el" href="buffer_8h-source.html#l00060">DiskBlock::Fat::BPB_BytsPerSec</a>, <a class="el" href="buffer_8h-source.html#l00067">DiskBlock::Fat::BPB_FATSz16</a>, <a class="el" href="buffer_8h-source.html#l00088">DiskBlock::Fat::Extensions::Fat32Specific::BPB_FATSz32</a>, <a class="el" href="buffer_8h-source.html#l00070">DiskBlock::Fat::BPB_HiddSec</a>, <a class="el" href="buffer_8h-source.html#l00063">DiskBlock::Fat::BPB_NumFATs</a>, <a class="el" href="buffer_8h-source.html#l00064">DiskBlock::Fat::BPB_RootEntCnt</a>, <a class="el" href="buffer_8h-source.html#l00062">DiskBlock::Fat::BPB_RsvdSecCnt</a>, <a class="el" href="buffer_8h-source.html#l00061">DiskBlock::Fat::BPB_SecPerClus</a>, <a class="el" href="buffer_8h-source.html#l00065">DiskBlock::Fat::BPB_TotSec16</a>, <a class="el" href="buffer_8h-source.html#l00071">DiskBlock::Fat::BPB_TotSec32</a>, <a class="el" href="buffer_8h-source.html#l00083">DiskBlock::Fat::Extensions::Fat16Specific::BS_FilSysType</a>, <a class="el" href="buffer_8h-source.html#l00100">DiskBlock::Fat::Extensions::Fat32Specific::BS_FilSysType</a>, <a class="el" href="buffer_8h-source.html#l00058">DiskBlock::Fat::BS_OEMName</a>, <a class="el" href="buffer_8h-source.html#l00082">DiskBlock::Fat::Extensions::Fat16Specific::BS_VolLab</a>, <a class="el" href="buffer_8h-source.html#l00099">DiskBlock::Fat::Extensions::Fat32Specific::BS_VolLab</a>, <a class="el" href="board_8h-source.html#l00235">Temp::c</a>, <a class="el" href="filesys_8c-source.html#l00029">dataStart</a>, <a class="el" href="buffer_8c-source.html#l00010">diskSect</a>, <a class="el" href="structDiskBlock_1_1Fat.html#o14">DiskBlock::Fat::ext</a>, <a class="el" href="unionDiskBlock.html#o0">DiskBlock::fat</a>, <a class="el" href="filesys_8c-source.html#l00032">fatSectorsPerCluster</a>, <a class="el" href="filesys_8c-source.html#l00021">fatStart</a>, <a class="el" href="filesys_8c-source.html#l00068">IS_FAT_12</a>, <a class="el" href="filesys_8h-source.html#l00015">IS_FAT_32</a>, <a class="el" href="buffer_8h-source.html#l00129">Address::l</a>, <a class="el" href="filesys_8c-source.html#l00024">rootStart</a>, <a class="el" href="buffer_8c-source.html#l00015">sectorAddress</a>, and <a class="el" href="board_8c.html#a0">temp</a>.<p>Referenced by <a class="el" href="filesys_8c-source.html#l00923">InitFileSystem()</a>.<p><pre class="fragment"><div>00806 {00807 00808 ConsoleWrite(<span class="stringliteral">"Formatter signature:"</span>);00809 <span class="keywordflow">for</span> (<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>=0; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a><8; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>++){00810 ConsolePutChar(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o1">BS_OEMName</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>]);00811 }00812 ConsoleWrite(<span class="stringliteral">"\rBytes per sector: "</span>);00813 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o2">BPB_BytsPerSec</a>);00814 ConsoleWrite(<span class="stringliteral">"\rSectors per Cluster: "</span>);00815 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o3">BPB_SecPerClus</a>);00816 ConsoleWrite(<span class="stringliteral">"\rReserved sectors: "</span>);00817 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o4">BPB_RsvdSecCnt</a>);00818 ConsoleWrite(<span class="stringliteral">"\rNumber of FATs: "</span>);00819 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o5">BPB_NumFATs</a>);00820 ConsoleWrite(<span class="stringliteral">"\rRoot entries: "</span>);00821 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o6">BPB_RootEntCnt</a>);00822 ConsoleWrite(<span class="stringliteral">"\rTotal Sectors 16: "</span>);00823 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o7">BPB_TotSec16</a>);00824 ConsoleWrite(<span class="stringliteral">"\rFat Size 16: "</span>);00825 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o9">BPB_FATSz16</a>);00826 ConsoleWrite(<span class="stringliteral">"\rHidden Sectors: "</span>);00827 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o12">BPB_HiddSec</a>);00828 ConsoleWrite(<span class="stringliteral">"\rTotal Sectors 32: "</span>);00829 ConsolePutUInt(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o13">BPB_TotSec32</a>);00830 00831 00832 00833 <span class="comment">/* Determine FAT Type (16/32) */</span>00834 <span class="comment">/* This should be done better, but it'll do for now. */</span>00835 <a class="code" href="filesys_8h.html#a0">IS_FAT_32</a> = 1;00836 <span class="keywordflow">if</span> (<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o6">BPB_RootEntCnt</a>) 00837 <a class="code" href="filesys_8h.html#a0">IS_FAT_32</a> = 0; <span class="comment">/* FAT32 does not have separate root entries. */</span>00838 00839 ConsoleWrite(<span class="stringliteral">"\rFile system is "</span>);00840 <span class="keywordflow">if</span> (<a class="code" href="filesys_8h.html#a0">IS_FAT_32</a>){00841 ConsoleWrite(<span class="stringliteral">"FAT32"</span>);00842 } <span class="keywordflow">else</span> {00843 ConsoleWrite(<span class="stringliteral">"FAT16"</span>);00844 }00845 00846 ConsoleWrite(<span class="stringliteral">"\rFile system signature is "</span>);00847 <span class="keywordflow">for</span> (<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>=0;<a class="code" href="board_8c.html#a0">temp</a>. c<8; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>++)00848 <span class="keywordflow">if</span> (<a class="code" href="filesys_8h.html#a0">IS_FAT_32</a>){00849 ConsolePutChar(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o14">ext</a>.<a class="code" href="unionDiskBlock_1_1Fat_1_1Extensions.html#o1">_32</a>.<a class="code" href="structDiskBlock_1_1Fat_1_1Extensions_1_1Fat32Specific.html#o12">BS_FilSysType</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>]);00850 } <span class="keywordflow">else</span> {00851 ConsolePutChar(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o14">ext</a>.<a class="code" href="unionDiskBlock_1_1Fat_1_1Extensions.html#o0">_16</a>.<a class="code" href="structDiskBlock_1_1Fat_1_1Extensions_1_1Fat16Specific.html#o5">BS_FilSysType</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>]);00852 }00853 00854 <span class="keywordflow">if</span> (!<a class="code" href="filesys_8h.html#a0">IS_FAT_32</a>){00855 <span class="keywordflow">if</span> (<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o14">ext</a>.<a class="code" href="unionDiskBlock_1_1Fat_1_1Extensions.html#o0">_16</a>.<a class="code" href="structDiskBlock_1_1Fat_1_1Extensions_1_1Fat16Specific.html#o5">BS_FilSysType</a>[4]==<span class="charliteral">'2'</span>){00856 <a class="code" href="filesys_8c.html#a12">IS_FAT_12</a> = 1;00857 ConsoleWrite(<span class="stringliteral">"Well, actually it's FAT12 filesystem.\r"</span>);00858 }00859 } 00860 00861 00862 ConsoleWrite(<span class="stringliteral">"\rVolume Label is "</span>);00863 <span class="keywordflow">for</span> (<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>=0; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a><11; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>++)00864 <span class="keywordflow">if</span> (<a class="code" href="filesys_8h.html#a0">IS_FAT_32</a>){00865 ConsolePutChar(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o14">ext</a>.<a class="code" href="unionDiskBlock_1_1Fat_1_1Extensions.html#o1">_32</a>.<a class="code" href="structDiskBlock_1_1Fat_1_1Extensions_1_1Fat32Specific.html#o11">BS_VolLab</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>]);00866 } <span class="keywordflow">else</span> {00867 ConsolePutChar(<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o0">fat</a>.<a class="code" href="structDiskBlock_1_1Fat.html#o14">ext</a>.<a class="code" href="unionDiskBlock_1_1Fat_1_1Extensions.html#o0">_16</a>.<a class="code" href="structDiskBlock_1_1Fat_1_1Extensions_1_1Fat16Specific.html#o4">BS_VolLab</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>]);00868 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -