Spieler splodiert.
[hackover2013-badge-firmware.git] / core / usbcdc / usbdesc.c
1 /*----------------------------------------------------------------------------
2 * U S B - K e r n e l
3 *----------------------------------------------------------------------------
4 * Name: usbdesc.c
5 * Purpose: USB Descriptors
6 * Version: V1.20
7 *----------------------------------------------------------------------------
8 * This software is supplied "AS IS" without any warranties, express,
9 * implied or statutory, including but not limited to the implied
10 * warranties of fitness for purpose, satisfactory quality and
11 * noninfringement. Keil extends you a royalty-free right to reproduce
12 * and distribute executable files created using this software for use
13 * on NXP Semiconductors LPC microcontroller devices only. Nothing else
14 * gives you the right to use this software.
15 *
16 * Copyright (c) 2009 Keil - An ARM Company. All rights reserved.
17 *----------------------------------------------------------------------------
18 * History:
19 * V1.20 Changed string descriptor handling
20 * V1.00 Initial Version
21 *---------------------------------------------------------------------------*/
22 #include "projectconfig.h"
23
24 #include "usb.h"
25 #include "cdc.h"
26 #include "usbcfg.h"
27 #include "usbdesc.h"
28 #include "config.h"
29
30
31 /* USB Standard Device Descriptor */
32 const uint8_t USB_DeviceDescriptor[] = {
33 USB_DEVICE_DESC_SIZE, /* bLength */
34 USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
35 WBVAL(0x0200), /* 2.0 */ /* bcdUSB */
36 USB_DEVICE_CLASS_COMMUNICATIONS, /* bDeviceClass CDC*/
37 0x00, /* bDeviceSubClass */
38 0x00, /* bDeviceProtocol */
39 USB_MAX_PACKET0, /* bMaxPacketSize0 */
40 WBVAL(USB_VENDOR_ID), /* idVendor */
41 WBVAL(USB_PROD_ID), /* idProduct */
42 WBVAL(USB_DEVICE), /* 1.00 */ /* bcdDevice */
43 0x01, /* iManufacturer */
44 0x02, /* iProduct */
45 0x03, /* iSerialNumber */
46 0x01 /* bNumConfigurations: one possible configuration*/
47 };
48
49 /* USB Configuration Descriptor */
50 /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
51 const uint8_t USB_ConfigDescriptor[] = {
52 /* Configuration 1 */
53 USB_CONFIGUARTION_DESC_SIZE, /* bLength */
54 USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
55 WBVAL( /* wTotalLength */
56 1*USB_CONFIGUARTION_DESC_SIZE +
57 1*USB_INTERFACE_DESC_SIZE + /* communication interface */
58 0x0013 + /* CDC functions */
59 1*USB_ENDPOINT_DESC_SIZE + /* interrupt endpoint */
60 1*USB_INTERFACE_DESC_SIZE + /* data interface */
61 2*USB_ENDPOINT_DESC_SIZE /* bulk endpoints */
62 ),
63 0x02, /* bNumInterfaces */
64 0x01, /* bConfigurationValue: 0x01 is used to select this configuration */
65 0x00, /* iConfiguration: no string to describe this configuration */
66 USB_CONFIG_BUS_POWERED /*|*/ /* bmAttributes */
67 /*USB_CONFIG_REMOTE_WAKEUP*/,
68 USB_CONFIG_POWER_MA(100), /* bMaxPower, device power consumption is 100 mA */
69 /* Interface 0, Alternate Setting 0, Communication class interface descriptor */
70 USB_INTERFACE_DESC_SIZE, /* bLength */
71 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
72 USB_CDC_CIF_NUM, /* bInterfaceNumber: Number of Interface */
73 0x00, /* bAlternateSetting: Alternate setting */
74 0x01, /* bNumEndpoints: One endpoint used */
75 CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */
76 CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass: Abstract Control Model */
77 0x01, /* bInterfaceProtocol: no protocol used */
78 0x00, /* iInterface: */
79 /*Header Functional Descriptor*/
80 0x05, /* bLength: Endpoint Descriptor size */
81 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
82 CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */
83 WBVAL(CDC_V1_10), /* 1.10 */ /* bcdCDC */
84 /*Call Management Functional Descriptor*/
85 0x05, /* bFunctionLength */
86 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
87 CDC_CALL_MANAGEMENT, /* bDescriptorSubtype: Call Management Func Desc */
88 0x03, /* bmCapabilities: device handles call management */
89 0x01, /* bDataInterface: CDC data IF ID */
90 /*Abstract Control Management Functional Descriptor*/
91 0x04, /* bFunctionLength */
92 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
93 CDC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype: Abstract Control Management desc */
94 0x02, /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */
95 /*Union Functional Descriptor*/
96 0x05, /* bFunctionLength */
97 CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
98 CDC_UNION, /* bDescriptorSubtype: Union func desc */
99 USB_CDC_CIF_NUM, /* bMasterInterface: Communication class interface is master */
100 USB_CDC_DIF_NUM, /* bSlaveInterface0: Data class interface is slave 0 */
101 /*Endpoint 1 Descriptor*/ /* event notification (optional) */
102 USB_ENDPOINT_DESC_SIZE, /* bLength */
103 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
104 USB_ENDPOINT_IN(1), /* bEndpointAddress */
105 USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
106 WBVAL(0x0010), /* wMaxPacketSize */
107 0x02, /* 2ms */ /* bInterval */
108 /* Interface 1, Alternate Setting 0, Data class interface descriptor*/
109 USB_INTERFACE_DESC_SIZE, /* bLength */
110 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
111 USB_CDC_DIF_NUM, /* bInterfaceNumber: Number of Interface */
112 0x00, /* bAlternateSetting: no alternate setting */
113 0x02, /* bNumEndpoints: two endpoints used */
114 CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass: Data Interface Class */
115 0x00, /* bInterfaceSubClass: no subclass available */
116 0x00, /* bInterfaceProtocol: no protocol used */
117 0x00, /* iInterface: */
118 /* Endpoint, EP3 Bulk Out */
119 USB_ENDPOINT_DESC_SIZE, /* bLength */
120 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
121 USB_ENDPOINT_OUT(3), /* bEndpointAddress */
122 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
123 WBVAL(64), /* wMaxPacketSize */
124 0x00, /* bInterval: ignore for Bulk transfer */
125 /* Endpoint, EP3 Bulk In */
126 USB_ENDPOINT_DESC_SIZE, /* bLength */
127 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
128 USB_ENDPOINT_IN(3), /* bEndpointAddress */
129 USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
130 WBVAL(64), /* wMaxPacketSize */
131 0x00, /* bInterval: ignore for Bulk transfer */
132 /* Terminator */
133 0 /* bLength */
134 };
135
136
137
138
139 /* USB String Descriptor (optional) */
140 const uint8_t USB_StringDescriptor[] = {
141 /* Index 0x00: LANGID Codes */
142 0x04, /* bLength */
143 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
144 WBVAL(0x0409), /* US English */ /* wLANGID */
145 /* Index 0x01: Manufacturer */
146 (13*2 + 2), /* bLength (13 Char + Type + lenght) */
147 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
148 'N',0,
149 'X',0,
150 'P',0,
151 ' ',0,
152 'S',0,
153 'E',0,
154 'M',0,
155 'I',0,
156 'C',0,
157 'O',0,
158 'N',0,
159 'D',0,
160 ' ',0,
161 /* Index 0x02: Product */
162 (17*2 + 2), /* bLength ( 17 Char + Type + lenght) */
163 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
164 'N',0,
165 'X',0,
166 'P',0,
167 ' ',0,
168 'L',0,
169 'P',0,
170 'C',0,
171 '1',0,
172 '3',0,
173 'x',0,
174 'x',0,
175 ' ',0,
176 'V',0,
177 'C',0,
178 'O',0,
179 'M',0,
180 ' ',0,
181 /* Index 0x03: Serial Number */
182 (12*2 + 2), /* bLength (12 Char + Type + lenght) */
183 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
184 'D',0,
185 'E',0,
186 'M',0,
187 'O',0,
188 '0',0,
189 '0',0,
190 '0',0,
191 '0',0,
192 '0',0,
193 '0',0,
194 '0',0,
195 '0',0,
196 /* Index 0x04: Interface 0, Alternate Setting 0 */
197 ( 4*2 + 2), /* bLength (4 Char + Type + lenght) */
198 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
199 'V',0,
200 'C',0,
201 'O',0,
202 'M',0,
203 };
This page took 0.0602279999999999 seconds and 5 git commands to generate.