//这是FAT32文件系统源代码
#ifndef __FAT_H__
#define __FAT_H__
#define CHARchar
#define BYTEunsigned char
#define WORDunsigned int
#define DWORDunsigned long
#define FIX_DIRECTORY 0/* 1 means use fix directory, 0 for any directory */
#if FIX_DIRECTORY==0
#define RECORD_ADDR_START 0/* eeprom start address */
#define RECORD_ADDR_END 512/* eeprom end address */
//#include
//#include
//#include
#endif
//#include "UART.H"
#include
//#include "gui.h"
//声明外部器件读写函数
//external hardware operating function
extern unsigned char MMC_SD_ReadSingleBlock(unsigned long sector, unsigned char* buffer);
extern unsigned char MMC_SD_WriteSingleBlock(unsigned long sector, unsigned char* buffer);
extern unsigned long MMC_SD_ReadCapacity(void);
#define MSDOSFSROOT 0 // cluster 0 means the root dir
#define CLUST_FREE 0 // cluster 0 also means a free cluster
#define MSDOSFSFREE CLUST_FREE
#define CLUST_FIRST 2 // first legal cluster number
#define CLUST_RSRVD 0xfff6 // reserved cluster range
#define CLUST_BAD 0xfff7 // a cluster with a defect
#define CLUST_EOFS 0xfff8 // start of eof cluster range
#define CLUST_EOFE 0xffff // end of eof cluster range
#if 0
struct partsector
{
/*char*/unsigned charpsPartCode[/*512-64-2*/446];// pad so struct is 512b
unsigned charpsPart[64];// four partition records (64 bytes)
unsigned charpsBootSectSig0;// two signature bytes (2 bytes)
unsigned charpsBootSectSig1;
#define BOOTSIG0 0x55
#define BOOTSIG1 0xaa
};
struct extboot {
CHARexDriveNumber;// drive number (0x80)//0x00 for floopy disk 0x80 for hard disk
CHARexReserved1;// reserved should always set 0
CHARexBootSignature;// ext. boot signature (0x29)
#define EXBOOTSIG 0x29
CHARexVolumeID[4];// volume ID number
CHARexVolumeLabel[11];// volume label "NO NAME"
CHARexFileSysType[8];// fs t