⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fat_8h-source.html

📁 ATMEL的AVR单片机库文件
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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>Procyon AVRlib: fat.h Source File</title><link href="dox.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.6 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>fat.h</h1><a href="fat_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*! \file fat.h \brief FAT16/32 file system driver. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name    : 'fat.h'</span>00005 <span class="comment">// Title        : FAT16/32 file system driver</span>00006 <span class="comment">// Author       : Pascal Stang</span>00007 <span class="comment">// Date         : 11/07/2000</span>00008 <span class="comment">// Revised      : 12/12/2000</span>00009 <span class="comment">// Version      : 0.3</span>00010 <span class="comment">// Target MCU   : ATmega103 (should work for Atmel AVR Series)</span>00011 <span class="comment">// Editor Tabs  : 4</span>00012 <span class="comment">//</span>00013 <span class="comment">// NOTE: This code is currently below version 1.0, and therefore is considered</span>00014 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span>00015 <span class="comment">// tested.  Nonetheless, you can expect most functions to work.</span>00016 <span class="comment">//</span>00017 <span class="comment">// This code is distributed under the GNU Public License</span>00018 <span class="comment">//      which can be found at http://www.gnu.org/licenses/gpl.txt</span>00019 <span class="comment">//</span>00020 <span class="comment">//*****************************************************************************</span>00021 00022 <span class="preprocessor">#ifndef FAT_H</span>00023 <span class="preprocessor"></span><span class="preprocessor">#define FAT_H</span>00024 <span class="preprocessor"></span>00025 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00026 00027 00028 <span class="comment">// Some useful cluster numbers</span>00029 <span class="preprocessor">#define MSDOSFSROOT     0               // cluster 0 means the root dir</span>00030 <span class="preprocessor"></span><span class="preprocessor">#define CLUST_FREE      0               // cluster 0 also means a free cluster</span>00031 <span class="preprocessor"></span><span class="preprocessor">#define MSDOSFSFREE     CLUST_FREE</span>00032 <span class="preprocessor"></span><span class="preprocessor">#define CLUST_FIRST     2               // first legal cluster number</span>00033 <span class="preprocessor"></span><span class="preprocessor">#define CLUST_RSRVD     0xfffffff6      // reserved cluster range</span>00034 <span class="preprocessor"></span><span class="preprocessor">#define CLUST_BAD       0xfffffff7      // a cluster with a defect</span>00035 <span class="preprocessor"></span><span class="preprocessor">#define CLUST_EOFS      0xfffffff8      // start of eof cluster range</span>00036 <span class="preprocessor"></span><span class="preprocessor">#define CLUST_EOFE      0xffffffff      // end of eof cluster range</span>00037 <span class="preprocessor"></span>00038 <span class="preprocessor">#define FAT12_MASK      0x00000fff      // mask for 12 bit cluster numbers</span>00039 <span class="preprocessor"></span><span class="preprocessor">#define FAT16_MASK      0x0000ffff      // mask for 16 bit cluster numbers</span>00040 <span class="preprocessor"></span><span class="preprocessor">#define FAT32_MASK      0x0fffffff      // mask for FAT32 cluster numbers</span>00041 <span class="preprocessor"></span>00042 00043 <span class="comment">// Partition Type used in the partition record</span>00044 <span class="preprocessor">#define PART_TYPE_UNKNOWN       0x00</span>00045 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_FAT12         0x01</span>00046 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_XENIX         0x02</span>00047 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_DOSFAT16      0x04</span>00048 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_EXTDOS        0x05</span>00049 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_FAT16         0x06</span>00050 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_NTFS          0x07</span>00051 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_FAT32         0x0B</span>00052 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_FAT32LBA      0x0C</span>00053 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_FAT16LBA      0x0E</span>00054 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_EXTDOSLBA     0x0F</span>00055 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_ONTRACK       0x33</span>00056 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_NOVELL        0x40</span>00057 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_PCIX          0x4B</span>00058 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_PHOENIXSAVE   0xA0</span>00059 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_CPM           0xDB</span>00060 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_DBFS          0xE0</span>00061 <span class="preprocessor"></span><span class="preprocessor">#define PART_TYPE_BBT           0xFF</span>00062 <span class="preprocessor"></span>00063 <span class="keyword">struct </span>partrecord <span class="comment">// length 16 bytes</span>00064 {           00065     BYTE    prIsActive;                 <span class="comment">// 0x80 indicates active partition</span>00066     BYTE    prStartHead;                <span class="comment">// starting head for partition</span>00067     WORD    prStartCylSect;             <span class="comment">// starting cylinder and sector</span>00068     BYTE    prPartType;                 <span class="comment">// partition type (see above)</span>00069     BYTE    prEndHead;                  <span class="comment">// ending head for this partition</span>00070     WORD    prEndCylSect;               <span class="comment">// ending cylinder and sector</span>00071     DWORD   prStartLBA;                 <span class="comment">// first LBA sector for this partition</span>00072     DWORD   prSize;                     <span class="comment">// size of this partition (bytes or sectors ?)</span>00073 };00074 00075         00076 <span class="keyword">struct </span>partsector00077 {00078     CHAR    psPartCode[512-64-2];       <span class="comment">// pad so struct is 512b</span>00079     BYTE    psPart[64];                 <span class="comment">// four partition records (64 bytes)</span>00080     BYTE    psBootSectSig0;             <span class="comment">// two signature bytes (2 bytes)</span>00081     BYTE    psBootSectSig1;00082 <span class="preprocessor">#define BOOTSIG0        0x55</span>00083 <span class="preprocessor"></span><span class="preprocessor">#define BOOTSIG1        0xaa</span>00084 <span class="preprocessor"></span>};00085 00086 00087 00088 <span class="comment">// Format of a boot sector.  This is the first sector on a DOS floppy disk</span>00089 <span class="comment">// or the first sector of a partition on a hard disk.  But, it is not the</span>00090 <span class="comment">// first sector of a partitioned hard disk.</span>00091 <span class="keyword">struct </span>bootsector33 {00092     BYTE    bsJump[3];                  <span class="comment">// jump inst E9xxxx or EBxx90</span>00093     CHAR    bsOemName[8];               <span class="comment">// OEM name and version</span>00094     CHAR    bsBPB[19];                  <span class="comment">// BIOS parameter block</span>00095     CHAR    bsDriveNumber;              <span class="comment">// drive number (0x80)</span>00096     CHAR    bsBootCode[479];            <span class="comment">// pad so struct is 512b</span>00097     BYTE    bsBootSectSig0;             <span class="comment">// boot sector signature byte 0x55</span>00098     BYTE    bsBootSectSig1;             <span class="comment">// boot sector signature byte 0xAA</span>00099 <span class="preprocessor">#define BOOTSIG0        0x55</span>00100 <span class="preprocessor"></span><span class="preprocessor">#define BOOTSIG1        0xaa</span>00101 <span class="preprocessor"></span>};00102 00103 <span class="keyword">struct </span>extboot {00104     CHAR    exDriveNumber;              <span class="comment">// drive number (0x80)</span>00105     CHAR    exReserved1;                <span class="comment">// reserved</span>00106     CHAR    exBootSignature;            <span class="comment">// ext. boot signature (0x29)</span>00107 <span class="preprocessor">#define EXBOOTSIG       0x29</span>00108 <span class="preprocessor"></span>    CHAR    exVolumeID[4];              <span class="comment">// volume ID number</span>00109     CHAR    exVolumeLabel[11];          <span class="comment">// volume label</span>00110     CHAR    exFileSysType[8];           <span class="comment">// fs type (FAT12 or FAT16)</span>00111 };00112 00113 <span class="keyword">struct </span>bootsector50 {00114     BYTE    bsJump[3];                  <span class="comment">// jump inst E9xxxx or EBxx90</span>00115     CHAR    bsOemName[8];               <span class="comment">// OEM name and version</span>00116     CHAR    bsBPB[25];                  <span class="comment">// BIOS parameter block</span>00117     CHAR    bsExt[26];                  <span class="comment">// Bootsector Extension</span>00118     CHAR    bsBootCode[448];            <span class="comment">// pad so structure is 512b</span>00119     BYTE    bsBootSectSig0;             <span class="comment">// boot sector signature byte 0x55 </span>00120     BYTE    bsBootSectSig1;             <span class="comment">// boot sector signature byte 0xAA</span>00121 <span class="preprocessor">#define BOOTSIG0        0x55</span>00122 <span class="preprocessor"></span><span class="preprocessor">#define BOOTSIG1        0xaa</span>00123 <span class="preprocessor"></span>};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -