ATmega8GPSLoggerBasismodul  20131018
fat16.c File Reference
#include <stdio.h>
#include <avr/io.h>
#include "mmc.h"
#include "fat16.h"
Include dependency graph for fat16.c:

Go to the source code of this file.

Functions

unsigned char InitFat16 (void)
 
unsigned char fopen_ (unsigned char *fname, char mode, File *file)
 
int fflush_ (File *file)
 
void fclose_ (File *file)
 
unsigned long fread_ (void *buffer, unsigned long size, unsigned long count, File *file)
 
unsigned long fwrite_ (void *buffer, unsigned long size, unsigned long count, File *file)
 
int fseek_ (File *file, long offset, int origin)
 
int fgetchar_ (File *file)
 
unsigned char fputchar_ (File *file, char c)
 
unsigned char fputs_ (File *file, char *string)
 
char * fgets_ (char *string, int count, File *file)
 
unsigned char fexist_ (unsigned char *fname, File *file)
 
unsigned int GetNextCluster (File *file)
 
unsigned int FindNextFreeCluster (File *file)
 
unsigned char AppendCluster (File *file)
 
unsigned int GetFatClusterOffset (File *file)
 
unsigned int GetFatSectorIndex (File *file)
 
unsigned char CreateDirectoryEntry (unsigned char *fname, unsigned int cluster, File *file, unsigned char attrib)
 
unsigned char SeekDirectoryEntry (unsigned char *fname, File *file)
 
unsigned char ScanSubDirectories (unsigned char *fname, File *file)
 
void SeperateFileName (unsigned char *fname, unsigned char *name)
 

Variables

unsigned char SectorsPerCluster = 0
 
unsigned char FatCopies = 0
 
unsigned int PossibleRootEntries = 0
 
unsigned int SectorsPerFat = 0
 
unsigned long ReservedSectors = 0
 
unsigned long FirstPartitionSector = 0
 
unsigned long FileAllocationTable = 0
 
unsigned long RootDirectory = 0
 
unsigned long FirstDataCluster = 0
 
unsigned char FileBuffer [512]
 
struct DirEntryDirectoryEntry
 
struct FatEntryFat
 

Function Documentation

unsigned char AppendCluster ( File file)

Definition at line 614 of file fat16.c.

References afile::cluster_pointer, FileAllocationTable, FileBuffer, FindNextFreeCluster(), FirstDataCluster, GetFatClusterOffset(), GetFatSectorIndex(), FatEntry::next_cluster, SDC_GetSector, SDC_PutSector, and SectorsPerCluster.

Referenced by fputchar_().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char CreateDirectoryEntry ( unsigned char *  fname,
unsigned int  cluster,
File file,
unsigned char  attrib 
)
void fclose_ ( File file)

Definition at line 195 of file fat16.c.

References afile::attribute, afile::byte_index, afile::cluster_pointer, afile::directory_index, afile::directory_sector, fflush_(), afile::fileposition, afile::filesize, afile::mode, afile::sector_in_buffer, afile::sector_index, and afile::start_cluster.

Referenced by fexist_(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char fexist_ ( unsigned char *  fname,
File file 
)

Definition at line 505 of file fat16.c.

References fclose_(), and fopen_().

Here is the call graph for this function:

int fflush_ ( File file)
int fgetchar_ ( File file)

Definition at line 356 of file fat16.c.

References afile::byte_index, afile::cluster_pointer, FileBuffer, afile::filesize, GetNextCluster(), SDC_GetSector, afile::sector_in_buffer, afile::sector_index, and SectorsPerCluster.

Referenced by fgets_(), and fread_().

Here is the call graph for this function:

Here is the caller graph for this function:

char* fgets_ ( char *  string,
int  count,
File file 
)

Definition at line 463 of file fat16.c.

References fgetchar_().

Here is the call graph for this function:

unsigned int FindNextFreeCluster ( File file)

Definition at line 574 of file fat16.c.

References FileAllocationTable, FileBuffer, FatEntry::next_cluster, SDC_GetSector, SDC_PutSector, afile::sector_in_buffer, and SectorsPerFat.

Referenced by AppendCluster(), and fopen_().

Here is the caller graph for this function:

unsigned char fopen_ ( unsigned char *  fname,
char  mode,
File file 
)
unsigned char fputchar_ ( File file,
char  c 
)

Definition at line 400 of file fat16.c.

References AppendCluster(), afile::byte_index, afile::cluster_pointer, FileBuffer, afile::fileposition, afile::filesize, SDC_PutSector, afile::sector_index, and SectorsPerCluster.

Referenced by fputs_(), and fwrite_().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char fputs_ ( File file,
char *  string 
)

Definition at line 443 of file fat16.c.

References fputchar_().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned long fread_ ( void *  buffer,
unsigned long  size,
unsigned long  count,
File file 
)

Definition at line 221 of file fat16.c.

References fgetchar_(), and DirEntry::size.

Here is the call graph for this function:

int fseek_ ( File file,
long  offset,
int  origin 
)

Definition at line 286 of file fat16.c.

References afile::byte_index, afile::cluster_pointer, FileBuffer, afile::fileposition, afile::filesize, GetNextCluster(), SDC_GetSector, afile::sector_index, SectorsPerCluster, and afile::start_cluster.

Referenced by fopen_().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned long fwrite_ ( void *  buffer,
unsigned long  size,
unsigned long  count,
File file 
)

Definition at line 254 of file fat16.c.

References fputchar_(), and DirEntry::size.

Here is the call graph for this function:

unsigned int GetFatClusterOffset ( File file)

Definition at line 646 of file fat16.c.

References afile::cluster_pointer, FirstDataCluster, and SectorsPerCluster.

Referenced by AppendCluster(), and GetFatSectorIndex().

Here is the caller graph for this function:

unsigned int GetFatSectorIndex ( File file)

Definition at line 664 of file fat16.c.

References GetFatClusterOffset().

Referenced by AppendCluster().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int GetNextCluster ( File file)

Definition at line 526 of file fat16.c.

References afile::cluster_pointer, FileAllocationTable, FileBuffer, FirstDataCluster, RootDirectory, SDC_GetSector, afile::sector_in_buffer, and SectorsPerCluster.

Referenced by fgetchar_(), fseek_(), and SeekDirectoryEntry().

Here is the caller graph for this function:

unsigned char InitFat16 ( void  )

Definition at line 71 of file fat16.c.

References FatCopies, FileAllocationTable, FileBuffer, FirstDataCluster, FirstPartitionSector, MBR_SECTOR, PossibleRootEntries, ReservedSectors, RootDirectory, SDC_GetSector, SectorsPerCluster, and SectorsPerFat.

Referenced by main().

Here is the caller graph for this function:

unsigned char ScanSubDirectories ( unsigned char *  fname,
File file 
)

Definition at line 790 of file fat16.c.

References _DIRECTORY, _FILE, afile::attribute, afile::cluster_pointer, RootDirectory, and SeekDirectoryEntry().

Referenced by fopen_().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char SeekDirectoryEntry ( unsigned char *  fname,
File file 
)
void SeperateFileName ( unsigned char *  fname,
unsigned char *  name 
)

Definition at line 854 of file fat16.c.

Referenced by fopen_().

Here is the caller graph for this function:

Variable Documentation

struct DirEntry* DirectoryEntry

Definition at line 56 of file fat16.c.

struct FatEntry* Fat

Definition at line 57 of file fat16.c.

unsigned char FatCopies = 0

Definition at line 46 of file fat16.c.

Referenced by InitFat16().

unsigned long FileAllocationTable = 0

Definition at line 51 of file fat16.c.

Referenced by AppendCluster(), FindNextFreeCluster(), GetNextCluster(), and InitFat16().

unsigned long FirstDataCluster = 0
unsigned long FirstPartitionSector = 0

Definition at line 50 of file fat16.c.

Referenced by InitFat16().

unsigned int PossibleRootEntries = 0

Definition at line 47 of file fat16.c.

Referenced by CreateDirectoryEntry(), and InitFat16().

unsigned long ReservedSectors = 0

Definition at line 49 of file fat16.c.

Referenced by InitFat16().

unsigned long RootDirectory = 0

Definition at line 52 of file fat16.c.

Referenced by CreateDirectoryEntry(), GetNextCluster(), InitFat16(), and ScanSubDirectories().

unsigned char SectorsPerCluster = 0
unsigned int SectorsPerFat = 0

Definition at line 48 of file fat16.c.

Referenced by FindNextFreeCluster(), and InitFat16().