/*---------------------------------------------------------------------------- * U S B - K e r n e l *---------------------------------------------------------------------------- * Name: USBDESC.C * Purpose: USB Descriptors * Version: V1.10 *---------------------------------------------------------------------------- * This software is supplied "AS IS" without any warranties, express, * implied or statutory, including but not limited to the implied * warranties of fitness for purpose, satisfactory quality and * noninfringement. Keil extends you a royalty-free right to reproduce * and distribute executable files created using this software for use * on Philips LPC2xxx microcontroller devices only. Nothing else gives * you the right to use this software. * * Copyright (c) 2005-2006 Keil Software. *---------------------------------------------------------------------------*/ #include "type.h" #include "usb.h" #include "hid.h" #include "usbcfg.h" #include "usbdesc.h" /* HID Report Descriptor */ const BYTE HID_ReportDescriptor[] = { 0x05, 0x01, // Usage Page (Generic Desktop), 0x09, 0x06, // Usage (Keyboard), 0xA1, 0x01, // Collection (Application), 0x75, 0x01, // Report Size (1), 0x95, 0x08, // Report Count (8), 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), 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte 0x95, 0x01, // Report Count (1), 0x75, 0x08, // Report Size (8), 0x81, 0x03, // Input (Constant), ;Reserved byte 0x95, 0x05, // Report Count (5), 0x75, 0x01, // Report Size (1), 0x05, 0x08, // Usage Page (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, // Output (Constant), ;LED report padding 0x95, 0x06, // Report Count (6), 0x75, 0x08, // Report Size (8), 0x15, 0x00, // Logical Minimum (0), 0x25, 0x68, // Logical Maximum(104), 0x05, 0x07, // Usage Page (Key Codes), 0x19, 0x00, // Usage Minimum (0), 0x29, 0x68, // Usage Maximum (104), 0x81, 0x00, // Input (Data, Array), 0xc0 // End Collection*/ /*HID_UsagePage(0x01), HID_Usage(0x06), HID_Collection(HID_Application), HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), HID_UsageMin(HID_USAGE_KEYBOARD_LCTRL), HID_UsageMax(HID_USAGE_KEYBOARD_RGUI), HID_LogicalMin(0), HID_LogicalMax(1), HID_ReportCount(8), HID_ReportSize(1), HID_Input(HID_Data | HID_Variable | HID_Absolute), HID_ReportCount(1), HID_ReportSize(8), HID_Input(HID_Constant | HID_Variable | HID_Absolute), HID_ReportCount(5), HID_ReportSize(1), HID_UsagePage(HID_USAGE_PAGE_LED), HID_UsageMin(HID_USAGE_LED_NUM_LOCK), HID_UsageMax(HID_USAGE_LED_KANA), HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_ReportCount(1), HID_ReportSize(3), HID_Output(HID_Constant | HID_Variable | HID_Absolute), HID_ReportCount(6), HID_ReportSize(8), HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), HID_UsageMin(HID_USAGE_KEYBOARD_NOEVENT), HID_UsageMax(0x65), HID_Input(HID_Data | HID_Array | HID_Absolute), HID_EndCollection,*/ }; const WORD HID_ReportDescSize = sizeof(HID_ReportDescriptor); /* USB Standard Device Descriptor */ const BYTE USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0110), /* 1.10 */ /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0xFFFE), /* idVendor */ WBVAL(0xFFFF), /* idProduct */ WBVAL(0x0001), /* 1.00 */ /* bcdDevice */ 0x04, /* iManufacturer */ 0x20, /* iProduct */ 0x42, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */ const BYTE USB_ConfigDescriptor[] = { /* Configuration 1 */ USB_CONFIGUARTION_DESC_SIZE, /* bLength */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL( /* wTotalLength */ USB_CONFIGUARTION_DESC_SIZE + USB_INTERFACE_DESC_SIZE + HID_DESC_SIZE + USB_ENDPOINT_DESC_SIZE ), 0x01, /* bNumInterfaces */ 0x01, /* bConfigurationValue */ 0x00, /* iConfiguration */ USB_CONFIG_BUS_POWERED /*|*/ /* bmAttributes */ /*USB_CONFIG_REMOTE_WAKEUP*/, USB_CONFIG_POWER_MA(100), /* bMaxPower */ /* Interface 0, Alternate Setting 0, HID Class */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ 0x00, /* bInterfaceNumber */ 0x00, /* bAlternateSetting */ 0x01, /* bNumEndpoints */ USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */ HID_SUBCLASS_NONE, /* bInterfaceSubClass */ HID_PROTOCOL_KEYBOARD, /* bInterfaceProtocol */ 0x5C, /* iInterface */ /* HID Class Descriptor */ /* HID_DESC_OFFSET = 0x0012 */ HID_DESC_SIZE, /* bLength */ HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0100), /* 1.00 */ /* bcdHID */ 0x00, /* bCountryCode */ 0x01, /* bNumDescriptors */ HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(HID_REPORT_DESC_SIZE), /* wDescriptorLength */ /* Endpoint, HID Interrupt In */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(1), /* bEndpointAddress */ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ WBVAL(0x0040), /* wMaxPacketSize */ 0x20, /* 32ms */ /* bInterval */ /* Terminator */ 0 /* bLength */ }; /* USB String Descriptor (optional) */ const BYTE USB_StringDescriptor[] = { /* Index 0x00: LANGID Codes */ 0x04, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0409), /* US English */ /* wLANGID */ /* Index 0x04: Manufacturer */ 0x1C, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'S',0, 'a',0, 'n',0, 'k',0, 'a',0, 'r',0, 'a',0, ' ',0, 'A',0, 'k',0, 'h',0, 'i',0, 'l',0, /* Index 0x20: Product */ 0x22, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'M',0, 'o',0, 'r',0, 's',0, 'e',0, ' ',0, 'K',0, 'e',0, 'y',0, 'b',0, 'o',0, 'a',0, 'r',0, 'd',0, ' ',0, ' ',0, /* Index 0x42: Serial Number */ 0x1A, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'D',0, 'E',0, 'M',0, 'O',0, '0',0, '0',0, '0',0, '0',0, '0',0, '0',0, '0',0, '0',0, /* Index 0x5C: Interface 0, Alternate Setting 0 */ 0x08, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'H',0, 'I',0, 'D',0, };