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

📄 descriptor.c

📁 周立功magic2410实验箱源码 第6章Linux高级实验(part1) 6.1 Linux内核编译实验 6.2 Linux根文件系统实验 6.3 CAT1025读/写实验. 6.4 ZL
💻 C
字号:
/****************************************Copyright (c)****************************************************                               Guangzhou ZHIYUAN electronics Co.,LTD.**                                     **                                 http://www.zyinside.com****--------------File Info-------------------------------------------------------------------------------** File Name: 				Descriptor.c** Last modified Date: 		2005-11-01** Last Version:			V1.0		** Description: 			USB 设备描述符**                          USB device descriptor**------------------------------------------------------------------------------------------------------** Created By: 				MingYuan Zheng 郑明远** Created date: 			2005-11-01** Version: 				V1.0** Descriptions:			The original version 初始版本****------------------------------------------------------------------------------------------------------** Modified by:** Modified date:** Version:** Description:**********************************************************************************************************/#include "config.h"/* device descriptor: test device type */#define USB_CLASS_CODE_TEST_CLASS_DEVICE                    0xdc			   /* 设备描述符: 测试设备类型 *//* interface descriptor: subclass code */#define USB_SUBCLASS_CODE_TEST_CLASS_D12                    0xA0			   /* 接口描述符: 子类代码 *//* interface descriptor: protocol code */#define USB_PROTOCOL_CODE_TEST_CLASS_D12                    0xB0			   /* 接口描述符: 协议代码 *//* device descriptor(FULL Speed) 设备描述符 USB1.1(全速) */const USB_DEVICE_DESCRIPTOR DeviceDescr ={	sizeof(USB_DEVICE_DESCRIPTOR),					// 设备描述符长度,= 12H    	   device descriptor length = 12H	USB_DEVICE_DESCRIPTOR_TYPE,						// 设备描述符类型,= 01H        device descriptor type = 01H	0x00,0x01,										// 协议版本,= 1.10             protocol version = 1.10	USB_CLASS_CODE_TEST_CLASS_DEVICE,				// 测试设备类型, = 0DCH		   Class code = 0DCH	0, 0,											// 设备子类,设备协议       	   Subclass code, Protocol code	EP0_PACKET_SIZE,								// 端点0最大数据包大小,= 40H   Maximum packet size for endpoint 0, = 40H	0x9f,0x04,										// 设备ID	      			   Vendor ID		0x10,0x24,										// 设备制造商定的产品ID        Product ID	0x00,0x01,										// 设备系列号                  Device release number in binary-coded decimal	0, 0, 0,										// 索引                        Index	1												// 可能的配置数                Number of possible configurations};/**********************************************************************************						 USB描述符集合(USB1.1 全速) 						 				 USB descriptor collector(USB1.1 Full Speed)				 ***********************************************************************************/const USB_DESCRIPTOR usb_descr ={//configuration descriptor							// 配置描述符{	sizeof(USB_CONFIGURATION_DESCRIPTOR),			// 配置描述符长度,= 09H        Size of this descriptor in bytes = 09H	USB_CONFIGURATION_DESCRIPTOR_TYPE,				// 配置描述符类型,= 02H        configuration descriptor type = 02H	CONFIG_DESCRIPTOR_LENGTH,0x00,					// 描述符总长度, = 002EH       Total length of data returned for this configuration, = 002EH	1,												// 只支持1个接口               only support a interface	1,												// 配置值                      configuration value 	0,												// 字符串描述符指针(无)        Index of string descriptor describing this configuration(no)	0x60,											// 自供电,支持远程唤醒         Configuration characteristics: support Self-powered, Remote Wakeup	0x32											// 最大功耗(100mA) 			   Maximum power consumption(100mA)},//interface descriptor								// 接口描述符{	sizeof(USB_INTERFACE_DESCRIPTOR),				// 接口描述符长度,= 09H 	   Size of this descriptor in bytes = 09H	USB_INTERFACE_DESCRIPTOR_TYPE,					// 接口描述符类型,= 04H        interface descriptor type = 04H	0,												// 接口数,只有1个              Number of this interface, only one	0,												// 可选配置,只有1个            optional configuration, only one	NUM_ENDPOINTS,									// 除端点0的端点索引数目,=04H  Number of endpoints used by this interface (excluding endpoint zero) = 04H	USB_CLASS_CODE_TEST_CLASS_DEVICE,				// 测试设备类型,= 0DCH         Class code = 0DCH	USB_SUBCLASS_CODE_TEST_CLASS_D12,				// 子类代码,= 0A0H             Subclass code = 0A0H	USB_PROTOCOL_CODE_TEST_CLASS_D12,				// 协议代码,= 0B0H             Protocol code = 0B0H	0												// 字符串描述符索引            Index of string descriptor describing this interface},//endpoint descriptor, physical endpoint 1 IN		// 物理端点 1 输入	{	sizeof(USB_ENDPOINT_DESCRIPTOR),				// 端点描述符长度,= 07H        endpoint descriptor length = 07H	USB_ENDPOINT_DESCRIPTOR_TYPE,					// 端点描述符类型,= 05H        endpoint descriptor type = 05H	0x81,											// 端点1 IN                    endpoint 1 IN	USB_ENDPOINT_TYPE_BULK,							// 批量传输,= 02H   		   bulk transfer = 02H	EP1_PACKET_SIZE,0x00,							// 端点最大包的大小,= 0040H    endpoint max packet size = 0040H	1												// 传输间隔时间,= 10ms         Interval for polling endpoint for data transfers = 1ms},//endpoint descriptor, physical endpoint 2 OUT		// 物理端点 2 输出{	sizeof(USB_ENDPOINT_DESCRIPTOR),				// 端点描述符长度,= 07H        endpoint descriptor length = 07H	USB_ENDPOINT_DESCRIPTOR_TYPE,					// 端点描述符类型,= 05H        endpoint descriptor type = 05H	0x2,											// 端点1 OUT                   endpoint 1 OUT	USB_ENDPOINT_TYPE_BULK,							// 批量传输,= 02H   		   bulk transfer = 02H	EP2_PACKET_SIZE,0x00,							// 端点最大包的大小,= 0040H    endpoint max packet size = 0040H	1												// 传输间隔时间,= 10ms         Interval for polling endpoint for data transfers = 1ms},//endpoint descriptor, physical endpoint 3 IN		// 物理端点 3 输入	{	sizeof(USB_ENDPOINT_DESCRIPTOR),				// 端点描述符长度,= 07H  	   endpoint descriptor length = 07H	USB_ENDPOINT_DESCRIPTOR_TYPE,					// 端点描述符类型,= 05H  	   endpoint descriptor type = 05H	0x83,											// 端点2 IN					   endpoint 2 IN	USB_ENDPOINT_TYPE_BULK,							// 批量传输,= 02H   		   bulk transfer = 02H	EP3_PACKET_SIZE,0x00,							// 端点最大包的大小,= 0040H    endpoint max packet size = 0040H	10												// 批量传输时该值无效 		   the value is invalid when bulk transfer},//endpoint descriptor, physical endpoint 4 OUT		// 物理端点 4 输出{		sizeof(USB_ENDPOINT_DESCRIPTOR),				// 端点描述符长度,= 07H        endpoint descriptor length = 07H	USB_ENDPOINT_DESCRIPTOR_TYPE,					// 端点描述符类型,= 05H		   endpoint descriptor type = 05H	0x4,											// 端点2 OUT				   endpoint 2 OUT		USB_ENDPOINT_TYPE_BULK,							// 批量传输,= 02H			   bulk transfer = 02H	EP4_PACKET_SIZE,0x00,							// 端点最大包的大小,= 0040H	   endpoint max packet size = 0040H	10												// 批量传输时该值无效		   the value is invalid when bulk transfer}};/*********************************************************************************************************                            End Of File********************************************************************************************************/

⌨️ 快捷键说明

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