#include <Fat16.h>
Public Member Functions | |
uint8_t | close (void) |
uint8_t | create (char *fileName) |
uint32_t | fileSize (void) |
uint8_t | isOpen (void) |
uint8_t | open (char *fileName) |
uint8_t | open (uint16_t entry) |
int16_t | read (void) |
int16_t | read (uint8_t *dst, uint16_t count) |
uint32_t | readPos (void) |
uint8_t | seek (uint32_t pos) |
uint8_t | sync (void) |
void | write (uint8_t b) |
int16_t | write (uint8_t *src, uint16_t count) |
Static Public Member Functions | |
static uint8_t | init (BlockDevice &dev, uint8_t part) |
static dir_t * | readDir (uint16_t &entry, uint8_t skip=(DIR_ATT_VOLUME_ID|DIR_ATT_DIRECTORY)) |
static uint16_t | rootDirEntryCount (void) |
static void | dbgSetDev (BlockDevice &dev) |
static uint8_t * | dbgCacheBlock (uint32_t blockNumber) |
static dir_t * | dbgCacheDir (uint16_t index) |
static uint16_t * | dbgCacheFat (uint16_t cluster) |
Fat16 does not support subdirectories or long file names.
uint8_t Fat16::init | ( | BlockDevice & | dev, | |
uint8_t | part | |||
) | [static] |
Initialize a FAT16 volume.
[in] | dev | The BlockDevice where the volume is located. |
[in] | part | The partition to be used. Legal values for part are 1-4 to use the corresponding partition on a device formatted with a MBR, Master Boot Record, or zero if the device is formatted as a super floppy with the FAT boot sector in block zero. |
static dir_t* Fat16::readDir | ( | uint16_t & | entry, | |
uint8_t | skip = (DIR_ATT_VOLUME_ID | DIR_ATT_DIRECTORY) | |||
) | [inline, static] |
Read the next short, 8.3, directory entry into the cache buffer.
Unused entries and entries for long names are skipped.
The directory entry must not be modified since the cached block containing the entry may be written back to the storage device.
[in,out] | entry | The search starts at entry and entry is updated with the root directory index of the found directory entry. If the entry is a file, it may be opened by calling open(entry). |
[in] | skip | Skip entries that have these attributes. If skip is not specified, the default is to skip the volume label and directories. |
static uint16_t Fat16::rootDirEntryCount | ( | void | ) | [inline, static] |
uint8_t Fat16::close | ( | void | ) |
Closes a file and forces cached data and directory information to be written to the storage device.
uint8_t Fat16::create | ( | char * | fileName | ) |
Create and open a new file.
[in] | fileName | a valid DOS 8.3 file name. |
uint32_t Fat16::fileSize | ( | void | ) | [inline] |
uint8_t Fat16::isOpen | ( | void | ) | [inline] |
Checks the file's open/closed status for this instance of Fat16.
uint8_t Fat16::open | ( | char * | fileName | ) |
Open a file for read and write by file name. Two file positions are maintained. The write position is at the end of the file. Data is appended to the file. The read position starts at the beginning of the file.
[in] | fileName | A valid 8.3 DOS name for a file in the root directory. |
uint8_t Fat16::open | ( | uint16_t | index | ) |
Open a file for read and write by file index. Two file positions are maintained. The write position is at the end of the file. Data is appended to the file. The read position starts at the beginning of the file.
[in] | index | The root directory index of the file to be opened. See readDir(). |
int16_t Fat16::read | ( | void | ) |
Read the next byte from a file.
int16_t Fat16::read | ( | uint8_t * | dst, | |
uint16_t | count | |||
) |
Read data from a file at starting at the current read position.
[out] | dst | Pointer to the location that will receive the data. |
[in] | count | Maximum number of bytes to read. |
uint32_t Fat16::readPos | ( | void | ) | [inline] |
uint8_t Fat16::seek | ( | uint32_t | pos | ) |
Sets the file's read position.
[in] | pos | The new read position in bytes from the beginning of the file. |
uint8_t Fat16::sync | ( | void | ) |
void Fat16::write | ( | uint8_t | b | ) | [virtual] |
int16_t Fat16::write | ( | uint8_t * | src, | |
uint16_t | count | |||
) |
Write data at the end of an open file.
[in] | src | Pointer to the location of the data to be written. |
[in] | count | Number of bytes to write. |
static void Fat16::dbgSetDev | ( | BlockDevice & | dev | ) | [inline, static] |
For debug only. Do not use in applications.
static uint8_t* Fat16::dbgCacheBlock | ( | uint32_t | blockNumber | ) | [inline, static] |
For debug only. Do not use in applications.
static dir_t* Fat16::dbgCacheDir | ( | uint16_t | index | ) | [inline, static] |
For debug only. Do not use in applications.
static uint16_t* Fat16::dbgCacheFat | ( | uint16_t | cluster | ) | [inline, static] |
For debug only. Do not use in applications.