#include <string.h>
#include <stddef.h>
#include <ctype.h>
#include <sys/heap.h>
#include <sys/event.h>
#include <sys/thread.h>
#include <sys/device.h>
#include <dev/ide.h>
#include <fs/fat.h>
#include <fs/typedefs.h>
#define __FAT_C__ |
#define FAT_OK 0 |
#define FAT_ERROR -1 |
#define FAT_ERROR_EOF -2 |
Referenced by FATFileRead().
#define FAT_ERROR_IDE -3 |
Referenced by FATFileRead().
#define NUTDEV_OK 0 |
#define NUTDEV_ERROR -1 |
Referenced by FATFileRead(), and FATFileSize().
#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 (FAT_NAME_LEN+FAT_EXT_LEN+1) |
#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 |
typedef struct _FAT32FileDataTime FAT32_FILEDATETIME |
typedef struct _FAT32FileDataTime * PFAT32_FILEDATETIME |
typedef struct _FAT32DirectoryEntry FAT32_DIRECTORY_ENTRY |
typedef struct _FAT32DirectoryEntryLong FAT32_DIRECTORY_ENTRY_LONG |
typedef struct _FAT32FileSystemInformation FAT32_FSINFO |
typedef struct _FAT32PartitionEntry FAT32_PARTITION_ENTRY |
typedef struct _FAT32PartionTable FAT32_PARTITION_TABLE |
typedef union _bpboffset36 BPBOFFSET36 |
typedef struct _FAT32BootRecord FAT32_BOOT_RECORD |
typedef struct _FAT32BootRecord * PFAT32_BOOT_RECORD |
typedef struct _fat_entry_table16 FAT_ENTRY_TABLE16 |
typedef struct _fat_entry_table32 FAT_ENTRY_TABLE32 |
typedef union _fat_dir_table FAT_DIR_TABLE |
typedef struct _drive_info DRIVE_INFO |
typedef struct _atapi_pvd ATAPI_PVD |
typedef struct _ATAPIDirectoryRecord ATAPI2_DIRECTORY_RECORD |
void FATLock | ( | void | ) |
References NutEventWait().
Referenced by FATFileRead(), and FATFileSize().
void FATFree | ( | void | ) |
References NutEventPost().
Referenced by FATFileRead(), and FATFileSize().
void FATSemaInit | ( | void | ) |
long FATFileSize | ( | NUTFILE * | hNUTFile | ) |
References _fhandle::dwFileSize, FATFree(), FATLock(), _NUTFILE::nf_fcb, NULL, and NUTDEV_ERROR.
int FATFileRead | ( | NUTFILE * | hNUTFile, |
void * | pData, | ||
int | nSize | ||
) |
References _drive_info::bDevice, _fhandle::dwClusterPointer, _drive_info::dwClusterSize, _fhandle::dwFilePointer, _fhandle::dwFileSize, _fhandle::dwReadCluster, FAT_ERROR_EOF, FAT_ERROR_IDE, FATFree(), FATLock(), IDE_OK, IDEReadSectors(), memcpy(), _fhandle::nEOF, _NUTFILE::nf_fcb, _fhandle::nLastError, NULL, NUTDEV_ERROR, _fhandle::pDrive, TRUE, and _drive_info::wSectorSize.
{ 0, {'F', 'A', 'T', '_', 'C', 0, 0, 0, 0} , IFTYP_STREAM, 2, 0, 0, 0, FATInit, 0, FATFileRead, FATFileWrite, FATFileWriteP, FATFileOpen, FATFileClose, FATFileSize }