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