?? descriptors.c
字號:
/*----------------------------------------------------------------------------+
| |
| Texas Instruments |
| |
| TUSB3410 |
| Descriptors |
| |
+-----------------------------------------------------------------------------+
| Source: descriptors.c, v00.01 2002/04/23 18:41 |
| Author: Ching-Hua Jim Chen Jim_Chen@ti.com |
| |
| For more information, please contact |
| |
| Jim Chen |
| Texas Instruments |
| 12500 TI Blvd, MS 8761 |
| Dallas, TX 75243 |
| USA |
| |
| Tel 214-480-4656 |
| Fax 972-761-6043 |
| |
| Release Notes: |
| |
| Logs: |
| |
| WHO WHEN WHAT |
| --- ---------- -------------------------------------------------- |
| CJH 04/23/2002 born |
| |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| Include files |
+----------------------------------------------------------------------------*/
/*
#include <io51.h> // 8051 sfr definition
#include "types.h" // Basic Type declarations
#include "usb.h" // USB-specific Data Structures
#include "tusb3410.h"
*/
/*----------------------------------------------------------------------------+
| External Function Prototype |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| External Variables |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| Internal Type Definition & Macro |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| Internal Constant Definition |
+----------------------------------------------------------------------------*/
BYTE code abromDeviceDescriptor[SIZEOF_DEVICE_DESCRIPTOR] = {
SIZEOF_DEVICE_DESCRIPTOR, // Length of this descriptor (12h bytes)
DESC_TYPE_DEVICE, // Type code of this descriptor (01h)
0x10,0x01, // Release of USB spec (Rev 1.1)
0xff, // Device's base class code
0, // Device's sub class code
0, // Device's protocol type code
EP0_PACKET_SIZE, // End point 0's packet size = 8
0x51, 0x04, // Vendor ID for device, TI=0x0451
0x11, 0x34, // Product ID for device, 0x3411
0x00, 0x01, // Revision level of device, Rev=1.00
1, // Index of manufacturer name string desc
2, // Index of product name string desc
3, // Index of serial number string desc
1 // Number of configurations supported
};
#define SIZEOF_REPORT_DESCRIPTOR 0x3F
BYTE code abromConfigurationDescriptorGroup[] =
{
// CONFIGURATION DESCRIPTOR (9 bytes)
SIZEOF_CONFIG_DESCRIPTOR, // bLength
DESC_TYPE_CONFIG, // bDescriptorType: 2
// SIZEOF_CONFIG_DESCRIPTOR+SIZEOF_INTERFACE_DESCRIPTOR+
// SIZEOF_ENDPOINT_DESCRIPTOR+SIZEOF_ENDPOINT_DESCRIPTOR , // wTotalLength
0x00,0x00, // dummp wTotalLength, will be initialized runtime
0x01, // bNumInterfaces
0x01, // bConfigurationValue
0x00, // iConfiguration Description offset
#if (SUPPORT_REMOTE_WACKUP == 1)
0xa0, // bmAttributes, bus power, support remote wakeup
#else
0x80, // bmAttributes, bus power
#endif
0x32, // Max. Power Consumption at 2mA unit
// INTERFACE DESCRIPTOR (9 bytes)
SIZEOF_INTERFACE_DESCRIPTOR, // bLength
DESC_TYPE_INTERFACE, // bDescriptorType: 4
0x00, // bInterfaceNumber
0x00, // bAlternateSetting
1, // bNumEndpoints
0x03, // bInterfaceClass: 3 = HID Device
1, // bInterfaceSubClass: 1 = Boot Device
1, // bInterfaceProtocol: 1 = Keyboard
1, // iInterface:
// KEYBOARD HID DESCRIPTOR (9 bytes)
0x09, // bLength of HID descriptor
0x21, // HID Descriptor Type: 0x21 = Keyboard
0x00,0x01, // HID Revision number 1.00
0x00, // Target country, nothing specified (00h)
0x01, // Number of HID classes to follow
0x22, // Report descriptor type
SIZEOF_REPORT_DESCRIPTOR, 0x00, // Total length of report descriptor
// ENDPOINT #1 INPUT DESCRIPTOR, (7 bytes)
SIZEOF_ENDPOINT_DESCRIPTOR, // bLength
DESC_TYPE_ENDPOINT, // bDescriptorType
0x81, // bEndpointAddress; bit7=1 for IN, bits 3-0=1 for ep1
EP_DESC_ATTR_TYPE_INT, // bmAttributes, interrupt transfers
0x08, 0x00, // wMaxPacketSize, 8 bytes
0x0A, // Polling interval: Every 10 ms
};
BYTE code abromReportDescriptor[SIZEOF_REPORT_DESCRIPTOR] =
{
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
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) -- Modifier byte
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x03, // (81 01) Input (Constant) -- Reserved byte
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 Maximum (5)
0x91, 0x02, // Output (Data, Variable, Absolute) -- LED report
0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x91, 0x03, // (91 03) Output (Constant) -- LED report padding
0x95, 0x06, // Report Count (6)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x66, // Logical Maximum(102) // was 0x65
0x05, 0x07, // Usage Page (Key Codes)
0x19, 0x00, // Usage Minimum (0)
0x29, 0x66, // Usage Maximum (102) // was 0x65
0x81, 0x00, // Input (Data, Array) -- Key arrays (6 bytes)
0xC0 // End Collection
};
// Using RAW STRING benefits small code size but unconvenient to define string
#ifdef RAW_STRING_DESCRIPTOR
BYTE code abromStringDescriptor[] = {
// string index 0, language support
4, // Length of language descriptor ID
3, // LANGID tag
0x09,0x04, // 0x0409 for English
// string index 1, manufacture
36, // Length of this string descriptor
DESC_TYPE_STRING,
'T',0x00,'e',0x00,'x',0x00,'a',0x00,'s',0x00,' ',0x00,
'I',0x00,'n',0x00,'s',0x00,'t',0x00,'r',0x00,'u',0x00,
'm',0x00,'e',0x00,'n',0x00,'t',0x00,'s',0x00,
// string index 2, product
68, // Length of this string descriptor
DESC_TYPE_STRING,
'T',0x00,'e',0x00,'x',0x00,'a',0x00,'s',0x00,' ',0x00,
'I',0x00,'n',0x00,'s',0x00,'t',0x00,'r',0x00,'u',0x00,
'm',0x00,'e',0x00,'n',0x00,'t',0x00,'s',0x00,' ',0x00,
'T',0x00,'U',0x00,'S',0x00,'B',0x00,'3',0x00,'4',0x00,
'1',0x00,'0',0x00,' ',0x00,'S',0x00,'a',0x00,'m',0x00,
'p',0x00,'l',0x00,'e',0x00
// string index 3, serial
};
#else
char code mfgDescription[]="Texas Instruments";
char code prodDescription[]="Texas Instruments TUSB3410 Sample";
char code serialNumber[]="";
#endif
/*----------------------------------------------------------------------------+
| Internal Variables |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| Global Variables |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| Hardware Related Structure Definition |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| System Initialization Routines |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| Interrupt Sub-routines |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| Main Routine |
+----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------+
| End of source file |
+----------------------------------------------------------------------------*/
/*------------------------ Nothing Below This Line --------------------------*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -