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

📄 setusbinfo.h

📁 16位单片机H8的例子源代码
💻 H
字号:
/*
****************************************************************************
					H I T A C H I    P R O P R I E T A R Y

	COPYRIGHT (c)	2001 BY Semiconductor & Integrated Circuits,Hitachi,Ltd.
						---  ALL RIGHTS RESERVED  ---

	File Name	:SetUsbInfo.h
	Working		:USB information data
	Created		:Rev 2001_11_28 {Author : T.Ishikawa}
****************************************************************************
*/

#define	SetUsbInfo



/*	interrupt enable register bits	*/
InterruptType	interruptEnableBitsGVar = {0xFFFFFFFF};



/*	function and "EpInfo" number for each interrupt	*/
LinkType	jump[] = {
	{0x80000000,1,0,ActBusReset},		/*	Bus_Reset interrupt	*/
	{0x01000000,0,0,ActControl},		/*	Setup_TS	*/
	{0x0E000000,1,0,ActControlIn},		/*	EP0o_TS, EP0i_TR, EP0i_TS	*/
	{0x0E000000,2,0,ActControlOut},		/*	EP0o_TS, EP0i_TR, EP0i_TS	*/
	{0x00040000,3,5,ActBulkOnly},		/*	EP1_Full		*/
	{0x00030000,4,6,ActBulkOnly},		/*	EP2_Empty, EP2_TR	*/
	{0x00000080,0,0,SetUsbModule},		/*	PLL_Ready Interrupt	*/
	{0x00000001,0,0,ActBusVcc},			/*	USB Bus Connect (VBUS) Interrupt	*/
	{0x00000000,255,0,0}				/*	table end	*/
};



/*	register information for each Endpoint	*/
EpInfoType	EpInfo[] = {
	/*	0	EP0-Setup (Control Transfer Setup Stage)	*/	/*	clear EP0o, EP0i FIFOs	*/
	{0,	CONTROL,	&writeFifoSizeGVar[0],	&USBFM.UEDR0S.BYTE,	0x00,				0x00,	0x01,	0x06,	0x00,	WAIT,	8},
	/*	1	EP0-In (Control IN Transfer)	*/
	{0,	CONTROL,	&writeFifoSizeGVar[0],	&USBFM.UEDR0I.BYTE,	0x00,				0x02,	0x04,	0x02,	0x00,	WAIT,	64},
	/*	2	EP0-Out (Control OUT Transfer)	*/
	{0,	CONTROL,	&USBFM.UESZ0O,			&USBFM.UEDR0O.BYTE,	0x00,				0x02,	0x04,	0x04,	0x00,	WAIT,	64},
	/*	3	EP1-BulkOut	*/
	{1,	BULK,		&USBFM.UESZ2O,			&USBFM.UEDR2O.BYTE,	&USBFM.UEDR2O.LONG,	0x00,	0x20,	0x20,	0x20,	WAIT,	64},
	/*	4	EP2-BulkIn	*/
	{2,	BULK,		&writeFifoSizeGVar[1],	&USBFM.UEDR2I.BYTE,	&USBFM.UEDR2I.LONG,	0x10,	0x00,	0x10,	0x10,	WAIT,	64}
};



/*	data buffer information	*/
BuffType	dataBuffGPtr[] = {
	{&controlBeginGVar,&controlBeginGVar,&controlBeginGVar,&controlEndGVar},	/*	Control Transfer	*/
	{0,0,0,0},	/*	not use	*/
	{0,0,0,0},	/*	not use	*/
	{&bulkBeginGVar,&bulkBeginGVar,&bulkBeginGVar,&bulkEndGVar},	/*	Bulk OUT Transfer	*/
	{&bulkBeginGVar,&bulkBeginGVar,&bulkBeginGVar,&bulkEndGVar},	/*	Bulk IN Transfer	*/

	/*	CBW/CSW transfer data pointer for BOT	*/
	{&cbwDataGVar->byteVal[0],&cbwDataGVar->byteVal[0],&cbwDataGVar->byteVal[0],(&cbwDataGVar->byteVal[31] + 1)},
	/*	Storage/Sense transfer data pointer for BOT	*/
	{&botDataGVar.byteVal[0],&botDataGVar.byteVal[0],&botDataGVar.byteVal[0],(&botDataGVar.byteVal[DISK_ALL_BYTE] + 1)}
};



BuffType	contCMDGPtr = {&ep0PacketGVar.byteVal[0],&ep0PacketGVar.byteVal[0],&ep0PacketGVar.byteVal[0],(&ep0PacketGVar.byteVal[7] + 1)};



/*	data buffer pointer for Control OUT transfer	*/
ControlType transStageGPtr = {0,0};



/*	Max Packet Size	*/
unsigned char	writeFifoSizeGVar[] = {64,64};



/*	Descriptor information	*/
/*	Device Descriptor	*/
unsigned char		DeviceItem[] = {
	0x12,0x01,0x10,0x01,0x00,0x00,0x00,0x40,
	0x5B,0x04,0x03,0x00,0x00,0x01,0x00,0x00,0x00,0x01	/*	Vender=Hitachi. No String	*/
/*	""Attention"" Please use your company Vendor ID	*/
};

DiscriptorType		deviceDiscriptorGVar[] = {
	{18,DeviceItem}
};



/*	Configuration Descriptoer ( data length=32Byte )	*/
unsigned char		configurationItem[] = {
	0x09,0x02,0x20,0x00,0x01,0x01,0x00,0xC0,0x10,	/*	not use remoteWakeup	*/
	0x09,0x04,0x00,0x00,0x02,0x08,0x06,0x50,0x00,	/*	Interface / Endpoint number is 2 , Mass Storage Class Bulk Only Transport	*/
	0x07,0x05,0x82,0x02,0x40,0x00,0x00,				/*	EP2 / BalkIn MaxPacket=64	*/
	0x07,0x05,0x01,0x02,0x40,0x00,0x00				/*	EP1 / BalkOut MaxPacket=64	*/
};

DiscriptorType		configurationDiscriptorGVar[] = {
	{32,configurationItem}
};



/*	String Descriptor (sample)	*/
unsigned char		StringItem0[] = {0x71,0x72,0x73,0x74,0x75};	/*	String Descriptor Information (sample)	*/
unsigned char		StringItem1[] = {0x71,0x72,0x73,0x74,0x75};	/*	Vendor String Descriptor Information (sample)	*/
unsigned char		StringItem2[] = {0x71,0x72,0x73,0x74,0x75};	/*	Product String Descriptor Information (sample)	*/
unsigned char		StringItem3[] = {0x71,0x72,0x73,0x74,0x75};	/*	Product Number String Descriptor Information (sample)	*/
unsigned char		StringItem4[] = {0x71,0x72,0x73,0x74,0x75};	/*	Configuration String Descriptor Information (sample)	*/
unsigned char		StringItem5[] = {0x71,0x72,0x73,0x74,0x75};	/*	Interface String Descriptor Information (sample)	*/

DiscriptorType		stringDiscriptorGVar[] = {
	{5,StringItem0},
	{5,StringItem1},
	{5,StringItem2},
	{5,StringItem3},
	{5,StringItem4},
	{5,StringItem5}
};

⌨️ 快捷键说明

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