/* File: UsbDescriptors.h
* Author: Szymon Roslowski, Henrik Haftmann
*/
// Actual USB Data Buffers
__persistent struct _OneReport InReport;
__persistent struct _OneReport OutReport;
__persistent struct _OneReport FeatureReport;
__persistent BYTE TmcIn[64]; // Kommen automatisch in „höhere“ Bänke
__persistent BYTE TmcOut[64];
/***********************/
/* Descriptors */
/***********************/
#define W(x) (BYTE)(x),(BYTE)((WORD)(x)>>8)
const BYTE DeviceDescriptor[]={
0x12, // Size of this descriptor in bytes
0x01, // DEVICE descriptor type
W(0x0200), // USB Spec Release Number in BCD format
0, // Class Code
0, // Subclass code
0, // Protocol code
E0SZ, // Max packet size for EP0 (8)
W(0x04D8), // Vendor ID
W(0x01A5), // Product ID
W(0x0001), // Device release number in BCD format
1, // Manufacturer string index
2, // Product string index
0, // Device serial number string index
1 // Number of possible configurations
};
// Report For Generic HID
const BYTE HIDReport[] = {
0x06, W(0xffa0U), // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
// The Input report
0x09, 0x01, // Usage ID - vendor defined
0x15, 0x00, // Logical Minimum (0)
0x26, W(255), // Logical Maximum (255)
0x75, 0x08, // Report Size (8 bits)
0x95, sizeof InReport,// Report Count
0x81, 0x02, // Input (Data, Variable, Absolute)
// The Output report
0x09, 0x01, // Usage ID - vendor defined
0x15, 0x00, // Logical Minimum (0)
0x26, W(255), // Logical Maximum (255)
0x75, 0x08, // Report Size (8 bits)
0x95, sizeof OutReport, // Report Count
0x91, 0x02, // Output (Data, Variable, Absolute)
// The Feature report
0x09, 0x02, // Usage ID - vendor defined
0x15, 0x00, // Logical Minimum (0)
0x26, W(255), // Logical Maximum (255)
0x75, 0x08, // Report Size (8 bits)
0x95, sizeof FeatureReport, // Report Count
0xB1, 0x02, // Feature (Data, Variable, Absolute)
0xc0 // END_COLLECTION
};
// Configuration descriptor
const BYTE ConfigurationDescriptor[64]={
9, // Size of this descriptor in bytes
2, // CONFIGURATION descriptor type
W(64), // Total length of data for this (power consumption) configuration
2, // Number of interfaces
1, // Index value of this configuration
0, // Configuration string index
0xA0, // Attributes
50/2, // Max power consumption (50 mA)
9, // Size of this descriptor in bytes
4, // INTERFACE descriptor type
0, // Interface Number
0, // Alternate Setting Number
2, // Number of endpoints in this interface
3, // Class code (HID)
0, // Subclass code
0, // Protocol code (Boot protocol 0=none, 1=Keyboard, 2=Mouse)
3, // Interface string index
9, // Size of this descriptor in bytes
0x21, // HID descriptor type
W(0x0111), // HID Spec Release Number in BCD format (1.11)
0, // Country Code (0 for Not supported)
1, // Number of class descriptors
0x22, // Report descriptor type
W(sizeof HIDReport), // Report Size (47 bytes)
7, // Size of this descriptor in bytes
5, // ENDPOINT descriptor type
0x01, // Endpoint Address
0x03, // Attributes (Interrupt)
W(sizeof OutReport), // Max Packet Size
1, // Interval (1 millisecond)
7, // Size of this descriptor in bytes
5, // ENDPOINT descriptor type
0x81, // Endpoint Address
0x03, // Attributes (Interrupt)
W(sizeof InReport), // Max Packet Size
1, // Interval (1 millisecond)
9, // Size of this descriptor in bytes
4, // INTERFACE descriptor type
1, // Interface Number
0, // Alternate Setting Number
2, // Number of endpoints in this interface
0xFE, // Class code (USBTMC)
3, // Subclass code (USBTMC)
0, // Protocol code (0=normal, 1=USB488)
4, // Interface string index
7, // Size of this descriptor in bytes
5, // ENDPOINT descriptor type
0x02, // Endpoint Address
0x02, // bmAttributes (Bulk)
W(sizeof TmcOut), // Max Packet Size
0, // Interval (unused)
7, // Size of this descriptor in bytes
5, // ENDPOINT descriptor type
0x82, // Endpoint Address
0x02, // bmAttributes (Bulk)
W(sizeof TmcIn), // Max Packet Size
0, // Interval (unused)
};
const BYTE TmcCap[24]= {
1,
0,
W(0x0100), // Bcd
0, // Interface Caps
0, // Device Caps
};
#undef W
Detected encoding: UTF-8 | 0
|