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

📄 smf_conf.h

📁 the test file for GP32 gameboy hack
💻 H
📖 第 1 页 / 共 2 页
字号:
/**********
 *
 * sm_conf.h: SmartMedia File System Header File for Configuration
 *
 * Portable File System designed for SmartMedia
 *
 * Created by Kim Hyung Gi (06/99) - kimhg@mmrnd.sec.samsung.co.kr
 * Samsung Electronics, M/M R&D Center, Visual Communication Group
 *
 * Notes:
 *	1. "SM_WAIT_TR" is very important definition.
 *		This makes great diffrence in the SYSTEM PERFORMANCE !!!
 *		It is best to check if the ready signal of the chip is ON.
 *		If there is no way to check the ready signal in your platform
 *		however, use smfsWaitUSec(10).
 *		But this function has some overhead to operate correctly in
 *		various system, therefore it makes the system slow.
 **********
 * WebVP Porting: Kim Do Wan(99/07/26)
 *		1. Change "Platform Decision"
 *
 **********
 * Modified by Lee Jin Woo (1999/08/17)
 *		1. Removed the #define's for SM_OUTB and SM_INB
 **********/

#ifndef SMF_CONF_H
#define SMF_CONF_H


#ifdef __cplusplus
extern "C" {
#endif


/**********
 * Decision of Platform
 **********/

/* COMPILER */
#define MSVC		1
#define ARMC		2	/* ARM is defined in ARM compiler environment */
#define GNUC		3	// ***************

/* TARGET */
#define IML_EPP		1	/* made by InfoMedia Lab, SEC */
#define WEBVP		2	/* made by InfoMedia Lab, SEC */
#define ISA_SM		3	/* made by Memory Product & Technology, SEC */
#define WEBVP_SM	4	/* made by InfoMedia Lab, SEC */
#define GP32_SM		5	// ***************

/* OS */
#define MS_WINDOWS	1
#define PSOS		2
#define MS_WINNT	3
#define GPOS		4	// ***************

/* memory level */
#define MEMORY_VERY_SMALL	1		/* Data Memory: 2K ~ 4K */
#define MEMORY_SMALL		2		/* Data Memory: 4K ~ 30K */
#define MEMORY_MEDIUM		3		/* Data Memory: 30K ~ 80K */
#define MEMORY_LARGE		4		/* Data Memory: 80K ~ 150K */
#define MEMORY_VERY_LARGE	5		/* Data Memory: 150K ~ */

/* Platform Decision */


// **********
//#define SM_COMPILER		GNUC
//#define SM_TARGET		GP32_SM
//#define SM_OS			GPOS
#define MEMORY_LEVEL	MEMORY_MEDIUM

/*#if 0
#define SM_COMPILER		MSVC
#define SM_TARGET		IML_EPP
#define SM_OS			MS_WINDOWS
#define MEMORY_LEVEL	MEMORY_LARGE

#else
#define SM_COMPILER		ARMC
#define SM_TARGET		WEBVP_SM
#define SM_OS			PSOS
#define MEMORY_LEVEL	MEMORY_LARGE

#endif*/

/**********
 * This value must be set larger than or equal to the CPU MIPS
 *	(Million Instructions Per Second).
 *	. PentiumII 400MHz => 1158
 **********/
#if (SM_TARGET == WEBVP_SM || SM_TARGET == WEBVP)
#define CPU_MIPS		170
#else
#define CPU_MIPS		1200
#endif
/*---------------------------------------------------------------------------*/


/**********
 * Decision of Compile Option
 * (default setting is that nothing is defined)
 **********/

/**********
 * Compile Environment
 **********/
#define NO_STDLIB

/**********
 * Operation Mode
 **********/
#define LONG_FILE_NAME_ENABLE		/* this needs some more code size,
									   and some more time in
									   smReadDirEx() */
/* #define CHANGE_DIR_ENABLE */
/* #define ECC_ENCODE_DISABLE */	/* if this is defined, it could not
									   have interoperability with other
									   systems */
/* #define ECC_DECODE_DISABLE */
#define FAT_UPDATE_WHEN_FILE_CLOSE	/* if not, fat is updated everytime
									   it is changed, so it makes the
									   system a little bit slow */

#if (MEMORY_LEVEL <= MEMORY_MEDIUM)
	#define WRITE_CACHE_DISABLE		/* don't change this line. cache
									   must be disabled if (MEMORY_LEVEL
									   <= MEMORY_MEDIUM) */
#else
	/* #define WRITE_CACHE_DISABLE */		/* user can control cache
											 * enable/disable only if
											 * (MEMORY_LEVEL
											 * >= MEMORY_LARGE)
											 */
#endif


#define SM_MULTITASK		/* if two or more tasks call SMFS API's
							 * simultaneously, this must be defined
							 */

/*--------------------------------------------------------------------*/



/**********
 * ETC
 **********/

/* number of SmartMedia drive that is installed.
 * each is defined in "smf_conf.c" */
#define MAX_DRIVE		1

/* pre-declarator for export functions */
#define SM_EXPORT
#define SML_EXPORT
#define SMP_EXPORT
/*--------------------------------------------------------------------*/



/**********
 * Macro Definition
 **********/

#ifdef	LONG_FILE_NAME_ENABLE
extern int sm_ConvertStrToUnicode(unsigned short *des, unsigned char *src, int len);

/****
* This MACRO must return 2byte-length of converted unicode  as an 'int' type
* Parameters
* 	- p_uni : unicode string pointer (unsigned short*)
* 	- p_mb : multibyte string pointer (unsignd char*)
* 	- mb_len : multibyte string length in bytes.
*				If 0, p_mb is considered to be a NULL terminated string (int)
* Return Value
*	- 2byte-length of converted unicode. It includes NULL character at the end.
*		(eg. If it returns 3, it successfully converted 3 unicode character(6 bytes).
*			The last 2 bytes are all 0)
* Notes
*	- 'p_uni' must be allocated for the (MAX_FILE_NAME_LEN + 2) bytes.
*	- This function must be able to stop the conversion at the maximum length,
*		and add NULL unicode character at the end.
*****/
#define	SM_MBS_TO_UNICODE(p_uni, p_mb, mb_len)	sm_ConvertStrToUnicode(p_uni, p_mb, mb_len)
#endif


/**********
 * Compiler Dependent Definition
 **********/
	extern int rand(void);
	extern void srand(unsigned int seed);
	#define SM_RANDOM()				rand()
	#define SM_SRAND(seed)			srand((seed))

#ifdef NO_STDLIB
	#define SM_MEMCMP		sm_memcmp
	#define SM_MEMCPY		sm_memcpy
	#define SM_MEMSET		sm_memset
	#define SM_STRCMP		sm_strcmp
	#define SM_STRCPY		sm_strcpy
	#define SM_STRLEN		sm_strlen
#else
	#define SM_MEMCMP		memcmp
	#define SM_MEMCPY		memcpy
	#define SM_MEMSET		memset
	#define SM_STRCMP		strcmp
	#define SM_STRCPY		strcpy
	#define SM_STRLEN		strlen
#endif

/**********
 * OS Dependent Definition
 **********/
#ifdef SM_MULTITASK
#if (SM_OS == MS_WINDOWS)
	#define SM_LOCK_INIT(x)
	#define SM_LOCK(x)
	#define SM_UNLOCK(x)
#elif (SM_OS == PSOS)
	extern int sm_LockInit(void);
	extern int sm_Lock(void);
	extern int sm_Unlock(void);

	#define SM_LOCK_INIT(x)		sm_LockInit()
	#define SM_LOCK(x)			sm_Lock()
	#define SM_UNLOCK(x)		sm_Unlock()
#else
	#define SM_LOCK_INIT(x)
	#define SM_LOCK(x)
	#define SM_UNLOCK(x)
#endif
#endif


/**********
 * Target Dependent Definition
 **********/
#if (SM_OS == MS_WINNT)
#include <windows.h>
#endif

#if (SM_TARGET == IML_EPP)
#if (SM_OS == MS_WINDOWS)
	extern volatile unsigned char* g_smStatAddr[MAX_DRIVE];
	extern volatile unsigned char* g_smCtrlAddr[MAX_DRIVE];
	extern volatile unsigned char* g_smAddrAddr[MAX_DRIVE];
	extern volatile unsigned char* g_smDataAddr[MAX_DRIVE];

	extern int _outp(unsigned short port, int databyte);
	extern int _inp(unsigned short port);

	#define SM_ALE_EN(drv_no) 		_outp((unsigned short)g_smAddrAddr[(drv_no)], 0x0a)
	#define SM_ALE_DIS(drv_no)		_outp((unsigned short)g_smAddrAddr[(drv_no)], 0x08)
	#define SM_CLE_EN(drv_no) 		_outp((unsigned short)g_smAddrAddr[(drv_no)], 0x09)
	#define SM_CLE_DIS(drv_no)		_outp((unsigned short)g_smAddrAddr[(drv_no)], 0x08)
	#define SM_CHIP_EN(drv_no)		_outp((unsigned short)g_smAddrAddr[(drv_no)], 0x08)
	#define SM_CHIP_DIS(drv_no)		_outp((unsigned short)g_smAddrAddr[(drv_no)], 0x0c)

	#define SM_WRITE_EN(drv_no)		_outp((unsigned short)g_smCtrlAddr[(drv_no)], 4)
	#define SM_WRITE_DIS(drv_no)	_outp((unsigned short)g_smCtrlAddr[(drv_no)], 0)
	#define SM_READ_EN(drv_no) 		_outp((unsigned short)g_smCtrlAddr[(drv_no)], 0xf4)
	#define SM_READ_DIS(drv_no)		_outp((unsigned short)g_smCtrlAddr[(drv_no)], 0)

	#define SM_WRITE_CMD(drv_no, cmd) 	_outp((unsigned short)g_smDataAddr[(drv_no)], cmd)
	#define SM_WRITE_ADDR(drv_no, addr)	_outp((unsigned short)g_smDataAddr[(drv_no)], addr)
	#define SM_WRITE_DATA(drv_no, data)	_outp((unsigned short)g_smDataAddr[(drv_no)], data)
	#define SM_READ_DATA(drv_no) 		_inp((unsigned short)g_smDataAddr[(drv_no)])

	#define SM_WAIT_TR(drv_no) \

⌨️ 快捷键说明

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