VLSI Solution Oy / MegaLib Documentation

minifat.h File Reference

#include <vstypes.h>
#include "fat.h"

Include dependency graph for minifat.h:

Go to the source code of this file.

Defines

#define MINIFAT_H

Typedefs

typedef s_int16(* freeSectorCallback )(void *private, u_int32 sector, u_int32 numSecs)

Functions

auto u_int16 FatGetByte (register __c0 u_int16 n)
auto u_int16 FatGetWord (register __c0 u_int16 n)
auto u_int32 FatGetLong (register __c0 u_int16 n)
auto u_int16 FatInitFileSystem (void)
auto __y struct FRAGMENTFatFragmentList (register __i2 __y struct FRAGMENT *frag, register __reg_b u_int32 fatCluster)
auto s_int16 FatHandleDir (register __y struct FRAGMENT *curFragment, __y struct FRAGMENT *nextFragment)
auto s_int16 FatOpenFile (register __c0 u_int16 fileNum)
auto s_int16 FatReadFile (register __i3 u_int16 *buf, register __c1 s_int16 byteOff, register __c0 s_int16 byteSize)
u_int32 FatTell (void)
u_int32 FatSeek (register __reg_a u_int32 pos)
auto u_int32 FatFindSector (register __reg_d u_int32 pos)
auto s_int16 FatCheckFileType (register __reg_a u_int32 suffix)
void MemCopyPackedBigEndian (register __i0 u_int16 *dst, register __a0 u_int16 dstidx, register __i1 u_int16 *src, register __a1 u_int16 srcidx, register __b0 u_int16 byteSize)
void MemCopyPackedLittleEndian (register __i0 u_int16 *dst, register __a0 u_int16 dstidx, register __i1 u_int16 *src, register __a1 u_int16 srcidx, register __b0 u_int16 byteSize)
void MemWritePacked (register __a0 void *dst, register __a1 u_int16 dstidx, register __b0 u_int16 dat)
u_int16 MemReadPacked (register __a0 const void *src, register __a1 u_int16 srcidx)
void MemWritePackedY (register __a0 __y void *dst, register __a1 u_int16 dstidx, register __b0 u_int16 dat)
u_int16 MemReadPackedY (register __a0 __y const void *src, register __a1 u_int16 srcidx)
s_int16 FatIterateOverFreeSectors (freeSectorCallback callBackFunction, void *private)
auto u_int16 ReadDiskSector (register __i0 u_int16 *buffer, register __reg_a u_int32 sector)


Detailed Description

MiniFAT contains functions to handle one simultaneous open file.

Definition in file minifat.h.


Define Documentation

#define MINIFAT_H
 

Definition at line 7 of file minifat.h.


Typedef Documentation

typedef s_int16(* freeSectorCallback)(void *private, u_int32 sector, u_int32 numSecs)
 

Definition at line 126 of file minifat.h.


Function Documentation

auto s_int16 FatCheckFileType register __reg_a u_int32  suffix  ) 
 

Internal function to compare the 24-bit parameter to allowed suffixes.

Parameters:
suffix The suffix to compare.
Returns:
non-zero if suffix matches, or minifatInfo.supportedSuffixes is NULL.

auto u_int32 FatFindSector register __reg_d u_int32  pos  ) 
 

Internal function to locate the right sector for the current read position.

Parameters:
pos Byte position to find.
Returns:
the FAT sector that corresponds to the pos.

auto __y struct FRAGMENT* FatFragmentList register __i2 __y struct FRAGMENT frag,
register __reg_b u_int32  fatCluster
 

Creates a list of fragments in a file, starting from a specified FAT cluster.

Parameters:
frag fragment array entry to start filling information from.
fatCluster fat cluster to start from.
Returns:
the next free fragment array entry.

auto u_int16 FatGetByte register __c0 u_int16  n  ) 
 

Reads byte values from minifatBuffer.

Parameters:
n byte offset of the value inside minifatBuffer
Returns:
byte value

auto u_int32 FatGetLong register __c0 u_int16  n  ) 
 

Reads 32-bit long values from minifatBuffer.

Parameters:
n byte offset of the little-endian value inside minifatBuffer
Returns:
long value

auto u_int16 FatGetWord register __c0 u_int16  n  ) 
 

Reads 16-bit word values from minifatBuffer.

Parameters:
n byte offset of the little-endian value inside minifatBuffer
Returns:
word value

auto s_int16 FatHandleDir register __y struct FRAGMENT curFragment,
__y struct FRAGMENT nextFragment
 

Internal function that scans files until the right file is found. Uses minifatInfo.gFileNum[0] and minifatInfo.gFileNum[1] for file number counts.

Parameters:
curFragment The clusters in the directory to scan.
nextFragment The first free fragment table entry, used for recursion.
Returns:
< 0 for file found, otherwise the total number of files (can be 0).

auto u_int16 FatInitFileSystem void   ) 
 

Initializes the file system and checks if FAT present.

Returns:
0 for success.

s_int16 FatIterateOverFreeSectors freeSectorCallback  callBackFunction,
void *  private
 

Finds free areas from the FAT disk and executes a callback function.

Parameters:
callBackFunction Is called for each free area. If callback returns non-zero, the iteration is ended prematurely.
private a private parameter to be passed to the callBackFunction.

auto s_int16 FatOpenFile register __c0 u_int16  fileNum  ) 
 

Opens the specified file for reading. Only counts files that match a suffix set in the array set to minifatInfo.supportedSuffixes, or all files if minifatInfo.supportedSuffixes is NULL.

Parameters:
fileNum The number of file to open, starting from 0.
Returns:
< 0 for file found, otherwise the total number of files (can be 0).

auto s_int16 FatReadFile register __i3 u_int16 buf,
register __c1 s_int16  byteOff,
register __c0 s_int16  byteSize
 

u_int32 FatSeek register __reg_a u_int32  pos  ) 
 

Changes the current read byte position of the file.

Parameters:
pos Absolute position for the new read byte position.
Returns:
The old read position.

u_int32 FatTell void   ) 
 

Returns the current read byte position of the file.

Returns:
Current read position.

void MemCopyPackedBigEndian register __i0 u_int16 dst,
register __a0 u_int16  dstidx,
register __i1 u_int16 src,
register __a1 u_int16  srcidx,
register __b0 u_int16  byteSize
 

Copies big-endian packed byte strings with arbitrary alignments (in X memory).

Parameters:
dst destination word pointer
dstidx destination byte offset
src source word pointer
srcidx source byte offset
byteSize the number of bytes to copy

void MemCopyPackedLittleEndian register __i0 u_int16 dst,
register __a0 u_int16  dstidx,
register __i1 u_int16 src,
register __a1 u_int16  srcidx,
register __b0 u_int16  byteSize
 

Not in VS1000B ROM!

u_int16 MemReadPacked register __a0 const void *  src,
register __a1 u_int16  srcidx
 

Not in VS1000B ROM!

u_int16 MemReadPackedY register __a0 __y const void *  src,
register __a1 u_int16  srcidx
 

Not in VS1000B ROM!

void MemWritePacked register __a0 void *  dst,
register __a1 u_int16  dstidx,
register __b0 u_int16  dat
 

Not in VS1000B ROM!

void MemWritePackedY register __a0 __y void *  dst,
register __a1 u_int16  dstidx,
register __b0 u_int16  dat
 

Writes bytes to big-endian packed byte array in Y memory.

Parameters:
dst destination word pointer
dstidx destination byte offset
dat byte to write, the value should be 0..255

auto u_int16 ReadDiskSector register __i0 u_int16 buffer,
register __reg_a u_int32  sector
 

Outside service that must be provided for minifat. VS1000 provides this function through IRAM hook ReadDiskSector. The default value for it is MapperReadDiskSector(), which uses map->Read() to implement the sector read.

Parameters:
buffer the buffer for the sector data.
sector the sector to read.


All software copyright 2005-2006 VLSI Solution OY. Redistribution of this software is strictly forbidden.