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

📄 fatlite.h

📁 该程序是一个tffs文件系统的源码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * $Log:   P:/user/amir/lite/vcs/fatlite.h_v  $         Rev 1.13   11 Sep 1997 15:24:04   danig   FlashType -> unsigned short         Rev 1.12   10 Aug 1997 18:02:26   danig   Comments         Rev 1.11   04 Aug 1997 13:18:28   danig   Low level API         Rev 1.10   07 Jul 1997 15:23:24   amirban   Ver 2.0         Rev 1.9   21 Oct 1996 18:10:10   amirban   Defragment I/F change         Rev 1.8   17 Oct 1996 16:19:24   danig   Audio features         Rev 1.7   20 Aug 1996 13:22:44   amirban   fsGetBPB      Rev 1.6   14 Jul 1996 16:47:44   amirban   Format Params      Rev 1.5   04 Jul 1996 18:19:24   amirban   New fsInit and modified fsGetDiskInfo         Rev 1.4   09 Jun 1996 18:16:56   amirban   Added fsExit         Rev 1.3   03 Jun 1996 16:20:48   amirban   Separated fsParsePath         Rev 1.2   19 May 1996 19:31:16   amirban   Got rid of aliases in IOreq         Rev 1.1   12 May 1996 20:05:38   amirban   Changes to findFile         Rev 1.0   20 Mar 1996 13:33:20   amirban   Initial revision. *//************************************************************************//*                                                                      *//*		FAT-FTL Lite Software Development Kit			*//*		Copyright (C) M-Systems Ltd. 1995-1996			*//*									*//************************************************************************/#ifndef FATLITE_H#define FATLITE_H#ifdef __cplusplusextern "C" {#endif#include "flbase.h"#include "dosformt.h"typedef unsigned FLHandle;	/* Handle of an open file or drive.	*/				/* Actually an index to file table or	*/				/* drive table.				*//*----------------------------------------------------------------------*//*			P a t h - N a m e s				*//*									*//* A path-name is represented as an array of SimplePath records.	*//* Each SimplePath record holds a directory or file name segment, with  *//* the full 8.3 (spaces not compressed) name.				*//*									*//* Path-names always start at the root directory. There is no current   *//* directory. The directories pointers '.' and '..' can be specified	*//* as the 'name' part of the path-segment, except at the root-directory.*//*									*//* Lower-case letters are different from upper-case. To be compatible   *//* with DOS, file-names should be upper-case. File names may contain    *//* any character, but files starting with hex E5 are considered deleted *//* according to DOS convention.						*//*									*//* A null (hex 0) in the first byte of the name field denotes that the  *//* path ends here.							*//*                                                                      *//* Note that paths can be specified as strings: For example:     	*//*									*//* "UTIL       FATLITE H  "    ===> "\UTIL\FATLITE.H".			*//* ""				 ===> "\" (root directory)		*//* "AUTOEXECBAT"                ===> "\AUTOEXEC.BAT"			*//* "UTIL       ..         "	 ===> "\UTIL\.." (root directory)	*//*									*//* The optional service flParsePath may be used to convert regular	*//* string paths to this format.						*//*----------------------------------------------------------------------*/typedef struct {   char	name[8];	/* name part of path segment */			/* A hex 0 in 1st character indicates end of path */   char	ext[3];		/* extension part of path segment */} FLSimplePath;/*----------------------------------------------------------------------*//*			  I O r e q					*//*									*//* IOreq is a common structure passed to all file-system functions.	*//* Refer to the description of individual functions for specific usage  *//* of fields. Some fields have different names when used by different   *//* functions, hence the use of unions.					*//*									*//*----------------------------------------------------------------------*/typedef struct {  FLHandle	irHandle;	/* Handle of file or drive for operation*/  unsigned	irFlags;	/* function-specific flags 		*/  FLSimplePath FAR1 * irPath;	/* path of file for operation 		*/  void FAR1 *	irData;		/* Pointer to user-buffer for operation */  long		irLength;	/* No. of bytes, size or position for   */				/* operation			 	*/} IOreq;/* definiftions for absolute read & write */#define irSectorCount	irFlags#define	irSectorNo	irLength/* definitions for physical read & write */#define irByteCount	irFlags#define irAddress       irLength/* definitions for physical erase */#define irUnitCount     irFlags#define irUnitNo	irLength/*----------------------------------------------------------------------*//*		           f l C a l l   				*//*									*//* Common entry-point to all file-system functions. Macros are          *//* to call individual function, which are separately described below.	*//*                                                                      *//* Parameters:                                                          *//*	function	: file-system function code (listed below)	*//*	ioreq		: IOreq structure				*//*                                                                      *//* Returns:                                                             *//*	FLStatus	: 0 on success, otherwise failed                *//*----------------------------------------------------------------------*/typedef enum    {FL_MOUNT_VOLUME,		 FL_DISMOUNT_VOLUME,		 FL_CHECK_VOLUME,		 FL_OPEN_FILE,		 FL_CLOSE_FILE,		 FL_READ_FILE,		 FL_WRITE_FILE,		 FL_SEEK_FILE,		 FL_FIND_FILE,		 FL_FIND_FIRST_FILE,		 FL_FIND_NEXT_FILE,		 FL_GET_DISK_INFO,		 FL_DELETE_FILE,		 FL_RENAME_FILE,		 FL_DEFRAGMENT_VOLUME,		 FL_FORMAT_VOLUME,		 FL_MAKE_DIR,		 FL_REMOVE_DIR,		 FL_ABS_READ,		 FL_ABS_WRITE,		 FL_ABS_DELETE,		 FL_GET_BPB,		 FL_SPLIT_FILE,		 FL_JOIN_FILE,		 FL_GET_PHYSICAL_INFO,		 FL_PHYSICAL_READ,		 FL_PHYSICAL_WRITE,		 FL_PHYSICAL_ERASE,		 FL_DONT_MONITOR_FAT} FLFunctionNo;FLStatus flCall(FLFunctionNo functionNo, IOreq FAR2 *ioreq);/*----------------------------------------------------------------------*//*		      f l M o u n t V o l u m e				*//*									*//* Mounts, verifies or dismounts the Flash medium.			*//*									*//* In case the inserted volume has changed, or on the first access to   *//* the file system, it should be mounted before file operations can be  *//* done on it.								*//* Mounting a volume has the effect of discarding all open files (the   *//* files cannot be properly closed since the original volume is gone),  *//* and turning off the media-change indication to allow file processing *//* calls.								*//*									*//* The volume automatically becomes unmounted if it is removed or       *//* changed.								*//*                                                                      *//* Parameters:                                                          *//*	irHandle	: Drive number (0, 1, ...)			*//*                                                                      *//* Returns:                                                             *//*	FLStatus	: 0 on success, otherwise failed                *//*----------------------------------------------------------------------*/#define flMountVolume(ioreq)	flCall(FL_MOUNT_VOLUME,ioreq)/*----------------------------------------------------------------------*//*		   f l D i s m o u n t V o l u m e			*//*									*//* Dismounts the volume, closing all files.				*//* This call is not normally necessary, unless it is known the volume   *//* will soon be removed.						*//*									*//* Parameters:                                                          *//*	irHandle	: Drive number (0, 1, ...)			*//*                                                                      *//* Returns:                                                             *//*	FLStatus		: 0 on success, otherwise failed                *//*----------------------------------------------------------------------*/#define flDismountVolume(ioreq)	flCall(FL_DISMOUNT_VOLUME,ioreq)/*----------------------------------------------------------------------*//*		     f l C h e c k V o l u m e				*//*									*//* Verifies that the current volume is mounted.				*//*                                                                      *//* Parameters:                                                          *//*	irHandle	: Drive number (0, 1, ...)			*//*                                                                      *//* Returns:                                                             *//*	FLStatus	: 0 on success, otherwise failed                *//*----------------------------------------------------------------------*/#define flCheckVolume(ioreq)	flCall(FL_CHECK_VOLUME,ioreq)#ifdef DEFRAGMENT_VOLUME/*----------------------------------------------------------------------*//*		      f l D e f r a g m e n t V o l u m e		*//*									*//* Performs a general defragmentation and recycling of non-writable	*//* Flash areas, to achieve optimal write speed.				*//*                                                                      *//* NOTE: The required number of sectors (in irLength) may be changed    *//* (from another execution thread) while defragmentation is active. In  *//* particular, the defragmentation may be cut short after it began by	*//* modifying the irLength field to 0.					*//*									*//* Parameters:                                                          *//*	irHandle	: Drive number (0, 1, ...)			*//*	irLength	: Minimum number of sectors to make available   *//*			  for writes.					*//*                                                                      *//* Returns:                                                             *//*	irLength	: Actual number of sectors available for writes	*//*	FLStatus	: 0 on success, otherwise failed                *//*----------------------------------------------------------------------*/#define flDefragmentVolume(ioreq)	flCall(FL_DEFRAGMENT_VOLUME,ioreq)#endif /* DEFRAGMENT_VOLUME */#ifdef FORMAT_VOLUME/*----------------------------------------------------------------------*//*		      f l F o r m a t V o l u m e			*//*									*//* Formats a volume, writing a new and empty file-system. All existing  *//* data is destroyed. Optionally, a low-level FTL formatting is also    *//* done.								*//* Formatting leaves the volume in the dismounted state, so that a	*//* flMountVolume call is necessary after it.				*//*                                                                      *//* Parameters:                                                          *//*	irHandle	: Drive number (0, 1, ...)			*//*	irFlags		: NO_FTL_FORMAT: Do FAT formatting only		*//*			  FTL_FORMAT: Do FTL & FAT formatting           *//*			  FTL_FORMAT_IF_NEEDED: Do FTL formatting only	*//*				      if current format is invalid	*//*	irData		: Address of FormatParams structure to use	*//*			  (defined in dosformt.h)			*//*                                                                      *//* Returns:                                                             *//*	FLStatus	: 0 on success, otherwise failed                *//*----------------------------------------------------------------------*//** Values of irFlags for flFormatVolume: */#define NO_FTL_FORMAT	0	/* FAT formatting only */#define	FTL_FORMAT	1	/* FAT & FTL formatting */#define	FTL_FORMAT_IF_NEEDED 2	/* FAT formatting & FTL formatting if necessary */#define	PROGRESS_REPORT		/* Format progress is reported via callback */#define flFormatVolume(ioreq)	flCall(FL_FORMAT_VOLUME,ioreq)#endif /* FORMAT_VOLUME */

⌨️ 快捷键说明

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