Difference between revisions of "Unit FATFS"

From Ultibo.org
Jump to: navigation, search
 
(10 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo FAT12/16/32/exFAT interface unit'''
+
'''Ultibo FAT12/16/32/exFAT Interface unit'''
  
 
''Notes:''
 
''Notes:''
Line 37: Line 37:
 
|-
 
|-
 
| <code>fatDotDotName = '..';</code>
 
| <code>fatDotDotName = '..';</code>
| &nbsp;
 
|-
 
| <code>fatBlankName= '';</code>
 
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 307: Line 304:
 
| <code>lfnAttributeMask = (faReadOnly or faHidden or faSysFile or faVolumeID);</code>
 
| <code>lfnAttributeMask = (faReadOnly or faHidden or faSysFile or faVolumeID);</code>
 
| Not Used - See faLongName
 
| Not Used - See faLongName
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>fatBootSignature = $29;</code>
 +
| &nbsp;
 
|-
 
|-
 
|colspan="2"|&nbsp;
 
|colspan="2"|&nbsp;
Line 335: Line 337:
 
| <code>fatLowercaseChars:set of Byte = [$61..$7A];</code>
 
| <code>fatLowercaseChars:set of Byte = [$61..$7A];</code>
 
| 97..122 (These dont account for the code page)
 
| 97..122 (These dont account for the code page)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FATFS params table''' <code> fatParams* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Used for FAT entry block loading
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>fatMaxParams = 11;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>fatParams:array[0..fatMaxParams] of TFATParams = (</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''SectorSize,FATType,BlockShiftCount,EntriesPerBlock,SectorsPerBlock''
 +
|-
 +
|colspan="2"|''FAT12''
 +
|-
 +
| <code>(SectorSize:512; FATType:ftFAT12; BlockShiftCount:10; EntriesPerBlock:1024; SectorsPerBlock:3),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:1024; FATType:ftFAT12; BlockShiftCount:11 ;EntriesPerBlock:2048; SectorsPerBlock:3),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:2048; FATType:ftFAT12; BlockShiftCount:12; EntriesPerBlock:4096; SectorsPerBlock:3),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:4096; FATType:ftFAT12; BlockShiftCount:13; EntriesPerBlock:8192; SectorsPerBlock:3),</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''FAT16''
 +
|-
 +
| <code>(SectorSize:512; FATType:ftFAT16; BlockShiftCount:10; EntriesPerBlock:1024; SectorsPerBlock:4),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:1024; FATType:ftFAT16; BlockShiftCount:11; EntriesPerBlock:2048; SectorsPerBlock:4),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:2048; FATType:ftFAT16; BlockShiftCount:12; EntriesPerBlock:4096; SectorsPerBlock:4),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:4096 ;FATType:ftFAT16 ;BlockShiftCount:13; EntriesPerBlock:8192; SectorsPerBlock:4),</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''FAT32''
 +
|-
 +
| <code>(SectorSize:512; FATType:ftFAT32; BlockShiftCount:10; EntriesPerBlock:1024; SectorsPerBlock:8),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:1024; FATType:ftFAT32; BlockShiftCount:11; EntriesPerBlock:2048; SectorsPerBlock:8),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:2048; FATType:ftFAT32; BlockShiftCount:12; EntriesPerBlock:4096; SectorsPerBlock:8),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(SectorSize:4096; FATType:ftFAT32; BlockShiftCount:13; EntriesPerBlock:8192; SectorsPerBlock:8));</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FATFS geometry tables''' <code> fat12Geometry* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Used for FAT formatting (Floppy Disk only)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>fat12MaxGeometry = 4;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>fat12Geometry:array[0..fat12MaxGeometry] of TFATGeometry = (</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''FloppyType,SectorsPerFat,SectorsPerCluster,RootEntryCount,MediaId''
 +
|-
 +
| <code>(FloppyType:ft360K; SectorsPerFat:2; SectorsPerCluster:2; RootEntryCount:112; MediaId:$FD),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(FloppyType:ft12M;SectorsPerFat:7;SectorsPerCluster:1;RootEntryCount:224;MediaId:$F9),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(FloppyType:ft720K; SectorsPerFat:3; SectorsPerCluster:2; RootEntryCount:112; MediaId:$F9),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(FloppyType:ft144M; SectorsPerFat:9; SectorsPerCluster:1; RootEntryCount:224; MediaId:$F0),</code>
 +
| &nbsp;
 +
|-
 +
| <code>(FloppyType:ft288M; SectorsPerFat:9; SectorsPerCluster:2; RootEntryCount:240; MediaId:$F0));</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FATFS cluster size tables''' <code> fat_ClusterSize* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Used for FAT formatting (Fixed Disk only)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>fat12MaxClusterSize = 2;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>fat12ClusterSize:array[0..fat12MaxClusterSize] of TFATClusterSize = (</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''SectorCount,SectorsPerCluster''
 +
|-
 +
| <code>(SectorCount:6; SectorsPerCluster:0),</code>
 +
| up to 3 KB, the 0 value for SectorsPerCluster trips an error (Not possible due to 512 Root entries)
 +
|-
 +
| <code>(SectorCount:798; SectorsPerCluster:0),</code>
 +
| up to 399 KB, the 0 value for SectorsPerCluster trips an error
 +
|-
 +
| <code>(SectorCount:32623; SectorsPerCluster:8),</code>
 +
| up to 15.9 MB, 4k cluster
 +
|-
 +
| <code>(SectorCount:$FFFFFFFF; SectorsPerCluster:0));</code>
 +
| greater than 15.9 MB, 0 value for SectorsPerCluster trips an error
 +
|-
 +
|colspan="2"|See FAT12 Notes for Min/Max and Values
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>fat16MaxClusterSize = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>fat16ClusterSize:array[0..fat16MaxClusterSize] of TFATClusterSize = (</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''SectorCount,SectorsPerCluster''
 +
|-
 +
| <code>(SectorCount:8400; SectorsPerCluster:0),</code>
 +
| up to 4.1 MB, the 0 value for SectorsPerCluster trips an error
 +
|-
 +
| <code>(SectorCount:32680; SectorsPerCluster:2),</code>
 +
| up to 16 MB, 1k cluster
 +
|-
 +
| <code>(SectorCount:262144; SectorsPerCluster:4),</code>
 +
| up to 128 MB, 2k cluster
 +
|-
 +
| <code>(SectorCount:524288; SectorsPerCluster:8),</code>
 +
| up to 256 MB, 4k cluster
 +
|-
 +
| <code>(SectorCount:1048576; SectorsPerCluster:16),</code>
 +
| up to 512 MB, 8k cluster
 +
|-
 +
|colspan="2"|The entries after this point are not used unless FAT16 is forced
 +
|-
 +
| <code>(SectorCount:2097152; SectorsPerCluster:32),</code>
 +
| up to 1 GB, 16k cluster
 +
|-
 +
| <code>(SectorCount:4194304; SectorsPerCluster:64),</code>
 +
| up to 2 GB, 32k cluster
 +
|-
 +
| <code>(SectorCount:8388608; SectorsPerCluster:128),</code>
 +
| up to 4 GB, 64k cluster
 +
|-
 +
| <code>(SectorCount:$FFFFFFFF;SectorsPerCluster:0));</code>
 +
| greater than 4 GB, 0 value for SectorsPerCluster trips an error
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>fat32MaxClusterSize = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>fat32ClusterSize:array[0..fat32MaxClusterSize] of TFATClusterSize = (</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''SectorCount,SectorsPerCluster''
 +
|-
 +
| <code>(SectorCount:66600; SectorsPerCluster:0),</code>
 +
| up to 32.5 MB, the 0 value for SectorsPerCluster trips an error
 +
|-
 +
| <code>(SectorCount:532480 ;SectorsPerCluster:1),</code>
 +
| up to 260 MB, .5k cluster
 +
|-
 +
|colspan="2"|The entries before this point are not used unless FAT32 is forced
 +
|-
 +
| <code>(SectorCount:16777216; SectorsPerCluster:8),</code>
 +
| up to 8 GB, 4k cluster
 +
|-
 +
| <code>(SectorCount:33554432; SectorsPerCluster:16),</code>
 +
| up to 16 GB, 8k cluster
 +
|-
 +
| <code>(SectorCount:67108864; SectorsPerCluster:32),</code>
 +
| up to 32 GB, 16k cluster
 +
|-
 +
| <code>(SectorCount:$FFFFFFFF; SectorsPerCluster:64));</code>
 +
| greater than 32 GB, 32k cluster
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FATFS partition types''' <code> fatPartitionType* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>fatMaxPartitionType = 5;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>fatPartitionType:array[0..fatMaxPartitionType] of TFATPartitionType = (</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Excluded,Extended,SectorCount,PartitionId,LBAType''
 +
|-
 +
|colspan="2"|''Extended Partitions''
 +
|-
 +
| <code>(Excluded:False; Extended:True; SectorCount:$FFFFFFFF ;PartitionId:pidExtended; LBAType:pidExtLBA),</code>
 +
| any size, Extended
 +
|-
 +
|colspan="2"|Primary and Logical Partitions
 +
|-
 +
|colspan="2"|''Unused''
 +
|-
 +
| <code>(Excluded:False; Extended:False; SectorCount:798; PartitionId:pidUnused; LBAType:pidUnused),</code>
 +
| up to 399 KB, Unused (Unused type trips an error)
 +
|-
 +
|colspan="2"|''FAT12''
 +
|-
 +
| <code>(Excluded:False; Extended:False; SectorCount:32680; PartitionId:pidFAT12; LBAType:pidFAT12),</code>
 +
| up to 16 MB, FAT12
 +
|-
 +
|colspan="2"|''FAT16''
 +
|-
 +
| <code>(Excluded:False; Extended:False; SectorCount:65360; PartitionId:pidFAT16; LBAType:pidFAT16LBA),</code>
 +
| up to 32 MB, FAT16
 +
|-
 +
| <code>(Excluded:False; Extended:False; SectorCount:1048576; PartitionId:pidFAT16HUGE; LBAType:pidFAT16LBA),</code>
 +
| up to 512 MB, FAT16 HUGE
 +
|-
 +
|colspan="2"|''FAT32''
 +
|-
 +
| <code>(Excluded:False; Extended:False; SectorCount:$FFFFFFFF; PartitionId:pidFAT32; LBAType:pidFAT32LBA));</code>
 +
| above 512 MB, FAT32
 
|-
 
|-
 
|}
 
|}
Line 343: Line 591:
 
----
 
----
  
''To be documented''
+
 
 +
'''FATFS specific types'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TFATType = (ftNONE,ftFAT12,ftFAT16,ftFAT32);</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''FATFS params'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
 
 +
<code>TFATParams = record </code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: (Not Packed) Block values for various Sector sizes.
 +
|-
 +
| <code>SectorSize:Word;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>FATType:TFATType;</code>
 +
| &nbsp;
 +
|-
 +
| <code>BlockShiftCount:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>EntriesPerBlock:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SectorsPerBlock:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''FATFS geometry''' 
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
 
 +
<code>TFATGeometry = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: (Not Packed) FAT12 values for various Floppy Types.
 +
|-
 +
| <code>FloppyType:TFloppyType;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>SectorsPerFat:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SectorsPerCluster:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>RootEntryCount:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>MediaId:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 +
'''FATFS cluster size'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
 
 +
<code>TFATClusterSize = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: (Not Packed) Sectors per Cluster for various disk sizes (Fixed Disk only).
 +
|-
 +
| <code>SectorCount:LongWord;</code>
 +
| Based on 512 bytes per sector only
 +
|-
 +
| <code>SectorsPerCluster:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''FATFS partition type'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
 
 +
<code>TFATPartitionType = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: (Not Packed) Partition Type for various disk sizes (Fixed Disk only).
 +
|-
 +
| <code>Excluded:Boolean;</code>
 +
| Entry is excluded from FAT Partition Type check
 +
|-
 +
| <code>Extended:Boolean;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SectorCount:LongWord;</code>
 +
| Based on 512 bytes per sector only
 +
|-
 +
| <code>PartitionId:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>LBAType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''FATFS name'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PFATName = ^TFATName;</code>
 +
 
 +
<code>TFATName = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: 11 Bytes
 +
|-
 +
| <code>Name:array[0..7] of Char;</code>
 +
| File Name
 +
|-
 +
| <code>Ext:array[0..2] of Char;</code>
 +
| File Extension
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''FATSFS directory'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PFATDirectory = ^TFATDirectory;</code>
 +
 
 +
<code>TFATDirectory = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: 32 Bytes
 +
|-
 +
| <code>Name:array[0..7] of Char;</code>
 +
| File Name
 +
|-
 +
| <code>Ext:array[0..2] of Char;</code>
 +
| File Extension
 +
|-
 +
| <code>Attribute:Byte;</code>
 +
| File Attributes - See Standard Values
 +
|-
 +
| <code>Reserved:Byte;</code>
 +
| Always 0 (See below)
 +
|-
 +
| <code>CaseFlags:Byte;</code>
 +
| Set to $08 if Name, $10 if Extension or $18 if both
 +
|-
 +
| <code>CreateTimeMsecs:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CreateTime:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>CreateDate:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>LastAccessDate:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FirstClusterHigh:Word;</code>
 +
| High word of the start cluster (FAT32 Only)
 +
|-
 +
| <code>WriteTime:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>WriteDate:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FirstClusterLow:Word;</code>
 +
| Low Word of Start Cluster all versions
 +
|-
 +
| <code>Length:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''LFN directory''' 
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PLFNDirectory = ^TLFNDirectory;</code>
 +
 
 +
<code>TLFNDirectory = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: 32 Bytes
 +
|-
 +
| <code>Order:Byte;</code>
 +
| Bit 6 = 1 if last LFN in chain, Bits 5-0 = Order of LFN chunks for this File
 +
|-
 +
| <code>Name1:array[0..4] of WideChar;</code>
 +
| First 5 Characters in this chunk
 +
|-
 +
| <code>Attribute:Byte;</code>
 +
| Always 0Fh - Volume, System, Hidden, ReadOnly
 +
|-
 +
| <code>FileType:Byte;</code>
 +
| Usually 00h
 +
|-
 +
| <code>Checksum:Byte;</code>
 +
| Checksum calculated on 8.3 name
 +
|-
 +
| <code>Name2:array[0..5] of WideChar;</code>
 +
| Next 6 Characters in this chunk
 +
|-
 +
| <code>Reserved:Word;</code>
 +
| Always 0000h - FirstCluster in Standard Entry
 +
|-
 +
| <code>Name3:array[0..1] of WideChar;</code>
 +
| Next 2 Characters in this chunk
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''FATFS info sector'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PFATInfoSector = ^TFATInfoSector;</code>
 +
 
 +
<code>TFATInfoSector = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>LeadSignature:LongWord;</code>
 +
| Signature "RRaA" or 41615252h
 +
|-
 +
| <code>Reserved1:array[0..479] of Byte;</code>
 +
| Always 0
 +
|-
 +
| <code>StructureSignature:LongWord;</code>
 +
| Signature "rrAa" or 61417272h
 +
|-
 +
| <code>FreeClusterCount:LongWord;</code>
 +
| Free Clusters $FFFFFFFF if unknown
 +
|-
 +
| <code>LastFreeCluster:LongWord;</code>
 +
| Most recently allocated cluster $FFFFFFFF if unknown
 +
|-
 +
| <code>Reserved2:array[0..11] of Byte;</code>
 +
| Always 0
 +
|-
 +
| <code>TrailSignature:LongWord;</code>
 +
| Signature AA550000h
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 
 +
=== Class definitions ===
 +
----
 +
 
 +
 
 +
'''FATFS specific classes'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATRecognizer|<code>TFATRecognizer = class(TRecognizer)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATPartitioner|<code>TFATPartitioner = class(TDiskPartitioner)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATFormatter|<code>TFATFormatter = class(TDiskFormatter)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATDefragger|<code>TFATDefragger = class(TDiskDefragger)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATRepairer|<code>TFATRepairer = class(TDiskRepairer)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATFileSystem|<code>TFATFileSystem = class(TFileSystem)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATDiskTable|<code>TFATDiskTable = class(TDiskTable)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATDiskBlock|<code>TFATDiskBlock = class(TDiskBlock)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TFATDiskEntry|<code>TFATDiskEntry = class(TDiskEntry)</code>]]
 +
|-
 +
|}
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
''None defined''
  
 
=== Function declarations ===
 
=== Function declarations ===
Line 362: Line 922:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 374: Line 934:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 389: Line 949:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Latest revision as of 05:36, 31 August 2021

Return to Unit Reference


Description


Ultibo FAT12/16/32/exFAT Interface unit

Notes:

Based on information from numerous sources, primarily the document fatgen103.pdf from Microsoft. FAT Disk Blocks are based on reading a group of sectors into a block at once. The BlockNo of each block is therefore the FAT entry no of the first FAT in the block.

The use of IsEightDotThree and GenerateShortName(Ex) from the UltiboUtils unit should be replaced by internal routines optimised for maximum performance. All Block and Entry Offsets have been expanded to 32bit to avoid 16bit overflow on 64K clusters.

Constants



[Expand]
FATFS specific constants fat*


[Expand]
FATFS params table fatParams*


[Expand]
FATFS geometry tables fat12Geometry*


[Expand]
FATFS cluster size tables fat_ClusterSize*


[Expand]
FATFS partition types fatPartitionType*


Type definitions



FATFS specific types

TFATType = (ftNONE,ftFAT12,ftFAT16,ftFAT32);

FATFS params

[Expand]

TFATParams = record

FATFS geometry

[Expand]

TFATGeometry = record

FATFS cluster size

[Expand]

TFATClusterSize = record

FATFS partition type

[Expand]

TFATPartitionType = record

FATFS name

[Expand]

PFATName = ^TFATName;

TFATName = packed record

FATSFS directory

[Expand]

PFATDirectory = ^TFATDirectory;

TFATDirectory = packed record

LFN directory

[Expand]

PLFNDirectory = ^TLFNDirectory;

TLFNDirectory = packed record

FATFS info sector

[Expand]

PFATInfoSector = ^TFATInfoSector;

TFATInfoSector = packed record


Class definitions



FATFS specific classes

TFATRecognizer = class(TRecognizer)
TFATPartitioner = class(TDiskPartitioner)
TFATFormatter = class(TDiskFormatter)
TFATDefragger = class(TDiskDefragger)
TFATRepairer = class(TDiskRepairer)
TFATFileSystem = class(TFileSystem)
TFATDiskTable = class(TDiskTable)
TFATDiskBlock = class(TDiskBlock)
TFATDiskEntry = class(TDiskEntry)


Public variables


None defined

Function declarations



Initialization functions

[Expand]
procedure FATFSInit;
Description: To be documented


[Expand]
procedure FATFSQuit;
Description: To be documented


FATFS helper functions

[Expand]
function FATTypeToString(AType:TFATType):String;
Description: To be documented


Return to Unit Reference