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

📄 smt.h

📁 The combined demo is dedicated for S1C33L05, so DMT33L05 should be used to load and run the demo. F
💻 H
字号:
/********************************************************************************/
/*																				*/
/*	Copyright (C) SEIKO EPSON CORP. 2000										*/
/*																				*/
/*	File name : smt33.h															*/
/*		This is smart media common header										*/
/*																				*/
/*	Revision history															*/
/*		2000.04.07	H.Ogura		start											*/
/* 		2001.09.21	A.Saito		comment out FAT difiniens,						*/
/*						structures.												*/
/*		2001.10.04	A.Saito		Modify SmatrMedia format library				*/
/*		2002.09.19	A.Saito		Delete invalid part								*/
/*		2003.03.13	A.Saito		Modify prototype difinition						*/
/*		2003.06.05	A.Saito		Modify Comment									*/
/*								Delete define "CS_*"							*/
/*																				*/
/********************************************************************************/
/********************************************************************************/
/*		The tab size of this file is 4. 										*/
/********************************************************************************/

#ifndef	__SMART_MEDIA_COMMON_HEADER__
#define	__SMART_MEDIA_COMMON_HEADER__

#include	<stdio.h>
#include 	"fat.h"

/********************************************************/
/*	COMMON CONSTANT DEFINE								*/
/********************************************************/
/*------------------------------------------------------*/
/*	RETURN VALUE										*/
/*------------------------------------------------------*/
#define		SMT_FALSE	0				// False Value
#define		SMT_TRUE	1				// True Value
/*------------------------------------------------------*/
/*	SIGNAL LEVEL VALUE									*/
/*------------------------------------------------------*/
#define		SMT_BYTE0	0				// Low Value
#define		SMT_BYTE1	1				// Middle Value
#define		SMT_BYTE2	2				// High Value
/*------------------------------------------------------*/
/*	LED CONTROL VALUE									*/
/*------------------------------------------------------*/
#define		SMT_OFF		1				// OFF
#define		SMT_ON		0				// ON
#define		SMT_BLINK	1000				// LED Blink Wait Loop Count
/*------------------------------------------------------*/
/*	MACRO												*/
/*------------------------------------------------------*/
#define		SMT_M_MASK(n)		(1 << n)
#define		SMT_M_BYTE(v, n)	((unsigned char)((unsigned long)v >> (8 * n)) & 0xFF)

/********************************************************/
/*	ERROR CONSTANT DEFINE								*/
/********************************************************/
/*------------------------------------------------------*/
/*	COMMON ERROR CODE		-( 0~ 9)					*/
/*------------------------------------------------------*/
#define		SMT_E_SUCCESS	0				// Successful
#define		SMT_E_FAILURE	-1				// Failure
/*------------------------------------------------------*/
/*	MEDIA CHECK ERROR		-(10~19)					*/
/*------------------------------------------------------*/
#define		SMT_E_DEVNOSP	-10				// Device No Support Error
#define		SMT_E_NOTDTCT	-11				// Card Detect Error
#define		SMT_E_WRPROTS	-12				// Write Protect Seal Error
/*------------------------------------------------------*/
/*	MEDIA INITIAL ERROR		-(20~29)					*/
/*------------------------------------------------------*/
#define		SMT_E_MDAINIT	-20				// Media Initialize Error
#define		SMT_E_MDAINFO	-21				// Media Information Error
#define		SMT_E_IDEXIST	-22				// Media ID Exist Error
#define		SMT_E_PHYSFMT	-23				// Physical Format Error
#define		SMT_E_LOGIFMT	-24				// Logical Format Error
/*------------------------------------------------------*/
/*	MAKE TABLE ERROR		-(30~39)					*/
/*------------------------------------------------------*/
#define		SMT_E_TBLMAKE	-30				// Block Allocation Tabke Make Error
/*------------------------------------------------------*/
/*	MEDIA CONTROL ERROR		-(40~49)					*/
/*------------------------------------------------------*/
#define		SMT_E_TIMEOUT	-40				// Busy Time Out Error
#define		SMT_E_STSBUSY	-41				// Status Read in Busy Error
#define		SMT_E_CDERASE	-42				// Card Erase Error (ALL BLOCK)
#define		SMT_E_BKERASE	-43				// Block Erase Error
#define		SMT_E_MIDREAD	-44				// Media ID Read Error
#define		SMT_E_PAGREAD	-45				// Page Read Error
#define		SMT_E_PAGPROG	-46				// Page Program Error
#define		SMT_E_MDRESET	-47				// Media Reset Error
#define		SMT_E_ECCRDY	-48				// ECC Ready check error
#define		SMT_E_ECCCMP	-49				// ECC compare error
#define		SMT_E_NOTYPE	-50				// Unknown smt type

/*------------------------------------------------------*/
/*	MEDIA ACCESS ERROR		-(50~59)					*/
/*------------------------------------------------------*/
#define		SMT_E_SCTREAD	-50				// Sector Read Error
#define		SMT_E_SCTWRTE	-51				// Sector Write Error
#define		SMT_E_BLKCOPY	-52				// Block Copy Error
#define		SMT_E_ADDRLMT	-53				// Address Limit Check Error
#define		SMT_E_OVLPBLK	-54				// Overlap Block Error
#define		SMT_E_NOEMPTY	-55				// Block No Empty Error
#define		SMT_E_BADBLCK	-56				// BAD Block Error
/*------------------------------------------------------*/
/*	DATA CHECK ERROR		-(60~69)					*/
/*------------------------------------------------------*/
#define		SMT_E_PRTYCHK	-60				// Parity Check Error
#define		SMT_E_ECCCRTB	-61				// ECC Error Correctable
#define		SMT_E_ECCCODE	-62				// ECC Code Error
#define		SMT_E_ECCFAIL	-63				// ECC Correctable Fail Error


/********************************************************/
/*	STRUCTURE											*/
/********************************************************/
/*------------------------------------------------------*/
/*	COMMON BIT FIELD STRUCTURE							*/
/*------------------------------------------------------*/
union	SMT_COMMSTR{
	unsigned char	bByte;
	struct{
		unsigned char	bBIT0:1;			// b0
		unsigned char	bBIT1:1;			// b1
		unsigned char	bBIT2:1;			// b2
		unsigned char	bBIT3:1;			// b3
		unsigned char	bBIT4:1;			// b4
		unsigned char	bBIT5:1;			// b5
		unsigned char	bBIT6:1;			// b6
		unsigned char	bBIT7:1;			// b7
	}stBit;
};

/*------------------------------------------------------*/
/*	LED CONTROL 										*/
/*------------------------------------------------------*/
union	SMT_LEDCTL{
	unsigned char	bByte;
	struct{
		unsigned char	bRSV1:3;			// P00-02 : (RESERVED)
		unsigned char	bLED:1;				// P03    : LED
		unsigned char	bRSV2:4;			// P04-07 : (RESERVED)
	}stBit;
};

#define		SMT_R_P0PORT	0x00402d1L
#define		SMT_R_LEDCTL	((volatile union SMT_LEDCTL *)SMT_R_P0PORT)

/*------------------------------------------------------*/
/*	SMT33 ERROR INFORMATION STRUCTURE					*/
/*------------------------------------------------------*/
struct	SMT_ERR_INFO{
	unsigned char	bDrvNum;				// Drive Number
	int		iFatErr;				// FAT File System Error Code
	int		iSmtErr;				// Smart Media Error Code
	int		iSctNum;				// Sector Number
};
extern struct SMT_ERR_INFO	smtErrInf;			// Error Information
extern int		smtMerror(void);
extern void		smtMclearErr(void);

/*------------------------------------------------------*/
/*	SMART MEDIA FORMAT LIBRARY							*/
/*------------------------------------------------------*/
extern	int		smtPhyFormat(unsigned long, unsigned char **, FatInitParams_t *);
extern	int		smtPhyFmtChk(unsigned long *);
extern	int		smtLogFormat(unsigned long, unsigned char **, FatInitParams_t *);
extern	int		smtLogFmtChk(void);

#define			smtUsuallyFormat(ulSel, pbVol, pParams)	smtPhyFormat(ulSel, pbVol, pParams)
#define			smtQuickFormat(ulSel, pbVol, pParams)	smtLogFormat(ulSel, pbVol, pParams)

/*-----------------------------------------------------*/
/* SMART MEDIA TYPE DEFINE							     */
/*-----------------------------------------------------*/
#define	SMT_T_CARD	0x0
#define	SMT_T_MCP	0x1
#define	SMT_T_ADV	0x2


#endif	//__SMART_MEDIA_COMMON_HEADER__

/***** End of file *****/

⌨️ 快捷键说明

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