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

📄 reqcode.c

📁 单片机USB编程。摘自ZLGMCU。很有参考价值。希望能参大家有用
💻 C
📖 第 1 页 / 共 2 页
字号:
ENDPOINT_DESCRIPTOR	code	HS_Bulk_In_Descriptor[] =
{
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x82, 								//Set Bulk endpoint to 1 for ATAPI mode
		0x02,								//Endpoint Characteristic
		SWAP(0x0200),						//Endpoint Max Packet Size
		0x00								//Interval for Polling Endpoint for data transfer
		
};


ENDPOINT_DESCRIPTOR	code	Int_Out_Descriptor[] =
{
	
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x01, 								//Set Int endpoint to 2 for ATAPI mode
		0x03,								//Endpoint Characteristic
		SWAP(0x0040),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

ENDPOINT_DESCRIPTOR	code	Int_In_Descriptor[] =
{
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x81, 								//Set Int endpoint to 2 for ATAPI mode
		0x03,	 							//Endpoint Characteristic
		SWAP(0x0040),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

ENDPOINT_DESCRIPTOR	code	HS_Int_Out_Descriptor[] =
{
	
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x01, 								//Set Int endpoint to 2 for ATAPI mode
		0x03,								//Endpoint Characteristic
		SWAP(0x0040),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

ENDPOINT_DESCRIPTOR	code	HS_Int_In_Descriptor[] =
{
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x81, 								//Set Int endpoint to 2 for ATAPI mode
		0x03,	 							//Endpoint Characteristic
		SWAP(0x0040),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

//***********************************************************************
//*										    							               *
//*	Routine 	:  Standard Interface Descriptor                    		*
//*	Input		:  None              									         *
//*	Output	:  None                                					   *
//*	Function	:  None                                      			   *
//*																		               *
//***********************************************************************

INTERFACE_DESCRIPTOR	code	Iso_Interface_Descriptor[] =
{
	
	sizeof(INTERFACE_DESCRIPTOR),	//Length of standard interface descriptor
		0x04,								//Standard Interface Type
		0x00,								//No of Interface
		0x01,								//Alternate Setting Selector
		0x02,								//No of Endpoints
		0x00,								//Interface Class
		0x00,								//Interface Sub Class
		0x00,								//Interface Protocol
		0x00								//Index of interface string desriptor
		
};


ENDPOINT_DESCRIPTOR	code	Iso_Out_Descriptor[] =
{
	
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x03, 								//Enndpoint Address
		0x01,								//Endpoint Characteristic
		SWAP(0x0040),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

ENDPOINT_DESCRIPTOR	code	Iso_In_Descriptor[] =
{
	
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x83, 								//Enndpoint Address
		0x01,								//Endpoint Characteristic
		SWAP(0x0040),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

ENDPOINT_DESCRIPTOR	code	Iso_Out_Zero_Descriptor[] =
{
	
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x03, 								//Enndpoint Address
		0x01,								//Endpoint Characteristic
		SWAP(0x0000),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

ENDPOINT_DESCRIPTOR	code	Iso_In_Zero_Descriptor[] =
{
	
	sizeof(ENDPOINT_DESCRIPTOR),	//Length of Standard Endpoint Descriptor
		0x05,								//Standard Endpoint Type
		0x83, 								//Enndpoint Address
		0x01,								//Endpoint Characteristic
		SWAP(0x0000),						//Endpoint Max Packet Size
		0x01								//Interval for Polling Endpoint for data transfer
		
};

//***********************************************************************
//*										    							               *
//*	Routine 	:  Standard String Descriptor                    		   *
//*	Input		:  None              									         *
//*	Output	:  None                                					   *
//*	Function	:  None                                      			   *
//*																		               *
//***********************************************************************

STRING_DESCRIPTOR	code	Standard_Product_String[] =	     

{	 0x30,	   /* length                   */
0x03, 	   /* descriptor type = string */
'P' , 0x00,
'h' , 0x00,
'i' , 0x00,
'l' , 0x00,
'i' , 0x00,
'p' , 0x00,
's' , 0x00,
' ' , 0x00,
'I' , 0x00,
'S' , 0x00,
'P' , 0x00,
'1' , 0x00,
'5' , 0x00,
'8' , 0x00,
'1' , 0x00,
' ' , 0x00,
'V' , 0x00,
'e' , 0x00,
'r' , 0x00,
' ' , 0x00,
'1' , 0x00,
'.' , 0x00,
'0' , 0x00
};

//***********************************************************************
//*										    							               *
//*	Routine 	:  Standard String Descriptor                    		   *
//*	Input		:  None              									         *
//*	Output	:  None                                					   *
//*	Function	:  None                                      			   *
//*																		               *
//***********************************************************************

STRING_DESCRIPTOR	code	Standard_Manufacturer_String[] =	     

{	 0x1C,	   /* length                   */
0x03, 	   /* descriptor type = string */
'P' , 0x00,
'h' , 0x00,
'i' , 0x00,
'l' , 0x00,
'i' , 0x00,
'p' , 0x00,
' ' , 0x00,
'-' , 0x00,
' ' , 0x00,
'A' , 0x00,
'P' , 0x00,
'I' , 0x00,
'C' , 0x00
};



//***********************************************************************
//*										    							               *
//*	Routine 	:  Standard String Identifications                  		*
//*	Input		:  None              									         *
//*	Output	:  None                                					   *
//*	Function	:  None                                      			   *
//*																		               *
//***********************************************************************

STRING_ID 	code	Standard_String_ID[] = 
{
	
	0x04,
		0x03,
		0x09,
		0x04
		
};																 



//***********************************************************************
//*										    							               *
//*	Routine 	:  Standard Mass Storage Identifications                 *
//*	Input		:  None              									         *
//*	Output	:  None                                					   *
//*	Function	:  None                                      			   *
//*																		               *
//***********************************************************************
UC code  Test_Packet[] =
{
	//	0x00, 0x00,
	//	0x00, 0x80, // syn pattern
	0xc3,
		0x00, 0x00,
		0x00, 0x00,
		0x00, 0x00,
		0x00, 0x00,
		0x00, 0xaa,
		0xaa, 0xaa,
		0xaa, 0xaa,
		0xaa, 0xaa,
		0xaa, 0xee,  //aa*4
		0xee, 0xee,
		0xee, 0xee,
		0xee, 0xee,
		0xee, 0xfe,  //ee*4
		0xff, 0xff,
		0xff, 0xff,
		0xff, 0xff,
		0xff, 0xff,
		0xff, 0xff,  //FF*6
		0xff, 0x7f,
		0xbf, 0xdf,
		0xef, 0xf7,
		0xfb, 0xfd,
		0xfc, 0x7e,
		0xbf, 0xdf,
		0xef, 0xf7,
		0xfb, 0xfd,
		0x7e,
		0xb6, 0xce  // crc
		//	0xff, 0xf7
};

⌨️ 快捷键说明

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