]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/USB_CDC/usbdesc.c
Back out changes to LPC18xx UDP demo.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / USB_CDC / 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 "lpc18xx.H"
23 #include "lpc_types.h"
24
25 #include "usb.h"
26 #include "cdc.h"
27 #include "usbcfg.h"
28 #include "usbdesc.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(0x1FC9),                     /* idVendor */
41   WBVAL(0x2002),                     /* idProduct */
42   WBVAL(0x0100), /* 1.00 */          /* bcdDevice */
43   0x01,                              /* iManufacturer */
44   0x02,                              /* iProduct */
45   0x03,                              /* iSerialNumber */
46   0x01                               /* bNumConfigurations: one possible configuration*/
47 };
48
49 /* USB FSConfiguration Descriptor */
50 /*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
51 const uint8_t USB_FSConfigDescriptor[] = {
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   0x00,                              /* bInterfaceProtocol: no protocol used */
78   0x5E,                              /* 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   0x01,                              /* 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   0x5E,                              /* iInterface: */
118 /* Endpoint, EP2 Bulk Out */
119   USB_ENDPOINT_DESC_SIZE,            /* bLength */
120   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
121   USB_ENDPOINT_OUT(2),               /* bEndpointAddress */
122   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
123   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
124   0x00,                              /* bInterval: ignore for Bulk transfer */
125 /* Endpoint, EP2 Bulk In */
126   USB_ENDPOINT_DESC_SIZE,            /* bLength */
127   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
128   USB_ENDPOINT_IN(2),                /* bEndpointAddress */
129   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
130   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
131   0x00,                              /* bInterval: ignore for Bulk transfer */
132 /* Terminator */
133   0                                  /* bLength */
134                            /* bLength */
135 };
136
137 /* USB HSConfiguration Descriptor */
138 /*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
139 const uint8_t USB_HSConfigDescriptor[] = {
140 /* Configuration 1 */
141   USB_CONFIGUARTION_DESC_SIZE,       /* bLength */
142   USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
143   WBVAL((                             /* wTotalLength */
144     1*USB_CONFIGUARTION_DESC_SIZE +
145     1*USB_INTERFACE_DESC_SIZE     +  /* communication interface */
146     0x0013                        +  /* CDC functions */
147     1*USB_ENDPOINT_DESC_SIZE      +  /* interrupt endpoint */
148     1*USB_INTERFACE_DESC_SIZE     +  /* data interface */
149     2*USB_ENDPOINT_DESC_SIZE         /* bulk endpoints */
150       )),
151   0x02,                              /* bNumInterfaces */
152   0x01,                              /* bConfigurationValue: 0x01 is used to select this configuration */
153   0x00,                              /* iConfiguration: no string to describe this configuration */
154   USB_CONFIG_BUS_POWERED /*|*/       /* bmAttributes */
155 /*USB_CONFIG_REMOTE_WAKEUP*/,
156   USB_CONFIG_POWER_MA(100),          /* bMaxPower, device power consumption is 100 mA */
157 /* Interface 0, Alternate Setting 0, Communication class interface descriptor */
158   USB_INTERFACE_DESC_SIZE,           /* bLength */
159   USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
160   USB_CDC_CIF_NUM,                   /* bInterfaceNumber: Number of Interface */
161   0x00,                              /* bAlternateSetting: Alternate setting */
162   0x01,                              /* bNumEndpoints: One endpoint used */
163   CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */
164   CDC_ABSTRACT_CONTROL_MODEL,        /* bInterfaceSubClass: Abstract Control Model */
165   0x00,                              /* bInterfaceProtocol: no protocol used */
166   0x5E,                              /* iInterface: */
167 /*Header Functional Descriptor*/
168   0x05,                              /* bLength: Endpoint Descriptor size */
169   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
170   CDC_HEADER,                        /* bDescriptorSubtype: Header Func Desc */
171   WBVAL(CDC_V1_10), /* 1.10 */       /* bcdCDC */
172 /*Call Management Functional Descriptor*/
173   0x05,                              /* bFunctionLength */
174   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
175   CDC_CALL_MANAGEMENT,               /* bDescriptorSubtype: Call Management Func Desc */
176   0x01,                              /* bmCapabilities: device handles call management */
177   0x01,                              /* bDataInterface: CDC data IF ID */
178 /*Abstract Control Management Functional Descriptor*/
179   0x04,                              /* bFunctionLength */
180   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
181   CDC_ABSTRACT_CONTROL_MANAGEMENT,   /* bDescriptorSubtype: Abstract Control Management desc */
182   0x02,                              /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */
183 /*Union Functional Descriptor*/
184   0x05,                              /* bFunctionLength */
185   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
186   CDC_UNION,                         /* bDescriptorSubtype: Union func desc */
187   USB_CDC_CIF_NUM,                   /* bMasterInterface: Communication class interface is master */
188   USB_CDC_DIF_NUM,                   /* bSlaveInterface0: Data class interface is slave 0 */
189 /*Endpoint 1 Descriptor*/            /* event notification (optional) */
190   USB_ENDPOINT_DESC_SIZE,            /* bLength */
191   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
192   USB_ENDPOINT_IN(1),                /* bEndpointAddress */
193   USB_ENDPOINT_TYPE_INTERRUPT,       /* bmAttributes */
194   WBVAL(0x0010),                     /* wMaxPacketSize */
195   0x02,          /* 2ms */           /* bInterval */
196 /* Interface 1, Alternate Setting 0, Data class interface descriptor*/
197   USB_INTERFACE_DESC_SIZE,           /* bLength */
198   USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
199   USB_CDC_DIF_NUM,                   /* bInterfaceNumber: Number of Interface */
200   0x00,                              /* bAlternateSetting: no alternate setting */
201   0x02,                              /* bNumEndpoints: two endpoints used */
202   CDC_DATA_INTERFACE_CLASS,          /* bInterfaceClass: Data Interface Class */
203   0x00,                              /* bInterfaceSubClass: no subclass available */
204   0x00,                              /* bInterfaceProtocol: no protocol used */
205   0x5E,                              /* iInterface: */
206 /* Endpoint, EP2 Bulk Out */
207   USB_ENDPOINT_DESC_SIZE,            /* bLength */
208   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
209   USB_ENDPOINT_OUT(2),               /* bEndpointAddress */
210   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
211   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
212   0x00,                              /* bInterval: ignore for Bulk transfer */
213 /* Endpoint, EP2 Bulk In */
214   USB_ENDPOINT_DESC_SIZE,            /* bLength */
215   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
216   USB_ENDPOINT_IN(2),                /* bEndpointAddress */
217   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
218   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
219   0x00,                              /* bInterval: ignore for Bulk transfer */
220 /* Terminator */
221   0                                  /* bLength */
222                               /* bLength */
223 };
224
225 /* USB String Descriptor (optional) */
226 const uint8_t USB_StringDescriptor[] = {
227 /* Index 0x00: LANGID Codes */
228   0x04,                              /* bLength */
229   USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
230   WBVAL(0x0409), /* US English */    /* wLANGID */
231 /* Index 0x01: Manufacturer */
232   (16*2 + 2),                        /* bLength (13 Char + Type + lenght) */
233   USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
234   'N',0,
235   'G',0,
236   'X',0,
237   ' ',0,
238   'T',0,
239   'E',0,
240   'C',0,
241   'H',0,
242   'N',0,
243   'O',0,
244   'L',0,
245   'O',0,
246   'G',0,\r
247         'I',0,\r
248         'E',0,\r
249         'S',0,
250 /* Index 0x02: Product */
251   (17*2 + 2),                        /* bLength ( 17 Char + Type + lenght) */
252   USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
253   'N',0,
254   'G',0,
255   'X',0,
256   ' ',0,
257   'L',0,
258   'P',0,
259   'C',0,
260   '1',0,
261   '8',0,
262   'x',0,
263   'x',0,
264   ' ',0,
265   'V',0,
266   'C',0,
267   'O',0,
268   'M',0,
269   ' ',0,
270 /* Index 0x03: Serial Number */
271   (12*2 + 2),                        /* bLength (12 Char + Type + lenght) */
272   USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
273   'D',0,
274   'E',0,
275   'M',0,
276   'O',0,
277   '0',0,
278   '0',0,
279   '0',0,
280   '0',0,
281   '0',0,
282   '0',0,
283   '0',0,
284   '0',0,
285 /* Index 0x04: Interface 0, Alternate Setting 0 */
286   ( 4*2 + 2),                        /* bLength (4 Char + Type + lenght) */
287   USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
288   'V',0,
289   'C',0,
290   'O',0,
291   'M',0,
292 };
293
294 /* USB Device Qualifier */
295 const uint8_t USB_DeviceQualifier[] = {
296   USB_DEVICE_QUALI_SIZE,                /* bLength */
297   USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE, /* bDescriptorType */
298   WBVAL(0x0200), /* 2.00 */          /* bcdUSB */
299   0x00,                              /* bDeviceClass */
300   0x00,                              /* bDeviceSubClass */
301   0x00,                              /* bDeviceProtocol */
302   USB_MAX_PACKET0,                   /* bMaxPacketSize0 */
303   0x01,                              /* bNumOtherSpeedConfigurations */
304   0x00                               /* bReserved */
305 };
306
307 /* USB Configuration Descriptor */
308 /*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
309 const uint8_t USB_FSOtherSpeedConfiguration[] = {
310 /* Configuration 1 */
311   USB_CONFIGUARTION_DESC_SIZE,       /* bLength */
312   USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
313   WBVAL((                             /* wTotalLength */
314     1*USB_CONFIGUARTION_DESC_SIZE +
315     1*USB_INTERFACE_DESC_SIZE     +  /* communication interface */
316     0x0013                        +  /* CDC functions */
317     1*USB_ENDPOINT_DESC_SIZE      +  /* interrupt endpoint */
318     1*USB_INTERFACE_DESC_SIZE     +  /* data interface */
319     2*USB_ENDPOINT_DESC_SIZE         /* bulk endpoints */
320       )),
321   0x02,                              /* bNumInterfaces */
322   0x01,                              /* bConfigurationValue: 0x01 is used to select this configuration */
323   0x00,                              /* iConfiguration: no string to describe this configuration */
324   USB_CONFIG_BUS_POWERED /*|*/       /* bmAttributes */
325 /*USB_CONFIG_REMOTE_WAKEUP*/,
326   USB_CONFIG_POWER_MA(100),          /* bMaxPower, device power consumption is 100 mA */
327 /* Interface 0, Alternate Setting 0, Communication class interface descriptor */
328   USB_INTERFACE_DESC_SIZE,           /* bLength */
329   USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
330   USB_CDC_CIF_NUM,                   /* bInterfaceNumber: Number of Interface */
331   0x00,                              /* bAlternateSetting: Alternate setting */
332   0x01,                              /* bNumEndpoints: One endpoint used */
333   CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */
334   CDC_ABSTRACT_CONTROL_MODEL,        /* bInterfaceSubClass: Abstract Control Model */
335   0x00,                              /* bInterfaceProtocol: no protocol used */
336   0x5E,                              /* iInterface: */
337 /*Header Functional Descriptor*/
338   0x05,                              /* bLength: Endpoint Descriptor size */
339   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
340   CDC_HEADER,                        /* bDescriptorSubtype: Header Func Desc */
341   WBVAL(CDC_V1_10), /* 1.10 */       /* bcdCDC */
342 /*Call Management Functional Descriptor*/
343   0x05,                              /* bFunctionLength */
344   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
345   CDC_CALL_MANAGEMENT,               /* bDescriptorSubtype: Call Management Func Desc */
346   0x01,                              /* bmCapabilities: device handles call management */
347   0x01,                              /* bDataInterface: CDC data IF ID */
348 /*Abstract Control Management Functional Descriptor*/
349   0x04,                              /* bFunctionLength */
350   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
351   CDC_ABSTRACT_CONTROL_MANAGEMENT,   /* bDescriptorSubtype: Abstract Control Management desc */
352   0x02,                              /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */
353 /*Union Functional Descriptor*/
354   0x05,                              /* bFunctionLength */
355   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
356   CDC_UNION,                         /* bDescriptorSubtype: Union func desc */
357   USB_CDC_CIF_NUM,                   /* bMasterInterface: Communication class interface is master */
358   USB_CDC_DIF_NUM,                   /* bSlaveInterface0: Data class interface is slave 0 */
359 /*Endpoint 1 Descriptor*/            /* event notification (optional) */
360   USB_ENDPOINT_DESC_SIZE,            /* bLength */
361   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
362   USB_ENDPOINT_IN(1),                /* bEndpointAddress */
363   USB_ENDPOINT_TYPE_INTERRUPT,       /* bmAttributes */
364   WBVAL(0x0010),                     /* wMaxPacketSize */
365   0x02,          /* 2ms */           /* bInterval */
366 /* Interface 1, Alternate Setting 0, Data class interface descriptor*/
367   USB_INTERFACE_DESC_SIZE,           /* bLength */
368   USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
369   USB_CDC_DIF_NUM,                   /* bInterfaceNumber: Number of Interface */
370   0x00,                              /* bAlternateSetting: no alternate setting */
371   0x02,                              /* bNumEndpoints: two endpoints used */
372   CDC_DATA_INTERFACE_CLASS,          /* bInterfaceClass: Data Interface Class */
373   0x00,                              /* bInterfaceSubClass: no subclass available */
374   0x00,                              /* bInterfaceProtocol: no protocol used */
375   0x5E,                              /* iInterface: */
376 /* Endpoint, EP2 Bulk Out */
377   USB_ENDPOINT_DESC_SIZE,            /* bLength */
378   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
379   USB_ENDPOINT_OUT(2),               /* bEndpointAddress */
380   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
381   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
382   0x00,                              /* bInterval: ignore for Bulk transfer */
383 /* Endpoint, EP2 Bulk In */
384   USB_ENDPOINT_DESC_SIZE,            /* bLength */
385   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
386   USB_ENDPOINT_IN(2),                /* bEndpointAddress */
387   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
388   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
389   0x00,                              /* bInterval: ignore for Bulk transfer */
390 /* Terminator */
391   0                                  /* bLength */
392 };
393
394 /* USB Configuration Descriptor */
395 /*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
396 const uint8_t USB_HSOtherSpeedConfiguration[] = {
397 /* Configuration 1 */
398   USB_CONFIGUARTION_DESC_SIZE,       /* bLength */
399   USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
400   WBVAL((                             /* wTotalLength */
401     1*USB_CONFIGUARTION_DESC_SIZE +
402     1*USB_INTERFACE_DESC_SIZE     +  /* communication interface */
403     0x0013                        +  /* CDC functions */
404     1*USB_ENDPOINT_DESC_SIZE      +  /* interrupt endpoint */
405     1*USB_INTERFACE_DESC_SIZE     +  /* data interface */
406     2*USB_ENDPOINT_DESC_SIZE         /* bulk endpoints */
407       )),
408   0x02,                              /* bNumInterfaces */
409   0x01,                              /* bConfigurationValue: 0x01 is used to select this configuration */
410   0x00,                              /* iConfiguration: no string to describe this configuration */
411   USB_CONFIG_BUS_POWERED /*|*/       /* bmAttributes */
412 /*USB_CONFIG_REMOTE_WAKEUP*/,
413   USB_CONFIG_POWER_MA(100),          /* bMaxPower, device power consumption is 100 mA */
414 /* Interface 0, Alternate Setting 0, Communication class interface descriptor */
415   USB_INTERFACE_DESC_SIZE,           /* bLength */
416   USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
417   USB_CDC_CIF_NUM,                   /* bInterfaceNumber: Number of Interface */
418   0x00,                              /* bAlternateSetting: Alternate setting */
419   0x01,                              /* bNumEndpoints: One endpoint used */
420   CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */
421   CDC_ABSTRACT_CONTROL_MODEL,        /* bInterfaceSubClass: Abstract Control Model */
422   0x00,                              /* bInterfaceProtocol: no protocol used */
423   0x5E,                              /* iInterface: */
424 /*Header Functional Descriptor*/
425   0x05,                              /* bLength: Endpoint Descriptor size */
426   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
427   CDC_HEADER,                        /* bDescriptorSubtype: Header Func Desc */
428   WBVAL(CDC_V1_10), /* 1.10 */       /* bcdCDC */
429 /*Call Management Functional Descriptor*/
430   0x05,                              /* bFunctionLength */
431   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
432   CDC_CALL_MANAGEMENT,               /* bDescriptorSubtype: Call Management Func Desc */
433   0x01,                              /* bmCapabilities: device handles call management */
434   0x01,                              /* bDataInterface: CDC data IF ID */
435 /*Abstract Control Management Functional Descriptor*/
436   0x04,                              /* bFunctionLength */
437   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
438   CDC_ABSTRACT_CONTROL_MANAGEMENT,   /* bDescriptorSubtype: Abstract Control Management desc */
439   0x02,                              /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */
440 /*Union Functional Descriptor*/
441   0x05,                              /* bFunctionLength */
442   CDC_CS_INTERFACE,                  /* bDescriptorType: CS_INTERFACE */
443   CDC_UNION,                         /* bDescriptorSubtype: Union func desc */
444   USB_CDC_CIF_NUM,                   /* bMasterInterface: Communication class interface is master */
445   USB_CDC_DIF_NUM,                   /* bSlaveInterface0: Data class interface is slave 0 */
446 /*Endpoint 1 Descriptor*/            /* event notification (optional) */
447   USB_ENDPOINT_DESC_SIZE,            /* bLength */
448   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
449   USB_ENDPOINT_IN(1),                /* bEndpointAddress */
450   USB_ENDPOINT_TYPE_INTERRUPT,       /* bmAttributes */
451   WBVAL(0x0010),                     /* wMaxPacketSize */
452   0x02,          /* 2ms */           /* bInterval */
453 /* Interface 1, Alternate Setting 0, Data class interface descriptor*/
454   USB_INTERFACE_DESC_SIZE,           /* bLength */
455   USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
456   USB_CDC_DIF_NUM,                   /* bInterfaceNumber: Number of Interface */
457   0x00,                              /* bAlternateSetting: no alternate setting */
458   0x02,                              /* bNumEndpoints: two endpoints used */
459   CDC_DATA_INTERFACE_CLASS,          /* bInterfaceClass: Data Interface Class */
460   0x00,                              /* bInterfaceSubClass: no subclass available */
461   0x00,                              /* bInterfaceProtocol: no protocol used */
462   0x5E,                              /* iInterface: */
463 /* Endpoint, EP2 Bulk Out */
464   USB_ENDPOINT_DESC_SIZE,            /* bLength */
465   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
466   USB_ENDPOINT_OUT(2),               /* bEndpointAddress */
467   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
468   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
469   0x00,                              /* bInterval: ignore for Bulk transfer */
470 /* Endpoint, EP2 Bulk In */
471   USB_ENDPOINT_DESC_SIZE,            /* bLength */
472   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
473   USB_ENDPOINT_IN(2),                /* bEndpointAddress */
474   USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
475   WBVAL(USB_CDC_BUFSIZE),            /* wMaxPacketSize */
476   0x00,                              /* bInterval: ignore for Bulk transfer */
477 /* Terminator */
478   0                                  /* bLength */
479 };