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

📄 tcc730_usb.h

📁 TELECHIPS MP3解决方案UMS实现源代码
💻 H
字号:
/**************************************************************************************
 *
 * TELECHIPS Co.
 * 
 * 3rd floor Heung-A 70-1 Samsung-dong, KangNam-ku, Seoul, Korea
 * ====================================================================================
 *
 * Name:        Ji-Woong	Choi
 * Phone:       82-2-3443-6792
 * E-mail:      ddag@telechips.com
 *
 * FILE NAME:   USB.H
 *
 * DESCRIPTION:
 *       This is a Header file for USB
 *
 *
 * FILE HISTORY:
 * 	Date: 2002.01.30	Start source coding		By Jiwoong	Choi
 *	Date: 2002.08.06	Start Revision 			By Hyunchul	Hong
 *
 **************************************************************************************/
#ifndef	_USB_H_
#define _USB_H_


#ifdef	USB_ONLY
#define	USB_EXT
#else
#define	USB_EXT extern
#endif


//**********************************************************
//*
//*		Definition USB Error Code
//*
//**********************************************************

typedef	unsigned int	USB_ERROR;
typedef	unsigned int	PROC_ERROR;

//**********************************************************
//*
//*		Definition CONSTANT or TYPEDEF
//*
//**********************************************************
typedef unsigned char	usb_u8;
typedef unsigned int	usb_u16;
typedef unsigned long	usb_u32;

typedef void (*USERHANDLERFUNC) (unsigned char);


//**********************************************************
//*
//*		Definition about USB
//*
//**********************************************************

//===============================================
//=		USB_PROC.C
//===============================================
#define LITTLE_ENDIAN
#define PTL_HEAD_SIZE	3
#define PTL_INT_MEM		0x00
#define PTL_EXT_CARD	0x01
#define PTL_VOICE_MEM	0x02

/* command parser defines */
#define EMOD_COMMHEAD   0x01
#define EMOD_PACKLEN1   0x02
#define EMOD_PACKLEN2   0x03
#define EMOD_PACKXFER   0x04
#define EMOD_COMMCODE   0x05
#define EMOD_COMMPARM   0x06
#define EMOD_COMMTAIL   0x07

#ifndef PUBLIC
#define PUBLIC
#define PRIVATE static
#endif

#ifndef MAX_FILE_LEN
#define MAX_FILE_LEN	8
#endif

#define SEND_BUF_SIZE	64
#define RECV_BUF_SIZE	64

//===============================================
//=		USB_IO.C
//===============================================

//[ USB Set-up Data ]
#define	bmRequestType	0
#define	bRequest		1
#define	wValueL			2
#define	wValueH			3
#define	wIndexL			4
#define	wIndexH			5
#define	wLengthL		6
#define	wLengthH		7

// [ bmRequestType ]
//Data Trasfer Direction
#define	DataTrsDir		(1<<7)
#define	HostToDevice	0x00
#define	DeviceToHost	0x80

//Data Trasfer Type
#define	DataTrsType		(3<<5)
#define	StandardType	0x00
#define	ClassType		0x20
#define	VendorType		0x40
#define	ResevType		0x60

// Recipient Type
#define	RecipiType		(0x1f)
#define	DeviceRecipi	0x00	// Standard ?
#define	InterfaceRecipi	0x01	// HID ?
#define	EndpointRecipi	0x02	
#define	OtherRecipi		0x03

// [ bRequest ]
// Specfic Request Code
// StandardType
#define	GET_STATUS			0x00
#define	CLEAR_FEATURE		0x01
#define	SET_FEATURE			0x03
#define	SET_ADDRESS			0x05
#define	GET_DESCRIPTOR		0x06
#define	SET_DESCRIPTOR		0x07
#define	GET_CONFIGURATION	0x08
#define	SET_CONFIGURATION	0x09
#define GET_INTERFACE		0x0A
#define SET_INTERFACE		0x0B
#define SYNCH_FRAME			0x0C

// Specfic Request Code		(bRequest)
// ClassType
#define	GET_REPORT			0x01
#define	GET_IDLE			0x02
#define	GET_PROTOCOL		0x03
#define	SET_REPORT			0x09
#define	SET_IDLE			0x0A
#define	SET_PROTOCOL		0x0B

// DECRIPTOR Type		(wValueH)
#define DecrType		(3<<5)
#define StandardDecr	0x00
#define	DEVICE			0x01
#define	CONFIGURATION	0x02
#define	STRING			0x03
#define INTERFACE		0x04
#define ENDPOINT		0x05

#define ClassdDecr		0x20
#define HIDDecr			0x21
#define ReportDecr		0x22
#define PhysiDecr		0x23

// CLEAR_FEATURE Type		(wValue)
#define	DEVICE_R_WAKEUP	0x01
#define	ENDPOINT_HALTN	0x00

// USB Bit Function Descriptions for Main Chip 
//////////////////////////////////////////////////
// PWRMAN
#define SUSPEND						(1<<0)
#define UC_RESUME					(1<<1)
#define USB_RESEUME					(1<<2)
#define USB_RESTN					(1<<3)

//INTREG
#define		EP0						(1<<0)
#define		EP1_IN					(1<<1)
#define		EP1_OUT					(1<<2)
#define		EP2_IN					(1<<3)
#define		EP2_OUT					(1<<4)
#define		EP3_IN					(1<<5)
#define		EP4_OUT					(1<<6)
#define		SUS_RSM					(1<<7)

// EP0_CSR
#define EP0_OUT_PKT_RDY				(1<<0)
#define EP0_IN_PKT_RDY				(1<<1)
#define EP0_SENT_STALL				(1<<2)
#define EP0_DATA_END				(1<<3)
#define EP0_SETUP_END				(1<<4)
#define EP0_FORCE_STALL				(1<<5)
#define EP0_CLR_OUT_PKT_RDY			(1<<6)
#define EP0_CLR_SETUP_END			(1<<7)

//OUTCSR
#define OUT_PKT_RDY					(1<<0)
#define OVER_RUN					(1<<1)
#define SEND_STALL					(1<<2)
#define ISO							(1<<3)
#define FORCE_STALL					(1<<4)
#define DATA_ERR					(1<<5)
//#define FIFO_FLUSH				(1<<6)
//INCSR
#define IN_PKT_RDY					(1<<0)
#define UNDER_RUN					(1<<1)
#define iFORCE_STALL				(1<<2)
#define iISO						(1<<3)
#define INTPT_ENDPT					(1<<4)
#define IN_PKT_RDY2					(1<<5)
#define iFIFO_FLUSH					(1<<6)
#define CLR_DATA_TOGGLE				(1<<7)

#define		CONFIG_DESC_TOTAL_SIZE      32	
#define		DEVICE_DESC_SIZE            0x12
#define		CONFIG_DESC_SIZE            9
#define		INTERFACE_DESC_SIZE         9
#define		ENDPOINT_DESC_SIZE          7
#define		LANGID			    		0x0409  /* English is 0009, neutral is 0000 */

#define		npage	9
#define 	nblock  5

#ifndef CODE
#define CODE		code
#define CODE_UBYTE (CODE unsigned char*)// Up to Code Memory
#define CODE_BYTE  (CODE char*)// Up to Code Memory
#define CODE_UWORD (CODE uword*)// Up to Code Memory
#endif

#ifndef USB_OK
#define USB_OK 	   1
#define USB_CANCEL 0
#endif

typedef void (*TCC730_BOOT_MAIN)(int);

#ifndef _Jump_Addr
#define _Jump_Addr *((unsigned short int*)0x223ffe)
#endif

//**********************************************************
//*
//*		Struct about USB
//*
//**********************************************************

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

union	USB_DWORD_BYTE {
	
	unsigned long		DWORD;
	unsigned int		WORD[2];
	unsigned char		BYTE[4];
};

//**********************************************************
//*
//*		Definition FUNCTION
//*
//**********************************************************
//===============================================
//=		USB_DRV.C
//===============================================
extern void				USB_DRV_Init(void);
extern void 			USB_DRV_Reset(void);
extern USB_ERROR		USB_DRV_IsConnected(void);
extern void 			IntHdlr_TCC730_USB(void);
extern void 			USB_DRV_ParserCmd(void);
extern void 			USB_DRV_ProcessGetDescriptor(void);
extern void 			USB_DRV_SendTxData(void);
extern USB_ERROR		USB_DRV_CheckRecvChar(void);
extern USB_ERROR		USB_DRV_RecvStr( usb_u8* str, usb_u16 Total_Byte);
extern USB_ERROR		USB_DRV_SendStr( usb_u8* str, usb_u16 Total_Byte);
extern void				USB_DRV_FlushExtendedCommand(void);

//===============================================
//=		PROC_EXT.c
//===============================================
extern PROC_ERROR		USB_PROC_CheckCommand( void );

extern void	PROC_SUB_Refresh(unsigned char *Command_Buff);
extern void	PROC_SUB_UNICODE_VersionFont(unsigned char *Command_Buff);
extern void	PROC_SUB_UNICODE_DownloadFont(unsigned char *Command_Buff);
extern void	PROC_SUB_UNICODE_UploadFont(unsigned char *Command_Buff);
extern void	PROC_SUB_UNICODE_EraseFont(unsigned char* Command_Buff);
extern void	PROC_SUB_Send_NACK_Packet(unsigned char com1,unsigned char com2,unsigned char* Command_Buff);
extern void	PROC_SUB_Send_ACK_Packet(unsigned char cmd1,unsigned char cmd2,unsigned char cmd3, unsigned char* Command_Buff);




#endif

⌨️ 快捷键说明

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