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

📄 cluster.h

📁 PDA上的CF CARD 文件系统的建立程式
💻 H
字号:
#ifndef _FAT_CLUSTER_H
#define _FAT_CLUSTER_H

#include "../include/fat1x.h"

/*
#ifdef FAT_USE_PCMCIA
  #include "../include/ata_pcc.h"
#else
  #include "../include/ata.h"
#endif
*/

#define FAT_ENTRY_PER_SECTOR	(SECTOR_SIZE / 2)	/* 256 FAT entries per sector in FAT16 */
/*
#define	END_OF_CHAIN		0x0FF8
#define FATBadCluster		0x0FF7
*/

/* data structure */
#ifdef FAT_CLUSTER_CACHE_ON
struct FAT_clusterCache				/* the cache buffer */
{
	short drive;			/* the drive on which the cluster is located */
	unsigned short cluster_no;	/* the cluster number of the cached cluster */
	unsigned short *diskBuffer;	/* pointer to cache buffers */
	unsigned long luCount;		/* the use count */
	int dirty;			/* TRUE means this buffer has been modified */
};
#endif

#ifdef FAT_FAT_CACHE_ON
struct FAT_fatCache			/* the FAT cache */
{
	short drive;		/* the drive on which the FAT sector is located */
	unsigned long sec_num;	/* the sector number of the cached FAT sector */
	unsigned short *Entry;	/* the FAT buffer */
	unsigned long lu;	/* the use count */
	int DirtySec;		/* TRUE means this buffer has been modified */
};
#endif

/* functions */
#ifdef FAT_CLUSTER_CACHE_ON
int FAT_init_cluster_cache(void);
int FAT_flush_cluster_cache(void);
#endif
#ifdef FAT_FAT_CACHE_ON
int FAT_init_fat_cache(void);
int FAT_flush_fat_cache(void);
#endif

//int		FAT_read_cluster(char drive, unsigned short cluster, unsigned short *buffer);
//int		FAT_write_cluster(char drive, unsigned short cluster, unsigned short *buffer);
//unsigned short	find_free_cluster(char drive);
//void		clear_fat1x_cluster_chain(int fhandle);
//void		free_fat1x_cluster_chain(char drive, unsigned short startCluster);
void		FAT_Delete_SubDir_Entry(short drive, unsigned short clusterNo, 
				    unsigned short nThEntry,
				    unsigned short *clusterBuffer);
//void		dump_fat1x_cluster_chain(int fhandle);
unsigned short	FAT_read_fat_cluster(short drive, unsigned short clusterNo);
int		FAT_write_fat_cluster(short drive, unsigned short clusterNo, unsigned short cluster);

/**** added by chilong ****/
void FAT_recycleUnusedCluster(short drive, unsigned short clusterNo);
/**** added by chilong ****/


#endif

⌨️ 快捷键说明

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