📄 fat_8h-source.html
字号:
00272 BYTE bpbSectors[2]; <span class="comment">// total number of sectors</span>00273 BYTE bpbMedia; <span class="comment">// media descriptor</span>00274 BYTE bpbFATsecs[2]; <span class="comment">// number of sectors per FAT</span>00275 BYTE bpbSecPerTrack[2]; <span class="comment">// sectors per track</span>00276 BYTE bpbHeads[2]; <span class="comment">// number of heads</span>00277 BYTE bpbHiddenSecs[4]; <span class="comment">// # of hidden sectors</span>00278 BYTE bpbHugeSectors[4]; <span class="comment">// # of sectors if bpbSectors == 0</span>00279 BYTE bpbBigFATsecs[4]; <span class="comment">// like bpbFATsecs for FAT32</span>00280 BYTE bpbExtFlags[2]; <span class="comment">// extended flags:</span>00281 BYTE bpbFSVers[2]; <span class="comment">// filesystem version</span>00282 BYTE bpbRootClust[4]; <span class="comment">// start cluster for root directory</span>00283 BYTE bpbFSInfo[2]; <span class="comment">// filesystem info structure sector</span>00284 BYTE bpbBackup[2]; <span class="comment">// backup boot sector</span>00285 <span class="comment">// There is a 12 byte filler here, but we ignore it</span>00286 };00287 00288 <span class="comment">// FAT32 FSInfo block.</span>00289 <span class="keyword">struct </span>fsinfo {00290 BYTE fsisig1[4];00291 BYTE fsifill1[480];00292 BYTE fsisig2[4];00293 BYTE fsinfree[4];00294 BYTE fsinxtfree[4];00295 BYTE fsifill2[12];00296 BYTE fsisig3[4];00297 BYTE fsifill3[508];00298 BYTE fsisig4[4];00299 };00300 00301 00302 <span class="comment">/***************************************************************/</span>00303 <span class="comment">/***************************************************************/</span>00304 00305 00306 <span class="comment">// Structure of a dos directory entry.</span>00307 <span class="keyword">struct </span>direntry {00308 BYTE deName[8]; <span class="comment">// filename, blank filled</span>00309 <span class="preprocessor">#define SLOT_EMPTY 0x00 // slot has never been used</span>00310 <span class="preprocessor"></span><span class="preprocessor">#define SLOT_E5 0x05 // the real value is 0xE5</span>00311 <span class="preprocessor"></span><span class="preprocessor">#define SLOT_DELETED 0xE5 // file in this slot deleted</span>00312 <span class="preprocessor"></span> BYTE deExtension[3]; <span class="comment">// extension, blank filled</span>00313 BYTE deAttributes; <span class="comment">// file attributes</span>00314 <span class="preprocessor">#define ATTR_NORMAL 0x00 // normal file</span>00315 <span class="preprocessor"></span><span class="preprocessor">#define ATTR_READONLY 0x01 // file is readonly</span>00316 <span class="preprocessor"></span><span class="preprocessor">#define ATTR_HIDDEN 0x02 // file is hidden</span>00317 <span class="preprocessor"></span><span class="preprocessor">#define ATTR_SYSTEM 0x04 // file is a system file</span>00318 <span class="preprocessor"></span><span class="preprocessor">#define ATTR_VOLUME 0x08 // entry is a volume label</span>00319 <span class="preprocessor"></span><span class="preprocessor">#define ATTR_LONG_FILENAME 0x0F // this is a long filename entry </span>00320 <span class="preprocessor"></span><span class="preprocessor">#define ATTR_DIRECTORY 0x10 // entry is a directory name</span>00321 <span class="preprocessor"></span><span class="preprocessor">#define ATTR_ARCHIVE 0x20 // file is new or modified</span>00322 <span class="preprocessor"></span> BYTE deLowerCase; <span class="comment">// NT VFAT lower case flags (set to zero)</span>00323 <span class="preprocessor">#define LCASE_BASE 0x08 // filename base in lower case</span>00324 <span class="preprocessor"></span><span class="preprocessor">#define LCASE_EXT 0x10 // filename extension in lower case</span>00325 <span class="preprocessor"></span> BYTE deCHundredth; <span class="comment">// hundredth of seconds in CTime</span>00326 BYTE deCTime[2]; <span class="comment">// create time</span>00327 BYTE deCDate[2]; <span class="comment">// create date</span>00328 BYTE deADate[2]; <span class="comment">// access date</span>00329 WORD deHighClust; <span class="comment">// high bytes of cluster number</span>00330 BYTE deMTime[2]; <span class="comment">// last update time</span>00331 BYTE deMDate[2]; <span class="comment">// last update date</span>00332 WORD deStartCluster; <span class="comment">// starting cluster of file</span>00333 DWORD deFileSize; <span class="comment">// size of file in bytes</span>00334 };00335 00336 <span class="comment">// number of directory entries in one sector</span>00337 <span class="preprocessor">#define DIRENTRIES_PER_SECTOR 0x10</span>00338 <span class="preprocessor"></span>00339 <span class="comment">// Structure of a Win95 long name directory entry</span>00340 <span class="keyword">struct </span>winentry {00341 BYTE weCnt; <span class="comment">// </span>00342 <span class="preprocessor">#define WIN_LAST 0x40</span>00343 <span class="preprocessor"></span><span class="preprocessor">#define WIN_CNT 0x3f</span>00344 <span class="preprocessor"></span> BYTE wePart1[10];00345 BYTE weAttributes;00346 <span class="preprocessor">#define ATTR_WIN95 0x0f</span>00347 <span class="preprocessor"></span> BYTE weReserved1;00348 BYTE weChksum;00349 BYTE wePart2[12];00350 WORD weReserved2;00351 BYTE wePart3[4];00352 };00353 00354 <span class="preprocessor">#define WIN_ENTRY_CHARS 13 // Number of chars per winentry</span>00355 <span class="preprocessor"></span>00356 <span class="comment">// Maximum filename length in Win95</span>00357 <span class="comment">// Note: Must be < sizeof(dirent.d_name)</span>00358 <span class="preprocessor">#define WIN_MAXLEN 255</span>00359 <span class="preprocessor"></span>00360 <span class="comment">// This is the format of the contents of the deTime field in the direntry</span>00361 <span class="comment">// structure.</span>00362 <span class="comment">// We don't use bitfields because we don't know how compilers for</span>00363 <span class="comment">// arbitrary machines will lay them out.</span>00364 <span class="preprocessor">#define DT_2SECONDS_MASK 0x1F // seconds divided by 2</span>00365 <span class="preprocessor"></span><span class="preprocessor">#define DT_2SECONDS_SHIFT 0</span>00366 <span class="preprocessor"></span><span class="preprocessor">#define DT_MINUTES_MASK 0x7E0 // minutes</span>00367 <span class="preprocessor"></span><span class="preprocessor">#define DT_MINUTES_SHIFT 5</span>00368 <span class="preprocessor"></span><span class="preprocessor">#define DT_HOURS_MASK 0xF800 // hours</span>00369 <span class="preprocessor"></span><span class="preprocessor">#define DT_HOURS_SHIFT 11</span>00370 <span class="preprocessor"></span>00371 <span class="comment">// This is the format of the contents of the deDate field in the direntry</span>00372 <span class="comment">// structure.</span>00373 <span class="preprocessor">#define DD_DAY_MASK 0x1F // day of month</span>00374 <span class="preprocessor"></span><span class="preprocessor">#define DD_DAY_SHIFT 0</span>00375 <span class="preprocessor"></span><span class="preprocessor">#define DD_MONTH_MASK 0x1E0 // month</span>00376 <span class="preprocessor"></span><span class="preprocessor">#define DD_MONTH_SHIFT 5</span>00377 <span class="preprocessor"></span><span class="preprocessor">#define DD_YEAR_MASK 0xFE00 // year - 1980</span>00378 <span class="preprocessor"></span><span class="preprocessor">#define DD_YEAR_SHIFT 9</span>00379 <span class="preprocessor"></span>00380 <span class="comment">// Stuctures</span>00381 <span class="keyword">struct </span>FileInfoStruct00382 {00383 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> StartCluster; <span class="comment">//< file starting cluster for last file accessed</span>00384 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> Size; <span class="comment">//< file size for last file accessed</span>00385 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Attr; <span class="comment">//< file attr for last file accessed</span>00386 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> CreateTime; <span class="comment">//< file creation time for last file accessed</span>00387 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> CreateDate; <span class="comment">//< file creation date for last file accessed</span>00388 };00389 00390 <span class="comment">// Prototypes</span>00391 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> fatInit( <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> device);00392 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> fatClusterSize(<span class="keywordtype">void</span>);00393 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> fatGetDirEntry(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> entry);00394 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> fatChangeDirectory(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> entry);00395 <span class="keywordtype">void</span> fatPrintDirEntry(<span class="keywordtype">void</span>);00396 <span class="keywordtype">void</span> fatDumpDirSlot(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> entry);00397 <span class="keyword">struct </span>FileInfoStruct* fatGetFileInfo(<span class="keywordtype">void</span>);00398 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fatGetFilesize(<span class="keywordtype">void</span>);00399 <span class="keywordtype">char</span>* fatGetFilename(<span class="keywordtype">void</span>);00400 <span class="keywordtype">char</span>* fatGetDirname(<span class="keywordtype">void</span>);00401 <span class="keywordtype">void</span> fatLoadCluster(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> cluster, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *buffer);00402 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fatNextCluster(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> cluster);00403 00404 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -