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

📄 fsmapi.h

📁 norflash的文件系统。 用于中低端手机开发的参考
💻 H
字号:
/*****************************************************************************
 
  FILE NAME: FsmApi.h

  DESCRIPTION:

    Fsm definitions and prototype.

 Copyright (c) 2002, VIA Technologies, Inc.
*****************************************************************************/


#ifndef __FSM_API_H__

#define __FSM_API_H__

#include "Fsmdefs.h"
#include "FsmDev.h"
#include "FsmFs.h"

/* Operation mode */

/* These options can be ORed together. -- access mode. */
#define FSM_OPEN_READ			0x00000001
#define FSM_OPEN_WRITE			0x00000002

#define FSM_ACCESS_MODE_MASK	0x000000FF

/* These options exclude each other. -- open mode.     */
#define FSM_CREATE_NEW			0x00000100
#define FSM_CREATE_ALWAYS		0x00000200  
#define FSM_OPEN_EXISTING		0x00000400
#define FSM_OPEN_ALWAYS			0x00000800

#define FSM_OPEN_MODE_MASK		0x0000FF00

#define FSM_MODE_MASK			0x0000FFFF

/* one and only one mode in these could be set */
#define FSM_OPEN_FILE			0x00010000
#define FSM_OPEN_DIR			0x00020000



/* Seek mode */
#define FSM_FILE_BEGIN			1
#define FSM_FILE_END			2
#define FSM_FILE_CURRENT		3


#define INVALID_FILE_HANDLE		((uint32)(-1))


typedef uint32				HFSMFILE;

typedef void *				HENUM;


#define FILE_NAME_LENGTH	128			/*  max filename length is determined by Dfs/Cfs/Dos design. */

typedef /*PACKED*/ struct
{
	char			FileName[FILE_NAME_LENGTH + 1];
	uint32			FileLength;
	uint16			CreateDate;
	uint16			CreateTime;
	uint16			Attrib;
}FsmFileInfoT;

typedef /*PACKED*/ struct
{
	uint32			FileLength;
	uint16			CreateDate;
	uint16			CreateTime;
	uint16			Attrib;
}FsmFileAttribT;

#define FSM_FORMAT_NAME      1
#define FSM_FORMAT_DEV       2

typedef struct
{
    uint8          mode;

    /*  This arg should point to the volume name when the mode is FSM_FORMAT_NAME.
        or point to the device structure when the mode is FS_FORMAT_DEV  */
    union 
	{
        struct 
        {
		    FsmFsDrvT       *	FsP;
		    FsmDevObjHdrT   *	DevP;
        } DevArg;
        char      * VolumeName;   
    } Param;

} FsmFormatArgumentT;


#define MAX_PATH_LENGTH			256		/*  max PATH length is determined by Dfs/Cfs/Dos design. */


#define FSM_FILE_ATTRIB_NORMAL         0x00
#define FSM_FILE_ATTRIB_READONLY       0x01
#define FSM_FILE_ATTRIB_HIDDEN         0x02
#define FSM_FILE_ATTRIB_SYSTEM         0x04

#define FSM_FILE_ATTRIB_DIR            0x10
#define FSM_FILE_ATTRIB_ARCHIVE        0x20

#define VOLUME_PATH         "vt"
/*========================= File System APIs ===============================*/

HFSMFILE	FsmOpen(const char * path, uint32 mode);

uint32		FsmClose(HFSMFILE hFile);
uint32		FsmCloseAll(void);

uint32		FsmRead(HFSMFILE hFile, void * buffer, uint32 size);
uint32		FsmWrite(HFSMFILE hFile, void * buffer, uint32 size);

uint32		FsmSeek(HFSMFILE hFile, int32 offset, uint32 whence);

int32		FsmTell(HFSMFILE hFile);

uint32		FsmEof(HFSMFILE hFile, uint32 * Eof);

uint32		FsmError(HFSMFILE hFile);

uint32		FsmGetAttrib(HFSMFILE hFile, FsmFileAttribT * attrib);
uint32		FsmGetAttribByName(const char * path, FsmFileAttribT * attrib);

uint32		FsmSetAttrib(const char * path, FsmFileAttribT * attrib);

uint32		FsmTruncate(HFSMFILE hFile, uint32 size);

uint32		FsmRemove(const char* filename);

uint32		FsmRename(const char *path, const char *newname);

uint32		FsmMakeDir(const char *path);
uint32		FsmRemoveDir(const char *path);

HENUM		FsmFindFirstFile(const char * filename, FsmFileInfoT * Info);
uint32		FsmFindNextFile(HENUM hEnum, FsmFileInfoT * Info);

uint32		FsmFindClose(HENUM hEnum);

uint32		FsmCloseDir(HFSMFILE hFile);

uint32		FsmFlush(HFSMFILE hFile);
uint32		FsmFlushAll(void);

uint32		FsmGetFreeSpace(const char * VolumeName, uint32 * totalspace, uint32 * availablespace, uint32 * freespace);

uint32		FsmFileIoCtrl(HFSMFILE hFile, uint32 cmd, void * arg);

HFSMFILE	FsmOpenDir(const char *path);

uint32		FsmReadDir(HFSMFILE hDir, FsmFileInfoT * DirEntry);

/*uint32		FsmFormat(const char * VolumeName);*/
uint32      FsmFormat(FsmFormatArgumentT * FormatArg); 

uint32		FsmMount(FsmFsDrvT * pFs, FsmDevObjHdrT * pDev, const char * VolumeName, uint32 sectorsize);

uint32		FsmUnMount(const char* VolumeName);


#endif /* __FSM_API_H__ */


/*****************************************************************************
* $Log: FsmApi.h $
* Revision 1.5  2004/03/17 12:58:32  zgy
* Revision 1.20  2004/03/16 15:59:34  jjs
* Revision 1.19  2004/03/11 14:57:12  jjs
* Format api support.
* Revision 1.18  2003/12/04 11:24:01  wsm
* correct #define FSM_TYPE_DIR            0x10
* Revision 1.17  2003/11/25 16:02:18  wsm
* 1.attrib define change
* Revision 1.16  2003/11/05 10:21:24  wsm
* Revision 1.15  2003/10/26 17:01:11  jjs
* Updated the function prototype of FsmEof.
* Revision 1.14  2003/10/24 17:06:56  jjs
* added FsmFormat declaration
* Revision 1.13  2003/10/16 11:13:05  jjs
* Revision 1.12  2003/10/08 17:59:49  jjs
* Revision 1.11  2003/10/08 17:55:22  jjs
* Revision 1.10  2003/10/08 12:52:17  jjs
* Revision 1.9  2003/09/19 11:24:56  wsm
* Revision 1.8  2003/09/17 14:08:58  wsm
* Revision 1.7  2003/09/16 17:11:32  wsm
* Revision 1.6  2003/09/16 11:32:15  wsm
* Revision 1.5  2003/09/14 16:56:10  jjs
* Revision 1.4  2003/09/12 15:27:13  wsm
* FD_MAX 
* Revision 1.3  2003/09/12 13:43:21  jjs
* Revision 1.2  2003/09/11 09:55:26  wsm
* update the Function name and include file
* Revision 1.1  2003/09/09 15:09:14  jjs
* Initial revision
*****************************************************************************/



⌨️ 快捷键说明

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