embkernel
 All Classes Functions Variables Typedefs Groups Pages
UsbDescriptor.cpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #include "UsbDevice.hpp"
7 
8 const uint8_t UsbDevice::sDescriptor[] = {
9 
11 //Descriptor
13  0x12,//
14  UsbDefs::DESC_TYPE_DEVICE, //
15  LE_WORD(0x0110), // bcdUSB
16  0x00, // bDeviceClass
17  0x00, // bDeviceSubClass
18  0x00, // bDeviceProtocol
19  64, // bMaxPacketSize
20  LE_WORD(0x0483), // idVendor
21  LE_WORD(0x6789), // idProduct
22  LE_WORD(0x0000), // bcdDevice
23  0x01, // iManufacturer
24  0x02, // iProduct
25  0x00, // iSerialNumber
26  0x01, // bNumConfigurations
27 
29  //Configuration
31  0x09,//
32  UsbDefs::DESC_TYPE_CONFIG, //
33 #if RTOS_CFG_TRACE_BUFFER_SIZE
34  LE_WORD((9 + 9 + 7 + 9 + 7 + 7 + 9 + 7 + 7)), // wTotalLength
35  0x03, // bNumInterfaces
36 #else
37  LE_WORD((9 + 9 + 7 + 9 + 7 + 7)), // wTotalLength
38  0x02, // bNumInterfaces
39 #endif
40  0x01, // bConfigurationValue
41  0x00, // iConfiguration
42  0x80, // bmAttributes
43  0x32, // bMaxPower
44 
46  //LOG OUT interface
48  //Interface
49  0x09,//
50  UsbDefs::DESC_TYPE_INTERFACE, //
51  0x00, // bInterfaceNumber
52  0x00, // bAlternateSetting
53  0x01, // bNumEndPoints
54  UsbDefs::CLASS_VEND_SPECIFIC, // bInterfaceClass
55  UsbDefs::SUB_CLASS_LOG_OUT, // bInterfaceSubClass
56  0x00, // bInterfaceProtocol
57  0x00, // iInterface
58 
59  //Endpoint in for debugOut
60  0x07,//
61  UsbDefs::DESC_TYPE_ENDPOINT, //
62  0x82, // bEndpointAddress
63  UsbDefs::EP_TRANSF_TYPE_BULK, // bmAttributes = bulk
64  LE_WORD(64), // wMaxPacketSize
65  0x10, // bInterval
66 
68  //Comm interface
70  //Interface
71  0x09,//
72  UsbDefs::DESC_TYPE_INTERFACE, //
73  0x01, // bInterfaceNumber
74  0x00, // bAlternateSetting
75  0x02, // bNumEndPoints
76  UsbDefs::CLASS_VEND_SPECIFIC, // bInterfaceClass
77  UsbDefs::SUB_CLASS_COM, // bInterfaceSubClass
78  0x00, // bInterfaceProtocol
79  0x00, // iInterface
80 
81  //Endpoint out for trace
82  0x07,//
83  UsbDefs::DESC_TYPE_ENDPOINT, //
84  3, // bEndpointAddress
85  UsbDefs::EP_TRANSF_TYPE_INT, // bmAttributes = bulk
86  LE_WORD(32), // wMaxPacketSize
87  0x01, // bInterval
88 
89  //Endpoint in for trace
90  0x07,//
91  UsbDefs::DESC_TYPE_ENDPOINT, //
92  4 | 0x80, // bEndpointAddress
93  UsbDefs::EP_TRANSF_TYPE_BULK, // bmAttributes = bulk
94  LE_WORD(32), // wMaxPacketSize
95  0x10, // bInterval
96 
97 #if RTOS_CFG_TRACE_BUFFER_SIZE
98 
99  //Trace interface
101  //Interface
102  0x09,//
103  UsbDefs::DESC_TYPE_INTERFACE, //
104  0x02, // bInterfaceNumber
105  0x00, // bAlternateSetting
106  0x02, // bNumEndPoints
107  UsbDefs::CLASS_VEND_SPECIFIC, // bInterfaceClass
108  UsbDefs::SUB_CLASS_TRACE, // bInterfaceSubClass
109  0x00, // bInterfaceProtocol
110  0x00, // iInterface
111 
112  //Endpoint out for trace
113  0x07,//
114  UsbDefs::DESC_TYPE_ENDPOINT, //
115  5, // bEndpointAddress
116  UsbDefs::EP_TRANSF_TYPE_INT, // bmAttributes = bulk
117  LE_WORD(16), // wMaxPacketSize
118  0x01, // bInterval
119 
120  //Endpoint in for trace
121  0x07,//
122  UsbDefs::DESC_TYPE_ENDPOINT, //
123  6 | 0x80, // bEndpointAddress
124  UsbDefs::EP_TRANSF_TYPE_BULK, // bmAttributes = bulk
125  LE_WORD(64), // wMaxPacketSize
126  0x10, // bInterval
127 #endif
128 
130  //Strings
132  0x04,
133  UsbDefs::DESC_TYPE_STRING, LE_WORD(0x0409), //Language
134 
135  0x14, UsbDefs::DESC_TYPE_STRING, 'E', 0, 'M', 0, 'B', 0, 'K', 0, 'E', 0, 'R', 0, 'N', 0, 'E', 0, 'L', 0, //Manufacturer
136 
137  0x0A, UsbDefs::DESC_TYPE_STRING, 'D', 0, 'E', 0, 'M', 0, 'O', 0, //Product
138 
139  0x06, UsbDefs::DESC_TYPE_STRING, '0', 0, '0', 0, //Serial
140 
141  //Zero termination
142  0 }; //