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

📄 usbdesc.c

📁 motorola jw32 usb 源码
💻 C
📖 第 1 页 / 共 2 页
字号:
	}; // end of DeviceDesc

//----------------------------------------------------------------------------
const hid_configuration_descriptor ConfigDesc ={
	{					// Size of this Descriptor in Bytes
	sizeof(configuration_descriptor),
	DT_CONFIGURATION,	// Descriptor Type (=2)
	{
	sizeof(configuration_descriptor) +	5*sizeof(interface_descriptor)+
	4*sizeof(endpoint_descriptor)+5*sizeof(hid_descriptor),
	 0x00},				// Total Length of Data for this Conf
	5,					// No. of Interfaces supported by this Conf 配置接口数
	1,					// Designator Value for *this* Configuration
	0,					// Index of String Desc for this Conf
	0xA0,				// Self-powered, no Remote-Wakeup
	64					// Max. Power Consumption in this Conf (*2mA)
	}, // end of ConfigDesc


//----------------------------------------------------------------------------

 //mouse interface
	{					// Size of this Descriptor in Bytes
	sizeof(interface_descriptor),
	DT_INTERFACE,		// Descriptor Type (=4)
	0,					// Number of *this* Interface (0..)
	0,					// Alternative for this Interface (if any)
	1,					// No of EPs used by this IF (excl. EP0)
	3,//0xff,			// IF Class Code (0xff = Vendor specific)
	1,				// Interface Subclass Code
	2,//0xff,				// IF Protocol Code  (0xff = Vendor specific)
	3					// Index of String Desc for this Interface
	}, // end of InterfaceDesc

//----------------------------------------------------------------------------
//mouse HID
	{					// Size of this Descriptor in Bytes
	sizeof(hid_descriptor),
	DT_HID,	// Descriptor Type (=0x21)
	{0x10, 0x01},		// USB Spec Release Number in BCD = 1.10
	0,                  // bCountryCode (US)
	1,                  // bNumDescriptors (1)
	0x22,               // bDescriptorType (HID report) HID_REPORT(0x22)
	sizeof(HidReportDesc0),0 // wDescriptorLength ( in bytes )
	},

//----------------------------------------------------------------------------

//mouse endpoint
	{					// Size of this Descriptor in Bytes
	sizeof(endpoint_descriptor),
	DT_ENDPOINT,		// Descriptor Type (=5)
	0x81,				// Endpoint Address (EP1, IN)
	0x03,				// Interrupt
	{0x10, 0x00},		// Max. Endpoint Packet Size
	1				// Polling Interval (Interrupt) in ms
	},
//keyboard interface
{
 0x09, 		/* length of descriptor (9 bytes) */
 0x04, 		/* descriptor type (INTERFACE) */
 0x01, 		/* interface number (1) */
 0x00, 		/* alternate setting (0) */
 0x01, 		/* number of endpoints (1) */
 0x03, 		/* interface class (3..defined by USB spec) */
 0x01, 		/* interface sub-class (1..defined by USB spec) */
 0x01, 		/* interface protocol (1 keyboard..defined by USB spec) */
 4  		/* interface string index (not supported) */
},
//keyboard HID
{
 0x09, 		/* descriptor size (9 bytes) */
 0x21, 		/* descriptor type (HID) */
 {0x10, 0x01},/* class specification (1.10) */
 0x00, 		/* hardware target country */
 0x01, 		/* number of hid class desriptors to follow (1) */
 0x22, 		/* report descriptor type (2) */
 sizeof(HidReportDesc1),0
},
//keyboard endpoint
{
 0x07, 		/* descriptor length (7 bytes) */
 0x05, 		/* descriptor type (ENDPOINT) */
 0x82, 		/* endpoint address (IN endpoint, endpoint 2) */
 0x03, 		/* endpoint attributes (interrupt) */
 {0x08, 0x00}, /* maximum packet size (8 bytes) */
 0x0A  		/* polling interval (10ms) */
},

            // HID interface
{
 	0x09,
	0x04,		// Descriptor Type (=4)
	2,					// Number of *this* Interface (0..)
	0,					// Alternative for this Interface (if any)
	0,					// No of EPs used by this IF (excl. EP0)
	3,//0xff,			// IF Class Code (0xff = Vendor specific)
	0,				// Interface Subclass Code
	0,//0xff,				// IF Protocol Code  (0xff = Vendor specific)
	0					// Index of String Desc for this Interface
},
        // HID
{
 	0x09,
	0x21,	// Descriptor Type (=0x21)
	{0x10, 0x01},	// USB Spec Release Number in BCD = 1.10
	0,                  // bCountryCode (US)
	1,                  // bNumDescriptors (1)
	0x22,               // bDescriptorType (HID report) HID_REPORT(0x22)
	sizeof(HidReportDesc2),0                    // wDescriptorLength ( in bytes )
},
/*
            //in endpoint
{
 	0x07,
	0x05,		// Descriptor Type (=5)
	0x83,				// Endpoint Address (EP3, OUT)
	0x03,				// Interrupt
	{0x10, 0x00},		// Max. Endpoint Packet Size
	10					// Polling Interval (Interrupt) in ms
},
*/
        //joystick interface
{
 0x09, 		/* length of descriptor (9 bytes) */
 0x04, 		/* descriptor type (INTERFACE) */
 0x03, 		/* interface number (3) */
 0x00, 		/* alternate setting (0) */
 0x01, 		/* number of endpoints (1) */
 0x03, 		/* interface class (3..defined by USB spec) */
 0x00, 		/* interface sub-class (0..defined by USB spec) */
 0x00, 		/* interface protocol (0 ..defined by USB spec) */
 5  		/* interface string index (not supported) */
},
            //joystick HID
{
 0x09, 		/* descriptor size (9 bytes) */
 0x21, 		/* descriptor type (HID) */
 {0x10, 0x01},/* class specification (1.10) */
 0x21, 		/* hardware target country */
 0x01, 		/* number of hid class desriptors to follow (1) */
 0x22, 		/* report descriptor type (2) */
 sizeof(HidReportDesc3),0
},
            //joystick endpoint
{
 0x07, 		/* descriptor length (7 bytes) */
 0x05, 		/* descriptor type (ENDPOINT) */
 0x83, 		/* endpoint address (IN endpoint, endpoint 3) */
 0x03, 		/* endpoint attributes (interrupt) */
 {0x10, 0x00}, /* maximum packet size (6 bytes) */
 0x10  		/* polling interval (16ms) */
},

        //joystick interface
{
 0x09, 		/* length of descriptor (9 bytes) */
 0x04, 		/* descriptor type (INTERFACE) */
 0x04, 		/* interface number (4) */
 0x00, 		/* alternate setting (0) */
 0x01, 		/* number of endpoints (1) */
 0x03, 		/* interface class (3..defined by USB spec) */
 0x00, 		/* interface sub-class (0..defined by USB spec) */
 0x00, 		/* interface protocol (0 ..defined by USB spec) */
 6  		/* interface string index (not supported) */
},
            //joystick HID
{
 0x09, 		/* descriptor size (9 bytes) */
 0x21, 		/* descriptor type (HID) */
 {0x10, 0x01},/* class specification (1.10) */
 0x21, 		/* hardware target country */
 0x01, 		/* number of hid class desriptors to follow (1) */
 0x22, 		/* report descriptor type (2) */
 sizeof(HidReportDesc4),0
},
            //joystick endpoint
{
 0x07, 		/* descriptor length (7 bytes) */
 0x05, 		/* descriptor type (ENDPOINT) */
 0x84, 		/* endpoint address (IN endpoint, endpoint 4) */
 0x03, 		/* endpoint attributes (interrupt) */
 {0x10, 0x00}, /* maximum packet size (6 bytes) */
 0x10  		/* polling interval (16ms) */
},

};
//----------------------------------------------------------------------------

// Language IDs
//--------------
#define SD0LEN 4
//--------------

const unsigned char  String0Desc[SD0LEN] = {
	// Size, Type
	SD0LEN, DT_STRING,
	// LangID Codes
	0x09, 0x04
	};

// Manufacturer String
//--------------------------------------------
#define SD1LEN sizeof("ChengDu Kturle Technogy Development Co,ltd")*2
//--------------------------------------------
const unsigned char  String1Desc[SD1LEN] = {
	// Size, Type
	SD1LEN, DT_STRING,
	// Unicode String
	'C', 0,
	'h', 0,
	'e', 0,
	'n', 0,
	'g', 0,
	'D', 0,
	'u', 0,
	' ', 0,
	'M', 0,
	'F', 0,
	'T', 0,
	' ', 0,
	'T', 0,
	'e', 0,
	'c', 0,
	'h', 0,
	'n', 0,
	'o', 0,
	'g', 0,
	'y', 0,
	' ', 0,
	'D', 0,
	'e', 0,
	'v', 0,
	'e', 0,
	'l', 0,
	'o', 0,
	'p', 0,
	'm', 0,
	'e', 0,
	'n', 0,
	't', 0,
	' ', 0,
	'C', 0,
	'o', 0,
	',', 0,
	'l', 0,
	't', 0,
	'd', 0
	};

// Product String
//-----------------------------------------------
#define SD2LEN sizeof("Kturle high-powered mice")*2
//-----------------------------------------------
const unsigned char  String2Desc[SD2LEN] = {
	// Size, Type
	SD2LEN, DT_STRING,
	// Unicode String
	'M', 0,
	'F', 0,
	'T', 0,
	' ', 0,
	'h', 0,
	'i', 0,
	'g', 0,
	'h', 0,
	'-', 0,
	'p', 0,
	'o', 0,
	'w', 0,
	'e', 0,
	'r', 0,
	'e', 0,
	'd', 0,
	' ', 0,
	'm', 0,
  'i', 0,
	'c', 0,
	'e', 0
	};

#define SD3LEN sizeof("mice")*2

const unsigned char  String3Desc[SD3LEN] = {
	// Size, Type
	SD3LEN, DT_STRING,
	// Unicode String
	'm', 0,
	'i', 0,
	'c', 0,
	'e', 0,
	};

#define SD4LEN sizeof("keyboard")*2

const unsigned char  String4Desc[SD4LEN] = {
	// Size, Type
	SD4LEN, DT_STRING,
	// Unicode String
	'k', 0,
	'e', 0,
	'y', 0,
	'b', 0,
	'o', 0,
	'a', 0,
	'r', 0,
	'd', 0,
	};

#define SD5LEN sizeof("joystick1")*2

const unsigned char  String5Desc[SD5LEN] = {
	// Size, Type
	SD5LEN, DT_STRING,
	// Unicode String
	'j', 0,
	'o', 0,
	'y', 0,
	's', 0,
	't', 0,
	'i', 0,
	'c', 0,
	'k', 0,
	'1', 0,
	};
#define SD6LEN sizeof("joystick2")*2

const unsigned char  String6Desc[SD6LEN] = {
	// Size, Type
	SD6LEN, DT_STRING,
	// Unicode String
	'j', 0,
	'o', 0,
	'y', 0,
	's', 0,
	't', 0,
	'i', 0,
	'c', 0,
	'k', 0,
	'2', 0,
	};

// Table of String Descriptors
//
const unsigned char  * const StringDescTable[] = {
	String0Desc,
	String1Desc,
	String2Desc,
	String3Desc,
	String4Desc,
	String5Desc,
  String6Desc,
	};

#pragma CONST_SEG DEFAULT

⌨️ 快捷键说明

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