OLD | NEW |
(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 typedef std::vector<UsbEndpointDescriptor>::const_iterator Iterator; |
| 43 |
| 44 uint8_t address; |
| 45 UsbEndpointDirection direction; |
| 46 uint16_t maximum_packet_size; |
| 47 UsbSynchronizationType synchronization_type; |
| 48 UsbTransferType transfer_type; |
| 49 UsbUsageType usage_type; |
| 50 uint16_t polling_interval; |
| 51 std::vector<uint8_t> extra_data; |
| 52 }; |
| 53 |
| 54 struct UsbInterfaceDescriptor { |
| 55 UsbInterfaceDescriptor(); |
| 56 ~UsbInterfaceDescriptor(); |
| 57 |
| 58 typedef std::vector<UsbInterfaceDescriptor>::const_iterator Iterator; |
| 59 |
| 60 uint8_t interface_number; |
| 61 uint8_t alternate_setting; |
| 62 uint8_t interface_class; |
| 63 uint8_t interface_subclass; |
| 64 uint8_t interface_protocol; |
| 65 std::vector<UsbEndpointDescriptor> endpoints; |
| 66 std::vector<uint8_t> extra_data; |
| 67 }; |
| 68 |
| 69 struct UsbConfigDescriptor { |
| 70 UsbConfigDescriptor(); |
| 71 ~UsbConfigDescriptor(); |
| 72 |
| 73 uint8_t configuration_value; |
| 74 bool self_powered; |
| 75 bool remote_wakeup; |
| 76 uint16_t maximum_power; |
| 77 std::vector<UsbInterfaceDescriptor> interfaces; |
| 78 std::vector<uint8_t> extra_data; |
| 79 }; |
| 80 |
| 81 } // namespace device |
| 82 |
| 83 #endif // DEVICE_USB_USB_DESCRIPTORS_H_ |
OLD | NEW |