#define FAT_OK 0
#define FAT_ERROR -1
#define FAT_ERROR_EOF -2
#define FAT_ERROR_IDE -3
#define NUTDEV_OK 0
#define NUTDEV_ERROR -1
#define FAT_MAX_DRIVE 2
#define ZIP_DRIVE_BR_SECTOR 32
#define BPB_RsvdSecCnt 32
#define BPB_NumFATs 2
#define BPB_HiddSec 63
#define FAT32_MEDIA 0xf8
#define FAT32_OFFSET_FSINFO 1
#define FAT32_OFFSET_BACKUP_BOOT 6
#define FAT16_CLUSTER_EOF 0x0000FFFF
#define FAT16_CLUSTER_ERROR 0x0000FFF7
#define FAT16_CLUSTER_MASK 0x0000FFFF
#define FAT32_CLUSTER_EOF 0x0FFFFFFF
#define FAT32_CLUSTER_ERROR 0x0FFFFFF7
#define FAT32_CLUSTER_MASK 0x0FFFFFFF
#define FAT_SIGNATURE 0xAA55
#define MBR_SIGNATURE FAT_SIGNATURE
#define MBR_FAT32 0x0C
#define FSINFO_FIRSTSIGNATURE 0x41615252
#define FSINFO_FSINFOSIGNATURE 0x61417272
#define FSINFO_SIGNATURE FAT_SIGNATURE
#define DIRECTORY_ATTRIBUTE_READ_ONLY 0x01
#define DIRECTORY_ATTRIBUTE_HIDDEN 0x02
#define DIRECTORY_ATTRIBUTE_SYSTEM_FILE 0x04
#define DIRECTORY_ATTRIBUTE_VOLUME_ID 0x08
#define DIRECTORY_ATTRIBUTE_DIRECTORY 0x10
#define DIRECTORY_ATTRIBUTE_ARCHIVE 0x20
#define DIRECTORY_ATTRIBUTE_LONG_NAME 0x0F
#define DIRECTORY_ATTRIBUTE_LONG_NAME_MASK 0x3F
#define FAT_NAME_LEN 8
#define FAT_EXT_LEN 3
#define FAT_SHORT_NAME_LEN
#define FAT_LONG_NAME_LEN 64
#define FLAG_FAT_IS_CDROM 0x0001
#define FLAG_FAT_IS_ZIP 0x0002
#define ATAPI_BOOT_RECORD 0x00
#define ATAPI_PVD_DESC 0x01
#define ATAPI_SVD_DESC 0x02
#define ATAPI_VDST_DESC 0xFF
| struct | |
| { | |
| DWORD DiskSize; | |
| BYTE SecPerClusVal; | |
| } |
| struct _FAT32FileDataTime | |
| { | |
| unsigned Seconds:5; | |
| unsigned Minute:6; | |
| unsigned Hour:5; | |
| unsigned Day:5; | |
| unsigned Month:4; | |
| unsigned Year:7; | |
| } |
| See: | Typedef FAT32_FILEDATETIME |
| struct _FAT32DirectoryEntry | |
| { | |
| BYTE Name[8]; | |
| BYTE Extension[3]; | |
| BYTE Attribute; | |
| BYTE Reserved[8]; | |
| WORD HighCluster; | |
| FAT32_FILEDATETIME Date; | |
| WORD LowCluster; | |
| DWORD FileSize; | |
| } |
| struct _FAT32DirectoryEntryLong | |
| { | |
| BYTE Order; | |
| WORD Name1[5]; | |
| BYTE Attribute; | |
| BYTE Type; | |
| BYTE Chksum; | |
| WORD Name2[6]; | |
| WORD LowCluster; | |
| WORD Name3[2]; | |
| } |
| struct _FAT32FileSystemInformation | |
| { | |
| DWORD FirstSignature; | |
| BYTE Reserved1[480]; | |
| DWORD FSInfoSignature; | |
| DWORD NumberOfFreeClusters; | |
| DWORD MostRecentlyAllocatedCluster; | |
| BYTE Reserved2[12]; | |
| BYTE Reserved3[2]; | |
| WORD Signature; | |
| } |
| struct _FAT32PartitionEntry | |
| { | |
| BYTE BootInd; | |
| BYTE FirstHead; | |
| BYTE FirstSector; | |
| BYTE FirstTrack; | |
| BYTE FileSystem; | |
| BYTE LastHead; | |
| BYTE LastSector; | |
| BYTE LastTrack; | |
| DWORD StartSectors; | |
| DWORD NumSectors; | |
| } |
| struct _FAT32PartionTable | |
| { | |
| BYTE LoadInstruction[446]; | |
| FAT32_PARTITION_ENTRY Partition[4]; | |
| WORD Signature; | |
| } |
| struct _bpbfat16 | |
| { | |
| BYTE DrvNum; | |
| BYTE Reserved1; | |
| BYTE BootSig; | |
| DWORD VollID; | |
| BYTE VolLab[11]; | |
| BYTE FilSysType[8]; | |
| BYTE Reserved2[28]; | |
| } |
| struct _bpbfat32 | |
| { | |
| DWORD FATSz32; | |
| WORD ExtFlags; | |
| WORD FSVer; | |
| DWORD RootClus; | |
| WORD FSInfo; | |
| WORD BkBootSec; | |
| BYTE Reserved[12]; | |
| BYTE DrvNum; | |
| BYTE Reserved1; | |
| BYTE BootSig; | |
| DWORD VollID; | |
| BYTE VolLab[11]; | |
| BYTE FilSysType[8]; | |
| } |
| union _bpboffset36 | |
| { | |
| BPBFAT16 FAT16; | |
| BPBFAT32 FAT32; | |
| } |
| struct _FAT32BootRecord | |
| { | |
| BYTE JumpBoot[3]; | |
| BYTE OEMName[8]; | |
| WORD BytsPerSec; | |
| BYTE SecPerClus; | |
| WORD RsvdSecCnt; | |
| BYTE NumFATs; | |
| WORD RootEntCnt; | |
| WORD TotSec16; | |
| BYTE Media; | |
| WORD FATSz16; | |
| WORD SecPerTrk; | |
| WORD NumHeads; | |
| DWORD HiddSec; | |
| DWORD TotSec32; | |
| BPBOFFSET36 Off36; | |
| BYTE Reserved[420]; | |
| WORD Signature; | |
| } |
| See: | Typedef FAT32_BOOT_RECORD |
| struct _fat_entry_table16 | |
| { | |
| WORD aEntry[256]; | |
| } |
| struct _fat_entry_table32 | |
| { | |
| DWORD aEntry[128]; | |
| } |
| union _fat_dir_table | |
| { | |
| FAT32_DIRECTORY_ENTRY aShort[16]; | |
| FAT32_DIRECTORY_ENTRY_LONG aLong[16]; | |
| } |
| struct _drive_info | |
| { | |
| BYTE bIsFAT32; | |
| BYTE bDevice; | |
| BYTE bSectorsPerCluster; | |
| BYTE bFlags; | |
| WORD wSectorSize; | |
| DWORD dwRootDirSectors; | |
| DWORD dwFirstRootDirSector; | |
| DWORD dwRootCluster; | |
| DWORD dwFAT1StartSector; | |
| DWORD dwFAT2StartSector; | |
| DWORD dwCluster2StartSector; | |
| DWORD dwClusterSize; | |
| } |
| struct _fhandle | |
| { | |
| DWORD dwFileSize; | |
| DWORD dwStartCluster; | |
| DWORD dwReadCluster; | |
| DWORD dwFilePointer; | |
| DWORD dwClusterPointer; | |
| int nLastError; | |
| int nEOF; | |
| DRIVE_INFO* pDrive; | |
| } |
| struct _atapi_pvd | |
| { | |
| BYTE descr_type; | |
| BYTE magic[5]; | |
| BYTE descr_ver; | |
| BYTE unused; | |
| BYTE sysid[32]; | |
| BYTE volid[32]; | |
| BYTE zeros1[8]; | |
| BYTE seknum[8]; | |
| BYTE zeros2[32]; | |
| BYTE volsetsize[4]; | |
| BYTE volseqnum[4]; | |
| BYTE seksize[4]; | |
| BYTE pathtablen[8]; | |
| DWORD firstsek_LEpathtab1_LE; | |
| DWORD firstsek_LEpathtab2_LE; | |
| BYTE firstsek_BEpathtab1_BE[4]; | |
| BYTE firstsek_BEpathtab2_BE[4]; | |
| BYTE rootdir[34]; | |
| BYTE volsetid[128]; | |
| BYTE pubid[128]; | |
| BYTE dataprepid[128]; | |
| BYTE appid[128]; | |
| BYTE copyr[37]; | |
| BYTE abstractfileid[37]; | |
| BYTE bibliofileid[37]; | |
| BYTE creationdate[17]; | |
| BYTE modify[17]; | |
| BYTE expire[17]; | |
| BYTE effective[17]; | |
| BYTE filestruc_ver; | |
| BYTE zero; | |
| BYTE app_use[512]; | |
| BYTE res[653]; | |
| } |
| struct _ATAPIDirectoryRecord | |
| { | |
| BYTE bRecordSize; | |
| BYTE bShouldBeZero; | |
| DWORD dwFirstSector; | |
| DWORD dwNotUse1; | |
| DWORD dwEntrySize; | |
| DWORD dwNotUse2; | |
| BYTE bDate[7]; | |
| BYTE bFlags; | |
| BYTE bInterleaveInfo[2]; | |
| BYTE bVolumeSequenceNumber[4]; | |
| BYTE bIdentifierLength; | |
| BYTE bName[1]; | |
| } |
| Visible in: | nut/fs/fat.c |
| Used in: | FATFileOpen() | |
| FATInit() |
pSectorBuffer
static BYTE* pSectorBuffer
| Used in: | FATFileRead() | |
| FATMountDrive() | ||
| FindFile() | ||
| FindFileATAPI() | ||
| GetNextCluster() | ||
| MountATAPI() | ||
| MountIDE() |
pLongName1
static char* pLongName1
| Used in: | FATFileOpen() | |
| FATMountDrive() |
pLongName2
static char* pLongName2
| Used in: | FATMountDrive() | |
| FindFile() |
sDriveInfo
static DRIVE_INFO sDriveInfo[2]
| Used in: | FATFileOpen() | |
| FATMountDrive() | ||
| FATUnMountDrive() | ||
| MountATAPI() | ||
| MountIDE() |
hFATSemaphore
static HANDLE hFATSemaphore
| Used in: | FATFree() | |
| FATLock() | ||
| FATSemaInit() |
| Calls: | FATFree() | nut/fs/fat.c |
| FATLock() | nut/fs/fat.c | |
| Used in: | nut/fs/fat.c |
| Calls: | NutEventPost() | |
| Called by: | FATFileClose() | nut/fs/fat.c |
| FATFileOpen() | nut/fs/fat.c | |
| FATFileRead() | nut/fs/fat.c | |
| FATFileSize() | nut/fs/fat.c | |
| FATMountDrive() | nut/fs/fat.c | |
| FATUnMountDrive() | nut/fs/fat.c | |
| References Variables: | hFATSemaphore | nut/fs/fat.c |
| Calls: | NutEventWait() | |
| Called by: | FATFileClose() | nut/fs/fat.c |
| FATFileOpen() | nut/fs/fat.c | |
| FATFileRead() | nut/fs/fat.c | |
| FATFileSize() | nut/fs/fat.c | |
| FATMountDrive() | nut/fs/fat.c | |
| FATUnMountDrive() | nut/fs/fat.c | |
| References Variables: | hFATSemaphore | nut/fs/fat.c |
| Calls: | NutEventPost() | |
| Called by: | FATInit() | nut/fs/fat.c |
| References Variables: | hFATSemaphore | nut/fs/fat.c |
| Calls: | FATMountDrive() | nut/fs/fat.c |
| NutHeapRootAlloc(), NutHeapRootFree() | ||
| Used in: | FATInit() | nut/fs/fat.c |
| Calls: | FATUnMountDrive() | nut/fs/fat.c |
| Used in: | FATInit() | nut/fs/fat.c |
| Called by: | FindFileATAPI() | nut/fs/fat.c |
| Calls: | FATFree() | nut/fs/fat.c |
| FATLock() | nut/fs/fat.c | |
| NutHeapRootFree() | ||
| Used in: | nut/fs/fat.c | |
| Calls: | FATFree() | nut/fs/fat.c |
| FATInit() | nut/fs/fat.c | |
| FATLock() | nut/fs/fat.c | |
| FindFile() | nut/fs/fat.c | |
| FindFileATAPI() | nut/fs/fat.c | |
| memset() | nut/c/string/memset.c | |
| strchr() | nut/c/string/strchr.c | |
| strlen() | nut/c/string/strlen.c | |
| NutHeapRootAlloc(), NutHeapRootFree(), toupper() | ||
| Used in: | nut/fs/fat.c | |
| References Variables: | gnIsInit | nut/fs/fat.c |
| pLongName1 | nut/fs/fat.c | |
| sDriveInfo | nut/fs/fat.c | |
| Used in: | nut/fs/fat.c |
| Used in: | nut/fs/fat.c |
| Calls: | FATMountDrive() | nut/fs/fat.c |
| FATSemaInit() | nut/fs/fat.c | |
| IDEInit() | nut/arch/avr/dev/ide.c | |
| IDEMountDevice() | nut/arch/avr/dev/ide.c | |
| NutHeapRootAlloc(), NutHeapRootFree() | ||
| Called by: | FATFileOpen() | nut/fs/fat.c |
| Used in: | nut/fs/fat.c | |
| References Functions: | CFMount() | nut/fs/fat.c |
| CFUnMount() | nut/fs/fat.c | |
| References Variables: | gnIsInit | nut/fs/fat.c |
| Calls: | FATFree() | nut/fs/fat.c |
| FATLock() | nut/fs/fat.c | |
| Called by: | CFUnMount() | nut/fs/fat.c |
| References Variables: | sDriveInfo | nut/fs/fat.c |
| Calls: | CheckATAPIName() | nut/fs/fat.c |
| IDEReadSectors() | nut/arch/avr/dev/ide.c | |
| RemoveChar() | nut/fs/fat.c | |
| strlen() | nut/c/string/strlen.c | |
| strncmp() | nut/c/string/strncmp.c | |
| Called by: | FATFileOpen() | nut/fs/fat.c |
| References Variables: | pSectorBuffer | nut/fs/fat.c |
| Called by: | FATFileRead() | nut/fs/fat.c |
| FindFile() | nut/fs/fat.c |
| Calls: | toupper() | |
| Called by: | FindFile() | nut/fs/fat.c |
| Calls: | IDEReadSectors() | nut/arch/avr/dev/ide.c |
| Called by: | FATFileRead() | nut/fs/fat.c |
| FindFile() | nut/fs/fat.c | |
| References Variables: | pSectorBuffer | nut/fs/fat.c |
| Calls: | IDEReadSectors() | nut/arch/avr/dev/ide.c |
| Called by: | FATMountDrive() | nut/fs/fat.c |
| References Variables: | pSectorBuffer | nut/fs/fat.c |
| sDriveInfo | nut/fs/fat.c |
| Calls: | IDEReadSectors() | nut/arch/avr/dev/ide.c |
| Called by: | FATMountDrive() | nut/fs/fat.c |
| References Variables: | pSectorBuffer | nut/fs/fat.c |
| sDriveInfo | nut/fs/fat.c |
| Called by: | FindFileATAPI() | nut/fs/fat.c |