⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fat16.h

📁 移植到mega32上面的fat16代码实现了
💻 H
字号:
#ifndef __fat16_h
#define __fat16_h



#define	MBR_SECTOR				0				// the masterboot record is located in sector 0.


typedef struct file
{
	unsigned long 	start_cluster;				// Sectorpointer to the first sector of the first datacluster of the file.
	unsigned long 	cluster_pointer;			// Sectorpointer to the cluster which is edited at the moment.
	unsigned char 	sector_index;				// The sector which is edited at the moment (cluster_pointer + sector_index).
	unsigned int  	byte_index;					// The bytelocation within the current sector (cluster_pointer + sector_index + byte_index).
	unsigned char 	mode;						// mode of fileoperation (read,write)
	unsigned long  filesize;					// the size of the opend file in bytes.
	unsigned long  sector_in_buffer;			// the last sector read, wich is still in the sectorbuffer.
	unsigned long  directory_sector;			// the sectorposition where the directoryentry has been made.
	unsigned char  directory_index;			// the index to the directoryentry within the specified sector.
} File;


struct DirEntry
{
	unsigned char name[8];						// 8 bytes name.
	unsigned char extension[3];				// 3 bytes extension.
	unsigned char attribute;					// attribute of the directory entry (unused,archive,read-only,system,directory,volume)
	unsigned char reserved[10];
	unsigned int  time;						// time and
	unsigned int  date;						// date of last write acces to the file or directory.
	unsigned int  startcluster;				// first cluster of the file or directory.
	unsigned long size;						// size of the file or directory in bytes.
};


struct FatEntry
{
	unsigned int  next_cluster;				// the next cluster of the file.
};



extern unsigned char InitFat16(void);			// initialises the adresspointers needed for the fat16 filesystem.
extern unsigned char FileOpen(unsigned char *fname,char mode, File *fpoint);
extern void FileClose(File *file);
extern 	         int FileGetchar(File *file);
extern unsigned char FilePutChar(File *file,char c);
extern unsigned int FileReadSector(File *file);
extern unsigned char SectorsPerCluster;
extern void FilePutc(unsigned char c);
extern unsigned char FileWriteSector(File *file,char *buf);
char FileGetString(char *text, File *file, unsigned char count);




extern unsigned char *FileBuffer;
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -