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

📄 __usbdesc.c

📁 motorola jw32 usb 源码
💻 C
📖 第 1 页 / 共 2 页
字号:
    0xC0,           //  end_collection

    0xA1,0x02,      //  collection(logical)

    0x75,0x08,      //    report_size(8)
    0x95,0x04,      //    report_count(4)
    0x46,0xFF,0x00, //    phusical_maximum(255)
    0x26,0xFF,0x00, //    logical_maximum(255)
    0x09,0x02,      //    usage(vendor usage 2)
    0x91,0x02,      //    output(data,var,abs)

    0xC0,           //  end_collection

    0xC0,           //end_collection
};

const device_descriptor DeviceDesc =
	{					// Size of this Descriptor in Bytes
	sizeof(device_descriptor),
	DT_DEVICE,			// Descriptor Type (=1)
	{0x10,0x01},		// USB Spec Release Number in BCD = 1.10
	0,					// Device Class Code (none)
	0,					// Device Subclass Code	(none)
	0,					// Device Protocol Code (none)
	8,					// Maximum Packet Size for EP0
{0x8F,0x0E},//{0xC4, 0x10},////{0x32,0x01/*0x15*//*,0x71,0x04*/},//	{0x70, 0x0C},		// Vendor ID = MCT Elektronikladen
{0x03,0x00},//{0x01, 0x00},////{0x01,0x01/*,0x88,0x08*/},//	{0x28, 0x00},		// Product ID = Generic Demo
{0x07,0x01},//{0x00, 0x00},////{0x00,0x21/*,0x00,0x01*/},//	{0x00, 0x31},		// Device Release Number in BCD
	1,					// Index of String Desc for Manufacturer
	2,					// Index of String Desc for Product
	0,					// Index of String Desc for SerNo
	1					// Number of possible Configurations
	}; // 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) +	4*sizeof(interface_descriptor)+
	3*sizeof(endpoint_descriptor)+4*sizeof(hid_descriptor),
	 0x00},				// Total Length of Data for this Conf
	4,					// 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)
	0					// 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) */
 0x00  		/* 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) */
 0x00  		/* 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) */
 0x84, 		/* endpoint address (IN endpoint, endpoint 3) */
 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 MFT 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("MFT 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
	};

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

#pragma CONST_SEG DEFAULT

⌨️ 快捷键说明

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