These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!

Committer:
frank26080115
Date:
Sun Mar 20 05:38:56 2011 +0000
Revision:
0:bf7b9fba3924

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frank26080115 0:bf7b9fba3924 1 /*----------------------------------------------------------------------------
frank26080115 0:bf7b9fba3924 2 * U S B - K e r n e l
frank26080115 0:bf7b9fba3924 3 *----------------------------------------------------------------------------
frank26080115 0:bf7b9fba3924 4 * Name: USBDESC.C
frank26080115 0:bf7b9fba3924 5 * Purpose: USB Descriptors
frank26080115 0:bf7b9fba3924 6 * Version: V1.10
frank26080115 0:bf7b9fba3924 7 *----------------------------------------------------------------------------
frank26080115 0:bf7b9fba3924 8 * This software is supplied "AS IS" without any warranties, express,
frank26080115 0:bf7b9fba3924 9 * implied or statutory, including but not limited to the implied
frank26080115 0:bf7b9fba3924 10 * warranties of fitness for purpose, satisfactory quality and
frank26080115 0:bf7b9fba3924 11 * noninfringement. Keil extends you a royalty-free right to reproduce
frank26080115 0:bf7b9fba3924 12 * and distribute executable files created using this software for use
frank26080115 0:bf7b9fba3924 13 * on NXP Semiconductors LPC family microcontroller devices only. Nothing
frank26080115 0:bf7b9fba3924 14 * else gives you the right to use this software.
frank26080115 0:bf7b9fba3924 15 *
frank26080115 0:bf7b9fba3924 16 * Copyright (c) 2005-2009 Keil Software.
frank26080115 0:bf7b9fba3924 17 *---------------------------------------------------------------------------*/
frank26080115 0:bf7b9fba3924 18
frank26080115 0:bf7b9fba3924 19 #include "lpc_types.h"
frank26080115 0:bf7b9fba3924 20
frank26080115 0:bf7b9fba3924 21 #include "usb.h"
frank26080115 0:bf7b9fba3924 22 #include "usbcfg.h"
frank26080115 0:bf7b9fba3924 23 #include "usbdesc.h"
frank26080115 0:bf7b9fba3924 24
frank26080115 0:bf7b9fba3924 25 #include "hid.h"
frank26080115 0:bf7b9fba3924 26
frank26080115 0:bf7b9fba3924 27 /* HID Report Descriptor */
frank26080115 0:bf7b9fba3924 28 const uint8_t HID_ReportDescriptor[] = {
frank26080115 0:bf7b9fba3924 29 HID_UsagePageVendor(0x00),
frank26080115 0:bf7b9fba3924 30 HID_Usage(0x01),
frank26080115 0:bf7b9fba3924 31 HID_Collection(HID_Application),
frank26080115 0:bf7b9fba3924 32 HID_UsagePage(HID_USAGE_PAGE_BUTTON),
frank26080115 0:bf7b9fba3924 33 HID_UsageMin(1),
frank26080115 0:bf7b9fba3924 34 HID_UsageMax(3),
frank26080115 0:bf7b9fba3924 35 HID_LogicalMin(0),
frank26080115 0:bf7b9fba3924 36 HID_LogicalMax(1),
frank26080115 0:bf7b9fba3924 37 HID_ReportCount(3),
frank26080115 0:bf7b9fba3924 38 HID_ReportSize(1),
frank26080115 0:bf7b9fba3924 39 HID_Input(HID_Data | HID_Variable | HID_Absolute),
frank26080115 0:bf7b9fba3924 40 HID_ReportCount(1),
frank26080115 0:bf7b9fba3924 41 HID_ReportSize(5),
frank26080115 0:bf7b9fba3924 42 HID_Input(HID_Constant),
frank26080115 0:bf7b9fba3924 43 HID_UsagePage(HID_USAGE_PAGE_LED),
frank26080115 0:bf7b9fba3924 44 HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR),
frank26080115 0:bf7b9fba3924 45 HID_LogicalMin(0),
frank26080115 0:bf7b9fba3924 46 HID_LogicalMax(1),
frank26080115 0:bf7b9fba3924 47 HID_ReportCount(8),
frank26080115 0:bf7b9fba3924 48 HID_ReportSize(1),
frank26080115 0:bf7b9fba3924 49 HID_Output(HID_Data | HID_Variable | HID_Absolute),
frank26080115 0:bf7b9fba3924 50 HID_EndCollection,
frank26080115 0:bf7b9fba3924 51 };
frank26080115 0:bf7b9fba3924 52
frank26080115 0:bf7b9fba3924 53 const uint16_t HID_ReportDescSize = sizeof(HID_ReportDescriptor);
frank26080115 0:bf7b9fba3924 54
frank26080115 0:bf7b9fba3924 55
frank26080115 0:bf7b9fba3924 56 /* USB Standard Device Descriptor */
frank26080115 0:bf7b9fba3924 57 const uint8_t USB_DeviceDescriptor[] = {
frank26080115 0:bf7b9fba3924 58 USB_DEVICE_DESC_SIZE, /* bLength */
frank26080115 0:bf7b9fba3924 59 USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 60 WBVAL(0x0200), /* 2.00 */ /* bcdUSB */
frank26080115 0:bf7b9fba3924 61 0x00, /* bDeviceClass */
frank26080115 0:bf7b9fba3924 62 0x00, /* bDeviceSubClass */
frank26080115 0:bf7b9fba3924 63 0x00, /* bDeviceProtocol */
frank26080115 0:bf7b9fba3924 64 USB_MAX_PACKET0, /* bMaxPacketSize0 */
frank26080115 0:bf7b9fba3924 65 WBVAL(0xC251), /* idVendor */
frank26080115 0:bf7b9fba3924 66 WBVAL(0x2201), /* idProduct */
frank26080115 0:bf7b9fba3924 67 WBVAL(0x0100), /* 1.00 */ /* bcdDevice */
frank26080115 0:bf7b9fba3924 68 0x04, /* iManufacturer */
frank26080115 0:bf7b9fba3924 69 0x20, /* iProduct */
frank26080115 0:bf7b9fba3924 70 0x42, /* iSerialNumber */
frank26080115 0:bf7b9fba3924 71 0x01 /* bNumConfigurations */
frank26080115 0:bf7b9fba3924 72 };
frank26080115 0:bf7b9fba3924 73
frank26080115 0:bf7b9fba3924 74 /* USB Configuration Descriptor */
frank26080115 0:bf7b9fba3924 75 /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
frank26080115 0:bf7b9fba3924 76 const uint8_t USB_ConfigDescriptor[] = {
frank26080115 0:bf7b9fba3924 77 /* Configuration 1 */
frank26080115 0:bf7b9fba3924 78 USB_CONFIGUARTION_DESC_SIZE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 79 USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 80 WBVAL( /* wTotalLength */
frank26080115 0:bf7b9fba3924 81 USB_CONFIGUARTION_DESC_SIZE +
frank26080115 0:bf7b9fba3924 82 USB_INTERFACE_DESC_SIZE +
frank26080115 0:bf7b9fba3924 83 HID_DESC_SIZE +
frank26080115 0:bf7b9fba3924 84 USB_ENDPOINT_DESC_SIZE
frank26080115 0:bf7b9fba3924 85 ),
frank26080115 0:bf7b9fba3924 86 0x01, /* bNumInterfaces */
frank26080115 0:bf7b9fba3924 87 0x01, /* bConfigurationValue */
frank26080115 0:bf7b9fba3924 88 0x00, /* iConfiguration */
frank26080115 0:bf7b9fba3924 89 USB_CONFIG_BUS_POWERED /*|*/ /* bmAttributes */
frank26080115 0:bf7b9fba3924 90 /*USB_CONFIG_REMOTE_WAKEUP*/,
frank26080115 0:bf7b9fba3924 91 USB_CONFIG_POWER_MA(100), /* bMaxPower */
frank26080115 0:bf7b9fba3924 92 /* Interface 0, Alternate Setting 0, HID Class */
frank26080115 0:bf7b9fba3924 93 USB_INTERFACE_DESC_SIZE, /* bLength */
frank26080115 0:bf7b9fba3924 94 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 95 0x00, /* bInterfaceNumber */
frank26080115 0:bf7b9fba3924 96 0x00, /* bAlternateSetting */
frank26080115 0:bf7b9fba3924 97 0x01, /* bNumEndpoints */
frank26080115 0:bf7b9fba3924 98 USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */
frank26080115 0:bf7b9fba3924 99 HID_SUBCLASS_NONE, /* bInterfaceSubClass */
frank26080115 0:bf7b9fba3924 100 HID_PROTOCOL_NONE, /* bInterfaceProtocol */
frank26080115 0:bf7b9fba3924 101 0x5C, /* iInterface */
frank26080115 0:bf7b9fba3924 102 /* HID Class Descriptor */
frank26080115 0:bf7b9fba3924 103 /* HID_DESC_OFFSET = 0x0012 */
frank26080115 0:bf7b9fba3924 104 HID_DESC_SIZE, /* bLength */
frank26080115 0:bf7b9fba3924 105 HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 106 WBVAL(0x0100), /* 1.00 */ /* bcdHID */
frank26080115 0:bf7b9fba3924 107 0x00, /* bCountryCode */
frank26080115 0:bf7b9fba3924 108 0x01, /* bNumDescriptors */
frank26080115 0:bf7b9fba3924 109 HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 110 WBVAL(HID_REPORT_DESC_SIZE), /* wDescriptorLength */
frank26080115 0:bf7b9fba3924 111 /* Endpoint, HID Interrupt In */
frank26080115 0:bf7b9fba3924 112 USB_ENDPOINT_DESC_SIZE, /* bLength */
frank26080115 0:bf7b9fba3924 113 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 114 USB_ENDPOINT_IN(1), /* bEndpointAddress */
frank26080115 0:bf7b9fba3924 115 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
frank26080115 0:bf7b9fba3924 116 WBVAL(0x0004), /* wMaxPacketSize */
frank26080115 0:bf7b9fba3924 117 0x20, /* 32ms */ /* bInterval */
frank26080115 0:bf7b9fba3924 118 /* Terminator */
frank26080115 0:bf7b9fba3924 119 0 /* bLength */
frank26080115 0:bf7b9fba3924 120 };
frank26080115 0:bf7b9fba3924 121
frank26080115 0:bf7b9fba3924 122 /* USB String Descriptor (optional) */
frank26080115 0:bf7b9fba3924 123 const uint8_t USB_StringDescriptor[] = {
frank26080115 0:bf7b9fba3924 124 /* Index 0x00: LANGID Codes */
frank26080115 0:bf7b9fba3924 125 0x04, /* bLength */
frank26080115 0:bf7b9fba3924 126 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 127 WBVAL(0x0409), /* US English */ /* wLANGID */
frank26080115 0:bf7b9fba3924 128 /* Index 0x04: Manufacturer */
frank26080115 0:bf7b9fba3924 129 0x1C, /* bLength */
frank26080115 0:bf7b9fba3924 130 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 131 'N',0,
frank26080115 0:bf7b9fba3924 132 'X',0,
frank26080115 0:bf7b9fba3924 133 'P',0,
frank26080115 0:bf7b9fba3924 134 ' ',0,
frank26080115 0:bf7b9fba3924 135 'S',0,
frank26080115 0:bf7b9fba3924 136 'E',0,
frank26080115 0:bf7b9fba3924 137 'M',0,
frank26080115 0:bf7b9fba3924 138 'I',0,
frank26080115 0:bf7b9fba3924 139 'C',0,
frank26080115 0:bf7b9fba3924 140 'O',0,
frank26080115 0:bf7b9fba3924 141 'N',0,
frank26080115 0:bf7b9fba3924 142 'D',0,
frank26080115 0:bf7b9fba3924 143 ' ',0,
frank26080115 0:bf7b9fba3924 144 /* Index 0x20: Product */
frank26080115 0:bf7b9fba3924 145 0x22, /* bLength */
frank26080115 0:bf7b9fba3924 146 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 147 'L',0,
frank26080115 0:bf7b9fba3924 148 'P',0,
frank26080115 0:bf7b9fba3924 149 'C',0,
frank26080115 0:bf7b9fba3924 150 '1',0,
frank26080115 0:bf7b9fba3924 151 '7',0,
frank26080115 0:bf7b9fba3924 152 'x',0,
frank26080115 0:bf7b9fba3924 153 'x',0,
frank26080115 0:bf7b9fba3924 154 ' ',0,
frank26080115 0:bf7b9fba3924 155 'H',0,
frank26080115 0:bf7b9fba3924 156 'I',0,
frank26080115 0:bf7b9fba3924 157 'D',0,
frank26080115 0:bf7b9fba3924 158 ' ',0,
frank26080115 0:bf7b9fba3924 159 ' ',0,
frank26080115 0:bf7b9fba3924 160 ' ',0,
frank26080115 0:bf7b9fba3924 161 ' ',0,
frank26080115 0:bf7b9fba3924 162 ' ',0,
frank26080115 0:bf7b9fba3924 163 /* Index 0x42: Serial Number */
frank26080115 0:bf7b9fba3924 164 0x1A, /* bLength */
frank26080115 0:bf7b9fba3924 165 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 166 'D',0,
frank26080115 0:bf7b9fba3924 167 'E',0,
frank26080115 0:bf7b9fba3924 168 'M',0,
frank26080115 0:bf7b9fba3924 169 'O',0,
frank26080115 0:bf7b9fba3924 170 '0',0,
frank26080115 0:bf7b9fba3924 171 '0',0,
frank26080115 0:bf7b9fba3924 172 '0',0,
frank26080115 0:bf7b9fba3924 173 '0',0,
frank26080115 0:bf7b9fba3924 174 '0',0,
frank26080115 0:bf7b9fba3924 175 '0',0,
frank26080115 0:bf7b9fba3924 176 '0',0,
frank26080115 0:bf7b9fba3924 177 '0',0,
frank26080115 0:bf7b9fba3924 178 /* Index 0x5C: Interface 0, Alternate Setting 0 */
frank26080115 0:bf7b9fba3924 179 0x08, /* bLength */
frank26080115 0:bf7b9fba3924 180 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
frank26080115 0:bf7b9fba3924 181 'H',0,
frank26080115 0:bf7b9fba3924 182 'I',0,
frank26080115 0:bf7b9fba3924 183 'D',0,
frank26080115 0:bf7b9fba3924 184 };