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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: device/usb/usb_descriptors.h
diff --git a/device/usb/usb_descriptors.h b/device/usb/usb_descriptors.h
new file mode 100644
index 0000000000000000000000000000000000000000..0395f1d420973c91ea5e91af4c9d09aee0072776
--- /dev/null
+++ b/device/usb/usb_descriptors.h
@@ -0,0 +1,79 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_USB_USB_DESCRIPTORS_H_
+#define DEVICE_USB_USB_DESCRIPTORS_H_
+
+#include <stdint.h>
+#include <vector>
+
+namespace device {
+
+enum UsbTransferType {
+ USB_TRANSFER_CONTROL = 0,
+ USB_TRANSFER_ISOCHRONOUS,
+ USB_TRANSFER_BULK,
+ USB_TRANSFER_INTERRUPT,
+};
+
+enum UsbEndpointDirection {
+ USB_DIRECTION_INBOUND = 0,
+ USB_DIRECTION_OUTBOUND,
+};
+
+enum UsbSynchronizationType {
+ USB_SYNCHRONIZATION_NONE = 0,
+ USB_SYNCHRONIZATION_ASYNCHRONOUS,
+ USB_SYNCHRONIZATION_ADAPTIVE,
+ USB_SYNCHRONIZATION_SYNCHRONOUS,
+};
+
+enum UsbUsageType {
+ USB_USAGE_DATA = 0,
+ USB_USAGE_FEEDBACK,
+ USB_USAGE_EXPLICIT_FEEDBACK
+};
+
+struct UsbEndpointDescriptor {
+ UsbEndpointDescriptor();
+ ~UsbEndpointDescriptor();
+
+ uint8_t address;
+ UsbEndpointDirection direction;
+ uint16_t maximum_packet_size;
+ UsbSynchronizationType synchronization_type;
+ UsbTransferType transfer_type;
+ UsbUsageType usage_type;
+ uint16_t polling_interval;
+ std::vector<uint8_t> extra_data;
+};
+
+struct UsbInterfaceDescriptor {
+ UsbInterfaceDescriptor();
+ ~UsbInterfaceDescriptor();
+
+ uint8_t interface_number;
+ uint8_t alternate_setting;
+ uint8_t interface_class;
+ uint8_t interface_subclass;
+ uint8_t interface_protocol;
+ std::vector<UsbEndpointDescriptor> endpoints;
+ std::vector<uint8_t> extra_data;
+};
+
+struct UsbConfigDescriptor {
+ UsbConfigDescriptor();
+ ~UsbConfigDescriptor();
+
+ uint8_t configuration_value;
+ bool self_powered;
+ bool remote_wakeup;
+ uint16_t maximum_power;
+ std::vector<UsbInterfaceDescriptor> interfaces;
+ std::vector<uint8_t> extra_data;
+};
+
+} // namespace device
+
+#endif // DEVICE_USB_USB_DESCRIPTORS_H_

Powered by Google App Engine
This is Rietveld 408576698