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

📄 smc_fs.h

📁 TELECHIPS MP3解决方案UMS实现源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/**************************************************************************************
 *
 * TELECHIPS Co.
 * 
 * 3rd floor Heung-A 70-1 Samsung-dong, KangNam-ku, Seoul, Korea
 * ====================================================================================
 *
 * Name:        Hyun-Chul Hong
 * Phone:       82-2-3443-6792
 * E-mail:      hchong@telechips.com
 *
 * FILE NAME:   DRIVE.H
 *
 * DESCRIPTION:
 *       This is a Header File for Drive.c
 *
 *
 * FILE HISTORY:
 * 	Date: 2002.07.18	Start source coding		By Hyunchul Hong
 *
 *
 *
 **************************************************************************************/
#ifndef	_SMC_FS_H_
#define	_SMC_FS_H_


#ifdef	SMC_FS_ONLY
#define	SMC_FS_EXT
#else
#define	SMC_FS_EXT extern
#endif

#include "MASS_COMMON.H"
//#include "SMC_FILE.H"


//**********************************************************
//*
//*		ErrCode for Mixed the existing Function ErrCode
//*
//**********************************************************
enum  {

	SMC_ERR_NOERROR = 0,			// 0
	SMC_ERR_UNKNOWN,				// 1
	SMC_ERR_INVALID_FILESYS,		// 2
	SMC_ERR_ILLEGAL_COMMAND,		// 3
	SMC_ERR_COMMAND_CRC,			// 4
	SMC_ERR_PARAM,					// 5
	SMC_ERR_DATA_CRC,				// 6
	SMC_ERR_PROTECT,				// 7
	SMC_ERR_INVALID_CARD,			// 8
	SMC_ERR_IO,						// 9, Read/Write Error
	SMC_ERR_HANDLE_EXHAUST,			// 10
	SMC_ERR_ENTRY_EXHAUST,			// 11
	SMC_ERR_PARAMETER,				// 12
	SMC_ERR_FILE_NOT_FOUND,			// 13
	SMC_ERR_FILE_ALREADY_EXIST,		// 14
	SMC_ERR_EOF,					// 15, End of File
	SMC_ERR_READONLY,				// 16
	SMC_ERR_UNSUPPORT,				// 17
	SMC_ERR_DISKFULL,				// 18
	SMC_ERR_OUTOF_RULE,				// 19
	SMC_ERR_FILE_ALREADY_OPEN,		// 20
	SMC_ERR_COUNT
};

//**********************************************************
//*
//*		Definition System Total DRIVES
//*
//**********************************************************

#if defined(MMC_INCLUDE)
enum 
{
	NFL = 0,				//	NAND FLASH
	SMC = 1				//  SMC 	
};	

#define	MAX_LOG_DRIVE		1
#define	MAX_PHY_DRIVE		1

#ifdef	SMC_FS_ONLY
const	unsigned char MediaOrder_Drv[MAX_PHY_DRIVE] = 
{
	0					// 1st Drive => SMC 1st Media
};
#endif

#else
enum 
{
	NFL = 0,			//	NAND FLASH
	SMC = 1				//  SMC 
};	

#define	MAX_LOG_DRIVE		2
#define	MAX_PHY_DRIVE		2

#ifdef	SMC_FS_ONLY
const	unsigned char MediaOrder_Drv[MAX_PHY_DRIVE] = 
{
	0,					// 1st Drive => SMC 1st Media
	1					// 2nd Drive => SMC 2nd Media
};
#endif

#endif


//**********************************************************
//*
//*		Definition DosFilesystem
//*
//**********************************************************
#define	SMC_FS_UNKNOWN			0x00
#define	SMC_FS_FAT12			0x01
#define	SMC_FS_FAT16			0x02
#define	SMC_FS_FAT32			0x03

#define MAX_LONGNAME			128			// 26*3 = 78


#define SEARCH_ENTIRE			0
#define SEARCH_CURRTOEND		1

#define	SMC_FAST_FORMAT			0
#define	SMC_LOW_FORMAT			1

#define UPDATE_FILE_ENTRY		0
#define ERASE_FILE_ENTRY		1
#define JUST_CHECK_ISEMPTY		2

#define	DIR_ENTRY				0
#define	FILE_ENTRY				1
#define ALL_ENTRY				2

//**********************************************************
//*
//*		Definition DRIVE Error Code
//*				
//**********************************************************

typedef	unsigned int	SMC_FS_ERROR;			// for SMC_FS.C
typedef	unsigned int	SMC_MPX_ERROR;			// for SMC_MPX.C

//**********************************************************
//*
//*		Definition Struct
//*
//**********************************************************
//	Definition Type of variable
typedef unsigned char	drv_u8;
typedef unsigned int	drv_u16;
typedef unsigned long	drv_u32;

typedef	unsigned int	F_HANDLE;

//	Definition Type of union
#pragma	packed on									// To align struct by 1byte
union	WORD_BYTE {
	
	unsigned int		WORD;
	unsigned char		BYTE[2];
};

union	DWORD_BYTE {
	
	unsigned long		DWORD;
	unsigned int		WORD[2];
	unsigned char		BYTE[4];
};
#pragma	packed off

//**********************************************************
//*
//*		Definition DosFilesystem Struct
//*
//**********************************************************
#pragma	packed on									// To align struct by 1byte


struct	PART_INFO {
 	
 	unsigned char		boot_id;					// Bootable? 0=no , 128(0x80) = yse
 	unsigned char		begin_head;					// beginning head number
 	unsigned char		begin_sector;				// beginning sector number
 	unsigned int		begin_cylinder;				// 10bit number [high 2bit], with high 2bits put in begin sector
 	unsigned char		system_id;					// Operating System type indicator code
 	unsigned char		end_head;					// ending head number
	unsigned char		end_sector;					// ending sector numer
 	unsigned int		end_cylinder;				// 10bit number [high 2bit] , with high 2bits put in end sector
 	unsigned long int	relative_first_sector;		// first sector relative to start of disk
 	unsigned long int	number_sector_partition;	// number of sectors in partion	
 	
};


struct	MBR_INFO {
	
//	unsigned char		bootinst[446];				// actual boot code	of MBR [ Don't need ]
	struct PART_INFO	parts[4];					// partion table	
	unsigned int		signature;					// 0xAA55
};


struct	_BPB	{
												// Offset	Size
//	unsigned char	BS_jmpBoot[3];				// 		0		3
//	unsigned char	BS_OEMName[8];				// 		3		8
	unsigned int	BPB_BytsPerSec;				//		11		2
	unsigned char	BPB_SecPerClus;				//		13		1
	unsigned int	BPB_ResvdsecCnt;			//		14		2
	unsigned char	BPB_NumFATs;				//		16		1
	unsigned int	BPB_RootEntCnt;				//		17		2
	unsigned int	BPB_TotSec16;				//		19		2
	unsigned char	BPB_Media;					//		21		1
	unsigned int	BPB_FATSz16;				//		22		2
	unsigned int	BPB_SecPerTrk;				//		24		2
	unsigned int	BPB_NumHeads;				//		26		2
	unsigned long	BPB_HiddSec;				//		28		4
	unsigned long	BPB_TotSec32;				//		32		4

};

struct	_FAT16_BS	{

												// Offset	Size
//	unsigned char	BS_DrvNum;					// 		36		1
//	unsigned char	BS_Reserved1;				//		37		1
//	unsigned char	BS_BootSig;					//		38		1
//	unsigned char	BS_VolID[4];				//		39		4
//	unsigned char	BS_VolLab[11];				//		43		11
	unsigned char	BS_FilSysType[8];			//		54		8

};

struct	_FAT32_BS	{

												// Offset	Size
	unsigned long	BPB_FATSz32;				//		36		4	
	unsigned int	ExtFlags;					//		40		2
	unsigned int	BPB_FSVer;					//		42		2
	unsigned long	BPB_RootClus;				//		44		4
	unsigned int	BPB_FSInfo;					//		48		2
	unsigned int	BPB_BkBootSec;				//		50		2
//	unsigned char	BPB_Reserved[12];			//		52		12
//	unsigned char	BS_DrvNum;					//		64		1
//	unsigned char	BS_Reserved1;				//		65		1
//	unsigned char	BS_BootSig;					//		66		1
//	unsigned char	BS_VolID[4];				//		67		4
//	unsigned char	BS_VolLab[11];				//		71		11
	unsigned char	BS_FilSysType[8];			//		82		8

};


struct	BS_INFO	{

	struct	_BPB		BPB;					// [25Bytes]
	struct	_FAT16_BS	FAT16_BS;				// [ 8Bytes]
	struct	_FAT32_BS	FAT32_BS;				// [24Bytes]

⌨️ 快捷键说明

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