LUFA Library - Mass Storage Class Bootloader
|
#include "VirtualFAT.h"
Functions | |
static uint8_t | ReadEEPROMByte (const uint8_t *const Address) |
static void | WriteEEPROMByte (uint8_t *const Address, const uint8_t Data) |
static void | UpdateFAT12ClusterEntry (uint8_t *const FATTable, const uint16_t Index, const uint16_t ChainEntry) |
static void | UpdateFAT12ClusterChain (uint8_t *const FATTable, const uint16_t Index, const uint8_t ChainLength) |
static void | ReadWriteFLASHFileBlock (const uint16_t BlockNumber, uint8_t *BlockBuffer, const bool Read) |
static void | ReadWriteEEPROMFileBlock (const uint16_t BlockNumber, uint8_t *BlockBuffer, const bool Read) |
void | VirtualFAT_WriteBlock (const uint16_t BlockNumber) |
void | VirtualFAT_ReadBlock (const uint16_t BlockNumber) |
Variables | |
static const FATBootBlock_t | BootBlock |
static FATDirectoryEntry_t | FirmwareFileEntries [] |
static const uint16_t * | FLASHFileStartCluster = &FirmwareFileEntries[DISK_FILE_ENTRY_FLASH_MSDOS].MSDOS_File.StartingCluster |
static const uint16_t * | EEPROMFileStartCluster = &FirmwareFileEntries[DISK_FILE_ENTRY_EEPROM_MSDOS].MSDOS_File.StartingCluster |
Virtualized FAT12 filesystem implementation, to perform self-programming in response to read and write requests to the virtual filesystem by the host PC.
|
static |
Reads a byte of EEPROM out from the EEPROM memory space.
[in] | Address | Address of the EEPROM location to read from |
|
static |
Reads or writes a block of data from/to the physical device EEPROM using a block buffer stored in RAM, if the requested block is within the virtual firmware file's sector ranges in the emulated FAT file system.
[in] | BlockNumber | Physical disk block to read from/write to |
[in,out] | BlockBuffer | Pointer to the start of the block buffer in RAM |
[in] | Read | If true , the requested block is read, if false , the requested block is written |
|
static |
Reads or writes a block of data from/to the physical device FLASH using a block buffer stored in RAM, if the requested block is within the virtual firmware file's sector ranges in the emulated FAT file system.
[in] | BlockNumber | Physical disk block to read from/write to |
[in,out] | BlockBuffer | Pointer to the start of the block buffer in RAM |
[in] | Read | If true , the requested block is read, if false , the requested block is written |
|
static |
Updates a FAT12 cluster chain in the FAT file table with a linear chain of the specified length.
[out] | FATTable | Pointer to the FAT12 allocation table |
[in] | Index | Index of the start of the cluster chain to update |
[in] | ChainLength | Length of the chain to write, in clusters |
|
static |
Updates a FAT12 cluster entry in the FAT file table with the specified next chain index. If the cluster is the last in the file chain, the magic value 0xFFF
should be used.
[out] | FATTable | Pointer to the FAT12 allocation table |
[in] | Index | Index of the cluster entry to update |
[in] | ChainEntry | Next cluster index in the file chain |
void VirtualFAT_ReadBlock | ( | const uint16_t | BlockNumber) |
Reads a block of data from the virtual FAT filesystem, and sends it to the host via the USB Mass Storage interface.
[in] | BlockNumber | Index of the block to read. |
void VirtualFAT_WriteBlock | ( | const uint16_t | BlockNumber) |
Writes a block of data to the virtual FAT filesystem, from the USB Mass Storage interface.
[in] | BlockNumber | Index of the block to write. |
|
static |
Writes a byte of EEPROM out to the EEPROM memory space.
[in] | Address | Address of the EEPROM location to write to |
[in] | Data | New data to write to the EEPROM location |
|
static |
FAT filesystem boot sector block, must be the first sector on the physical disk so that the host can identify the presence of a FAT filesystem. This block is truncated; normally a large bootstrap section is located near the end of the block for booting purposes however as this is not meant to be a bootable disk it is omitted for space reasons.
|
static |
Starting cluster of the virtual EEPROM.BIN file on disk, tracked so that the offset from the start of the data sector can be determined. On Windows systems files are usually replaced using the original file's disk clusters, while Linux appears to overwrite with an offset which must be compensated for.
|
static |
FAT 8.3 style directory entry, for the virtual FLASH contents file.
|
static |
Starting cluster of the virtual FLASH.BIN file on disk, tracked so that the offset from the start of the data sector can be determined. On Windows systems files are usually replaced using the original file's disk clusters, while Linux appears to overwrite with an offset which must be compensated for.