FAT filesystem top level header file. More...
#include <stdint.h>
Classes | |
struct | tsDevInfo |
This structure provides the FAT drivers with the necessary information to interface to the physical media. More... | |
struct | FAT_DIRENT |
This structure describes a directory entry from FAT_readdir(). More... |
Macros | |
#define | FATFS_OK 0 |
The following are the error codes used by the FAT driver. | |
#define | FATFS_INVALID_PATH -1 |
Path was not valid 8.3. | |
#define | FATFS_FILE_NOT_FOUND -2 |
File was not found. | |
#define | FATFS_FAT_TYPE_NOT_SUPPORTED -3 |
FAT type not supported. | |
#define | FATFS_DEVICE_READ_FAILED -4 |
Read from device failed. | |
#define | FATFS_DEVICE_WRITE_FAILED -5 |
Write to device failed. | |
#define | FATFS_DIR_NOT_FOUND -6 |
Sub-directory not found. | |
#define | FATFS_FILE_CREATE_FAILED -7 |
File creation failed. | |
#define | FATFS_FILEID_OUT_OF_RANGE -8 |
File ID out of range. | |
#define | FATFS_DIRECTORY_FULL -9 |
Directory is full. | |
#define | FATFS_DISK_FULL -10 |
Device is full. | |
#define | FATFS_FILEID_NOT_OPENED -11 |
Specified file ID not opened. | |
#define | FATFS_BAD_SEEK_ORIGIN -12 |
Bad origin provided for seek cmd. | |
#define | FATFS_INVALID_PARTITION -13 |
Invalid partition data. | |
#define | FATFS_FILE_ALREADY_EXISTS -14 |
Attempt to overwrite an existing file failed. | |
#define | FATFS_DIRECTORY_NOT_EMPTY -15 |
Directory must be empty prior to deletion. | |
#define | FAT_ATTRIB_READONLY 0x01 |
The following are the valid FAT file attributes. | |
#define | FAT_ATTRIB_HIDDEN 0x02 |
#define | FAT_ATTRIB_SYSTEM 0x04 |
#define | FAT_ATTRIB_VOLUMELABEL 0x08 |
#define | FAT_ATTRIB_SUBDIR 0x10 |
#define | FAT_ATTRIB_ARCHIVE 0x20 |
#define | FAT_ATTRIB_DEVICE 0x40 |
#define | FATIONOATIME 0x89F0 |
Device private ioctl calls (From GNU C headers...) |
Typedefs | |
typedef int(* | RAWREAD )(uint32_t start_sector, uint32_t offset, char *buffer, uint32_t length, void *apDriverData) |
Template function for Device Read Request used by FAT driver software. | |
typedef int(* | RAWWRITE )(uint32_t start_sector, uint32_t offset, char *buffer, uint32_t length, void *apDriverData) |
Template function for Device Write Request used by FAT driver software. | |
typedef int(* | GETTIME )(unsigned int *apYear, unsigned int *apMonth, unsigned int *apDay, unsigned int *apHour, unsigned int *apMinutes, unsigned int *apSeconds, unsigned int *apHundredths) |
Template function for the Real-Time Clock access used by FAT driver software. | |
typedef int(* | DEBUGHANDLER )(const char *apErrorString, int aeSeverity) |
Debugging string for FAT development. | |
typedef struct FAT_DIRENT | FAT_dirent |
This structure describes a directory entry from FAT_readdir(). | |
typedef void | FAT_DIR |
Functions | |
int | RegisterFATDriver (RAWREAD apRawReadFunc, RAWWRITE apRawWriteFunc, GETTIME apGetTimeFunc, tsDevInfo *apRawInfo, char *apDeviceName, void *apDriverData) |
Register a FAT device/driver with BIOS CIO utilities. | |
int | RemoveFATDriver (char *name) |
REMOVE a FAT device/driver with BIOS CIO utilities. | |
int | RegisterFATDebugHandler (DEBUGHANDLER apDebugFunc, void *apUserData) |
int | FAT_format (tsDevInfo *apRawInfo, RAWWRITE apRawWriteFunc, char *apFATType, void *apDriverData) |
FORMAT a device with a FAT filesystem. | |
int | FAT_mkdir (const char *path) |
Create directory on a FAT FileSystem. | |
int | FAT_rmdir (const char *path) |
Remove an empty directory on a FAT FileSystem. | |
double | FAT_getdiskfree (const char *apDrive) |
Computes the free space on a device based upon the free cluster count. | |
int | FAT_ioctl (const char *apDevName, int cmd, void *argp) |
IOCTL for FAT filasystem Supported IOCTLs are. | |
FAT_DIR * | FAT_opendir (const char *dirname) |
Open directory for reading (listing). | |
int | FAT_closedir (FAT_DIR *dirp) |
Close / Free resources associated with FAT_DIR structure initialized with FAT_opendir(). | |
int | FAT_readdir (FAT_DIR *dirp, FAT_dirent *direntp) |
Read next directory entry of FAT directory structure. | |
int | FAT_rewinddir (FAT_DIR *dirp) |
Resets directory listing pointer to beginning of list for a valid FAT_DIR entry as initalized by FAT_opendir. |
FAT filesystem top level header file.
This file contains the header information necessary for intializing a FAT filesystem device.
o 0 | / Copyright (c) 2007-2008 (CL)---o Critical Link, LLC \ O
#define FATFS_OK 0 |
The following are the error codes used by the FAT driver.
No error
#define FATFS_INVALID_PATH -1 |
Path was not valid 8.3.
#define FATFS_FILE_NOT_FOUND -2 |
File was not found.
#define FATFS_FAT_TYPE_NOT_SUPPORTED -3 |
FAT type not supported.
#define FATFS_DEVICE_READ_FAILED -4 |
Read from device failed.
#define FATFS_DEVICE_WRITE_FAILED -5 |
Write to device failed.
#define FATFS_DIR_NOT_FOUND -6 |
Sub-directory not found.
#define FATFS_FILE_CREATE_FAILED -7 |
File creation failed.
#define FATFS_FILEID_OUT_OF_RANGE -8 |
File ID out of range.
#define FATFS_DIRECTORY_FULL -9 |
Directory is full.
#define FATFS_DISK_FULL -10 |
Device is full.
#define FATFS_FILEID_NOT_OPENED -11 |
Specified file ID not opened.
#define FATFS_BAD_SEEK_ORIGIN -12 |
Bad origin provided for seek cmd.
#define FATFS_INVALID_PARTITION -13 |
Invalid partition data.
#define FATFS_FILE_ALREADY_EXISTS -14 |
Attempt to overwrite an existing file failed.
#define FATFS_DIRECTORY_NOT_EMPTY -15 |
Directory must be empty prior to deletion.
#define FAT_ATTRIB_READONLY 0x01 |
The following are the valid FAT file attributes.
#define FAT_ATTRIB_HIDDEN 0x02 |
#define FAT_ATTRIB_SYSTEM 0x04 |
#define FAT_ATTRIB_VOLUMELABEL 0x08 |
#define FAT_ATTRIB_SUBDIR 0x10 |
#define FAT_ATTRIB_ARCHIVE 0x20 |
#define FAT_ATTRIB_DEVICE 0x40 |
#define FATIONOATIME 0x89F0 |
Device private ioctl calls (From GNU C headers...)
typedef int(* RAWREAD)(uint32_t start_sector, uint32_t offset, char *buffer, uint32_t length, void *apDriverData) |
Template function for Device Read Request used by FAT driver software.
[in] | start_sector | starting sector to read from |
[in] | offset | numbet of bytes from beginning of sector |
[in,out] | buffer | buffer to store requested data from device |
[in] | length | number of bytes to retrieve |
[in] | apDriverData | Drive Data Info, see RegisterFATDriver |
typedef int(* RAWWRITE)(uint32_t start_sector, uint32_t offset, char *buffer, uint32_t length, void *apDriverData) |
Template function for Device Write Request used by FAT driver software.
[in] | start_sector | starting sector to read from |
[in] | offset | numbet of bytes from beginning of sector |
[in] | buffer | buffer to copy requested data to device |
[in] | length | number of bytes to write |
[in] | apDriverData | Drive Data Info, see RegisterFATDriver |
typedef int(* GETTIME)(unsigned int *apYear, unsigned int *apMonth, unsigned int *apDay, unsigned int *apHour, unsigned int *apMinutes, unsigned int *apSeconds, unsigned int *apHundredths) |
Template function for the Real-Time Clock access used by FAT driver software.
[out] | apYear | Year (1900-20??). |
[out] | apMonth | Month (1-12). |
[out] | apDay | Day of the month (1-31). |
[out] | apHour | Hours since midnight (0-23). |
[out] | apMinutes | Minutes (0-59). |
[out] | apSeconds | Seconds (0-59). |
[out] | apHundredths | Hundredths of a second (0-99), always zero if not supported by RTC. |
typedef int(* DEBUGHANDLER)(const char *apErrorString, int aeSeverity) |
Debugging string for FAT development.
[in] | apErrorString | string describing error condition |
[in] | aeSeverity | range 0-3 (debug, status, warning, error) |
typedef struct FAT_DIRENT FAT_dirent |
This structure describes a directory entry from FAT_readdir().
typedef void FAT_DIR |
int RegisterFATDriver | ( | RAWREAD | apRawReadFunc, |
RAWWRITE | apRawWriteFunc, | ||
GETTIME | apGetTimeFunc, | ||
tsDevInfo * | apRawInfo, | ||
char * | apDeviceName, | ||
void * | apDriverData | ||
) |
Register a FAT device/driver with BIOS CIO utilities.
This routine will load/interrogate the FAT tables on the provided device and register the device driver with the TI stdio lookup table.
[in] | apRawReadFunc | Pointer to RawRead Function used by Driver. |
[in] | apRawWriteFunc | Pointer to RawWrite function used by Driver. |
[in] | apGetTimeFunc | Pointer to RTC function used by Driver (if no RTC available, should be NULL to use tick timer). |
[in] | apRawInfo | Raw Device Info, required by FAT Driver. |
[in] | apDeviceName | Name of device, e.g. "RAMDISK". Must be less than 32 characters. This name is used to specify a path to fopen() from BIOS, e.g., "RAMDISK:\my\home\directory". |
[in] | apDriverData | Driver Data passed to RawRead and RawWrite Routines. |
int RemoveFATDriver | ( | char * | apDeviceName | ) |
REMOVE a FAT device/driver with BIOS CIO utilities.
This routine will remove a FAT device.
[in] | apDeviceName | Name of device, e.g. "RAMDISK". Must be less than 32 characters. This name is used to specify a path to fopen() from BIOS, e.g., "RAMDISK:\my\home\directory". |
int RegisterFATDebugHandler | ( | DEBUGHANDLER | apDebugFunc, |
void * | apUserData | ||
) |
int FAT_format | ( | tsDevInfo * | apRawInfo, |
RAWWRITE | apRawWriteFunc, | ||
char * | apFATType, | ||
void * | apDriverData | ||
) |
FORMAT a device with a FAT filesystem.
This routine is useful for non-volatile devices requiring a FAT filesystem.
[in] | apRawInfo | Device Info Structure required by FAT formatting logic. |
[in] | apRawWriteFunc | Raw Write routine called during format operation. |
[in] | apFATType | "FAT16" (FAT32 and FAT 12 are currently not supported) |
[in] | apDriverData | device drive info passwd to apRawWriteFunc. |
int FAT_mkdir | ( | const char * | apPath | ) |
Create directory on a FAT FileSystem.
[in] | apPath | Fully qualified path of directory to create |
int FAT_rmdir | ( | const char * | apPath | ) |
Remove an empty directory on a FAT FileSystem.
[in] | apPath | Fully qualified path of directory to create |
double FAT_getdiskfree | ( | const char * | apDrive | ) |
Computes the free space on a device based upon the free cluster count.
[in] | apDrive | Path name (including at least the device identifier) of the device to compute free space for. |
int FAT_ioctl | ( | const char * | apDevName, |
int | cmd, | ||
void * | argp | ||
) |
IOCTL for FAT filasystem Supported IOCTLs are.
[in] | apDevName | - Device name to perform IOCTL on |
[in] | cmd | - IOCTL command to implement |
[in] | argp | - cmd specific data |
FAT_DIR* FAT_opendir | ( | const char * | apDirName | ) |
Open directory for reading (listing).
Use this call in combination with FAT_readdir, FAT_closedir, and FAT_rewinddir in order to gather contents of a specified directory.
[in] | apDirName | Fully qualified path of interest |
int FAT_closedir | ( | FAT_DIR * | ahDir | ) |
Close / Free resources associated with FAT_DIR structure initialized with FAT_opendir().
[in] | ahDir | Pointer to successfully opened FAT_DIR structure |
int FAT_readdir | ( | FAT_DIR * | ahDir, |
FAT_dirent * | apDirent | ||
) |
Read next directory entry of FAT directory structure.
[in] | ahDir | Pointer to a valid FAT_DIR from FAT_opendir |
[out] | apDirent | Pointer to a valid buffer to populate with listing contents. |
int FAT_rewinddir | ( | FAT_DIR * | ahDir | ) |
Resets directory listing pointer to beginning of list for a valid FAT_DIR entry as initalized by FAT_opendir.
[in] | ahDir | Pointer to a valid FAT_DIR from FAT_opendir |