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

📄 _usbdesc.c

📁 motorola jw32 usb 源码
💻 C
字号:
//============================================================================
// File: UsbDesc.h
// Func: Device-, Configuration- and String-Descriptors for
//		 USB08 Demo Application (all const Data, placed in Flash-ROM)
// Ver.: 1.01
// Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR
//       http://hc08web.de/usb08
// Rem.: View/Edit this File with TAB-Size=4
//============================================================================

#pragma CONST_SEG ConstData

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

//mouse
const unsigned char  HidReportDesc0[58] = {
0x05,0x01,    //73
0x09,0x02,
0xA1,0x01,
0x09,0x01,
0xA1,0x00,
0x05,0x09,
0x19,0x01,
0x29,0x07,
0x15,0x00,
0x25,0x01,
0x95,0x08,
0x75,0x01,
0x81,0x02,
//------------------------------------------
/*
0x06,0x00,0xFF,
0x09,0x40,
0x95,0x02,
0x75,0x08,
0x15,0x81,
0x25,0x7F,
0x81,0x02,
*/
//---------------------------------- //x,y
0x05,0x01,
0x09,0x30,
0x09,0x31,
0x16,0x00,0x80,
0x26,0xFF,0x7F,
0x75,0x10,
0x95,0x02,
//---------------------------------		 //wheel
0x81,0x06,
0x09,0x38,
0x15,0x81,
0x25,0x7F,
0x75,0x08,
0x95,0x01,
0x81,0x06,
 //-----------------------------------
0xC0,
0xC0,
};
const unsigned char HidReportDesc1[] =    //keyboard
{
   0x05, 0x01,  /* Usage Page (Generic Desktop)             */
   0x09, 0x06,  /* Usage (Keyboard)                         */
   0xA1, 0x01,  /* Collection (Application)                 */
   0x85, 0x01,//ID
   0x05, 0x07,  /*      Usage page (Key Codes)              */
   0x19, 0xE0,  /*      Usage minimum (224)                 */
   0x29, 0xE7,  /*      Usage maximum (231)                 */
   0x15, 0x00,  /*      Logical minimum (0)                 */
   0x25, 0x01,  /* 		Logical maximum (1)                 */
   0x75, 0x01,  /*      Report size (1)                     */
   0x95, 0x08,  /*      Report count (8)                    */
   0x81, 0x02,  /*      Input (data, variable, absolute)    */
   0x95, 0x01,  /*      Report count (5)                    */
   0x75, 0x08,  /*      Report size (8)                     */
   0x81, 0x01,  /*      Input (constant)                    */
   0x95, 0x05,  /*      Report count (5)                    */
   0x75, 0x01,  /*      Report size (1)                     */
   0x05, 0x08,  /*      Usage page (page# for LEDs)         */
   0x19, 0x01,  /*      Usage minimum (1)                   */
   0x29, 0x05,  /*      Usage maxmimum (5)                  */
   0x91, 0x02,  /*      Output (data, variable, absolute)   */
   0x95, 0x01,  /*      Report count (1)                    */
   0x75, 0x03,  /*      Report size (3)                     */
   0x91, 0x01,  /*      Output (constant)                   */
   0x95, 0x03,  /*      Report count (3)                    */
   0x75, 0x08,  /*      Report size (8)                     */
   0x15, 0x00,  /*      Logical minimum (0)                 */
   0x25, 0x65,  /*      Logical maximum (101)               */
   0x05, 0x07,  /*      Usage page (key codes)              */
   0x19, 0x00,  /*      Usage minimum (0)                   */
   0x29, 0x65,  /*      Usage maximum (101)                 */
   0x81, 0x00,  /*      Input (data, array)                 */
   0xC0,        /* end Collection                           */
//----------------------------------------------
   0x05,0x01,
   0x09,0x80,
   0xA1,0x01,   //*collection (application) */
   0x85,0x03,
   0x19,0x81,     //POWER UP
   0x29,0x83,     //POWER
   0x15,0x00,   /*logical minimum (0) */
   0x25,0x01,   /*logical maximum (1) */
   0x95,0x03,
   0x75,0x01,   /*report size (1) */
   0x81,0x02,   //    input(data,var,abs)
   0x95,0x01,   /*report count (1) */
   0x75,0x05,
   0x81,0x01,
   0xC0,
 //----------------------------------------------
   0x05,0x0c,     //consumer
   0x09,0x01,     //Consumer Control
   0xA1,0x01,     //*collection (application) */
   0x85,0x02,     //ID
   0x15,0x00,     /*logical minimum (0) */
   0x25,0x01,     /*logical maximum (1) */
   0x09,0xb5,     //next
   0x09,0xb6,     //Previous
   0x09,0xCD,     //Play/Pause
   0x09,0xE2,     //Mute
   0x09,0xE9,     //Volume Increment
   0x09,0xEA,     //Volume Decrement
   0x0A,0x94,0x01,//my computer
   0x0A,0x23,0x02,//Home(open IE)
   0x0A,0x27,0x02,//Refresh(刷新)
   0x0A,0x8A,0x01,//Email Reader
   0x0A,0x21,0x02,//Search
   0x1a,0x01,0x00, /*usage minimum (1) */
   0x2a,0x00,0x04, /*usage maximum (40) */
   0x95,0x0b,      /*report count (3) */
   0x75,0x01,      /*report size (1) */
   0x81,0x02,      /*input (x button bits) */
   0x95,0x01,      /*report count (1) */
   0x75,0x05,      /*report size  (5) */
   0x81,0x01,    	 /*input (constant x? bit padding) */
   0xC0 		       /* end collection, end collection */
};
//const hid_report_descriptor
const unsigned char HidReportDesc2[] =    //
{
    0x06,0x00,0xff,
	0x09,0x01,
	0xA1,0x01,

	//input
	0x85,0x01,       // report id
	0x06,0x00,0xff, //usage page
	0x09,0x01,      //usage
	0x15,0, // logical min
	0x26,0xff,0, //logical max
	0x95,0x03, //report count
	0x75,8, //report size (8 bit)
	0x81,6, //input (data, variable, absolute)

	// output
	0x85,0x02,       // report id
	0x06,0x00,0xff,
	0x09,0x01,
	0x15,0, // logical min
	0x26,0xff,0, //logical max
	0x95,0x03, //report count 0x03
	0x75,0x08, //report size (8 bit)
	0x91,0x06, //output (data, variable, absolute)

 	//feature
	0x85,0x03,       // report id
	0x06,0x00,0xff, //usage page
	0x09,0x01,      //usage
	0x15,0, // logical min
	0x26,0xff,0, //logical max
	0x95,0x02, //report count
	0x75,0x08, //report size (8 bit)
	0xB1,0x06, //feature (data, variable, absolute)

	0xc0
};
//----------------------------------------------------------------------------

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
{0x32,0x16/*,0x71,0x04*/},//	{0x70, 0x0C},		// Vendor ID = MCT Elektronikladen
{0x01,0x01/*,0x88,0x08*/},//	{0x28, 0x00},		// Product ID = Generic Demo
{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) +	3*sizeof(interface_descriptor)+
	91,// 4*sizeof(endpoint_descriptor)+3*sizeof(hid_descriptor),
	 0x00},				// Total Length of Data for this Conf
	3,					// No. of Interfaces supported by this Conf 配置接口数
	1,					// Designator Value for *this* Configuration
	4,					// 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)
	58,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
	}, // end of Endpoint1Desc
//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)
	2,					// 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)
	0x3E,0                    // wDescriptorLength ( in bytes )
},
            //IN endpoint
{
 	0x07,
	0x05,		// Descriptor Type (=5)
	0x83,				// Endpoint Address (EP3, IN)
	0x03,				// Interrupt
	{0x10, 0x00},		// Max. Endpoint Packet Size
	10					// Polling Interval (Interrupt) in ms
},
            //OUT endpoint
{
	0x07,
	0x05,		// Descriptor Type (=5)
	0x04,				// Endpoint Address (EP4, OUT)
	0x03,				// Interrupt
	{0x10, 0x00},		// Max. Endpoint Packet Size
	10					// Polling Interval (Interrupt) in ms
}
};
//----------------------------------------------------------------------------

// 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 + -