Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: device/usb/usb_descriptors.h

Issue 562763002: Convert device::UsbConfigDescriptor and friends to structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_USB_USB_DESCRIPTORS_H_
6 #define DEVICE_USB_USB_DESCRIPTORS_H_
7
8 #include <stdint.h>
9 #include <vector>
10
11 namespace device {
12
13 enum UsbTransferType {
14 USB_TRANSFER_CONTROL = 0,
15 USB_TRANSFER_ISOCHRONOUS,
16 USB_TRANSFER_BULK,
17 USB_TRANSFER_INTERRUPT,
18 };
19
20 enum UsbEndpointDirection {
21 USB_DIRECTION_INBOUND = 0,
22 USB_DIRECTION_OUTBOUND,
23 };
24
25 enum UsbSynchronizationType {
26 USB_SYNCHRONIZATION_NONE = 0,
27 USB_SYNCHRONIZATION_ASYNCHRONOUS,
28 USB_SYNCHRONIZATION_ADAPTIVE,
29 USB_SYNCHRONIZATION_SYNCHRONOUS,
30 };
31
32 enum UsbUsageType {
33 USB_USAGE_DATA = 0,
34 USB_USAGE_FEEDBACK,
35 USB_USAGE_EXPLICIT_FEEDBACK
36 };
37
38 struct UsbEndpointDescriptor {
39 UsbEndpointDescriptor();
40 ~UsbEndpointDescriptor();
41
42 uint8_t address;
43 UsbEndpointDirection direction;
44 uint16_t maximum_packet_size;
45 UsbSynchronizationType synchronization_type;
46 UsbTransferType transfer_type;
47 UsbUsageType usage_type;
48 uint16_t polling_interval;
49 std::vector<uint8_t> extra_data;
50 };
51
52 struct UsbInterfaceDescriptor {
53 UsbInterfaceDescriptor();
54 ~UsbInterfaceDescriptor();
55
56 uint8_t interface_number;
57 uint8_t alternate_setting;
58 uint8_t interface_class;
59 uint8_t interface_subclass;
60 uint8_t interface_protocol;
61 std::vector<UsbEndpointDescriptor> endpoints;
62 std::vector<uint8_t> extra_data;
63 };
64
65 struct UsbConfigDescriptor {
66 UsbConfigDescriptor();
67 ~UsbConfigDescriptor();
68
69 uint8_t configuration_value;
70 bool self_powered;
71 bool remote_wakeup;
72 uint16_t maximum_power;
73 std::vector<UsbInterfaceDescriptor> interfaces;
74 std::vector<uint8_t> extra_data;
75 };
76
77 } // namespace device
78
79 #endif // DEVICE_USB_USB_DESCRIPTORS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698