Nut/OS  5.0.5
API Reference
fat.c File Reference
#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>
Include dependency graph for fat.c:

Data Structures

struct  DSKSZTOSECPERCLUS
struct  _FAT32FileDataTime
struct  _FAT32DirectoryEntry
struct  _FAT32DirectoryEntryLong
struct  _FAT32FileSystemInformation
struct  _FAT32PartitionEntry
struct  _FAT32PartionTable
struct  _bpbfat16
struct  _bpbfat32
union  _bpboffset36
struct  _FAT32BootRecord
struct  _fat_entry_table16
struct  _fat_entry_table32
union  _fat_dir_table
struct  _drive_info
struct  _fhandle
struct  _atapi_pvd
struct  _ATAPIDirectoryRecord

Defines

#define __FAT_C__
#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   (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

Typedefs

typedef struct _FAT32FileDataTime FAT32_FILEDATETIME
typedef struct _FAT32FileDataTimePFAT32_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 struct _bpbfat16 BPBFAT16
typedef struct _bpbfat32 BPBFAT32
typedef union _bpboffset36 BPBOFFSET36
typedef struct _FAT32BootRecord FAT32_BOOT_RECORD
typedef struct _FAT32BootRecordPFAT32_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 _fhandle FHANDLE
typedef struct _atapi_pvd ATAPI_PVD
typedef struct
_ATAPIDirectoryRecord 
ATAPI2_DIRECTORY_RECORD

Functions

void FATLock (void)
void FATFree (void)
void FATSemaInit (void)
long FATFileSize (NUTFILE *hNUTFile)
int FATFileRead (NUTFILE *hNUTFile, void *pData, int nSize)

Variables

NUTDEVICE devFATC

Define Documentation

#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 Documentation

typedef struct _bpbfat16 BPBFAT16
typedef struct _bpbfat32 BPBFAT32
typedef union _bpboffset36 BPBOFFSET36
typedef struct _drive_info DRIVE_INFO
typedef struct _fhandle FHANDLE
typedef struct _atapi_pvd ATAPI_PVD

Function Documentation

void FATLock ( void  )

References NutEventWait().

Referenced by FATFileRead(), and FATFileSize().

Here is the call graph for this function:

void FATFree ( void  )

References NutEventPost().

Referenced by FATFileRead(), and FATFileSize().

Here is the call graph for this function:

void FATSemaInit ( void  )

References NutEventPost().

Here is the call graph for this function:

long FATFileSize ( NUTFILE hNUTFile)

References _fhandle::dwFileSize, FATFree(), FATLock(), _NUTFILE::nf_fcb, NULL, and NUTDEV_ERROR.

Here is the call graph for this function:

int FATFileRead ( NUTFILE hNUTFile,
void *  pData,
int  nSize 
)

Variable Documentation

Initial value:
 {
    0,                          
    
    {'F', 'A', 'T', '_', 'C', 0, 0, 0, 0}
    ,

    IFTYP_STREAM,               
    2,                          
    0,                          
    0,                          
    0,                          
    FATInit,                    
    0,                          
    FATFileRead,                
    FATFileWrite,               

    FATFileWriteP,              

    FATFileOpen,                
    FATFileClose,               
    FATFileSize
}