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

📄 usb.h

📁 基于c8051F320的优盘制作代码及原理图
💻 H
字号:
#define			uchar		unsigned	char
#define			uint		unsigned	int
#define			ulong		unsigned	long
/**********************************************************************
Define	USB Specitial Fucntion Registor Address
***********************************************************************/
//Interrupt related
#define			IN1INT		0x02
#define			OUT1INT		0x04
#define			CMINT		0x06
#define			INIE		0x07
#define			OUTIE		0x09
#define			CMIE		0x0B
//Common SFR
#define			FADDR		0x00
#define			POWER		0x01
#define			FRAMEL		0x0C
#define			FRAMEH		0x0D
#define			INDEX		0x0E
#define			CLKREC		0x0F	
#define			FIFO0		0x20
#define			FIFO1		0x21
#define			FIFO2		0x22
#define			FIFO3		0x23
//Control SFR
#define			E0CSR		0x11
#define			EINCSRL		0x11
#define			EINCSRH		0x12
#define			EOUTCSRL	0x14
#define			EOUTCSRH	0x15
#define			E0CNT		0x16
#define			EOUTCNTL	0x16
#define			EOUTCNTH	0x17

/************************************************************************
USB Descriptors data Structure
*************************************************************************/
//Device Descriptor
typedef		struct	_Device_Descriptor
{
	uchar	bLength;
	uchar	bDescriptorType;
	uint	bcdUSB;
	uchar	bDeviceClass;
	uchar	bDeviceSubClass;
	uchar	bDeviceProtocal;
	uchar	bMaxPacketSize;
	uint	IDVendor;
	uint	IDProduct;
	uint	bcdDevice;
	uchar	iManufacture;
	uchar	iProduct;
	uchar	iSerialNumber;
	uchar	bNumConfig;

}	Device_Descriptor,	*pDevice;
		
//Configuration Descriptor
typedef		struct	_Config_Descriptor
{
	uchar	bLength;
	uchar	bDescriptorType;
	uint	wTotalLength;
	uchar	bNumInterfaces;
	uchar	bConfigValue;
	uchar	iConfig;
	uchar	bmAttributes;
	uchar	MaxPower;
}	Config_Descriptor,	*pConfig;

//Interface	Descriptor
typedef		struct	_Interface_Descriptor
{
	uchar	bLength;
	uchar	bDescriptorType;
	uchar	bInterfaceNum;
	uchar	bAlternateSetting;
	uchar	bNumEndpoints;
	uchar	bInterfaceClass;
	uchar	bInterfaceSubClass;
	uchar	bInterfaceProtocal;
	uchar	iInterface;
}	Interface_Descriptor,	*pInterface;

//Endpoint	Descriptor
typedef		struct	_Endpoint_Descriptor
{
	uchar	bLength;
	uchar	bDescriptorType;
	uchar	bEndpointAddress;
	uchar	bmAttributes;
	uint	wMaxPacketSize;
	uchar	bInterval;
}	Endpoint_Descriptor,	*pEndpoint;

//Full Description of Config Descriptor
typedef		struct	_Config_Long
{
	Config_Descriptor		subConfig_Descriptor;
	Interface_Descriptor	subInterface_Descripotr;
	Endpoint_Descriptor		subEndpoint_Descriptor[6];
}	Config_Long,	*pConfig_long;
	


/*********************************************************************************
Host Requst data Structure
**********************************************************************************/
typedef		struct	_Requst
{
	uchar	bRequstType;			//Requst Type
	uchar	bRequst;				//Requst Value
	uint	wValue;					//Descriptor Type and offset Value
	uint	wIndex;					//Useful only in Get_Descriptor otherwise is "0"
	uint	wLength;				//Requst data Length from Slave
}	Requst,	* pRequst;





⌨️ 快捷键说明

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